Skip to content

Commit

Permalink
Reorganize sources (#305)
Browse files Browse the repository at this point in the history
  • Loading branch information
cthoyt authored Jan 13, 2025
1 parent 8262e92 commit 23a6c0b
Show file tree
Hide file tree
Showing 28 changed files with 112 additions and 46 deletions.
3 changes: 2 additions & 1 deletion src/pyobo/cli/database_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
get_xrefs_df,
)
from ..getters import IterHelperHelperDict, iter_helper, iter_helper_helper
from ..sources import ncbigene, pubchem
from ..sources import pubchem
from ..sources.ncbi import ncbigene
from ..utils.path import ensure_path
from ..xrefdb.sources import iter_xref_plugins

Expand Down
22 changes: 7 additions & 15 deletions src/pyobo/sources/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,38 +15,30 @@
from .cvx import CVXGetter
from .depmap import DepMapGetter
from .dictybase_gene import DictybaseGetter
from .drugbank import DrugBankGetter
from .drugbank_salt import DrugBankSaltGetter
from .drugbank import DrugBankGetter, DrugBankSaltGetter
from .drugcentral import DrugCentralGetter
from .expasy import ExpasyGetter
from .famplex import FamPlexGetter
from .flybase import FlyBaseGetter
from .gard import GARDGetter
from .geonames import GeonamesFeatureGetter, GeonamesGetter
from .gtdb import GTDBGetter
from .gwascentral_phenotype import GWASCentralPhenotypeGetter
from .gwascentral_study import GWASCentralStudyGetter
from .hgnc import HGNCGetter
from .hgncgenefamily import HGNCGroupGetter
from .icd10 import ICD10Getter
from .icd11 import ICD11Getter
from .gwascentral import GWASCentralPhenotypeGetter, GWASCentralStudyGetter
from .hgnc import HGNCGetter, HGNCGroupGetter
from .icd import ICD10Getter, ICD11Getter
from .interpro import InterProGetter
from .itis import ITISGetter
from .kegg import KEGGGeneGetter, KEGGGenomeGetter, KEGGPathwayGetter
from .mesh import MeSHGetter
from .mgi import MGIGetter
from .mirbase import MiRBaseGetter
from .mirbase_family import MiRBaseFamilyGetter
from .mirbase_mature import MiRBaseMatureGetter
from .mirbase import MiRBaseFamilyGetter, MiRBaseGetter, MiRBaseMatureGetter
from .msigdb import MSigDBGetter
from .ncbi_gc import NCBIGCGetter
from .ncbigene import NCBIGeneGetter
from .ncbi import NCBIGCGetter, NCBIGeneGetter
from .nlm import NLMCatalogGetter, NLMPublisherGetter
from .npass import NPASSGetter
from .omim_ps import OMIMPSGetter
from .pathbank import PathBankGetter
from .pfam import PfamGetter
from .pfam_clan import PfamClanGetter
from .pfam import PfamClanGetter, PfamGetter
from .pid import PIDGetter
from .pombase import PomBaseGetter
from .pubchem import PubChemCompoundGetter
Expand Down
7 changes: 7 additions & 0 deletions src/pyobo/sources/chembl/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
"""Resources from ChEMBL."""

from .chembl_compound import ChEMBLCompoundGetter

__all__ = [
"ChEMBLCompoundGetter",
]
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
"""Converter for ChEMBL.
Run with ``python -m pyobo.sources.chembl -vv``.
"""
"""Converter for ChEMBL Compounds."""

import logging
from collections.abc import Iterable
Expand Down
9 changes: 9 additions & 0 deletions src/pyobo/sources/drugbank/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
"""Resources from DrugBank."""

from .drugbank import DrugBankGetter
from .drugbank_salt import DrugBankSaltGetter

__all__ = [
"DrugBankGetter",
"DrugBankSaltGetter",
]
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
import pystow
from tqdm.auto import tqdm

from ..getters import NoBuildError
from ..struct import Obo, Reference, Term
from ..struct.typedef import has_inchi, has_salt, has_smiles
from ..utils.cache import cached_pickle
from ..utils.path import prefix_directory_join
from ...getters import NoBuildError
from ...struct import Obo, Reference, Term
from ...struct.typedef import has_inchi, has_salt, has_smiles
from ...utils.cache import cached_pickle
from ...utils.path import prefix_directory_join

