Skip to content

Commit cf4d193

Browse files
committed
Merge branch 'pr/aukeheerdink/75'
2 parents a46afae + 3e810b7 commit cf4d193

3 files changed

Lines changed: 500 additions & 19 deletions

File tree

rustyms/src/aminoacid/aminoacid.rs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,35 @@ impl AminoAcid {
373373
Self::Valine,
374374
];
375375

376+
/// All amino acids (including I/L/J/B/Z but excluding X)
377+
pub const ALL_AMINO_ACIDS: &'static [Self] = &[
378+
Self::Alanine,
379+
Self::AmbiguousAsparagine,
380+
Self::AmbiguousGlutamine,
381+
Self::AmbiguousLeucine,
382+
Self::Arginine,
383+
Self::Asparagine,
384+
Self::AsparticAcid,
385+
Self::Cysteine,
386+
Self::GlutamicAcid,
387+
Self::Glutamine,
388+
Self::Glycine,
389+
Self::Histidine,
390+
Self::Isoleucine,
391+
Self::Leucine,
392+
Self::Lysine,
393+
Self::Methionine,
394+
Self::Phenylalanine,
395+
Self::Proline,
396+
Self::Pyrrolysine,
397+
Self::Selenocysteine,
398+
Self::Serine,
399+
Self::Threonine,
400+
Self::Tryptophan,
401+
Self::Tyrosine,
402+
Self::Valine,
403+
];
404+
376405
// TODO: generalise over used storage type, so using molecularformula, monoisotopic mass, or average mass, also make sure that AAs can return these numbers in a const fashion
377406
#[expect(clippy::too_many_lines, clippy::too_many_arguments)]
378407
pub(crate) fn fragments(

rustyms/src/peptidoform/peptidoform.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1508,7 +1508,12 @@ impl<Complexity: AtMax<Linear>> Peptidoform<Complexity> {
15081508
}
15091509

15101510
/// Digest this sequence with the given protease and the given maximal number of missed cleavages.
1511-
pub fn digest(&self, protease: &Protease, max_missed_cleavages: usize) -> Vec<Self> {
1511+
pub fn digest(
1512+
&self,
1513+
protease: &Protease,
1514+
max_missed_cleavages: usize,
1515+
size_range: impl RangeBounds<usize>,
1516+
) -> Vec<Self> {
15121517
let mut sites = vec![0];
15131518
sites.extend_from_slice(&protease.match_locations(&self.sequence));
15141519
sites.push(self.len());
@@ -1517,7 +1522,9 @@ impl<Complexity: AtMax<Linear>> Peptidoform<Complexity> {
15171522

15181523
for (index, start) in sites.iter().enumerate() {
15191524
for end in sites.iter().skip(index + 1).take(max_missed_cleavages + 1) {
1520-
result.push(self.sub_peptide((*start)..*end));
1525+
if size_range.contains(&(end - start)) {
1526+
result.push(self.sub_peptide((*start)..*end));
1527+
}
15211528
}
15221529
}
15231530
result

0 commit comments

Comments
 (0)