Пример #1
0
from app.funcs.network_graph import NetworkEdgeSchema, NetworkNodeSchema
from app.utils.meta_graph import gwas_label_formatter

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,
    )
Пример #2
0
from app.funcs.network_graph import NetworkEdgeSchema, NetworkNodeSchema
from app.utils.meta_graph import gwas_label_formatter, mr_eve_title_formatter

node_schemas = [
    NetworkNodeSchema(
        meta_node="GwasExposure",
        id_col="trait.id",
        label_formatter=gwas_label_formatter(node_name="trait"),
    ),
    NetworkNodeSchema(
        meta_node="Gwas",
        id_col="assoc_trait.id",
        label_formatter=gwas_label_formatter(node_name="assoc_trait"),
    ),
    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",
Пример #3
0
         gene.name is not null
     RETURN
         gwas {.id, .trait},
         gwas_to_variant {.se, .pval, .samplesize, .beta},
         variant {.name},
         gene {.name},
         protein {.uniprot_id},
         pathway {.reactome_id, .name}
     ORDER BY gwas_to_variant.pval ;
 """,
 query_type=GalleryQueryType.cypher,
 schema=GallerySchema(
     nodes=[
         NetworkNodeSchema(
             meta_node="Gwas",
             id_col="gwas.id",
             label_formatter=gwas_label_formatter(),
         ),
         NetworkNodeSchema(
             meta_node="Variant",
             id_col="variant.name",
             label_col="variant.name",
         ),
         NetworkNodeSchema(
             meta_node="Gene",
             id_col="gene.name",
             label_col="gene.name",
             match_node_by="name",
         ),
         NetworkNodeSchema(
             meta_node="Protein",
Пример #4
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",
    ),
]
Пример #5
0
     RETURN
         disease_gwas {.id, .trait},
         risk_factor_gwas {.id, .trait},
         variant {.name},
         gene {.name},
         drug {.label},
         obs_cor {.cor},
         mr {.b, .se, .pval, .selection, .method, .moescore}
     ORDER BY mr.pval ;
 """,
 query_type=GalleryQueryType.cypher,
 schema=GallerySchema(
     nodes=[
         NetworkNodeSchema(
             meta_node="GwasPrimary",
             id_col="disease_gwas.id",
             label_formatter=gwas_label_formatter(node_name="disease_gwas"),
         ),
         NetworkNodeSchema(
             meta_node="Gwas",
             id_col="risk_factor_gwas.id",
             label_formatter=gwas_label_formatter(
                 node_name="risk_factor_gwas"
             ),
         ),
         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"),
     ],
Пример #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="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,
    ),
]
Пример #7
0
     RETURN
         gwas, assoc_gwas, assoc_gwas2,
         mr,
         obs_cor1, obs_cor2,
         prs1, prs2,
         gwas_nlp1, gwas_nlp2
     ORDER BY
         mr.pval
     LIMIT 100
 """,
 query_type=GalleryQueryType.cypher,
 schema=GallerySchema(
     nodes=[
         NetworkNodeSchema(
             meta_node="GwasPrimary",
             id_col="gwas.id",
             label_col="gwas.trait",
         ),
         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(
Пример #8
0
     OPTIONAL MATCH
         (g1:Gwas)--(eChild)
     OPTIONAL MATCH
         (g2:Gwas)--(e)
     RETURN
         e {.id, .type, .value},
         eChild {.id, .type, .value},
         g1 {.id, .trait},
         g2 {.id, .trait}
     LIMIT 5000;
 """,
 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"
         ),
Пример #9
0
from app.funcs.network_graph import NetworkEdgeSchema, NetworkNodeSchema
from app.utils.meta_graph import gwas_label_formatter, mr_eve_title_formatter

node_schemas = [
    NetworkNodeSchema(
        meta_node="GwasExposure",
        id_col="exposure.id",
        label_formatter=gwas_label_formatter(node_name="exposure"),
    ),
    NetworkNodeSchema(
        meta_node="GwasOutcome",
        id_col="outcome.id",
        label_formatter=gwas_label_formatter(node_name="outcome"),
    ),
    NetworkNodeSchema(
        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",
Пример #10
0
         AND exposure.id <> outcome.id AND cf.trait <> exposure.trait
         AND cf.trait <> outcome.trait AND exposure.trait <> outcome.trait
     RETURN
         exposure {.id, .trait},
         outcome {.id, .trait},
         cf {.id, .trait},
         r1 {.b, .se, .pval, .selection, .method, .moescore},
         r2 {.b, .se, .pval, .selection, .method, .moescore},
         r3 {.b, .se, .pval, .selection, .method, .moescore}
     ORDER BY r1.pval;
 """,
 query_type=GalleryQueryType.cypher,
 schema=GallerySchema(
     nodes=[
         NetworkNodeSchema(meta_node="Gwas",
                           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",
Пример #11
0
from app.funcs.network_graph import NetworkEdgeSchema, NetworkNodeSchema
from app.utils.meta_graph import gwas_label_formatter, mr_eve_title_formatter

# 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"
        ),
Пример #12
0
multi_snp_mr_title_formatter = lambda row: """
    <b>exposure_ensembl_id</b>: {exposure_ensembl_id},
    <b>outcome_id</b>: {outcome_id}</br>
    <b>b</b>: {b:.2E}, <b>se</b>: {se:.2E}, <b>p</b>: {p:.2E}
    """.format(
    exposure_ensembl_id=row["gene.ensembl_id"],
    outcome_id=row["gwas.id"],
    b=row["r.beta"],
    se=row["r.se"],
    p=row["r.p"],
)

node_schemas_single_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"]),
    ),
    NetworkNodeSchema(meta_node="Variant", id_col="r.rsid"),
]

node_schemas_multi_snp = [
    NetworkNodeSchema(meta_node="Gene",
                      id_col="gene.ensembl_id",
                      label_col="gene.name"),
    NetworkNodeSchema(