Example #1
0
 def del_vcf_constructor(self, hgvs):
     if self._chr_data is None:
         self.load_chr_data()
     chrom = hgvs[0]
     pos = int(hgvs[1]) - 1
     # len=2 was a single del, len=3 was internval del
     if len(hgvs) == 2:
         end = int(hgvs[1])
     else:
         end = int(hgvs[2])
     chr_bit = self._chr_data[str(chrom)]
     ref = ''
     for i in range(pos, end+1):
         try:
             nuc_chr_bit = chr_bit[i*4-4:i*4]
             nuc_chr = bit_to_nuc(nuc_chr_bit)
             ref += nuc_chr
         except Exception as e:
             self.logger.warning("Couldn't extract nucleotide from bits with HGVS %s: %s" % (repr(hgvs),e))
             return None
     alt = ref[0]
     if chrom == 'MT':
         chrom = 'M'
     vcf = {"chrom": str(chrom), "position": str(pos), "ref": ref, "alt": alt}
     return vcf
 def ins_vcf_constructor(self, hgvs):
     if self._chr_data is None:
         self.load_chr_data()
     chrom = hgvs[0]
     pos = int(hgvs[1])
     chr_bit = self._chr_data[str(chrom)]
     nuc_chr_bit = chr_bit[pos * 4 - 4:pos * 4]
     try:
         ref = bit_to_nuc(nuc_chr_bit)
     except Exception as e:
         self.logger.warning(
             "Couldn't extract nucleotide from bits with HGVS %s: %s" %
             (repr(hgvs), e))
         return None
     alt = hgvs[3]
     alt = ref + alt
     if chrom == 'MT':
         chrom = 'M'
     vcf = {
         "chrom": str(chrom),
         "position": str(pos),
         "ref": ref,
         "alt": alt
     }
     return vcf
Example #3
0
 def del_vcf_constructor(self, hgvs):
     if self._chr_data is None:
         self.load_chr_data()
     chrom = hgvs[0]
     pos = int(hgvs[1]) - 1
     # len=2 was a single del, len=3 was internval del
     if len(hgvs) == 2:
         end = int(hgvs[1])
     else:
         end = int(hgvs[2])
     chr_bit = self._chr_data[str(chrom)]
     ref = ''
     for i in range(pos, end+1):
         try:
             nuc_chr_bit = chr_bit[i*4-4:i*4]
             nuc_chr = bit_to_nuc(nuc_chr_bit)
             ref += nuc_chr
         except Exception as e:
             self.logger.warning("Couldn't extract nucleotide from bits with HGVS %s: %s" % (repr(hgvs),e))
             return None
     alt = ref[0]
     if chrom == 'MT':
         chrom = 'M'
     vcf = {"chrom": str(chrom), "position": str(pos), "ref": ref, "alt": alt}
     return vcf
 def ins_vcf_constructor(self, hgvs):
     if self._chr_data is None:
         print()
         self.load_chr_data()
     chrom = hgvs[0]
     pos = int(hgvs[1])
     chr_bit = self._chr_data[str(chrom)]
     nuc_chr_bit = chr_bit[pos*3-3:pos*3]
     ref = bit_to_nuc(nuc_chr_bit)
     alt = hgvs[3]
     alt = ref + alt
     vcf = str(chrom) + '\t' + str(pos) + '\t' + '.' + '\t' + ref + '\t' + alt + '\t.\t.\t.\n'
     return vcf
Example #5
0
 def ins_vcf_constructor(self, hgvs):
     if self._chr_data is None:
         print()
         self.load_chr_data()
     chrom = hgvs[0]
     pos = int(hgvs[1])
     chr_bit = self._chr_data[str(chrom)]
     nuc_chr_bit = chr_bit[pos*3-3:pos*3]
     ref = bit_to_nuc(nuc_chr_bit)
     alt = hgvs[3]
     alt = ref + alt
     vcf = str(chrom) + '\t' + str(pos) + '\t' + '.' + '\t' + ref + '\t' + alt + '\t.\t.\t.\n'
     return vcf
 def delins_vcf_constructor(self, hgvs):
     if self._chr_data is None:
         print()
         self.load_chr_data()
     chrom = hgvs[0]
     pos = int(hgvs[1])
     end = int(hgvs[2])
     chr_bit = self._chr_data[str(chrom)]
     ref = ''
     for i in range(pos, end+1):
         nuc_chr_bit = chr_bit[i*3-3:i*3]
         nuc_chr = bit_to_nuc(nuc_chr_bit)
         ref += nuc_chr
     alt = hgvs[3]
     vcf = str(chrom) + '\t' + str(pos) + '\t' + '.' + '\t' + ref + '\t' + alt + '\t.\t.\t.\n'
     return vcf
Example #7
0
 def delins_vcf_constructor(self, hgvs):
     if self._chr_data is None:
         print()
         self.load_chr_data()
     chrom = hgvs[0]
     pos = int(hgvs[1])
     end = int(hgvs[2])
     chr_bit = self._chr_data[str(chrom)]
     ref = ''
     for i in range(pos, end+1):
         nuc_chr_bit = chr_bit[i*3-3:i*3]
         nuc_chr = bit_to_nuc(nuc_chr_bit)
         ref += nuc_chr
     alt = hgvs[3]
     vcf = str(chrom) + '\t' + str(pos) + '\t' + '.' + '\t' + ref + '\t' + alt + '\t.\t.\t.\n'
     return vcf
Example #8
0
 def ins_vcf_constructor(self, hgvs):
     if self._chr_data is None:
         self.load_chr_data()
     chrom = hgvs[0]
     pos = int(hgvs[1])
     chr_bit = self._chr_data[str(chrom)]
     nuc_chr_bit = chr_bit[pos*4-4:pos*4]
     try:
         ref = bit_to_nuc(nuc_chr_bit)
     except Exception as e:
         self.logger.warning("Couldn't extract nucleotide from bits with HGVS %s: %s" % (repr(hgvs),e))
         return None
     alt = hgvs[3]
     alt = ref + alt
     if chrom == 'MT':
         chrom = 'M'
     vcf = {"chrom": str(chrom), "position": str(pos), "ref": ref, "alt": alt}
     return vcf