Пример #1
0
def create_edge_schemas(type: str = "confounder"):
    edge_schemas = [
        NetworkEdgeSchema(
            from_col="exposure.id",
            to_col="outcome.id",
            from_meta_node="GwasExposure",
            hover_title_formatter=mr_eve_title_formatter(
                exposure_id="exposure.id",
                outcome_id="outcome.id",
                estimate="r2.b",
                se="r2.se",
                p="r2.pval",
                selection="r2.selection",
                method="r2.method",
            ),
        ),
        edge_confounder_exposure[type],
        edge_confounder_outcome[type],
    ]
    return edge_schemas
Пример #2
0
node_schemas = [
    NetworkNodeSchema(
        meta_node="Gwas",
        id_col="trait.id",
        label_formatter=gwas_label_formatter(node_name=None,
                                             id_col="trait.id",
                                             trait_col="trait.trait"),
    ),
    NetworkNodeSchema(
        meta_node="Gwas",
        id_col="assoc_trait.id",
        label_formatter=gwas_label_formatter(
            node_name=None,
            id_col="assoc_trait.id",
            trait_col="assoc_trait.trait",
        ),
    ),
]

edge_schemas = [
    NetworkEdgeSchema(
        from_col="trait.id",
        to_col="assoc_trait.id",
        from_meta_node="Gwas",
        arrows=False,
        meta_rel="GENETIC_COR",
        hover_title_formatter=lambda row: None,
    )
]
Пример #3
0
         meta_node="Pathway",
         id_col="pathway.name",
         label_col="pathway.name",
         match_node_by="name",
     ),
 ],
 edges=[
     NetworkEdgeSchema(
         from_col="gwas.id",
         to_col="variant.name",
         from_meta_node="Gwas",
         hover_title_formatter=lambda row: """
                     <b>gwas.id</b>: {gwas_id},
                     <b>variant.name</b>: {variant_name}</br>
                     <b>beta</b>: {beta:.2E},
                     <b>se</b>: {se:.2E},
                     <b>p</b>: {p:.2E}
                     """.format(
             gwas_id=row["gwas.id"],
             variant_name=row["variant.name"],
             beta=row["gwas_to_variant.beta"],
             se=row["gwas_to_variant.se"],
             p=row["gwas_to_variant.pval"],
         ),
     ),
     NetworkEdgeSchema(
         from_col="variant.name",
         to_col="gene.name",
         from_meta_node="Variant",
     ),
     NetworkEdgeSchema(
         from_col="gene.name",
Пример #4
0
    ),
    NetworkNodeSchema(meta_node="Variant", id_col="variant.name"),
    NetworkNodeSchema(
        meta_node="Gene", id_col="gene.name", match_node_by="name"
    ),
    NetworkNodeSchema(meta_node="Drug", id_col="drug.label"),
]

