Exemplo n.º 1
0
 def _getArgCondFilter(self, rq_args, activate_it=True):
     if rq_args.get("filter"):
         filter_h = self.pickSolEntry("filter", rq_args["filter"])
         assert filter_h is not None
     else:
         if "conditions" in rq_args:
             cond_data = json.loads(rq_args["conditions"])
         else:
             cond_data = ConditionMaker.condAll()
         filter_h = FilterEval(self.getEvalSpace(), cond_data)
     filter_h = self.updateSolEntry("filter", filter_h)
     if activate_it:
         filter_h.activate()
     return filter_h
Exemplo n.º 2
0
 def _getArgCondFilter(self, rq_args,
         activate_it = True, join_cond_data = None):
     filter_h, cond_data = None, None
     if rq_args.get("filter"):
         filter_h = self.pickSolEntry("filter", rq_args["filter"])
         assert filter_h is not None, "No filter for: " + rq_args["filter"]
         if join_cond_data is not None:
             cond_data = filter_h.getCondDataSeq()
             filter_h = None
     if filter_h is None and cond_data is None:
         if "conditions" in rq_args:
             cond_data = json.loads(rq_args["conditions"])
         else:
             cond_data = ConditionMaker.condAll()
     if join_cond_data is not None:
         assert filter_h is None, "Filter&join collision"
         cond_data = cond_data[:] + join_cond_data[:]
     if filter_h is None:
         filter_h = FilterEval(self.getEvalSpace(), cond_data)
     filter_h = self.updateSolEntry("filter", filter_h)
     if activate_it:
         filter_h.activate()
     return filter_h
Exemplo n.º 3
0
 def toJSon(self):
     return ConditionMaker.joinOr([it.toJSon() for it in self.getItems()])
Exemplo n.º 4
0
 def toJSon(self):
     return ConditionMaker.condNot(self.mBaseCond.toJSon())
Exemplo n.º 5
0
 def toJSon(self):
     return ConditionMaker.condEnum(*self.mData)
Exemplo n.º 6
0
def condition_good_confidence():
    return [
        ConditionMaker.condEnum("FT", ["PASS"]),
        ConditionMaker.condNum("Max_GQ", min_val=50),
        ConditionMaker.condNum("FS", max_val=30)
    ]
Exemplo n.º 7
0
def condition_high_confidence():
    return condition_good_confidence() + [
        ConditionMaker.condNum("QUAL", min_val=40)
    ]
Exemplo n.º 8
0
def condition_high_confidence_QD():
    return condition_good_confidence() + [
        ConditionMaker.condNum("QD", min_val=4)
    ]
Exemplo n.º 9
0
def condition_consequence_xBrowse():
    return ConditionMaker.condEnum("Transcript_consequence",
                                   MODERATE_IMPACT_CSQ)