__all__ = [
"DrugBankGetter",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from collections.abc import Iterable

from .drugbank import iterate_drug_info
from ..struct import Obo, Reference, Term
from ...struct import Obo, Reference, Term

__all__ = [
"DrugBankSaltGetter",
Expand Down
9 changes: 9 additions & 0 deletions src/pyobo/sources/gwascentral/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
"""Resources from GWAS Central."""

from .gwascentral_phenotype import GWASCentralPhenotypeGetter
from .gwascentral_study import GWASCentralStudyGetter

__all__ = [
"GWASCentralPhenotypeGetter",
"GWASCentralStudyGetter",
]
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@

from tqdm.auto import tqdm, trange

from pyobo.sources.gwascentral_study import VERSION
from pyobo.struct import Obo, Reference, Term
from pyobo.utils.path import ensure_path

from .gwascentral_study import VERSION

__all__ = [
"GWASCentralPhenotypeGetter",
]
Expand Down
File renamed without changes.
9 changes: 9 additions & 0 deletions src/pyobo/sources/hgnc/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
"""Resources from HGNC."""

from .hgnc import HGNCGetter
from .hgncgenefamily import HGNCGroupGetter

__all__ = [
"HGNCGetter",
"HGNCGroupGetter",
]
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@

import pandas as pd

from ..struct import Obo, Reference, SynonymTypeDef, Term, has_citation
from ..struct.typedef import enables, exact_match, from_species
from ..utils.path import ensure_path
from ...struct import Obo, Reference, SynonymTypeDef, Term, has_citation
from ...struct.typedef import enables, exact_match, from_species
from ...utils.path import ensure_path

__all__ = [
"HGNCGroupGetter",
Expand Down
9 changes: 9 additions & 0 deletions src/pyobo/sources/icd/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
"""Resources from ICD."""

from .icd10 import ICD10Getter
from .icd11 import ICD11Getter

__all__ = [
"ICD10Getter",
"ICD11Getter",
]
6 changes: 3 additions & 3 deletions src/pyobo/sources/icd10.py → src/pyobo/sources/icd/icd10.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@

from tqdm.auto import tqdm

from ..sources.icd_utils import (
from .icd_utils import (
ICD10_TOP_LEVEL_URL,
get_child_identifiers,
get_icd,
visiter,
)
from ..struct import Obo, Reference, Synonym, Term, has_category
from ..utils.path import prefix_directory_join
from ...struct import Obo, Reference, Synonym, Term, has_category
from ...utils.path import prefix_directory_join

__all__ = [
"ICD10Getter",
Expand Down
4 changes: 2 additions & 2 deletions src/pyobo/sources/icd11.py → src/pyobo/sources/icd/icd11.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
get_icd_11_mms,
visiter,
)
from ..struct import Obo, Reference, Synonym, Term, TypeDef, default_reference
from ..utils.path import prefix_directory_join
from ...struct import Obo, Reference, Synonym, Term, TypeDef, default_reference
from ...utils.path import prefix_directory_join

__all__ = [
"ICD11Getter",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
from pystow.config_api import ConfigError
from tqdm.auto import tqdm

from ..getters import NoBuildError
from ..struct import Term
from ...getters import NoBuildError
from ...struct import Term

TOKEN_URL = "https://icdaccessmanagement.who.int/connect/token" # noqa:S105

Expand Down
11 changes: 11 additions & 0 deletions src/pyobo/sources/mirbase/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
"""Resources from miRBase."""

from .mirbase import MiRBaseGetter
from .mirbase_family import MiRBaseFamilyGetter
from .mirbase_mature import MiRBaseMatureGetter

__all__ = [
"MiRBaseFamilyGetter",
"MiRBaseGetter",
"MiRBaseMatureGetter",
]
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@

from tqdm.auto import tqdm

from pyobo.sources.mirbase_constants import BASE_URL, _assert_frozen_version
from pyobo.struct import Obo, Reference, Synonym, Term, from_species
from pyobo.struct.typedef import has_mature
from pyobo.utils.cache import cached_mapping
from pyobo.utils.path import ensure_df, ensure_path, prefix_directory_join

from .mirbase_constants import BASE_URL, _assert_frozen_version

__all__ = [
"MiRBaseGetter",
]
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@
import pandas as pd
from tqdm.auto import tqdm

from pyobo.sources.mirbase_constants import (
from pyobo.struct import Obo, Reference, Term, has_member

from .mirbase_constants import (
get_premature_df,
get_premature_family_df,
get_premature_to_prefamily_df,
)
from pyobo.struct import Obo, Reference, Term, has_member

__all__ = [
"MiRBaseFamilyGetter",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
import pandas as pd
from tqdm.auto import tqdm

from pyobo.sources.mirbase_constants import get_mature_df
from pyobo.struct import Obo, Reference, Synonym, Term

from .mirbase_constants import get_mature_df

__all__ = [
"MiRBaseMatureGetter",
]
Expand Down
9 changes: 9 additions & 0 deletions src/pyobo/sources/ncbi/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
"""Resources from NCBI."""

from .ncbi_gc import NCBIGCGetter
from .ncbigene import NCBIGeneGetter

__all__ = [
"NCBIGCGetter",
"NCBIGeneGetter",
]
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
import pandas as pd
from tqdm.auto import tqdm

from ..struct import Obo, Reference, Term, from_species
from ..utils.path import ensure_df
from ...struct import Obo, Reference, Term, from_species
from ...utils.path import ensure_df

__all__ = [
"NCBIGeneGetter",
Expand Down
9 changes: 9 additions & 0 deletions src/pyobo/sources/pfam/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
"""Resources from PFAM."""

from .pfam import PfamGetter
from .pfam_clan import PfamClanGetter

__all__ = [
"PfamClanGetter",
"PfamGetter",
]
4 changes: 2 additions & 2 deletions src/pyobo/sources/pfam.py → src/pyobo/sources/pfam/pfam.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

import pandas as pd

from ..struct import Obo, Reference, Term
from ..utils.path import ensure_df
from ...struct import Obo, Reference, Term
from ...utils.path import ensure_df

__all__ = [
"PfamGetter",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from tqdm.auto import tqdm

from .pfam import get_pfam_clan_df
from ..struct import Obo, Reference, Term
from ...struct import Obo, Reference, Term

__all__ = [
"PfamClanGetter",
Expand Down

0 comments on commit 23a6c0b

Please sign in to comment.