edge_schemas = [
    NetworkEdgeSchema(
        from_col="assoc_trait.id",
        to_col="trait.id",
        from_meta_node="Gwas",
        hover_title_formatter=mr_eve_title_formatter(
            exposure_id="assoc_trait.id",
            outcome_id="trait.id",
            estimate="mr.b",
            se="mr.se",
            p="mr.pval",
            selection="mr.selection",
            method="mr.method",
        ),
    ),
    NetworkEdgeSchema(
        from_col="variant.name", to_col="assoc_trait.id", from_meta_node="Gwas"
    ),
    NetworkEdgeSchema(
        from_col="variant.name", to_col="gene.name", from_meta_node="Variant"
    ),
    NetworkEdgeSchema(
        from_col="drug.label", to_col="gene.name", from_meta_node="Drug"
    ),
Пример #5
0
         ),
     ),
     NetworkNodeSchema(meta_node="Variant", id_col="variant.name"),
     NetworkNodeSchema(
         meta_node="Gene", id_col="gene.name", match_node_by="name"
     ),
     NetworkNodeSchema(meta_node="Drug", id_col="drug.label"),
 ],
 edges=[
     NetworkEdgeSchema(
         from_col="risk_factor_gwas.id",
         to_col="disease_gwas.id",
         from_meta_node="Gwas",
         hover_title_formatter=mr_eve_title_formatter(
             exposure_id="risk_factor_gwas.id",
             outcome_id="disease_gwas.id",
             estimate="mr.b",
             se="mr.se",
             p="mr.pval",
             selection="mr.selection",
             method="mr.method",
         ),
     ),
     # NetworkEdgeSchema(
     #     from_col="risk_factor_gwas.id",
     #     to_col="disease_gwas.id",
     #     cols=["obs_cor.cor"],
     #     from_meta_node="Gwas",
     #     dashes=True,
     #     arrows=False,
     # ),
     NetworkEdgeSchema(
Пример #6
0
from app.funcs.network_graph import NetworkEdgeSchema, NetworkNodeSchema
from app.utils.meta_graph import gwas_label_formatter

node_schemas = [
    NetworkNodeSchema(
        id_col="gwas.id",
        label_formatter=gwas_label_formatter(node_name="gwas"),
        meta_node="Gwas",
    ),
    NetworkNodeSchema(id_col="triple.id", meta_node="LiteratureTriple"),
    NetworkNodeSchema(id_col="lit.id", meta_node="Literature"),
]

edge_schemas = [
    NetworkEdgeSchema(from_col="gwas.id",
                      to_col="triple.id",
                      from_meta_node="Gwas"),
    NetworkEdgeSchema(
        from_col="gwas.id",
        to_col="lit.id",
        from_meta_node="Gwas",
        arrows=False,
        dashes=True,
    ),
    NetworkEdgeSchema(
        from_col="triple.id",
        to_col="lit.id",
        from_meta_node="LiteratureTriple",
    ),
]
Пример #7
0
     NetworkNodeSchema(
         meta_node="GwasSecondary",
         id_col="assoc_gwas.id",
         label_col="assoc_gwas.trait",
     ),
     NetworkNodeSchema(
         meta_node="Gwas",
         id_col="assoc_gwas2.id",
         label_col="assoc_gwas2.trait",
     ),
 ],
 edges=[
     NetworkEdgeSchema(
         from_col="gwas.id",
         to_col="assoc_gwas.id",
         from_meta_node="Gwas",
         meta_rel="MR_EVE_MR",
         cols=["gwas.id", "assoc_gwas.id", "mr.pval"],
     ),
     # prs
     NetworkEdgeSchema(
         from_col="gwas.id",
         to_col="assoc_gwas2.id",
         from_meta_node="Gwas",
         meta_rel="PRS",
         cols=["gwas.id", "assoc_gwas2.id", "prs1.p"],
     ),
     NetworkEdgeSchema(
         from_col="assoc_gwas2.id",
         to_col="assoc_gwas.id",
         from_meta_node="Gwas",
Пример #8
0
from app.funcs.network_graph import NetworkEdgeSchema, NetworkNodeSchema
from app.utils.meta_graph import gwas_label_formatter

node_schemas = [
    NetworkNodeSchema(
        id_col="gwas.id",
        label_formatter=gwas_label_formatter(node_name="gwas"),
        meta_node="Gwas",
    ),
    NetworkNodeSchema(id_col="efo.id", label_col="efo.value", meta_node="Efo"),
    NetworkNodeSchema(id_col="disease.id",
                      label_col="disease.label",
                      meta_node="Disease"),
]

edge_schemas = [
    NetworkEdgeSchema(
        from_col="gwas.id",
        to_col="efo.id",
        from_meta_node="Gwas",
        arrows=False,
    ),
    NetworkEdgeSchema(
        from_col="efo.id",
        to_col="disease.id",
        from_meta_node="Disease",
        arrows=False,
    ),
]
Пример #9
0
    """,
    query_type=GalleryQueryType.cypher,
    schema=GallerySchema(
        nodes=[
            NetworkNodeSchema(
                meta_node="Gwas", id_col="g1.id", label_col="g1.trait"
            ),
            NetworkNodeSchema(
                meta_node="Gwas", id_col="g2.id", label_col="g2.trait"
            ),
            NetworkNodeSchema(
                meta_node="EfoPrimary", id_col="e.id", label_col="e.value"
            ),
            NetworkNodeSchema(
                meta_node="Efo", id_col="eChild.id", label_col="eChild.value"
            ),
        ],
        edges=[
            NetworkEdgeSchema(
                from_col="e.id", to_col="eChild.id", from_meta_node="Efo"
            ),
            NetworkEdgeSchema(
                from_col="eChild.id", to_col="g1.id", from_meta_node="Efo"
            ),
            NetworkEdgeSchema(
                from_col="e.id", to_col="g2.id", from_meta_node="Efo"
            ),
        ],
    ),
)
Пример #10
0
        meta_node="Gwas",
        id_col="cf.id",
        label_formatter=gwas_label_formatter(node_name="cf"),
    ),
]

edge_confounder_exposure = {
    "confounder":
    NetworkEdgeSchema(
        from_col="cf.id",
        to_col="exposure.id",
        from_meta_node="Gwas",
        dashes=True,
        hover_title_formatter=mr_eve_title_formatter(
            exposure_id="cf.id",
            outcome_id="exposure.id",
            estimate="r1.b",
            se="r1.se",
            p="r1.pval",
            selection="r1.selection",
            method="r1.method",
        ),
    ),
    "intermediate":
    NetworkEdgeSchema(
        from_col="exposure.id",
        to_col="cf.id",
        from_meta_node="GwasExposure",
        dashes=True,
        hover_title_formatter=mr_eve_title_formatter(
            exposure_id="exposure.id",
Пример #11
0
                              id_col="cf.id",
                              label_col="cf.trait"),
            NetworkNodeSchema(
                meta_node="GwasExposure",
                id_col="exposure.id",
                label_col="exposure.trait",
            ),
            NetworkNodeSchema(
                meta_node="GwasOutcome",
                id_col="outcome.id",
                label_col="outcome.trait",
            ),
        ],
        edges=[
            NetworkEdgeSchema(from_col="cf.id",
                              to_col="exposure.id",
                              from_meta_node="Gwas"),
            NetworkEdgeSchema(
                from_col="exposure.id",
                to_col="outcome.id",
                from_meta_node="GwasExposure",
            ),
            NetworkEdgeSchema(
                from_col="cf.id",
                to_col="outcome.id",
                from_meta_node="GwasOutcome",
            ),
        ],
    ),
)
Пример #12
0
# NOTE: it is impossible to specify a study to be exposure or outcome
#       in the current api spec, as a study can be both exposure or outcome
#       each time.
node_schemas = [
    NetworkNodeSchema(
        meta_node="Gwas",
        id_col="exposure.id",
        label_formatter=gwas_label_formatter(
            node_name=None, id_col="exposure.id", trait_col="exposure.trait"
        ),
    ),
    NetworkNodeSchema(
        meta_node="Gwas",
        id_col="outcome.id",
        label_formatter=gwas_label_formatter(
            node_name=None, id_col="outcome.id", trait_col="outcome.trait"
        ),
    ),
]

edge_schemas = [
    NetworkEdgeSchema(
        from_col="exposure.id",
        to_col="outcome.id",
        from_meta_node="Gwas",
        hover_title_formatter=mr_eve_title_formatter(
            exposure_id="exposure.id", outcome_id="outcome.id"
        ),
    )
]
Пример #13
0
node_schemas_multi_snp = [
    NetworkNodeSchema(meta_node="Gene",
                      id_col="gene.ensembl_id",
                      label_col="gene.name"),
    NetworkNodeSchema(
        meta_node="Gwas",
        id_col="gwas.id",
        label_formatter=lambda row: "{id}: {name}".format(
            id=row["gwas.id"], name=row["gwas.trait"]),
    ),
]

edge_schemas_single_snp = [
    NetworkEdgeSchema(
        from_col="gene.ensembl_id",
        to_col="gwas.id",
        from_meta_node="Gene",
        hover_title_formatter=single_snp_mr_title_formatter,
    ),
    NetworkEdgeSchema(from_col="r.rsid",
                      to_col="gene.ensembl_id",
                      from_meta_node="Variant"),
]

edge_schemas_multi_snp = [
    NetworkEdgeSchema(
        from_col="gene.ensembl_id",
        to_col="gwas.id",
        from_meta_node="Gene",
        hover_title_formatter=multi_snp_mr_title_formatter,
    )
]