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: cases where dup/inv goes beyond CDS #89

Merged
merged 1 commit into from
Apr 5, 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
22 changes: 11 additions & 11 deletions src/mapper/altseq.rs
Original file line number Diff line number Diff line change
Expand Up @@ -445,11 +445,11 @@ impl AltSeqBuilder {

let is_frameshift = (end - start) % 3 != 0;

let loc_range = self
.var_c
.loc_range()
.expect("Could not determine insertion location");
let variant_start_aa = ((loc_range.end + 1) as f64 / 3.0).ceil() as i32;
let loc_end = match &self.var_c {
HgvsVariant::CdsVariant { loc_edit, .. } => loc_edit.loc.inner().end.base,
_ => panic!("can only work on CDS variants"),
};
let variant_start_aa = ((loc_end + 1) as f64 / 3.0).ceil() as i32;

AltTranscriptData::new(
&seq,
Expand All @@ -475,12 +475,12 @@ impl AltSeqBuilder {
&seq[end..]
);

let loc_range = self
.var_c
.loc_range()
.expect("Could not determine insertion location");
let variant_start_aa =
std::cmp::max((((loc_range.start + 1) as f64) / 3.0).ceil() as i32, 1);
let loc_start = match &self.var_c {
HgvsVariant::CdsVariant { loc_edit, .. } => loc_edit.loc.inner().start.base,
_ => panic!("can only work on CDS variants"),
};

let variant_start_aa = std::cmp::max(((loc_start as f64) / 3.0).ceil() as i32, 1);

AltTranscriptData::new(
&seq,
Expand Down
2 changes: 1 addition & 1 deletion src/mapper/assembly.rs
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,7 @@ mod test {
assert_eq!(
format!("{}", &crate::parser::NoRef(&actual)),
hgvs_p,
"gene={gene}"
"gene={gene}, hgvs_c={hgvs_c}, hgvs_p={hgvs_p}"
);

Ok(())
Expand Down