Total Complexity | 5 |
Total Lines | 37 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | from typing import Set, Sequence |
||
|
|||
2 | |||
3 | from mandos.model.settings import MANDOS_SETTINGS |
||
4 | from mandos.model.apis.chembl_support.chembl_activity import DataValidityComment |
||
5 | from mandos.model.apis.chembl_support.chembl_targets import TargetType |
||
6 | from mandos.model.apis.pubchem_support.pubchem_models import ClinicalTrialsGovUtils |
||
7 | from mandos.model.taxonomy import Taxonomy |
||
8 | from mandos.model.taxonomy_caches import TaxonomyFactories |
||
9 | |||
10 | |||
11 | class EntryUtils: |
||
12 | """ """ |
||
13 | |||
14 | @staticmethod |
||
15 | def split(st: str) -> Set[str]: |
||
16 | return {s.strip() for s in st.split(",")} |
||
17 | |||
18 | @staticmethod |
||
19 | def get_taxa(taxa: str) -> Sequence[Taxonomy]: |
||
20 | factory = TaxonomyFactories.from_uniprot(MANDOS_SETTINGS.taxonomy_cache_path) |
||
21 | return [factory.load(str(taxon).strip()) for taxon in taxa.split(",")] |
||
22 | |||
23 | @staticmethod |
||
24 | def get_trial_statuses(st: str) -> Set[str]: |
||
25 | return ClinicalTrialsGovUtils.resolve_statuses(st) |
||
26 | |||
27 | @staticmethod |
||
28 | def get_target_types(st: str) -> Set[str]: |
||
29 | return {s.name for s in TargetType.resolve(st)} |
||
30 | |||
31 | @staticmethod |
||
32 | def get_flags(st: str) -> Set[str]: |
||
33 | return {s.name for s in DataValidityComment.resolve(st)} |
||
34 | |||
35 | |||
36 | __all__ = ["EntryUtils"] |
||
37 |