Skip to content

Commit

Permalink
fix: Produce Ident protein edits (#218)
Browse files Browse the repository at this point in the history
* produce Ident variants when ref and alt are identical
  • Loading branch information
tedil authored Jan 7, 2025
1 parent d871be7 commit 44ab9d1
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions src/mapper/altseq.rs
Original file line number Diff line number Diff line change
Expand Up @@ -295,21 +295,21 @@ impl AltSeqBuilder {
| VariantLocation::FivePrimeUtr
| VariantLocation::ThreePrimeUtr => EditType::NotCds,
VariantLocation::WholeGene => match na_edit {
NaEdit::DelRef {..} |
NaEdit::DelRef { .. } |
NaEdit::DelNum { .. } => EditType::WholeGeneDeleted,
NaEdit::Dup { .. } => {
log::warn!("Whole-gene duplication; consequence assumed to not affect protein product");
EditType::NotCds
},
}
NaEdit::InvRef { .. } |
NaEdit::InvNum { .. } => {
log::warn!("Whole-gene inversion; consequence assumed to not affected protein product");
EditType::NotCds
},
NaEdit::RefAlt {.. } => {
}
NaEdit::RefAlt { .. } => {
log::warn!("The whole-gene variant {} is not a clean deletion. Assuming whole gene deletion.", self.var_c);
EditType::WholeGeneDeleted
},
}
_ => panic!("Invalid combination of whole gene variant location and NaEdit {na_edit:?}"),
},
};
Expand Down Expand Up @@ -1111,10 +1111,18 @@ impl AltSeqToHgvsp {
// of protein prediction is certain or uncertain by a global configuration
// variable.
ProtLocEdit::Ordinary {
loc: Mu::Certain(interval),
edit: Mu::Certain(if is_sub {
ProteinEdit::Subst {
alternative: alternative.to_string(),
// cases like Ter525Ter should be Ter525=
if reference == alternative
|| alternative.len() == 1
&& interval.start.aa == alternative
&& interval.start.number == interval.end.number
{
ProteinEdit::Ident
} else {
ProteinEdit::Subst {
alternative: alternative.to_string(),
}
}
} else if is_ext {
ProteinEdit::Ext {
Expand Down Expand Up @@ -1147,6 +1155,7 @@ impl AltSeqToHgvsp {
alternative: alternative.to_string(),
}
}),
loc: Mu::Certain(interval),
}
};

Expand Down

0 comments on commit 44ab9d1

Please sign in to comment.