def test_highest(): effects = sorted(EFFECTS) top = Effect.top_severity(effects) assert isinstance(top, Effect) assert top.impact_severity == "MED" effects.append(effects[-1]) top = Effect.top_severity(effects) assert isinstance(top, list) assert top[0].impact_severity == "MED"
def test_highest(): effects = sorted(EFFECTS) top = Effect.top_severity(effects) assert top.impact_severity == "MED" assert top.so == "missense_variant" #assert top[0]. effects.append(effects[-1]) top = Effect.top_severity(effects) assert isinstance(top, list) assert top[0].impact_severity == "MED"
def getTopImpact(effects): top_severe = Effect.top_severity(effects) if type(top_severe) is list: top_impact = top_severe[0].top_consequence else: top_impact = top_severe.top_consequence return top_impact
def get_gene(variant): for anno in annos: consequences = variant.INFO[anno].split(",") effs = (Effect.new(anno, c, annos[anno]) for c in consequences) # limit to requested severity if severity is not None: effs = [e for e in effs if e.impact_severity in severity] effs = sorted(effs, reverse=True) for eff in effs: if eff.gene: return eff.gene
VEP.keys = vcf_reader.infos['CSQ'].desc.split(" ")[-1].split("|") novel = False overlap_effects = defaultdict(int) no_overlap_effects = defaultdict(int) for record in vcf_reader: maf = float(2 * record.num_hom_alt + record.num_het) / (2 * record.num_called) effects = [] for annot in record.INFO['CSQ']: vep = VEP(annot) effects.append(vep) effects = sorted(effects) # last record - the most severe top_severe = Effect.top_severity(effects) if type(top_severe) is list: top_impact = top_severe[0].impact_severity else: top_impact = top_severe.impact_severity is_lof = isLoF(effects) overlap_eur, overlap_afr, overlap_amr, overlap_eas, overlap_sas = overlapsExisting( effects) overlap_1kg = overlap_eur or overlap_afr or overlap_amr or overlap_eas or overlap_sas if not overlap_1kg: no_overlap_effects[top_impact] += 1 if is_lof: no_overlap_effects['LoF'] += 1 else: overlap_effects[top_impact] += 1 if is_lof: overlap_effects['LoF'] += 1