def __init__(self,
                 seq,
                 cds_start,
                 cds_stop,
                 is_frameshift,
                 variant_start_aa,
                 accession,
                 is_substitution=False,
                 is_ambiguous=False):
        """Create a variant sequence using inputs from VariantInserter
        :param seq: DNA sequence wiith variant incorporated
        :type seq: str or list
        :param cds_start: coding sequence start (1-based)
        :type cds_start: int
        :param cds_stop: coding sequence stop (1-based)
        :type cds_stop: int
        :param protein_accession: protein accession, e.g. NP_999999.2
        :type protein_accession: str
        :param is_frameshift: is this variant a frameshift
        :type is_frameshift: bool
        :param variant_start_aa: AA start index (1-based) for this variant
        :type variant_start_aa: int
        :param is_substitution: flag if this is a substitution AA variant
        :type is_substitution: bool
        :param is_ambiguous: flag if variant is "?"
        :type is_ambiguous: bool
        :return variant sequence data
        :rtype attrs
        """

        if len(seq) > 0:
            if isinstance(seq, six.string_types):
                seq = list(seq)
            seq_cds = seq[cds_start - 1:]
            if len(seq_cds) % 3 != 0:    # padding so biopython won't complain during the conversion
                seq_cds.extend(['N'] * ((3 - len(seq_cds) % 3) % 3))
            seq_cds = ''.join(seq_cds)
            seq_aa = str(Seq(seq_cds).translate())
            stop_pos = seq_aa[:(cds_stop - cds_start + 1) // 3].rfind("*")
            if stop_pos == -1:
                stop_pos = seq_aa.find("*")
            if stop_pos != -1:
                seq_aa = seq_aa[:stop_pos + 1]
        else:
            seq_aa = []

        self.transcript_sequence = ''.join(seq)
        self.aa_sequence = seq_aa
        self.cds_start = cds_start
        self.cds_stop = cds_stop
        self.protein_accession = accession
        self.is_frameshift = is_frameshift
        self.variant_start_aa = variant_start_aa
        self.frameshift_start = None
        self.is_substitution = is_substitution
        self.is_ambiguous = is_ambiguous
def __init__ ( self , seq , cds_start , cds_stop , is_frameshift , variant_start_aa , accession , is_substitution = False , is_ambiguous = False ) : if len ( seq ) > 0 : if isinstance ( seq , six . string_types ) : seq = list ( seq ) seq_cds = seq [ cds_start - 1 : ] if len ( seq_cds ) % 3 != 0 : seq_cds . extend ( [ 'N' ] * ( ( 3 - len ( seq_cds ) % 3 ) % 3 ) ) seq_cds = '' . join ( seq_cds ) seq_aa = str ( Seq ( seq_cds ) . translate ( ) ) stop_pos = seq_aa [ : ( cds_stop - cds_start + 1 ) // 3 ] . rfind ( "*" ) if stop_pos == - 1 : stop_pos = seq_aa . find ( "*" ) if stop_pos != - 1 : seq_aa = seq_aa [ : stop_pos + 1 ] else : seq_aa = [ ] self . transcript_sequence = '' . join ( seq ) self . aa_sequence = seq_aa self . cds_start = cds_start self . cds_stop = cds_stop self . protein_accession = accession self . is_frameshift = is_frameshift self . variant_start_aa = variant_start_aa self . frameshift_start = None self . is_substitution = is_substitution self . is_ambiguous = is_ambiguous
Create a variant sequence using inputs from VariantInserter
        :param seq: DNA sequence wiith variant incorporated
        :type seq: str or list
        :param cds_start: coding sequence start (1-based)
        :type cds_start: int
        :param cds_stop: coding sequence stop (1-based)
        :type cds_stop: int
        :param protein_accession: protein accession, e.g. NP_999999.2
        :type protein_accession: str
        :param is_frameshift: is this variant a frameshift
        :type is_frameshift: bool
        :param variant_start_aa: AA start index (1-based) for this variant
        :type variant_start_aa: int
        :param is_substitution: flag if this is a substitution AA variant
        :type is_substitution: bool
        :param is_ambiguous: flag if variant is "?"
        :type is_ambiguous: bool
        :return variant sequence data
        :rtype attrs