Skip to content

Commit

Permalink
feat: modified visibility, clone for pysage connector
Browse files Browse the repository at this point in the history
  • Loading branch information
theGreatHerrLebert authored and lazear committed Nov 22, 2023
1 parent 7abbb08 commit e4293a6
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 21 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ resolver = "2"
[profile.release]
lto = "fat"
codegen-units = 1
panic = "abort"
panic = "abort"
20 changes: 10 additions & 10 deletions crates/sage/src/database.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,24 +118,24 @@ impl Builder {

#[derive(Serialize, Clone, Debug)]
pub struct Parameters {
bucket_size: usize,
pub bucket_size: usize,
pub enzyme: EnzymeBuilder,
pub fragment_min_mz: f32,
pub fragment_max_mz: f32,
peptide_min_mass: f32,
peptide_max_mass: f32,
ion_kinds: Vec<Kind>,
min_ion_index: usize,
static_mods: HashMap<ModificationSpecificity, f32>,
variable_mods: HashMap<ModificationSpecificity, Vec<f32>>,
max_variable_mods: usize,
pub peptide_min_mass: f32,
pub peptide_max_mass: f32,
pub ion_kinds: Vec<Kind>,
pub min_ion_index: usize,
pub static_mods: HashMap<ModificationSpecificity, f32>,
pub variable_mods: HashMap<ModificationSpecificity, Vec<f32>>,
pub max_variable_mods: usize,
pub decoy_tag: String,
pub generate_decoys: bool,
pub fasta: String,
}

impl Parameters {
fn digest(&self, fasta: &Fasta) -> Vec<Peptide> {
pub fn digest(&self, fasta: &Fasta) -> Vec<Peptide> {
log::trace!("digesting fasta");
let enzyme = self.enzyme.clone().into();
// Generate all tryptic peptide sequences, including reversed (decoy)
Expand Down Expand Up @@ -335,7 +335,7 @@ pub struct IndexedDatabase {
pub peptides: Vec<Peptide>,
pub fragments: Vec<Theoretical>,
pub ion_kinds: Vec<Kind>,
pub(crate) min_value: Vec<f32>,
pub min_value: Vec<f32>,
/// Keep a list of potential (AA, mass) modifications for RT prediction
pub potential_mods: Vec<(ModificationSpecificity, f32)>,
pub bucket_size: usize,
Expand Down
5 changes: 3 additions & 2 deletions crates/sage/src/enzyme.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ pub struct EnzymeParameters {
pub enyzme: Option<Enzyme>,
}

#[derive(Clone)]
pub struct Enzyme {
// Skip cleaving if the site is followed matching this AA
pub skip_suffix: Option<char>,
Expand Down Expand Up @@ -150,7 +151,7 @@ impl Enzyme {
}
}

fn cleavage_sites(&self, sequence: &str) -> Vec<DigestSite> {
pub fn cleavage_sites(&self, sequence: &str) -> Vec<DigestSite> {
let mut sites = Vec::new();
let mut left = 0;
for mat in self.regex.find_iter(sequence) {
Expand Down Expand Up @@ -180,7 +181,7 @@ impl Enzyme {
}

impl EnzymeParameters {
fn cleavage_sites(&self, sequence: &str) -> Vec<DigestSite> {
pub fn cleavage_sites(&self, sequence: &str) -> Vec<DigestSite> {
match &self.enyzme {
Some(enzyme) => enzyme.cleavage_sites(sequence),
None => {
Expand Down
1 change: 1 addition & 0 deletions crates/sage/src/fasta.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use crate::enzyme::{Digest, EnzymeParameters};
use rayon::prelude::*;
use std::sync::Arc;

#[derive(Clone)]
pub struct Fasta {
pub targets: Vec<(Arc<String>, String)>,
decoy_tag: String,
Expand Down
8 changes: 4 additions & 4 deletions crates/sage/src/fdr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ use std::hash::BuildHasher;

#[derive(Copy, Clone, Debug)]
pub struct Competition<Ix> {
forward: f32,
foward_ix: Option<Ix>,
reverse: f32,
reverse_ix: Option<Ix>,
pub forward: f32,
pub foward_ix: Option<Ix>,
pub reverse: f32,
pub reverse_ix: Option<Ix>,
}

struct Row<Ix> {
Expand Down
8 changes: 4 additions & 4 deletions crates/sage/src/lfq.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,10 @@ pub struct PrecursorRange {
/// storing fragment masses binned by precursor mass, store MS1 precursors
/// binned by RT - This should enable rapid quantification as well
pub struct FeatureMap {
ranges: Vec<PrecursorRange>,
min_rts: Vec<f32>,
bin_size: usize,
settings: LfqSettings,
pub ranges: Vec<PrecursorRange>,
pub min_rts: Vec<f32>,
pub bin_size: usize,
pub settings: LfqSettings,
}

pub fn build_feature_map(
Expand Down
1 change: 1 addition & 0 deletions crates/sage/src/mass.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ pub const fn composition(aa: u8) -> Composition {
}
}

#[derive(Clone, Debug)]
pub struct Composition {
pub carbon: u16,
pub sulfur: u16,
Expand Down
1 change: 1 addition & 0 deletions crates/sage/src/spectrum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ pub struct Deisotoped {
pub envelope: Option<usize>,
}

#[derive(Debug, Clone)]
pub struct SpectrumProcessor {
pub take_top_n: usize,
pub max_fragment_mz: f32,
Expand Down
1 change: 1 addition & 0 deletions crates/sage/src/tmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@ const TMT18PLEX: [f32; 18] = [
// })
// }

#[derive(Clone)]
pub struct TmtQuant {
pub spec_id: String,
pub file_id: usize,
Expand Down

0 comments on commit e4293a6

Please sign in to comment.