diff --git a/src/mapper/altseq.rs b/src/mapper/altseq.rs index e2f8670..b8f5135 100644 --- a/src/mapper/altseq.rs +++ b/src/mapper/altseq.rs @@ -777,6 +777,17 @@ impl AltSeqToHgvsp { is_frameshift, } = &record; + // Handle the case of the variant being after the end of the protein sequence. This can + // happen when the variant is 5'-to-3' shifted beyond the stop codon. In this case, we + // can simply return `ProtLocEdit::NoChange` which will display as `p.=`. + if *start as usize > self.ref_seq().len() { + return Ok(HgvsVariant::ProtVariant { + accession: Accession::new(protein_accession), + gene_symbol: None, + loc_edit: ProtLocEdit::NoChange, + }); + } + // defaults let mut is_dup = false; // assume no dup let mut fsext_len = UncertainLengthChange::default(); // fs or ext length diff --git a/src/normalizer.rs b/src/normalizer.rs index 5a23a07..4825dcb 100644 --- a/src/normalizer.rs +++ b/src/normalizer.rs @@ -413,7 +413,7 @@ impl<'a> Normalizer<'a> { if stop < ref_seq.len().try_into()? || start == orig_start { break; } - // If stop at the end of the window, try to extend teh shuffling to the right. + // If stop at the end of the window, try to extend the shuffling to the right. base += start - orig_start; stop -= start - orig_start; start = orig_start;