def __str__(self): """ Give the HGVS description of the raw variant stored in this class. :returns unicode: The HGVS description of the raw variant stored in this class. """ if self.type == 'unknown': return '?' if self.type == 'none': return '=' if self.count > 0: return '{0}({1})'.format(self.inserted, self.count) description = str(self.start) if self.start != self.end: description += '_{0}'.format(self.end) if self.type != 'subst': description += str(self.type) if self.type in ('ins', 'delins'): return description + str(self.inserted) elif self.type == 'struct': return str(self.inserted) return description return description + '{0}>{1}'.format(self.deleted, self.inserted)
def __str__(self): """ Give the HGVS description of the raw variant stored in this class. :returns unicode: The HGVS description of the raw variant stored in this class. """ if self.type == 'unknown': return '?' if self.type == 'none': return '=' description = str(self.start) if self.start != self.end: description += '_{0}'.format(self.end) if self.type != 'subst': description += str(self.type) if self.type in ('ins', 'delins'): return description + str(self.inserted) return description return description + '{0}>{1}'.format(self.deleted, self.inserted)
def __str__(self): """ Give the HGVS description of the raw variant stored in this class. :returns unicode: The HGVS description of the raw variant stored in this class. """ # TODO: ext* if self.type == 'unknown': return '?' if self.type == 'none': return '=' description = '{}{}'.format(seq3(self.start_aa), self.start) if self.term: return description + '{}fs*{}'.format( seq3(self.inserted[0].sequence[0]), self.term) if self.start != self.end: description += '_{}{}'.format(seq3(self.end_aa), self.end) if self.type != 'subst': description += self.type if self.type in ('ins', 'delins'): return description + seq3(str(self.inserted)) # FIXME: str return description return description + seq3(self.inserted)
def test1(self): """ Test 1. """ result = describe_dna('ATGATGATCAGATACAGTGTGATACAGGTAGTTAGACAA', 'ATGATTTGATCAGATACATGTGATACCGGTAGTTAGGACAA') assert str(result) == '[5_6insTT;17del;26A>C;35dup]'
def test4(self): """ Test 4. """ result = describe_dna( 'TAAGCACCAGGAGTCCATGAAGAAGATGGCTCCTGCCATGGAATCCCCTACTCTA', 'TAAGCACCAGGAGTCCATGAAGAAGCCATGTCCTGCCATGAATCCCCTACTCTA') assert str(result) == '[26_29inv;30C>G;41del]'
def test2(self): """ Test 2. """ result = describe_dna( 'TAAGCACCAGGAGTCCATGAAGAAGATGGCTCCTGCCATGGAATCCCCTACTCTACTGTG', 'TAAGCACCAGGAGTCCATGAAGAAGCTGGATCCTCCCATGGAATCCCCTACTCTACTGTG') assert str(result) == '[26A>C;30C>A;35G>C]'
def test1(self): """ Test 1. """ result = describe_dna( 'ATGATGATCAGATACAGTGTGATACAGGTAGTTAGACAA', 'ATGATTTGATCAGATACATGTGATACCGGTAGTTAGGACAA') assert str(result) == '[5_6insTT;17del;26A>C;35dup]'
def nhgvs(self): """ """ if self.type == 'unknown': return '?' if self.type == 'none': return '=' description = str(self.start) if self.start != self.end: description += '_{}'.format(self.end) if self.type != 'subst': description += self.type if self.type in ('ins', 'delins'): return description + str(self.inserted) return description return description + '{}>{}'.format(self.deleted, self.inserted)
def _single_variant(self, sample, expected): """ General single variant test. """ description = describe.describe_protein(self.reference, sample) assert description[0].type == expected[0] assert description[0].start == expected[1] assert description[0].end == expected[2] assert description[0].sample_start == expected[3] assert description[0].sample_end == expected[4] assert description[0].deleted[0].sequence == expected[5] assert description[0].inserted[0].sequence == expected[6] assert str(description[0]) == expected[7]
def _single_variant(self, sample, expected): """ General single variant test. """ reference = 'ACGTCGATTCGCTAGCTTCGGGGGATAGATAGAGATATAGAGAT' result = describe_dna(reference, sample) assert result[0].type == expected[0] assert result[0].start == expected[1] assert result[0].end == expected[2] assert result[0].sample_start == expected[3] assert result[0].sample_end == expected[4] assert result[0].deleted[0].sequence == expected[5] assert result[0].inserted[0].sequence == expected[6] assert str(result[0]) == expected[7]
def __str__(self): if len(self.items) > 1: return '[{0}]'.format(';'.join(map(str, self.items))) return str(self.items[0])