BioClients 0.2.19__tar.gz → 0.2.30__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- BioClients-0.2.30/BioClients/badapple/Client.py +73 -0
- BioClients-0.2.30/BioClients/badapple/Utils.py +114 -0
- BioClients-0.2.30/BioClients/entrez/Client.py +54 -0
- BioClients-0.2.30/BioClients/entrez/Utils.py +25 -0
- BioClients-0.2.30/BioClients/entrez/__init__.py +3 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/gwascatalog/Client.py +39 -8
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/gwascatalog/Utils.py +211 -21
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/icite/Utils.py +3 -3
- BioClients-0.2.30/BioClients/umls/CPTClient.py +144 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/umls/Utils.py +3 -77
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/util/pandas/App.py +9 -2
- BioClients-0.2.30/BioClients/wikipathways/__init__.py +1 -0
- BioClients-0.2.30/BioClients.egg-info/PKG-INFO +122 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients.egg-info/SOURCES.txt +7 -0
- BioClients-0.2.30/PKG-INFO +122 -0
- BioClients-0.2.30/README.md +108 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/setup.py +1 -1
- BioClients-0.2.19/BioClients.egg-info/PKG-INFO +0 -88
- BioClients-0.2.19/PKG-INFO +0 -88
- BioClients-0.2.19/README.md +0 -74
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/__init__.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/allen/__init__.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/allen/brain/Client.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/allen/brain/Utils.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/allen/brain/__init__.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/amp/__init__.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/amp/t2d/Client.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/amp/t2d/Utils.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/amp/t2d/__init__.py +0 -0
- {BioClients-0.2.19/BioClients/bindingdb → BioClients-0.2.30/BioClients/badapple}/__init__.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/bindingdb/Client.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/bindingdb/Utils.py +0 -0
- {BioClients-0.2.19/BioClients/biogrid → BioClients-0.2.30/BioClients/bindingdb}/__init__.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/biogrid/Client.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/biogrid/Utils.py +0 -0
- {BioClients-0.2.19/BioClients/biomarkerkb → BioClients-0.2.30/BioClients/biogrid}/__init__.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/biomarkerkb/Client.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/biomarkerkb/Utils.py +0 -0
- {BioClients-0.2.19/BioClients/bioregistry → BioClients-0.2.30/BioClients/biomarkerkb}/__init__.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/bioregistry/Client.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/bioregistry/Utils.py +0 -0
- {BioClients-0.2.19/BioClients/brenda → BioClients-0.2.30/BioClients/bioregistry}/__init__.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/brenda/Client.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/brenda/Utils.py +0 -0
- {BioClients-0.2.19/BioClients/cdc → BioClients-0.2.30/BioClients/brenda}/__init__.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/cas/Client.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/cas/Utils.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/cas/__init__.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/cdc/Client.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/cdc/Utils.py +0 -0
- {BioClients-0.2.19/BioClients/cfde/cfchemdb → BioClients-0.2.30/BioClients/cdc}/__init__.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/cfde/__init__.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/cfde/cfchemdb/Client.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/cfde/cfchemdb/Utils.py +0 -0
- {BioClients-0.2.19/BioClients/chebi → BioClients-0.2.30/BioClients/cfde/cfchemdb}/__init__.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/chebi/Client.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/chebi/Utils.py +0 -0
- {BioClients-0.2.19/BioClients/chembl → BioClients-0.2.30/BioClients/chebi}/__init__.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/chem2bio2rdf/Client.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/chem2bio2rdf/Utils.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/chem2bio2rdf/__init__.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/chem2bio2rdf/slap/Client.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/chem2bio2rdf/slap/Utils.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/chem2bio2rdf/slap/__init__.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/chembl/Client.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/chembl/FetchByID.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/chembl/UnichemClient.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/chembl/Utils.py +0 -0
- {BioClients-0.2.19/BioClients/clinicaltrials → BioClients-0.2.30/BioClients/chembl}/__init__.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/chemidplus/Client.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/chemidplus/Utils.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/chemidplus/__init__.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/clinicaltrials/Client.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/clinicaltrials/Utils.py +0 -0
- {BioClients-0.2.19/BioClients/disgenet → BioClients-0.2.30/BioClients/clinicaltrials}/__init__.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/disgenet/Client.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/disgenet/Utils.py +0 -0
- {BioClients-0.2.19/BioClients/drugcentral → BioClients-0.2.30/BioClients/disgenet}/__init__.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/dnorm/Client.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/dnorm/__init__.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/drugcentral/Client.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/drugcentral/Test.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/drugcentral/Utils.py +0 -0
- {BioClients-0.2.19/BioClients/emblebi/identifiers → BioClients-0.2.30/BioClients/drugcentral}/__init__.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/emblebi/__init__.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/emblebi/identifiers/Client.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/emblebi/identifiers/Utils.py +0 -0
- {BioClients-0.2.19/BioClients/emblebi/unichem → BioClients-0.2.30/BioClients/emblebi/identifiers}/__init__.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/emblebi/unichem/Client.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/emblebi/unichem/Utils.py +0 -0
- {BioClients-0.2.19/BioClients/ensembl/biomart → BioClients-0.2.30/BioClients/emblebi/unichem}/__init__.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/ensembl/Client.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/ensembl/Utils.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/ensembl/__init__.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/ensembl/biomart/Client.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/ensembl/biomart/Utils.py +0 -0
- {BioClients-0.2.19/BioClients/fda/aer → BioClients-0.2.30/BioClients/ensembl/biomart}/__init__.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/fda/__init__.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/fda/aer/Client.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/fda/aer/Utils.py +0 -0
- {BioClients-0.2.19/BioClients/geneontology → BioClients-0.2.30/BioClients/fda/aer}/__init__.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/geneontology/Client.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/geneontology/Utils.py +0 -0
- {BioClients-0.2.19/BioClients/glygen → BioClients-0.2.30/BioClients/geneontology}/__init__.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/glygen/Client.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/glygen/Utils.py +0 -0
- {BioClients-0.2.19/BioClients/gtex → BioClients-0.2.30/BioClients/glygen}/__init__.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/gtex/Client.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/gtex/Utils.py +0 -0
- {BioClients-0.2.19/BioClients/gwascatalog → BioClients-0.2.30/BioClients/gtex}/__init__.py +0 -0
- {BioClients-0.2.19/BioClients/hubmap → BioClients-0.2.30/BioClients/gwascatalog}/__init__.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/hubmap/Client.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/hubmap/Utils.py +0 -0
- {BioClients-0.2.19/BioClients/hugo → BioClients-0.2.30/BioClients/hubmap}/__init__.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/hugo/Client.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/hugo/Utils.py +0 -0
- {BioClients-0.2.19/BioClients/icite → BioClients-0.2.30/BioClients/hugo}/__init__.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/humanbase/Client.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/humanbase/__init__.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/icite/Client.py +0 -0
- {BioClients-0.2.19/BioClients/idg/pharos → BioClients-0.2.30/BioClients/icite}/__init__.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/idg/Client.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/idg/Utils.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/idg/__init__.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/idg/pharos/Client.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/idg/pharos/Utils.py +0 -0
- {BioClients-0.2.19/BioClients/idg/rss → BioClients-0.2.30/BioClients/idg/pharos}/__init__.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/idg/rss/Client.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/idg/rss/Utils.py +0 -0
- {BioClients-0.2.19/BioClients/idg/tcrd → BioClients-0.2.30/BioClients/idg/rss}/__init__.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/idg/tcrd/Client.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/idg/tcrd/Utils.py +0 -0
- {BioClients-0.2.19/BioClients/idg/tiga → BioClients-0.2.30/BioClients/idg/tcrd}/__init__.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/idg/tiga/Client.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/idg/tiga/Utils.py +0 -0
- {BioClients-0.2.19/BioClients/idg/tinx → BioClients-0.2.30/BioClients/idg/tiga}/__init__.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/idg/tinx/Client.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/idg/tinx/Utils.py +0 -0
- {BioClients-0.2.19/BioClients/iuphar → BioClients-0.2.30/BioClients/idg/tinx}/__init__.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/iuphar/Client.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/iuphar/Utils.py +0 -0
- {BioClients-0.2.19/BioClients/jensenlab → BioClients-0.2.30/BioClients/iuphar}/__init__.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/jensenlab/Client.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/jensenlab/Utils.py +0 -0
- {BioClients-0.2.19/BioClients/lincs → BioClients-0.2.30/BioClients/jensenlab}/__init__.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/lincs/Client.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/lincs/Client_lincscloud.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/lincs/Utils.py +0 -0
- {BioClients-0.2.19/BioClients/lincs/sigcom → BioClients-0.2.30/BioClients/lincs}/__init__.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/lincs/sigcom/Client.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/lincs/sigcom/Utils.py +0 -0
- {BioClients-0.2.19/BioClients/maayanlab/archs4 → BioClients-0.2.30/BioClients/lincs/sigcom}/__init__.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/maayanlab/__init__.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/maayanlab/archs4/Client.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/maayanlab/archs4/Utils.py +0 -0
- {BioClients-0.2.19/BioClients/maayanlab/harmonizome → BioClients-0.2.30/BioClients/maayanlab/archs4}/__init__.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/maayanlab/harmonizome/Client.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/maayanlab/harmonizome/Utils.py +0 -0
- {BioClients-0.2.19/BioClients/medline/connect → BioClients-0.2.30/BioClients/maayanlab/harmonizome}/__init__.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/medline/__init__.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/medline/connect/Client.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/medline/connect/Utils.py +0 -0
- {BioClients-0.2.19/BioClients/medline/genetics → BioClients-0.2.30/BioClients/medline/connect}/__init__.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/medline/genetics/Client.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/medline/genetics/Utils.py +0 -0
- {BioClients-0.2.19/BioClients/mesh → BioClients-0.2.30/BioClients/medline/genetics}/__init__.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/mesh/Client.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/mesh/Utils.py +0 -0
- {BioClients-0.2.19/BioClients/monarch → BioClients-0.2.30/BioClients/mesh}/__init__.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/monarch/Biolink.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/monarch/Client.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/monarch/Utils.py +0 -0
- {BioClients-0.2.19/BioClients/mygene → BioClients-0.2.30/BioClients/monarch}/__init__.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/mygene/Client.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/mygene/Utils.py +0 -0
- {BioClients-0.2.19/BioClients/ncats/gsrs → BioClients-0.2.30/BioClients/mygene}/__init__.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/ncats/__init__.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/ncats/gsrs/Client.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/ncats/gsrs/Utils.py +0 -0
- {BioClients-0.2.19/BioClients/ncbo → BioClients-0.2.30/BioClients/ncats/gsrs}/__init__.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/ncbo/Client.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/ncbo/Utils.py +0 -0
- {BioClients-0.2.19/BioClients/oncotree → BioClients-0.2.30/BioClients/ncbo}/__init__.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/omim/Client.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/omim/__init__.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/oncotree/Client.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/oncotree/Utils.py +0 -0
- {BioClients-0.2.19/BioClients/openphacts → BioClients-0.2.30/BioClients/oncotree}/__init__.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/openphacts/Client.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/openphacts/Utils.py +0 -0
- {BioClients-0.2.19/BioClients/opentargets → BioClients-0.2.30/BioClients/openphacts}/__init__.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/opentargets/Client.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/opentargets/Utils.py +0 -0
- {BioClients-0.2.19/BioClients/pdb → BioClients-0.2.30/BioClients/opentargets}/__init__.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/panther/Client.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/panther/__init__.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/pdb/Client.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/pdb/Utils.py +0 -0
- {BioClients-0.2.19/BioClients/pubchem/ftp → BioClients-0.2.30/BioClients/pdb}/__init__.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/pubchem/Client.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/pubchem/Utils.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/pubchem/__init__.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/pubchem/ftp/Client.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/pubchem/ftp/Utils.py +0 -0
- {BioClients-0.2.19/BioClients/pubchem/soap → BioClients-0.2.30/BioClients/pubchem/ftp}/__init__.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/pubchem/ftp/pubchem_ftp_actives.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/pubchem/ftp/pubchem_ftp_assay_fetch.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/pubchem/ftp/pubchem_ftp_assay_results.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/pubchem/ftp/pubchem_ftp_assay_search.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/pubchem/ftp/pubchem_ftp_assaysim.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/pubchem/ftp/pubchem_ftp_compound_assaystats.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/pubchem/ftp/pubchem_ftp_gini_index.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/pubchem/rdf/Client.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/pubchem/rdf/__init__.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/pubchem/soap/Client.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/pubchem/soap/Utils.py +0 -0
- {BioClients-0.2.19/BioClients/pubtator → BioClients-0.2.30/BioClients/pubchem/soap}/__init__.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/pubchem/soap/pug_aids2assays.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/pubchem/soap/pug_ids2mols.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/pubchem/soap/pug_substance_search.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/pubmed/App_XML.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/pubmed/Client.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/pubmed/Utils.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/pubmed/Utils_XML.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/pubmed/__init__.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/pubtator/Client.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/pubtator/Utils.py +0 -0
- {BioClients-0.2.19/BioClients/rxnorm → BioClients-0.2.30/BioClients/pubtator}/__init__.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/reactome/Client.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/reactome/SMBL_utils.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/reactome/Utils.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/reactome/__init__.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/rxnorm/Client.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/rxnorm/Utils.py +0 -0
- {BioClients-0.2.19/BioClients/stringdb → BioClients-0.2.30/BioClients/rxnorm}/__init__.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/stringdb/Client.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/stringdb/Utils.py +0 -0
- {BioClients-0.2.19/BioClients/tcga → BioClients-0.2.30/BioClients/stringdb}/__init__.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/tcga/Client.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/tcga/Utils.py +0 -0
- {BioClients-0.2.19/BioClients/ubkg → BioClients-0.2.30/BioClients/tcga}/__init__.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/ubkg/Client.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/ubkg/Utils.py +0 -0
- {BioClients-0.2.19/BioClients/umls → BioClients-0.2.30/BioClients/ubkg}/__init__.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/umls/Client.py +0 -0
- {BioClients-0.2.19/BioClients/uniprot → BioClients-0.2.30/BioClients/umls}/__init__.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/uniprot/Client.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/uniprot/Utils.py +0 -0
- {BioClients-0.2.19/BioClients/util/db → BioClients-0.2.30/BioClients/uniprot}/__init__.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/util/__init__.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/util/db/Utils.py +0 -0
- {BioClients-0.2.19/BioClients/util/graphql → BioClients-0.2.30/BioClients/util/db}/__init__.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/util/graphql/Utils.py +0 -0
- {BioClients-0.2.19/BioClients/util/hdf → BioClients-0.2.30/BioClients/util/graphql}/__init__.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/util/hdf/Utils.py +0 -0
- {BioClients-0.2.19/BioClients/util/igraph → BioClients-0.2.30/BioClients/util/hdf}/__init__.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/util/igraph/App.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/util/igraph/Utils.py +0 -0
- {BioClients-0.2.19/BioClients/util/neo4j → BioClients-0.2.30/BioClients/util/igraph}/__init__.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/util/neo4j/App.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/util/neo4j/Utils.py +0 -0
- {BioClients-0.2.19/BioClients/util/obo → BioClients-0.2.30/BioClients/util/neo4j}/__init__.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/util/obo/App.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/util/obo/Utils.py +0 -0
- {BioClients-0.2.19/BioClients/util/owl → BioClients-0.2.30/BioClients/util/obo}/__init__.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/util/owl/App.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/util/owl/Utils.py +0 -0
- {BioClients-0.2.19/BioClients/util/pandas → BioClients-0.2.30/BioClients/util/owl}/__init__.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/util/pandas/Csv2Html.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/util/pandas/Csv2Markdown.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/util/pandas/Csv2Sql.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/util/pandas/Utils.py +0 -0
- {BioClients-0.2.19/BioClients/util/rdf → BioClients-0.2.30/BioClients/util/pandas}/__init__.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/util/rdf/App.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/util/rdf/Utils.py +0 -0
- {BioClients-0.2.19/BioClients/util/rest → BioClients-0.2.30/BioClients/util/rdf}/__init__.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/util/rest/Utils.py +0 -0
- {BioClients-0.2.19/BioClients/util/sparql → BioClients-0.2.30/BioClients/util/rest}/__init__.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/util/sparql/Client.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/util/sparql/Utils.py +0 -0
- {BioClients-0.2.19/BioClients/util/xml → BioClients-0.2.30/BioClients/util/sparql}/__init__.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/util/xml/Utils.py +0 -0
- {BioClients-0.2.19/BioClients/util/yaml → BioClients-0.2.30/BioClients/util/xml}/__init__.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/util/yaml/Utils.py +0 -0
- {BioClients-0.2.19/BioClients/wikidata → BioClients-0.2.30/BioClients/util/yaml}/__init__.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/wikidata/Client.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/wikidata/Utils.py +0 -0
- {BioClients-0.2.19/BioClients/wikipathways → BioClients-0.2.30/BioClients/wikidata}/__init__.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/wikipathways/Client.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients/wikipathways/Utils.py +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients.egg-info/dependency_links.txt +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/BioClients.egg-info/top_level.txt +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/LICENSE +0 -0
- {BioClients-0.2.19 → BioClients-0.2.30}/setup.cfg +0 -0
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
https://chiltepin.health.unm.edu/badapple2/apidocs/
|
|
4
|
+
"""
|
|
5
|
+
###
|
|
6
|
+
import sys,os,re,argparse,time,logging
|
|
7
|
+
#
|
|
8
|
+
from .. import badapple
|
|
9
|
+
#
|
|
10
|
+
##############################################################################
|
|
11
|
+
if __name__=='__main__':
|
|
12
|
+
parser = argparse.ArgumentParser(
|
|
13
|
+
description='Badapple REST API client utility',
|
|
14
|
+
epilog="""\
|
|
15
|
+
Example SMILES: OC(=O)C1=C2CCCC(C=C3C=CC(=O)C=C3)=C2NC2=CC=CC=C12
|
|
16
|
+
Example scaffold IDs: 46,50
|
|
17
|
+
""")
|
|
18
|
+
ops = ['get_compound2scaffolds', 'get_scaffold_info', 'get_scaffold2compounds', 'get_scaffold2drugs', ]
|
|
19
|
+
parser.add_argument("op",choices=ops,help='OPERATION')
|
|
20
|
+
parser.add_argument("--smi", dest="smi", help="input SMILES")
|
|
21
|
+
parser.add_argument("--ids", dest="ids", help="input IDs, comma-separated")
|
|
22
|
+
parser.add_argument("--i", dest="ifile", help="input SMILES file (with optional appended <space>NAME), or input IDs file")
|
|
23
|
+
parser.add_argument("--db", choices=badapple.DATABASES, default="badapple2", help="default=badapple2")
|
|
24
|
+
parser.add_argument("--o", dest="ofile", help="output file (TSV)")
|
|
25
|
+
parser.add_argument("--max_rings", type=int, default=10, help="max rings")
|
|
26
|
+
parser.add_argument("--api_host", default=badapple.API_HOST)
|
|
27
|
+
parser.add_argument("--api_base_path", default=badapple.API_BASE_PATH)
|
|
28
|
+
parser.add_argument("-v", "--verbose", action="count", default=0)
|
|
29
|
+
|
|
30
|
+
args = parser.parse_args()
|
|
31
|
+
|
|
32
|
+
logging.basicConfig(format='%(levelname)s:%(message)s', level=(logging.DEBUG if args.verbose>1 else logging.INFO))
|
|
33
|
+
|
|
34
|
+
base_url='https://'+args.api_host+args.api_base_path
|
|
35
|
+
|
|
36
|
+
fout = open(args.ofile,"w") if args.ofile else sys.stdout
|
|
37
|
+
|
|
38
|
+
t0=time.time()
|
|
39
|
+
|
|
40
|
+
if args.ifile:
|
|
41
|
+
fin = open(args.ifile)
|
|
42
|
+
ids = [];
|
|
43
|
+
while True:
|
|
44
|
+
line = fin.readline()
|
|
45
|
+
if not line: break
|
|
46
|
+
if line.rstrip(): ids.append(line.rstrip())
|
|
47
|
+
logging.info(f"Input SMILES: {len(ids)}")
|
|
48
|
+
fin.close()
|
|
49
|
+
elif args.ids:
|
|
50
|
+
ids = re.split(r'[, ]+', args.ids.strip())
|
|
51
|
+
elif args.smi:
|
|
52
|
+
ids = [args.smi.strip()]
|
|
53
|
+
|
|
54
|
+
if args.op == "get_compound2scaffolds":
|
|
55
|
+
badapple.GetCompound2Scaffolds(ids, args.db, args.max_rings, base_url, fout)
|
|
56
|
+
|
|
57
|
+
elif args.op == "get_scaffold_info":
|
|
58
|
+
badapple.GetScaffoldInfo(ids, args.db, base_url, fout)
|
|
59
|
+
|
|
60
|
+
elif args.op == "get_scaffold2compounds":
|
|
61
|
+
badapple.GetScaffold2Compounds(ids, args.db, base_url, fout)
|
|
62
|
+
|
|
63
|
+
elif args.op == "get_scaffold2drugs":
|
|
64
|
+
badapple.GetScaffold2Drugs(ids, args.db, base_url, fout)
|
|
65
|
+
|
|
66
|
+
elif args.op == "get_version":
|
|
67
|
+
#badapple.GetVersion(args.db, base_url, fout)
|
|
68
|
+
parser.error("Not implemented.")
|
|
69
|
+
|
|
70
|
+
else:
|
|
71
|
+
parser.error("No operation specified.")
|
|
72
|
+
|
|
73
|
+
logging.info(f"elapsed time: {time.strftime('%Hh:%Mm:%Ss',time.gmtime(time.time()-t0))}")
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
"""
|
|
4
|
+
###
|
|
5
|
+
import sys,os,io,re,time,requests,urllib,json,logging
|
|
6
|
+
import pandas as pd
|
|
7
|
+
#
|
|
8
|
+
API_HOST='chiltepin.health.unm.edu'
|
|
9
|
+
API_BASE_PATH='/badapple2/api/v1'
|
|
10
|
+
BASE_URL='https://'+API_HOST+API_BASE_PATH
|
|
11
|
+
#
|
|
12
|
+
DATABASES = ["badapple2", "badapple_classic"]
|
|
13
|
+
#
|
|
14
|
+
##############################################################################
|
|
15
|
+
def GetCompound2Scaffolds(smis, database, max_rings, base_url=BASE_URL, fout=None):
|
|
16
|
+
params = {}; n_out=0; df=None;
|
|
17
|
+
tags = ["id", "in_db", "prank", "pscore", "in_drug", "nass_active", "nass_tested", "ncpd_active", "ncpd_tested", "ncpd_total", "nsam_active", "nsam_tested", "nsub_active", "nsub_tested", "nsub_total", "scafsmi", "kekule_scafsmi", "scaftree" ]
|
|
18
|
+
headers = {'Accept': 'application/json'}
|
|
19
|
+
url = f"{base_url}/compound_search/get_associated_scaffolds_ordered"
|
|
20
|
+
params['database'] = database
|
|
21
|
+
params['max_rings'] = max_rings
|
|
22
|
+
for smi_this in smis:
|
|
23
|
+
vals = re.split(r'\s+', smi_this, 1)
|
|
24
|
+
if len(vals)>1:
|
|
25
|
+
params['SMILES'],params['Names'] = vals
|
|
26
|
+
else:
|
|
27
|
+
params['SMILES'],params['Names'] = smi_this, "Unspecified"
|
|
28
|
+
response = requests.get(url, params=params, headers=headers)
|
|
29
|
+
results = response.json()
|
|
30
|
+
logging.debug(json.dumps(results, indent=2))
|
|
31
|
+
scafs = results[0]["scaffolds"]
|
|
32
|
+
for scaf in scafs:
|
|
33
|
+
scaf_this = {"molecule_SMILES": params['SMILES'], "molecule_Name": params['Names'], "db": database}
|
|
34
|
+
for tag in tags:
|
|
35
|
+
scaf_this[tag] = scaf[tag] if tag in scaf else ""
|
|
36
|
+
df_this = pd.DataFrame([scaf_this])
|
|
37
|
+
if fout is not None: df_this.to_csv(fout, sep='\t', index=False, header=bool(n_out==0))
|
|
38
|
+
else: df = pd.concat([df, df_this])
|
|
39
|
+
n_out+=1
|
|
40
|
+
logging.info(f"Compounds: {len(smis)}; Scaffolds: {n_out}")
|
|
41
|
+
return df
|
|
42
|
+
|
|
43
|
+
##############################################################################
|
|
44
|
+
def GetScaffoldInfo(ids, database, base_url=BASE_URL, fout=None):
|
|
45
|
+
params = {}; n_out=0; df=None;
|
|
46
|
+
tags = ["id", "scafsmi", "kekule_scafsmi", "pscore", "prank", "in_drug", "nass_active", "nass_tested", "ncpd_active", "ncpd_tested", "ncpd_total", "nsam_active", "nsam_tested", "nsub_active", "nsub_tested", "nsub_total", "scaftree"]
|
|
47
|
+
headers = {'Accept': 'application/json'}
|
|
48
|
+
url = f"{base_url}/scaffold_search/get_scaffold_info"
|
|
49
|
+
params['database'] = database
|
|
50
|
+
for id_this in ids:
|
|
51
|
+
params['scafid'] = id_this
|
|
52
|
+
response = requests.get(url, params=params, headers=headers)
|
|
53
|
+
results = response.json()
|
|
54
|
+
logging.debug(json.dumps(results, indent=2))
|
|
55
|
+
scaf = results
|
|
56
|
+
scaf_this = {"db": database}
|
|
57
|
+
for tag in tags:
|
|
58
|
+
scaf_this[tag] = scaf[tag] if tag in scaf else ""
|
|
59
|
+
df_this = pd.DataFrame([scaf_this])
|
|
60
|
+
if fout is not None: df_this.to_csv(fout, sep='\t', index=False, header=bool(n_out==0))
|
|
61
|
+
else: df = pd.concat([df, df_this])
|
|
62
|
+
n_out+=1
|
|
63
|
+
logging.info(f"Scaffolds: {n_out}")
|
|
64
|
+
return df
|
|
65
|
+
|
|
66
|
+
##############################################################################
|
|
67
|
+
def GetScaffold2Compounds(ids, database, base_url=BASE_URL, fout=None):
|
|
68
|
+
params = {}; n_out=0; df=None;
|
|
69
|
+
tags = ["cansmi", "cid", "isosmi", "nass_active", "nass_tested", "nsam_active", "nsam_tested", "nsub_active", "nsub_tested", "nsub_total"]
|
|
70
|
+
headers = {'Accept': 'application/json'}
|
|
71
|
+
url = f"{base_url}/scaffold_search/get_associated_compounds"
|
|
72
|
+
params['database'] = database
|
|
73
|
+
for id_this in ids:
|
|
74
|
+
params['scafid'] = id_this
|
|
75
|
+
response = requests.get(url, params=params, headers=headers)
|
|
76
|
+
results = response.json()
|
|
77
|
+
logging.debug(json.dumps(results, indent=2))
|
|
78
|
+
cpds = results
|
|
79
|
+
for cpd in cpds:
|
|
80
|
+
cpd_this = {"scafid": id_this, "db": database}
|
|
81
|
+
for tag in tags:
|
|
82
|
+
cpd_this[tag] = cpd[tag] if tag in cpd else ""
|
|
83
|
+
df_this = pd.DataFrame([cpd_this])
|
|
84
|
+
if fout is not None: df_this.to_csv(fout, sep='\t', index=False, header=bool(n_out==0))
|
|
85
|
+
else: df = pd.concat([df, df_this])
|
|
86
|
+
n_out+=1
|
|
87
|
+
logging.info(f"Scaffolds: {len(ids)}; Compounds: {n_out}")
|
|
88
|
+
return df
|
|
89
|
+
|
|
90
|
+
##############################################################################
|
|
91
|
+
def GetScaffold2Drugs(ids, database, base_url=BASE_URL, fout=None):
|
|
92
|
+
params = {}; n_out=0; df=None;
|
|
93
|
+
tags = ["cansmi", "cid", "isosmi", "nass_active", "nass_tested", "nsam_active", "nsam_tested", "nsub_active", "nsub_tested", "nsub_total"]
|
|
94
|
+
headers = {'Accept': 'application/json'}
|
|
95
|
+
url = f"{base_url}/scaffold_search/get_associated_drugs"
|
|
96
|
+
params['database'] = database
|
|
97
|
+
for id_this in ids:
|
|
98
|
+
params['scafid'] = id_this
|
|
99
|
+
response = requests.get(url, params=params, headers=headers)
|
|
100
|
+
results = response.json()
|
|
101
|
+
logging.debug(json.dumps(results, indent=2))
|
|
102
|
+
cpds = results
|
|
103
|
+
for cpd in cpds:
|
|
104
|
+
cpd_this = {"scafid": id_this, "db": database}
|
|
105
|
+
for tag in tags:
|
|
106
|
+
cpd_this[tag] = cpd[tag] if tag in cpd else ""
|
|
107
|
+
df_this = pd.DataFrame([cpd_this])
|
|
108
|
+
if fout is not None: df_this.to_csv(fout, sep='\t', index=False, header=bool(n_out==0))
|
|
109
|
+
else: df = pd.concat([df, df_this])
|
|
110
|
+
n_out+=1
|
|
111
|
+
logging.info(f"Scaffolds: {len(ids)}; Drugs: {n_out}")
|
|
112
|
+
return df
|
|
113
|
+
|
|
114
|
+
##############################################################################
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
Utility app for the NIH NCBI Entrez E-Utils via Entrezpy.
|
|
4
|
+
"""
|
|
5
|
+
###
|
|
6
|
+
import sys,os,re,argparse,time,logging
|
|
7
|
+
#
|
|
8
|
+
from .. import entrez
|
|
9
|
+
#
|
|
10
|
+
##############################################################################
|
|
11
|
+
if __name__=='__main__':
|
|
12
|
+
OPS = [ "test", "get_esummary", "get_record", ]
|
|
13
|
+
parser = argparse.ArgumentParser(description="NIH NCBI Entrez client")
|
|
14
|
+
parser.add_argument("op", choices=OPS, help="OPERATION")
|
|
15
|
+
parser.add_argument("--i", dest="ifile", help="input IDs file (PMIDs)")
|
|
16
|
+
parser.add_argument("--ids", help="input IDs (comma-separated)")
|
|
17
|
+
parser.add_argument("--o", dest="ofile", help="output (usually TSV)")
|
|
18
|
+
parser.add_argument("--email", dest="email", help="user email address")
|
|
19
|
+
#parser.add_argument("--api_host", default=entrez.API_HOST)
|
|
20
|
+
#parser.add_argument("--api_base_path", default=entrez.API_BASE_PATH)
|
|
21
|
+
parser.add_argument("--skip", type=int, default=0)
|
|
22
|
+
parser.add_argument("--nmax", type=int, default=None)
|
|
23
|
+
parser.add_argument("-q", "--quiet", action="store_true", help="Suppress progress notification.")
|
|
24
|
+
parser.add_argument("-v", "--verbose", default=0, action="count")
|
|
25
|
+
args = parser.parse_args()
|
|
26
|
+
|
|
27
|
+
logging.basicConfig(format='%(levelname)s:%(message)s', level=(logging.DEBUG if args.verbose>0 else logging.ERROR if args.quiet else 15))
|
|
28
|
+
|
|
29
|
+
#base_url = f"https://{args.api_host}{args.api_base_path}"
|
|
30
|
+
|
|
31
|
+
fout = open(args.ofile, "w") if args.ofile else sys.stdout
|
|
32
|
+
|
|
33
|
+
ids=[]
|
|
34
|
+
if args.ifile:
|
|
35
|
+
fin = open(args.ifile)
|
|
36
|
+
while True:
|
|
37
|
+
line = fin.readline()
|
|
38
|
+
if not line: break
|
|
39
|
+
ids.append(line.rstrip())
|
|
40
|
+
fin.close()
|
|
41
|
+
elif args.ids:
|
|
42
|
+
ids = re.split(r'[,\s]+', args.ids)
|
|
43
|
+
logging.info(f"Input IDs: {len(ids)}")
|
|
44
|
+
|
|
45
|
+
t0=time.time()
|
|
46
|
+
|
|
47
|
+
if args.op == 'test':
|
|
48
|
+
entrez.Test(args.email)
|
|
49
|
+
|
|
50
|
+
else:
|
|
51
|
+
parser.error(f"Invalid operation: {args.op}")
|
|
52
|
+
|
|
53
|
+
logging.info(('elapsed time: %s'%(time.strftime('%Hh:%Mm:%Ss',time.gmtime(time.time()-t0)))))
|
|
54
|
+
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
'''
|
|
3
|
+
https://pypi.org/project/entrezpy/
|
|
4
|
+
https://entrezpy.readthedocs.io/en/master/
|
|
5
|
+
https://academic.oup.com/bioinformatics/article/35/21/4511/5488119
|
|
6
|
+
https://dataguide.nlm.nih.gov/eutilities/utilities.html
|
|
7
|
+
'''
|
|
8
|
+
import os,sys,io,re,json,time,requests,urllib.parse,logging,tqdm
|
|
9
|
+
import pandas as pd
|
|
10
|
+
|
|
11
|
+
import entrezpy.conduit
|
|
12
|
+
|
|
13
|
+
from .. import util
|
|
14
|
+
|
|
15
|
+
#############################################################################
|
|
16
|
+
def Test(email):
|
|
17
|
+
c = entrezpy.conduit.Conduit(email)
|
|
18
|
+
fetch_influenza = c.new_pipeline()
|
|
19
|
+
sid = fetch_influenza.add_search({'db' : 'nucleotide', 'term' : 'H3N2 [organism] AND HA', 'rettype':'count', 'sort' : 'Date Released', 'mindate': 2000, 'maxdate':2019, 'datetype' : 'pdat'})
|
|
20
|
+
fid = fetch_influenza.add_fetch({'retmax' : 10, 'retmode' : 'text', 'rettype': 'fasta'}, dependency=sid)
|
|
21
|
+
c.run(fetch_influenza)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
#############################################################################
|
|
25
|
+
#############################################################################
|
|
@@ -2,10 +2,17 @@
|
|
|
2
2
|
"""
|
|
3
3
|
GWAS Catalog REST API client.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
https://www.ebi.ac.uk/gwas/
|
|
7
|
-
https://www.ebi.ac.uk/gwas/rest/
|
|
8
|
-
https://www.ebi.ac.uk/gwas/rest/docs/
|
|
5
|
+
V1:
|
|
6
|
+
- https://www.ebi.ac.uk/gwas/docs/api
|
|
7
|
+
- https://www.ebi.ac.uk/gwas/rest/api
|
|
8
|
+
- https://www.ebi.ac.uk/gwas/rest/docs/api
|
|
9
|
+
- https://www.ebi.ac.uk/gwas/rest/docs/sample-scripts
|
|
10
|
+
|
|
11
|
+
V2:
|
|
12
|
+
- https://www.ebi.ac.uk/gwas/rest/api/v2/docs
|
|
13
|
+
- "GWAS RESTful API V2 has been released with various enhancements & improvements over GWAS RESTful API V1. V1 is deprecated and will be retired no later than May 2026."
|
|
14
|
+
- https://www.ebi.ac.uk/gwas/rest/api/v2/docs/reference
|
|
15
|
+
|
|
9
16
|
"""
|
|
10
17
|
import sys,os,re,argparse,json,time,logging
|
|
11
18
|
#
|
|
@@ -19,9 +26,19 @@ Example GCSTs: GCST004364, GCST000227;
|
|
|
19
26
|
Example EFOIDs: EFO_0004232;
|
|
20
27
|
Example SNPIDs: rs6085920, rs2273833, rs6684514, rs144991356
|
|
21
28
|
"""
|
|
22
|
-
parser = argparse.ArgumentParser(description='GWAS Catalog REST API client', epilog=epilog)
|
|
29
|
+
parser = argparse.ArgumentParser(description='GWAS Catalog REST API (V1|V2) client', epilog=epilog)
|
|
23
30
|
searchtypes=['pubmedmid', 'gcst', 'efotrait', 'efouri', 'accessionid', 'rs']
|
|
24
|
-
ops = [
|
|
31
|
+
ops = [
|
|
32
|
+
'get_metadata_v2',
|
|
33
|
+
'list_studies',
|
|
34
|
+
'list_studies_v2',
|
|
35
|
+
'get_studyAssociations',
|
|
36
|
+
'get_studyAssociations_v2',
|
|
37
|
+
'get_snps',
|
|
38
|
+
'get_snps_v2',
|
|
39
|
+
'search_studies',
|
|
40
|
+
'search_studies_v2'
|
|
41
|
+
]
|
|
25
42
|
parser.add_argument("op", choices=ops, help='operation')
|
|
26
43
|
parser.add_argument("--ids", dest="ids", help="IDs, comma-separated")
|
|
27
44
|
parser.add_argument("--searchtype", choices=searchtypes, help="ID type")
|
|
@@ -31,11 +48,13 @@ Example SNPIDs: rs6085920, rs2273833, rs6684514, rs144991356
|
|
|
31
48
|
parser.add_argument("--nmax", type=int, default=None)
|
|
32
49
|
parser.add_argument("--api_host", default=gwascatalog.API_HOST)
|
|
33
50
|
parser.add_argument("--api_base_path", default=gwascatalog.API_BASE_PATH)
|
|
51
|
+
parser.add_argument("--api_base_path_v2", default=gwascatalog.API_BASE_PATH_V2)
|
|
34
52
|
parser.add_argument("-v", "--verbose", default=0, action="count")
|
|
35
53
|
parser.add_argument("-q", "--quiet", default=0, action="count")
|
|
36
54
|
args = parser.parse_args()
|
|
37
55
|
|
|
38
56
|
base_url = 'https://'+args.api_host+args.api_base_path
|
|
57
|
+
base_url_v2 = 'https://'+args.api_host+args.api_base_path_v2
|
|
39
58
|
|
|
40
59
|
fout = open(args.ofile, 'w') if args.ofile else sys.stdout
|
|
41
60
|
|
|
@@ -55,18 +74,30 @@ Example SNPIDs: rs6085920, rs2273833, rs6684514, rs144991356
|
|
|
55
74
|
ids = re.split(r'\s*,\s*', args.ids.strip())
|
|
56
75
|
if ids: logging.info(f"Input IDs: {len(ids)}")
|
|
57
76
|
|
|
58
|
-
if args.op == '
|
|
59
|
-
gwascatalog.
|
|
77
|
+
if args.op == 'get_metadata_v2':
|
|
78
|
+
gwascatalog.GetMetadataV2(base_url, fout)
|
|
60
79
|
|
|
61
80
|
elif args.op == 'list_studies':
|
|
62
81
|
gwascatalog.ListStudies(base_url, fout)
|
|
63
82
|
|
|
83
|
+
elif args.op == 'list_studies_v2':
|
|
84
|
+
gwascatalog.ListStudies(base_url_v2, fout)
|
|
85
|
+
|
|
64
86
|
elif args.op == 'get_studyAssociations':
|
|
65
87
|
gwascatalog.GetStudyAssociations(ids, args.skip, args.nmax, base_url, fout)
|
|
66
88
|
|
|
89
|
+
elif args.op == 'get_studyAssociations_v2':
|
|
90
|
+
gwascatalog.GetStudyAssociationsV2(ids, args.skip, args.nmax, base_url_v2, fout)
|
|
91
|
+
|
|
67
92
|
elif args.op == 'get_snps':
|
|
68
93
|
gwascatalog.GetSnps(ids, args.skip, args.nmax, base_url, fout)
|
|
69
94
|
|
|
95
|
+
elif args.op == 'get_snps_v2':
|
|
96
|
+
gwascatalog.GetSnpsV2(ids, args.skip, args.nmax, base_url_v2, fout)
|
|
97
|
+
|
|
98
|
+
elif args.op == 'search_studies':
|
|
99
|
+
gwascatalog.SearchStudies(ids, args.searchtype, base_url, fout)
|
|
100
|
+
|
|
70
101
|
else:
|
|
71
102
|
parser.error(f"Unknown operation: {args.op}")
|
|
72
103
|
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
2
|
"""
|
|
3
|
-
|
|
3
|
+
V1:
|
|
4
|
+
- https://www.ebi.ac.uk/gwas/rest/docs/api
|
|
5
|
+
|
|
6
|
+
V2:
|
|
7
|
+
- https://www.ebi.ac.uk/gwas/rest/api/v2/docs
|
|
8
|
+
- "GWAS RESTful API V2 has been released with various enhancements & improvements over GWAS RESTful API V1. V1 is deprecated and will be retired no later than May 2026."
|
|
9
|
+
- https://www.ebi.ac.uk/gwas/rest/api/v2/docs/reference
|
|
4
10
|
"""
|
|
5
11
|
###
|
|
6
12
|
import sys,os,re,json,time,logging,tqdm
|
|
@@ -12,28 +18,54 @@ import pandas as pd
|
|
|
12
18
|
#
|
|
13
19
|
API_HOST='www.ebi.ac.uk'
|
|
14
20
|
API_BASE_PATH='/gwas/rest/api'
|
|
21
|
+
API_BASE_PATH_V2='/gwas/rest/api/v2'
|
|
15
22
|
BASE_URL='https://'+API_HOST+API_BASE_PATH
|
|
23
|
+
BASE_URL_V2='https://'+API_HOST+API_BASE_PATH_V2
|
|
16
24
|
#
|
|
17
25
|
NCHUNK=100;
|
|
18
26
|
#
|
|
19
27
|
##############################################################################
|
|
20
|
-
def
|
|
21
|
-
"""Only simple metadata."""
|
|
22
|
-
tags=[]; n_study=0; rval=None; df=None; tq=None;
|
|
23
|
-
|
|
28
|
+
def InitiateSession():
|
|
24
29
|
retry_strategy = Retry(
|
|
25
30
|
total=10,
|
|
26
31
|
status=4,
|
|
27
32
|
backoff_factor=2,
|
|
28
33
|
status_forcelist=[413, 429, 500, 502, 503, 504],
|
|
29
34
|
allowed_methods=Retry.DEFAULT_ALLOWED_METHODS
|
|
30
|
-
#method_whitelist=["HEAD", "GET", "PUT", "DELETE", "OPTIONS", "TRACE"] #DEPRECATED: method_whitelist deprecated and removed from urllib3==1.26.0 onwards, as per https://github.com/urllib3/urllib3/blob/main/CHANGES.rst#1260-2020-11-10
|
|
31
35
|
)
|
|
32
36
|
adapter = HTTPAdapter(max_retries=retry_strategy)
|
|
33
37
|
session = requests.Session()
|
|
34
38
|
session.mount("https://", adapter)
|
|
35
39
|
session.mount("http://", adapter)
|
|
40
|
+
return session
|
|
41
|
+
|
|
42
|
+
##############################################################################
|
|
43
|
+
def GetMetadataV2(base_url=BASE_URL_V2, fout=None):
|
|
44
|
+
session = InitiateSession()
|
|
45
|
+
url_this = base_url+f'/metadata'
|
|
46
|
+
response = session.get(url_this)
|
|
47
|
+
if (response.status_code!=200):
|
|
48
|
+
logging.error(f"(status_code={response.status_code}): url_this: {url_this}")
|
|
49
|
+
return
|
|
50
|
+
try:
|
|
51
|
+
rval = response.json()
|
|
52
|
+
except Exception as e:
|
|
53
|
+
logging.error(f"{str(e)}; response.text: {response.text}")
|
|
54
|
+
return
|
|
55
|
+
logging.debug(json.dumps(rval, sort_keys=True, indent=2))
|
|
56
|
+
metadata = rval['_embedded']['mappingMetadatas'][0]
|
|
57
|
+
for key in metadata.keys():
|
|
58
|
+
metadata[key] = [metadata[key]]
|
|
59
|
+
df_this = pd.DataFrame.from_dict(metadata)
|
|
60
|
+
if fout is not None:
|
|
61
|
+
df_this.to_csv(fout, sep="\t", index=False, header=True)
|
|
62
|
+
return df_this
|
|
36
63
|
|
|
64
|
+
##############################################################################
|
|
65
|
+
def ListStudies(base_url=BASE_URL, fout=None):
|
|
66
|
+
"""Only simple metadata."""
|
|
67
|
+
tags=[]; n_study=0; rval=None; df=None; tq=None;
|
|
68
|
+
session = InitiateSession()
|
|
37
69
|
url_this = base_url+f'/studies?size={NCHUNK}'
|
|
38
70
|
while True:
|
|
39
71
|
logging.debug(url_this)
|
|
@@ -55,7 +87,13 @@ def ListStudies(base_url=BASE_URL, fout=None):
|
|
|
55
87
|
if not tags:
|
|
56
88
|
tags = list(study.keys())
|
|
57
89
|
for tag in tags[:]:
|
|
58
|
-
if type(study[tag]) in (list, dict) and tag
|
|
90
|
+
if type(study[tag]) in (list, dict) and tag not in (
|
|
91
|
+
"diseaseTrait", #V1
|
|
92
|
+
"disease_trait", #V2
|
|
93
|
+
"efo_traits", #V2
|
|
94
|
+
"genotyping_technologies", #V2
|
|
95
|
+
"discovery_ancestry" #V2
|
|
96
|
+
):
|
|
59
97
|
tags.remove(tag)
|
|
60
98
|
logging.info(f"Ignoring tag: {tag}")
|
|
61
99
|
df_this = pd.DataFrame({tag:[str(study[tag]) if tag in study else ''] for tag in tags})
|
|
@@ -138,6 +176,77 @@ https://www.ebi.ac.uk/gwas/rest/api/studies/GCST001430/associations?projection=a
|
|
|
138
176
|
logging.info(f"INPUT RCSTs: {n_id}; OUTPUT RCSTs: {n_gcst} ; assns: {n_assn} ; loci: {n_loci} ; alleles: {n_sra} ; snps: {n_snp}")
|
|
139
177
|
if fout is None: return(df)
|
|
140
178
|
|
|
179
|
+
##############################################################################
|
|
180
|
+
def GetStudyAssociationsV2(ids, skip=0, nmax=None, base_url=BASE_URL_V2, fout=None):
|
|
181
|
+
"""
|
|
182
|
+
https://www.ebi.ac.uk/gwas/rest/api/v2/associations?accession_id=GCST000854&page=0&size=20
|
|
183
|
+
sea = SNP effect allele
|
|
184
|
+
"""
|
|
185
|
+
n_id=0; n_assn=0; df=None; tq=None;
|
|
186
|
+
tags_assn=[];
|
|
187
|
+
gcsts=set([]); snps=set([]); loci=set([]); seas=set([]);
|
|
188
|
+
quiet = bool(logging.getLogger().getEffectiveLevel()>15)
|
|
189
|
+
if skip>0: logging.info(f"SKIP IDs skipped: {skip}")
|
|
190
|
+
for id_this in ids[skip:]:
|
|
191
|
+
if not quiet and tq is None: tq = tqdm.tqdm(total=len(ids)-skip)
|
|
192
|
+
if tq is not None: tq.update()
|
|
193
|
+
url_this = base_url+f'/associations?accession_id={id_this}'
|
|
194
|
+
response = requests.get(url_this)
|
|
195
|
+
if (response.status_code!=200):
|
|
196
|
+
logging.error(f"(status_code={response.status_code}): url_this: {url_this}")
|
|
197
|
+
continue
|
|
198
|
+
rval = response.json()
|
|
199
|
+
if not rval: continue
|
|
200
|
+
logging.debug(json.dumps(rval, sort_keys=True, indent=2))
|
|
201
|
+
if '_embedded' in rval and 'associations' in rval['_embedded']:
|
|
202
|
+
assns = rval['_embedded']['associations']
|
|
203
|
+
else:
|
|
204
|
+
logging.error(f'No associations for study: {id_this}')
|
|
205
|
+
continue
|
|
206
|
+
df_this=None;
|
|
207
|
+
for assn in assns:
|
|
208
|
+
n_assn+=1
|
|
209
|
+
if n_assn==1:
|
|
210
|
+
for key,val in assn.items():
|
|
211
|
+
if type(val) not in (list, dict):
|
|
212
|
+
tags_assn.append(key)
|
|
213
|
+
df_assn = pd.DataFrame({tag_assn:[assn[tag_assn]] for tag_assn in tags_assn})
|
|
214
|
+
if 'accession_id' in assn: gcsts.add(assn['accession_id'])
|
|
215
|
+
links = assn['_links'] if '_links' in assn else {}
|
|
216
|
+
loci_this = links['loci']['href'] if 'loci' in links and 'href' in links['loci'] else {}
|
|
217
|
+
snps_this = links['snp']['href'] if 'snp' in links and 'href' in links['snp'] else {}
|
|
218
|
+
if loci_this:
|
|
219
|
+
loci.add(loci_this)
|
|
220
|
+
df_assn['loci'] = [str(loci_this)]
|
|
221
|
+
else:
|
|
222
|
+
df_assn['loci'] = []
|
|
223
|
+
if snps_this:
|
|
224
|
+
snps.add(snps_this)
|
|
225
|
+
df_assn['snps'] = [str(snps_this)]
|
|
226
|
+
else:
|
|
227
|
+
df_assn['snps'] = []
|
|
228
|
+
seas_this = assn['snp_effect_allele'] if 'snp_effect_allele' in assn else []
|
|
229
|
+
if seas_this:
|
|
230
|
+
df_assn['seas'] = [str(seas_this)]
|
|
231
|
+
else:
|
|
232
|
+
df_assn['seas'] = []
|
|
233
|
+
for sea in seas_this:
|
|
234
|
+
seas.add(sea)
|
|
235
|
+
df_this = pd.concat([df_this, df_assn], axis=0)
|
|
236
|
+
if fout: df_this.to_csv(fout, sep="\t", index=False, header=(n_id==0), mode=('w' if n_id==0 else 'a'))
|
|
237
|
+
if fout is None: df = pd.concat([df, df_this], axis=0)
|
|
238
|
+
n_id+=1
|
|
239
|
+
if n_id==nmax:
|
|
240
|
+
logging.info(f"NMAX IDs reached: {nmax}")
|
|
241
|
+
break
|
|
242
|
+
if tq is not None: tq.close()
|
|
243
|
+
n_gcst = len(gcsts)
|
|
244
|
+
n_loci = len(loci)
|
|
245
|
+
n_snp = len(snps)
|
|
246
|
+
n_sea = len(seas)
|
|
247
|
+
logging.info(f"INPUT RCSTs: {n_id}; OUTPUT RCSTs: {n_gcst} ; assns: {n_assn} ; loci: {n_loci} ; alleles: {n_sea} ; snps: {n_snp}")
|
|
248
|
+
if fout is None: return(df)
|
|
249
|
+
|
|
141
250
|
##############################################################################
|
|
142
251
|
def GetSnps(ids, skip=0, nmax=None, base_url=BASE_URL, fout=None):
|
|
143
252
|
"""
|
|
@@ -148,20 +257,7 @@ gc = genomicContext
|
|
|
148
257
|
n_snp=0; n_gene=0; n_loc=0; df=None; tq=None;
|
|
149
258
|
tags_snp=[]; tags_loc=[]; tags_gc=[]; tags_gcloc=[]; tags_gene=[];
|
|
150
259
|
quiet = bool(logging.getLogger().getEffectiveLevel()>15)
|
|
151
|
-
|
|
152
|
-
retry_strategy = Retry(
|
|
153
|
-
total=10,
|
|
154
|
-
status=4,
|
|
155
|
-
backoff_factor=2,
|
|
156
|
-
status_forcelist=[413, 429, 502, 503, 504], #Not 500
|
|
157
|
-
allowed_methods=Retry.DEFAULT_ALLOWED_METHODS
|
|
158
|
-
#method_whitelist=["HEAD", "GET", "PUT", "DELETE", "OPTIONS", "TRACE"] #DEPRECATED: method_whitelist deprecated and removed from urllib3==1.26.0 onwards, as per https://github.com/urllib3/urllib3/blob/main/CHANGES.rst#1260-2020-11-10
|
|
159
|
-
)
|
|
160
|
-
adapter = HTTPAdapter(max_retries=retry_strategy)
|
|
161
|
-
session = requests.Session()
|
|
162
|
-
session.mount("https://", adapter)
|
|
163
|
-
session.mount("http://", adapter)
|
|
164
|
-
|
|
260
|
+
session = InitiateSession()
|
|
165
261
|
url = base_url+'/singleNucleotidePolymorphisms'
|
|
166
262
|
if skip>0: logging.info(f"SKIP IDs skipped: {skip}")
|
|
167
263
|
for id_this in ids[skip:]:
|
|
@@ -214,6 +310,100 @@ gc = genomicContext
|
|
|
214
310
|
logging.info(f"SNPs: {n_snp}; genes: {n_gene}")
|
|
215
311
|
if fout is None: return(df)
|
|
216
312
|
|
|
313
|
+
##############################################################################
|
|
314
|
+
def GetSnpsV2(ids, skip=0, nmax=None, base_url=BASE_URL_V2, fout=None):
|
|
315
|
+
"""
|
|
316
|
+
Input: rs_id, e.g. rs7329174
|
|
317
|
+
https://www.ebi.ac.uk/gwas/rest/api/v2/single-nucleotide-polymorphisms?rs_id=rs7329174&page=0&size=20
|
|
318
|
+
To do(?): Include genomic contexts
|
|
319
|
+
"""
|
|
320
|
+
n_snp=0; n_gene=0; n_loc=0; n_gc=0; df=None; tq=None;
|
|
321
|
+
tags_snp=[]; tags_gc=[];
|
|
322
|
+
quiet = bool(logging.getLogger().getEffectiveLevel()>15)
|
|
323
|
+
session = InitiateSession()
|
|
324
|
+
url = base_url+'/single-nucleotide-polymorphisms'
|
|
325
|
+
if skip>0: logging.info(f"SKIP IDs skipped: {skip}")
|
|
326
|
+
for id_this in ids[skip:]:
|
|
327
|
+
if not quiet and tq is None: tq = tqdm.tqdm(total=len(ids)-skip)
|
|
328
|
+
if tq is not None: tq.update()
|
|
329
|
+
url_this = url+f"?rs_id={id_this}"
|
|
330
|
+
try:
|
|
331
|
+
response = session.get(url_this)
|
|
332
|
+
except Exception as e:
|
|
333
|
+
logging.error(f"Failed for SNP:{id_this}; URL:{url_this}; {str(e)}")
|
|
334
|
+
continue
|
|
335
|
+
if response.status_code!=200:
|
|
336
|
+
logging.error(f"(status_code={response.status_code}): url_this: {url_this}")
|
|
337
|
+
continue
|
|
338
|
+
|
|
339
|
+
rval = response.json()
|
|
340
|
+
logging.debug(json.dumps(rval, sort_keys=True, indent=2))
|
|
341
|
+
snps = rval['_embedded']['snps'] if '_embedded' in rval and 'snps' in rval['_embedded'] else []
|
|
342
|
+
df_this=None;
|
|
343
|
+
for snp in snps:
|
|
344
|
+
if not tags_snp:
|
|
345
|
+
for key,val in snp.items():
|
|
346
|
+
if type(val) not in (list, dict): tags_snp.append(key)
|
|
347
|
+
df_snp = pd.DataFrame({tag_snp:[snp[tag_snp]] for tag_snp in tags_snp})
|
|
348
|
+
if 'mapped_genes' in snp:
|
|
349
|
+
df_snp['mapped_genes'] = [','.join(snp['mapped_genes'])]
|
|
350
|
+
n_gene += len(snp['mapped_genes'])
|
|
351
|
+
links = snp['_links'] if '_links' in snp else {}
|
|
352
|
+
gcs_url = links['genomic_contexts']['href'] if 'genomic_contexts' in links and 'href' in links['genomic_contexts'] else None
|
|
353
|
+
df_snp['genomic_contexts_url'] = [gcs_url]
|
|
354
|
+
|
|
355
|
+
locs = snp['locations'] if 'locations' in snp else []
|
|
356
|
+
locs_strs = []
|
|
357
|
+
for loc in locs:
|
|
358
|
+
cn = loc['chromosome_name'] if 'chromosome_name' in loc else ''
|
|
359
|
+
cp = loc['chromosome_position'] if 'chromosome_position' in loc else ''
|
|
360
|
+
cr = loc['region']['name'] if 'region' in loc and 'name' in loc['region'] else ''
|
|
361
|
+
locs_strs.append(f"{cn}|{cp}|{cr}")
|
|
362
|
+
df_snp['locations'] = [','.join(locs_strs)]
|
|
363
|
+
n_loc += len(locs)
|
|
364
|
+
|
|
365
|
+
rs_id = snp['rs_id'] if 'rs_id' in snp else None
|
|
366
|
+
gcs = GetGenomicContextsV2(rs_id, session)
|
|
367
|
+
df_gc = None
|
|
368
|
+
for gc in gcs:
|
|
369
|
+
if not tags_gc:
|
|
370
|
+
for key,val in gc.items():
|
|
371
|
+
if type(val) not in (list, dict): tags_gc.append(key)
|
|
372
|
+
df_gc = pd.concat([df_gc, pd.DataFrame({tag_gc:[gc[tag_gc]] for tag_gc in tags_gc})])
|
|
373
|
+
n_gc += len(gcs)
|
|
374
|
+
df_snp = pd.concat([df_snp, df_gc], axis=1)
|
|
375
|
+
df_this = pd.concat([df_this, df_snp], axis=0)
|
|
376
|
+
|
|
377
|
+
if fout: df_this.to_csv(fout, sep="\t", index=False, header=(n_snp==0), mode=('w' if n_snp==0 else 'a'))
|
|
378
|
+
if fout is None: df = pd.concat([df, df_this], axis=0)
|
|
379
|
+
n_snp+=1
|
|
380
|
+
if n_snp==nmax:
|
|
381
|
+
logging.info(f"NMAX IDs reached: {nmax}")
|
|
382
|
+
break
|
|
383
|
+
if tq is not None: tq.close()
|
|
384
|
+
logging.info(f"SNPs: {n_snp}; mapped_genes: {n_gene}; locations: {n_loc}; genomic_contexts: {n_gc}")
|
|
385
|
+
if fout is None: return(df)
|
|
386
|
+
|
|
387
|
+
##############################################################################
|
|
388
|
+
def GetGenomicContextsV2(rs_id, session):
|
|
389
|
+
"""
|
|
390
|
+
https://www.ebi.ac.uk/gwas/rest/api/v2/single-nucleotide-polymorphisms/rs7329174/genomic-contexts?sort=distance&direction=asc
|
|
391
|
+
"""
|
|
392
|
+
if not rs_id: return []
|
|
393
|
+
url_this = f"https://www.ebi.ac.uk/gwas/rest/api/v2/single-nucleotide-polymorphisms/{rs_id}/genomic-contexts?sort=distance&direction=asc"
|
|
394
|
+
try:
|
|
395
|
+
response = session.get(url_this)
|
|
396
|
+
except Exception as e:
|
|
397
|
+
logging.error(f"Failed for SNP:{rs_id}; URL:{url_this}; {str(e)}")
|
|
398
|
+
return []
|
|
399
|
+
if response.status_code!=200:
|
|
400
|
+
logging.error(f"(status_code={response.status_code}): url_this: {url_this}")
|
|
401
|
+
return []
|
|
402
|
+
rval = response.json()
|
|
403
|
+
logging.debug(json.dumps(rval, sort_keys=True, indent=2))
|
|
404
|
+
gcs = rval['_embedded']['genomic_contexts'] if '_embedded' in rval and 'genomic_contexts' in rval['_embedded'] else []
|
|
405
|
+
return gcs
|
|
406
|
+
|
|
217
407
|
##############################################################################
|
|
218
408
|
def SearchStudies(ids, searchtype, base_url=BASE_URL, fout=None):
|
|
219
409
|
tags=[]; n_study=0; rval=None; df=None; tq=None;
|
|
@@ -27,11 +27,11 @@ cited_by) reported as counts."""
|
|
|
27
27
|
break
|
|
28
28
|
result = response.json()
|
|
29
29
|
logging.debug(json.dumps(result, indent=2))
|
|
30
|
-
url_self = result['links']['self']
|
|
31
|
-
pubs = result['data']
|
|
30
|
+
#url_self = result['links']['self']
|
|
31
|
+
pubs = result['data'] if 'data' in result else []
|
|
32
32
|
for pub in pubs:
|
|
33
33
|
if not tags: tags = list(pub.keys())
|
|
34
|
-
df_this = pd.DataFrame({
|
|
34
|
+
df_this = pd.DataFrame({tag:[pub[tag] if tag in pub else None] for tag in tags})
|
|
35
35
|
if fout: df_this.to_csv(fout, sep="\t", index=False, header=bool(n_out==0))
|
|
36
36
|
df = pd.concat([df, df_this])
|
|
37
37
|
n_out+=1
|