From f48ff5d0d8de11acfa4d179b731c460280d3f3ac Mon Sep 17 00:00:00 2001 From: Balazs Bohar Date: Tue, 19 Nov 2024 12:56:01 +0000 Subject: [PATCH] Inputs.adrecs new DL + inputs.adhesome new DL --- pypath/inputs/adhesome.py | 6 +++++- pypath/inputs/adrecs.py | 18 ++++++++++++++---- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/pypath/inputs/adhesome.py b/pypath/inputs/adhesome.py index b66b9cdcc..1d0a70eee 100644 --- a/pypath/inputs/adhesome.py +++ b/pypath/inputs/adhesome.py @@ -71,7 +71,11 @@ def adhesome_annotations(): result = collections.defaultdict(set) url = urls.urls['adhesome']['components'] - c = curl.Curl(url, large = True, silent = False) + + dmanager = dm.DownloadManager(pkg = 'pypath') + _, item, *_ = dmanager._download(url) + + c = item.open(large=True) data = csv.DictReader(c.result, delimiter = ',') diff --git a/pypath/inputs/adrecs.py b/pypath/inputs/adrecs.py index 581108edd..60f57e68a 100644 --- a/pypath/inputs/adrecs.py +++ b/pypath/inputs/adrecs.py @@ -25,6 +25,8 @@ import pandas as pd +import download_manager as dm + import pypath.share.curl as curl import pypath.resources.urls as urls import pypath.inputs.common as inputs_common @@ -130,11 +132,14 @@ def _adrecs_base( if isinstance(record, str): - record = collections.namedtuple(f'Adrecs{record_name}', fields) + record = collections.namedtuple(f'Adrecs{record}', fields) url = urls.urls['adrecs'][url_key] - path = curl.Curl(url, silent = False, large = True) - contents = inputs_common.read_xls(path.outfile, cell_range = cell_range) + + dmanager = dm.DownloadManager(pkg = 'pypath') + *_, dest = dmanager._download(url) + + contents = inputs_common.read_xls(dest, cell_range = cell_range) result = [] for line in contents[1:]: @@ -172,7 +177,12 @@ def adrecs_drug_adr( def _adrecs_drug_adr(): url = urls.urls['adrecs']['adrecs_drugs'] - c = curl.Curl(url, large = True, silent = False) + + dmanager = dm.DownloadManager(pkg = 'pypath') + _, item, *_ = dmanager._download(url) + + c = item.open(large=True) + _ = next(c.result) for line in c.result: