def build_hgvsp(self):
variants = []<EOL>if not self._is_ambiguous and len(self._alt_seq) > <NUM_LIT:0>:<EOL><INDENT>do_delins = True<EOL>if self._ref_seq == self._alt_seq:<EOL><INDENT>start = self._alt_data.variant_start_aa<EOL>if start - <NUM_LIT:1> < len(self._ref_seq):<EOL><INDENT>deletion = self._ref_seq[start - <NUM_LIT:1>]<EOL>insertion = deletion<EOL><DEDENT>else:<EOL><INDENT>start = "<STR_LIT>"<EOL>deletion = "<STR_LIT>"<EOL>insertion = "<STR_LIT>"<EOL>self._is_frameshift = False<EOL><DEDENT>variants.append({"<STR_LIT:start>": start, "<STR_LIT>": insertion, "<STR_LIT>": deletion})<EOL>do_delins = False<EOL><DEDENT>elif self._is_substitution:<EOL><INDENT>if len(self._ref_seq) == len(self._alt_seq):<EOL><INDENT>diff_pos = [(i, self._ref_seq[i], self._alt_seq[i])<EOL>for i in range(len(self._ref_seq))<EOL>if self._ref_seq[i] != self._alt_seq[i]]<EOL>if len(diff_pos) == <NUM_LIT:1>:<EOL><INDENT>(start, deletion, insertion) = diff_pos[<NUM_LIT:0>]<EOL>variants.append({"<STR_LIT:start>": start + <NUM_LIT:1>, "<STR_LIT>": insertion, "<STR_LIT>": deletion})<EOL>do_delins = False<EOL><DEDENT><DEDENT><DEDENT>if do_delins:<EOL><INDENT>if self._alt_data.is_frameshift:<EOL><INDENT>start = self._alt_data.variant_start_aa - <NUM_LIT:1><EOL>while self._ref_seq[start] == self._alt_seq[start]:<EOL><INDENT>start += <NUM_LIT:1><EOL><DEDENT>insertion = list(self._alt_seq[start:])<EOL>deletion = list(self._ref_seq[start:])<EOL>variants.append({"<STR_LIT:start>": start + <NUM_LIT:1>, "<STR_LIT>": insertion, "<STR_LIT>": deletion})<EOL><DEDENT>else:    <EOL><INDENT>start = self._alt_data.variant_start_aa - <NUM_LIT:1><EOL>delta = len(self._alt_seq) - len(self._ref_seq)<EOL>while self._ref_seq[start] == self._alt_seq[start]:<EOL><INDENT>start += <NUM_LIT:1><EOL><DEDENT>offset = start + abs(delta)<EOL>if delta > <NUM_LIT:0>:    <EOL><INDENT>insertion = list(self._alt_seq[start:offset])<EOL>deletion = []<EOL>ref_sub = self._ref_seq[start:]<EOL>alt_sub = self._alt_seq[offset:]<EOL><DEDENT>elif delta < <NUM_LIT:0>:    <EOL><INDENT>insertion = []<EOL>deletion = list(self._ref_seq[start:offset])<EOL>ref_sub = self._ref_seq[offset:]<EOL>alt_sub = self._alt_seq[start:]<EOL><DEDENT>else:<EOL><INDENT>insertion = []<EOL>deletion = []<EOL>ref_sub = self._ref_seq[start:]<EOL>alt_sub = self._alt_seq[start:]<EOL><DEDENT>diff_indices = [i for i in range(len(ref_sub)) if ref_sub[i] != alt_sub[i]]<EOL>if not diff_indices and not deletion and insertion[<NUM_LIT:0>] == '<STR_LIT:*>':<EOL><INDENT>diff_indices.append(<NUM_LIT:0>)<EOL><DEDENT>if diff_indices:<EOL><INDENT>max_diff = diff_indices[-<NUM_LIT:1>] + <NUM_LIT:1><EOL>insertion.extend(list(alt_sub[:max_diff]))<EOL>deletion.extend(list(ref_sub[:max_diff]))<EOL><DEDENT>variants.append({"<STR_LIT:start>": start + <NUM_LIT:1>, "<STR_LIT>": insertion, "<STR_LIT>": deletion})<EOL><DEDENT><DEDENT>if DBG:<EOL><INDENT>print(variants)<EOL><DEDENT><DEDENT>if self._is_ambiguous:<EOL><INDENT>var_ps = [<EOL>self._create_variant(<EOL>None,<EOL>None,<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>acc=self._protein_accession,<EOL>is_ambiguous=self._is_ambiguous)<EOL>]<EOL><DEDENT>elif len(self._alt_seq) == <NUM_LIT:0>:<EOL><INDENT>var_ps = [<EOL>self._create_variant(<EOL>None,<EOL>None,<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>acc=self._protein_accession,<EOL>is_ambiguous=self._is_ambiguous,<EOL>is_no_protein=True)<EOL>]<EOL><DEDENT>else:<EOL><INDENT>var_ps = [<EOL>self._convert_to_sequence_variants(x, self._protein_accession) for x in variants<EOL>]<EOL><DEDENT>if len(var_ps) > <NUM_LIT:1>:<EOL><INDENT>raise HGVSError("<STR_LIT>")<EOL><DEDENT>return var_ps[<NUM_LIT:0>]<EOL>
Compare two amino acid sequences; generate an hgvs tag from the output

        :return list of variants in sequence order
        :rtype list of dict