示例#1
0
 def get_variant_names(self, gene, mutation, protein_coding_var=True):
     ref, start, alt = split_var_name(mutation)
     gene = self.get_gene(gene)
     if start < 0 or not protein_coding_var:
         return self._process_DNA_mutation(gene, ref, start, alt)
     elif start > 0:
         return self._process_coding_mutation(gene, ref, start, alt)
     else:
         raise ValueError(
             "Variants are defined in 1-based coordinates. You can't have pos 0. "
         )
示例#2
0
 def test_make_variant_panel5(self):
     ag = AlleleGenerator("mykatlas/data/NC_000962.3.fasta")
     gene = self.gm.get_gene("gyrA")
     for var in self.gm.get_variant_names("gyrA", "D94X"):
         ref, start, alt = split_var_name(var)
         v = Variant.create(variant_sets=self.variant_sets,
                            reference=self.reference_id,
                            reference_bases=ref,
                            start=start,
                            alternate_bases=[alt])
         panel = ag.create(v)
         for alt in panel.alts:
             seq = copy.copy(str(gene.seq))
             seq = seq.replace(panel.ref, alt)
             assert Seq(seq).translate()[93] != "D"
示例#3
0
 def test_make_variant_panel4(self):
     ag = AlleleGenerator("mykatlas/data/NC_000962.3.fasta")
     gene = self.gm.get_gene("katG")
     for var in self.gm.get_variant_names("katG", "W90R"):
         ref, start, alt = split_var_name(var)
         v = Variant.create(variant_sets=self.variant_sets,
                            reference=self.reference_id,
                            reference_bases=ref,
                            start=start,
                            alternate_bases=[alt])
         panel = ag.create(v)
         for alt in panel.alts:
             seq = copy.copy(str(gene.seq.reverse_complement()))
             seq = seq.replace(panel.ref, alt)
             assert seq != str(gene.seq)
             assert Seq(seq).reverse_complement().translate()[89] == "R"
示例#4
0
文件: genotyper.py 项目: ffranr/atlas
 def _create_variant(self, probe_name):
     names = []
     params = get_params(probe_name)
     if params.get("mut"):
         names.append("_".join([params.get("gene"), params.get("mut")]))
     var_name = probe_name.split('?')[0].split('-')[1]
     names.append(var_name)
     try:
         # If it's a variant panel we can create a variant
         ref, start, alt = split_var_name(var_name)
         return Variant.create(start=start,
                               reference_bases=ref,
                               alternate_bases=[alt],
                               names=names,
                               info=params)
     except AttributeError:
         return None