Exemplo n.º 10
0
def setupSolutions_Case(app_config, base_pack):
    # BGM Filters, should belong to "Undiagnosed Patients Solution Pack"
    base_pack.regFilter("BGM_De_Novo", [
        condition_consequence_xBrowse(),
        ConditionMaker.condEnum("Callers", ["BGM_BAYES_DE_NOVO", "RUFUS"])
    ],
                        requires={"trio_base", "WS"})

    base_pack.regFilter("BGM_Homozygous_Rec", [
        condition_consequence_xBrowse(),
        ConditionMaker.condEnum("Transcript_biotype", ["protein_coding"]),
        ConditionMaker.condEnum("Callers", ["BGM_HOM_REC"]),
        ConditionMaker.condEnum("Transcript_source", ["Ensembl"]),
        ConditionMaker.condFunc("Inheritance_Mode", dict(),
                                ["Homozygous Recessive"])
    ],
                        requires={"trio_base", "WS"})

    base_pack.regFilter("BGM_Compound_Het", [
        condition_consequence_xBrowse(),
        ConditionMaker.condEnum("Transcript_biotype", ["protein_coding"]),
        ConditionMaker.condEnum("Callers", ["BGM_CMPD_HET"]),
        ConditionMaker.condEnum("Transcript_source", ["Ensembl"]),
        ConditionMaker.condFunc("Compound_Het", {"approx": "transcript"},
                                ["Proband"])
    ],
                        requires={"trio_base", "WS"})

    base_pack.regFilter("BGM_Autosomal_Dominant", [
        condition_consequence_xBrowse(),
        ConditionMaker.condEnum("Transcript_biotype", ["protein_coding"]),
        ConditionMaker.condEnum("Callers", ["BGM_DE_NOVO"]),
        ConditionMaker.condEnum("Transcript_source", ["Ensembl"])
    ],
                        requires={"trio_base", "WS"})

    # Standard mendelian Filters, should belong to
    # "Undiagnosed Patients Solution Pack"
    base_pack.regFilter(
        "X_Linked",
        condition_high_quality() + [
            condition_consequence_xBrowse(),
            ConditionMaker.condEnum("Transcript_biotype", ["protein_coding"]),
            ConditionMaker.condEnum("Transcript_source", ["Ensembl"]),
            ConditionMaker.condFunc("Inheritance_Mode", dict(), ["X-linked"])
        ],
        requires={"trio_base", "WS"})

    base_pack.regFilter(
        "Mendelian_Homozygous_Rec",
        condition_high_quality() + condition_all_genotypes_called() +
        clinVar_not_benign() + [
            condition_consequence_xBrowse(),
            ConditionMaker.condEnum("Transcript_biotype", ["protein_coding"]),
            ConditionMaker.condEnum("Transcript_source", ["Ensembl"]),
            ConditionMaker.condFunc("Inheritance_Mode", dict(),
                                    ["Homozygous Recessive"]),
            ConditionMaker.condEnum("Proband_Zygosity", ["Homozygous"])
        ],
        requires={"trio_base", "WS"})

    base_pack.regFilter(
        "Mendelian_Compound_Het",
        condition_high_quality() + clinVar_not_benign() + [
            condition_consequence_xBrowse(),
            ConditionMaker.condEnum("Transcript_biotype", ["protein_coding"]),
            ConditionMaker.condEnum("Transcript_source", ["Ensembl"]),
            ConditionMaker.condFunc("Compound_Het", {"approx": "transcript"},
                                    ["Proband"])
        ],
        requires={"trio_base", "WS"})

    base_pack.regFilter(
        "Mendelian_Auto_Dom",
        condition_high_quality() + clinVar_not_benign() + [
            condition_consequence_xBrowse(),
            ConditionMaker.condEnum("Transcript_biotype", ["protein_coding"]),
            ConditionMaker.condEnum("Transcript_source", ["Ensembl"]),
            ConditionMaker.condFunc("Inheritance_Mode", dict(),
                                    ["Autosomal Dominant"]),
            ConditionMaker.condEnum("Proband_Zygosity", ["Heterozygous"])
        ],
        requires={"trio_base", "WS"})

    base_pack.regFilter(
        "InSilico_Possibly_Damaging",
        condition_high_confidence() + [
            ConditionMaker.condEnum("Rules",
                                    [stdNm("Possibly_Damaging_Predictions")])
        ],
        requires={"WS"})

    base_pack.regFilter(
        "InSilico_Damaging",
        condition_high_confidence() +
        [ConditionMaker.condEnum("Rules", [stdNm("Damaging_Predictions")])],
        requires={"WS"})

    # SEQaBOO Filters, should belong to "Hearing Loss Solution Pack"
    # base_pack.regFilter("SEQaBOO_Hearing_Loss_v_01", [
    #     ConditionMaker.condEnum("Rules",
    #        [stdNm("SEQaBOO_Hearing_Loss_v_01")]),
    #     ConditionMaker.condEnum("Rules", [stdNm("ACMG59")], "NOT")],
    #     requires = {"WS"})
    # base_pack.regFilter("SEQaBOO_Hearing_Loss_v_02", [
    #     ConditionMaker.condEnum("Rules",
    #        [stdNm("SEQaBOO_Hearing_Loss_v_02")]),
    #     ConditionMaker.condEnum("Rules", [stdNm("ACMG59")], "NOT")],
    #     requires = {"WS"})
    # base_pack.regFilter("SEQaBOO_Hearing_Loss_v_03", [
    #     ConditionMaker.condEnum("Rules",
    #        [stdNm("SEQaBOO_Hearing_Loss_v_03")]),
    #     ConditionMaker.condEnum("Rules", [stdNm("ACMG59")], "NOT")],
    #     requires = {"WS"})
    # base_pack.regFilter("SEQaBOO_Hearing_Loss_v_03_5", [
    #     ConditionMaker.condEnum("Rules",
    #        [stdNm("SEQaBOO_Hearing_Loss_v_03")]),
    #     ConditionMaker.condEnum("Panels", ["All_Hearing_Loss"])],
    #     requires = {"WS"})
    # base_pack.regFilter("SEQaBOO_Hearing_Loss_v_4", [
    #     ConditionMaker.condEnum("Rules", [stdNm("Hearing Loss, v.4")])],
    #     requires = {"WS"})
    base_pack.regFilter(
        "SEQaBOO_Hearing_Loss_v_5",
        [ConditionMaker.condEnum("Rules", [stdNm("Hearing Loss, v.5")])],
        requires={"WS"})
    base_pack.regFilter(
        "SEQaBOO_Hearing_Quick",
        [ConditionMaker.condEnum("Rules", [stdNm("Hearing Loss Quick")])],
        requires={"WS"})

    # SEQaBOO Filters, should belong to "Base Solution Pack"
    base_pack.regFilter("SEQaBOO_ACMG59",
                        [ConditionMaker.condEnum("Rules", [stdNm("ACMG59")])],
                        requires={"WS"})
    # base_pack.regFilter("SEQaBOO_ACMG59", [
    #     ConditionMaker.condEnum("Rules", [stdNm("SEQaBOO_ACMG59")]),
    #     ConditionMaker.condEnum("Rules", [stdNm("ACMG59")], "AND")],
    #     requires = {"WS"})

    base_pack.regFilter(
        "Loss_Of_Function",
        condition_high_quality() +
        [ConditionMaker.condEnum("Most_Severe_Consequence", LoF_CSQ)])

    base_pack.regFilter(
        "Non_Synonymous",
        condition_high_quality() + [
            ConditionMaker.condEnum("Most_Severe_Consequence",
                                    NON_SYNONYMOUS_CSQ)
        ])

    base_pack.regFilter(
        "UTR_and_Worse",
        condition_high_quality() + [
            ConditionMaker.condEnum(
                "Most_Severe_Consequence", LOW_IMPACT_CSQ, join_mode="NOT")
        ])

    base_pack.regFilter("Impact_Splicing",
                        condition_high_confidence() + impacting_splicing())

    base_pack.regFilter(
        "ClinVar_VUS_or_Worse",
        condition_high_confidence() + [
            ConditionMaker.condEnum("Clinvar_stars", ["1", "2", "3", "4"]),
            ConditionMaker.condEnum("Clinvar_conflicts", ["True"],
                                    join_mode="NOT"),
            ConditionMaker.condEnum("Clinvar_Benign", ["VUS or Pathogenic"])
        ],
        requires={"XL"})

    base_pack.regFilter("In_Silico_Damaging",
                        condition_high_confidence() + [
                            ConditionMaker.condEnum("Polyphen_2_HVAR", ["D"]),
                            ConditionMaker.condEnum("SIFT", ["deleterious"])
                        ],
                        requires={"XL"})

    # base_pack.regFilter("Impact_Splicing",
    #     condition_high_quality() + impacting_splicing())

    # Production Decision Trees
    base_pack.regDTree("BGM Research",
                       cfgPathSeq(["bgm_xbrowse.pyt"]),
                       requires={"trio_base"})
    base_pack.regDTree("BGM Red Button",
                       cfgPathSeq(["bgm_strict.pyt"]),
                       requires={"trio_base"})
    base_pack.regDTree("Trio Candidates",
                       cfgPathSeq(["quality.pyt", "rare.pyt", "trio.pyt"]),
                       requires={"trio_base"})
    base_pack.regDTree(
        "All Rare Variants",
        cfgPathSeq(["quality.pyt", "rare.pyt", "return_true.pyt"]))
    # base_pack.regDTree("Hearing Loss, v.4",
    #    cfgPathSeq(["quality.pyt", "hearing_loss.pyt"]))
    base_pack.regDTree("Hearing Loss, v.5",
                       cfgPathSeq(["quality.pyt", "hearing_loss_v5.pyt"]))
    base_pack.regDTree("Hearing Loss Quick",
                       cfgPathSeq(["quality.pyt", "hearing_loss_ws.pyt"]),
                       requires={"WS"})
    base_pack.regDTree("ACMG59 Variants",
                       cfgPathSeq(["quality.pyt", "acmg59.pyt"]))
    base_pack.regDTree("Damaging_Predictions", cfgPathSeq(["damaging.pyt"]))
    base_pack.regDTree("Possibly_Damaging_Predictions",
                       cfgPathSeq(["possibly_damaging.pyt"]))

    # Test trees
    # base_pack.regDTree("Q Test",
    #     cfgPathSeq(["quality.pyt", "return_true.pyt"]))
    # base_pack.regDTree("R Test",
    #     cfgPathSeq(["rare.pyt", "return_true.pyt"]))
    # base_pack.regDTree("T Test",
    #     [cfgPath("trio.pyt")],
    #     requires = {"trio_base"})
    # base_pack.regDTree("H Test",
    #     [cfgPath("hearing_loss.pyt")])

    base_pack.regZone("Gene", "Symbol")
    base_pack.regZone("Gene List", "Panels")
    base_pack.regZone("Sample", "Has_Variant")
    base_pack.regZone("Cohort", "Variant_in", requires={"cohorts"})
    base_pack.regZone("Tag", "_tags")

    demo_tab_schema = ReportTabSchema("demo", use_tags=True)
    demo_tab_schema.addField("gene(s)", "/_view/general/genes[]")
    demo_tab_schema.addField("variant", "/__data/label")
    demo_tab_schema.addField("gnomAD_AF", "/_filters/gnomad_af_fam")
    base_pack.regTabSchema(demo_tab_schema)
Exemplo n.º 11
0
def clinVar_not_benign():
    return [
        ConditionMaker.condEnum("Clinvar_Trusted_Simplified", ["benign"],
                                "NOT")
    ]
Exemplo n.º 12
0
def impacting_splicing():
    return [ConditionMaker.condNum("splice_ai_dsmax", min_val=0.2)]
Exemplo n.º 13
0
def condition_all_genotypes_called():
    return [ConditionMaker.condNum("Num_NO_CALL", max_val=0)]
Exemplo n.º 14
0
def condition_high_quality_all_samples():
    return [ConditionMaker.condNum("Min_GQ", min_val=40)]