Skip to content

Commit

Permalink
Inputs.adrecs new DL + inputs.adhesome new DL
Browse files Browse the repository at this point in the history
  • Loading branch information
Balazs Bohar committed Nov 19, 2024
1 parent f09fba2 commit f48ff5d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
6 changes: 5 additions & 1 deletion pypath/inputs/adhesome.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ',')

Expand Down
18 changes: 14 additions & 4 deletions pypath/inputs/adrecs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:]:
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit f48ff5d

Please sign in to comment.