from app.funcs.query_processors import ( NetworkPlotSchemaInput, TopicQueryProcessor, ) from app.utils.data_table import NodeCol, RelCol from app.utils.url_helpers import data_table_node_link, data_table_rel_link from .graph import edge_schemas, node_schemas master_name = "mr" EXPOSURE_DESC = "Exposure {Gwas}.".format(Gwas=data_table_node_link("Gwas")) OUTCOME_DESC = "Outcome {Gwas}.".format(Gwas=data_table_node_link("Gwas")) MR_DESC = """ Mendelian randomization {MR_EVE_MR} evidence from exposure to outcome. """.format(MR_EVE_MR=data_table_rel_link("MR_EVE_MR")) table_col_configs = { "exposure.id": NodeCol("Gwas", "id", EXPOSURE_DESC), "exposure.trait": NodeCol("Gwas", "trait", EXPOSURE_DESC), "outcome.id": NodeCol("Gwas", "id", OUTCOME_DESC), "outcome.trait": NodeCol("Gwas", "trait", OUTCOME_DESC), "mr.b": RelCol("MR_EVE_MR", "b", MR_DESC, rounding=True), "mr.se": RelCol("MR_EVE_MR", "se", MR_DESC, rounding=True), "mr.pval": RelCol("MR_EVE_MR", "pval", MR_DESC), "mr.method": RelCol("MR_EVE_MR", "method", MR_DESC), "mr.selection": RelCol("MR_EVE_MR", "selection", MR_DESC), "mr.moescore": RelCol("MR_EVE_MR", "moescore", MR_DESC, rounding=True), } class MRQueryProcessor(TopicQueryProcessor):
from app.funcs.query_processors import ( NetworkPlotSchemaInput, TopicQueryProcessor, ) from app.utils.data_table import NodeCol, RelCol from app.utils.url_helpers import data_table_node_link, data_table_rel_link from .graph import edge_schemas, node_schemas master_name = "pathway" GWAS_DESC = "{Gwas} trait of interests".format( Gwas=data_table_node_link("Gwas")) GWAS_TO_VARIANT_DESC = """ Identified association {GWAS_TO_VARIANT} between {Gwas} and {Variant} """.format( GWAS_TO_VARIANT=data_table_rel_link("GWAS_TO_VARIANT"), Gwas=data_table_node_link("Gwas"), Variant=data_table_node_link("Variant"), ) VARIANT_DESC = "Associated {Variant}".format( Variant=data_table_node_link("Variant")) GENE_DESC = "Associated {Gene}".format(Gene=data_table_node_link("Gene")) PROTEIN_DESC = "Associated {Protein}".format( Protein=data_table_node_link("Protein")) PATHWAY_DESC = "Biological {Pathway}".format( Pathway=data_table_node_link("Pathway")) table_col_configs = { "gwas.id": NodeCol("Gwas", "id", GWAS_DESC), "gwas.trait": NodeCol("Gwas", "trait", GWAS_DESC),
TopicQueryProcessor, ) from app.utils.data_table import NodeCol, RelCol from app.utils.url_helpers import data_table_node_link, data_table_rel_link from .graph import edge_schemas, node_schemas master_name = "drugs_risk_factors" api_endpoint = "drugs/risk-factors" TRAIT_DESC = "Disease {Gwas} trait.".format(Gwas=data_table_node_link("Gwas")) ASSOC_TRAIT_DESC = """ Risk factor {Gwas} trait that is identified to have {MR_EVE_MR} evidence to the disease trait. """.format( Gwas=data_table_node_link("Gwas"), MR_EVE_MR=data_table_rel_link("MR_EVE_MR"), ) DRUG_DESC = """ {Drug} that is identified to be associated with the disease {Gwas} trait via the path as shown in the network plot. """.format(Gwas=data_table_node_link("Gwas"), Drug=data_table_node_link("Drug")) GENE_DESC = "Associated {Gene}".format(Gene=data_table_node_link("Gene")) MR_DESC = """ Mendelian randomization {MR_EVE_MR} evidence from the risk factor {Gwas} to the disease {Gwas}. """.format( MR_EVE_MR=data_table_rel_link("MR_EVE_MR"), Gwas=data_table_node_link("Gwas"), ) VARIANT_DESC = "Associated {Variant}".format(
from app.funcs.query_processors import ( NetworkPlotSchemaInput, TopicQueryProcessor, ) from app.utils.data_table import NodeCol, RelCol from app.utils.url_helpers import data_table_node_link, data_table_rel_link from .graph import edge_schemas, node_schemas master_name = "obs-cor" TRAIT_DESC = "{Gwas} trait of interests.".format( Gwas=data_table_node_link("Gwas")) ASSOC_TRAIT_DESC = "Associated {Gwas} trait.".format( Gwas=data_table_node_link("Gwas")) OBS_COR_DESC = "Observational correlation {OBS_COR} between the two {Gwas} traits.".format( Gwas=data_table_node_link("Gwas"), OBS_COR=data_table_rel_link("OBS_COR")) table_col_configs = { "trait.id": NodeCol("Gwas", "id", TRAIT_DESC), "trait.trait": NodeCol("Gwas", "trait", TRAIT_DESC), "obs_cor.cor": RelCol("OBS_COR", "cor", OBS_COR_DESC, rounding=True), "assoc_trait.id": NodeCol("Gwas", "id", ASSOC_TRAIT_DESC), "assoc_trait.trait": NodeCol("Gwas", "trait", ASSOC_TRAIT_DESC), } class ObsCorQueryProcessor(TopicQueryProcessor): def __init__(self, params: Dict[str, Any]): super().__init__( master_name=master_name, params=params, table_col_configs=table_col_configs,
from app.utils.data_table import NodeCol, RelCol from app.utils.url_helpers import data_table_node_link, data_table_rel_link from .graph import edge_schemas, node_schemas master_name = "ontology_trait_disease" api_endpoint = "ontology/gwas-efo-disease" GWAS_DESC = "{Gwas} trait of interest.".format( Gwas=data_table_node_link("Gwas") ) GE_DESC = """ Mapping from {Gwas} to {Efo} via semantic similarity {GWAS_NLP_EFO}. """.format( Gwas=data_table_node_link("Gwas"), Efo=data_table_node_link("Efo"), GWAS_NLP_EFO=data_table_rel_link("GWAS_NLP_EFO"), ) EFO_DESC = "Experimental Factor Ontology {Efo}".format( Efo=data_table_node_link("Efo") ) DISEASE_DESC = "{Disease} term".format(Disease=data_table_node_link("Disease")) table_col_configs = { "gwas.id": NodeCol("Gwas", "id", GWAS_DESC), "gwas.trait": NodeCol("Gwas", "trait", GWAS_DESC), "ge.score": RelCol("GWAS_NLP_EFO", "score", GE_DESC), "efo.type": NodeCol("Efo", "type", EFO_DESC), "efo.value": NodeCol("Efo", "value", EFO_DESC), "efo.id": NodeCol("Efo", "id", EFO_DESC), "disease.id": NodeCol("Disease", "id", DISEASE_DESC), "disease.label": NodeCol("Disease", "label", DISEASE_DESC), }
TopicQueryProcessor, ) from app.utils.data_table import NodeCol, RelCol from app.utils.url_helpers import data_table_node_link, data_table_rel_link from .graph import edge_schemas, node_schemas master_name = "literature_trait" api_endpoint = "literature/gwas" GWAS_DESC = "{Gwas} trait of interest.".format( Gwas=data_table_node_link("Gwas") ) GS_DESC = "Association between {Gwas} and {LiteratureTriple} via {GWAS_TO_LITERATURE_TRIPLE}.".format( Gwas=data_table_node_link("Gwas"), LiteratureTriple=data_table_node_link("LiteratureTriple"), GWAS_TO_LITERATURE_TRIPLE=data_table_rel_link("GWAS_TO_LITERATURE_TRIPLE"), ) TRIPLE_DESC = """ The SemMedDB knowledge triplet {LiteratureTriple} that links the {Gwas} trait with a SemMedDB term {LiteratureTerm}. """.format( LiteratureTriple=data_table_node_link("LiteratureTriple"), Gwas=data_table_node_link("Gwas"), LiteratureTerm=data_table_node_link("LiteratureTerm"), ) LIT_DESC = """ {Literature} evidence regarding the {Gwas} trait as a PubMed article. """.format( Literature=data_table_node_link("Literature"), Gwas=data_table_node_link("Gwas"), )
NetworkPlotSchemaInput, TopicQueryProcessor, ) from app.utils.data_table import NodeCol, RelCol from app.utils.url_helpers import data_table_node_link, data_table_rel_link from .graph import edge_schemas, node_schemas master_name = "prs" TRAIT_DESC = "The {gwas} trait of interests.".format( gwas=data_table_node_link("Gwas")) ASSOC_TRAIT_DESC = "The associated {gwas} trait.".format( gwas=data_table_node_link("Gwas")) PRS_DESC = "Pre-computed polygenic risk scores {prs} associations.".format( prs=data_table_rel_link("PRS")) table_col_configs = { "trait.id": NodeCol("Gwas", "id", TRAIT_DESC), "trait.trait": NodeCol("Gwas", "trait", TRAIT_DESC), "assoc_trait.id": NodeCol("Gwas", "id", ASSOC_TRAIT_DESC), "assoc_trait.trait": NodeCol("Gwas", "trait", ASSOC_TRAIT_DESC), "prs.beta": RelCol("PRS", "beta", PRS_DESC, rounding=True), "prs.se": RelCol("PRS", "se", PRS_DESC, rounding=True), "prs.p": RelCol("PRS", "p", PRS_DESC), "prs.r2": RelCol("PRS", "r2", PRS_DESC, rounding=True), "prs.nsnps": RelCol("PRS", "nsnps", PRS_DESC), "prs.n": RelCol("PRS", "n", PRS_DESC), "prs.model": RelCol("PRS", "model", PRS_DESC), }