Skip to content

Commit

Permalink
Fix mass difference calculation for alignments
Browse files Browse the repository at this point in the history
Signed-off-by: Douwe Schulte <d.schulte@uu.nl>
  • Loading branch information
douweschulte committed Mar 22, 2024
1 parent 7230fd1 commit 0819ec6
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions rustyms/src/align/alignment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ use crate::system::Mass;
use crate::LinearPeptide;
use crate::MolecularFormula;
use crate::Multi;
use crate::MultiChemical;

/// An alignment of two reads. Which has a reference to the sequences.
#[derive(Clone, PartialEq, Eq, Hash, Debug)]
Expand Down Expand Up @@ -206,7 +205,7 @@ pub trait Alignment: PrivateAlignment {
/// The mass(es) for the matched portion of the first sequence TODO: this assumes no terminal mods
fn mass_a(&self) -> Multi<MolecularFormula> {
if self.align_type().left.global_a() && self.align_type().right.global_a() {
self.seq_a().formulas()
self.seq_a().bare_formulas()
} else {
let mut placed_a = vec![false; self.seq_a().ambiguous_modifications.len()];
self.seq_a()[self.start_a()..self.start_a() + self.len_a()]
Expand All @@ -220,7 +219,7 @@ pub trait Alignment: PrivateAlignment {
/// The mass(es) for the matched portion of the second sequence
fn mass_b(&self) -> Multi<MolecularFormula> {
if self.align_type().left.global_b() && self.align_type().right.global_b() {
self.seq_b().formulas()
self.seq_b().bare_formulas()
} else {
let mut placed_b = vec![false; self.seq_b().ambiguous_modifications.len()];
self.seq_b()[self.start_b()..self.start_b() + self.len_b()]
Expand Down

0 comments on commit 0819ec6

Please sign in to comment.