Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: out of bounds issue on 5'-to-3' shifting beyond CDS #94

Merged
merged 2 commits into from
Apr 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/mapper/altseq.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/normalizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down