pub fn calculate_complementary_fragment_composition(
precursor_composition: &HashMap<&str, i32>,
fragment_composition: &HashMap<&str, i32>,
) -> HashMap<String, i32>Expand description
Calculate the atomic composition of the complementary fragment.
When a peptide is fragmented, the resulting fragment ion has a complementary portion (the rest of the precursor). This function calculates the atomic composition of that complementary fragment, which is needed for quad-selection dependent isotope distribution calculations.
§Arguments
precursor_composition- atomic composition of the full precursorfragment_composition- atomic composition of the fragment ion (from atomic_product_ion_composition)
§Returns
HashMap<String, i32>- atomic composition of the complementary fragment
§Examples
use mscore::algorithm::peptide::{peptide_sequence_to_atomic_composition, atomic_product_ion_composition, calculate_complementary_fragment_composition};
use mscore::data::peptide::{PeptideSequence, PeptideProductIon, PeptideIon, FragmentType};
let precursor = PeptideSequence::new("PEPTIDE".to_string(), Some(1));
let precursor_comp = peptide_sequence_to_atomic_composition(&precursor);
// Create a b3 ion (PEP)
let b3_ion = PeptideProductIon {
kind: FragmentType::B,
ion: PeptideIon {
sequence: PeptideSequence::new("PEP".to_string(), Some(1)),
charge: 1,
intensity: 1.0,
},
};
let fragment_comp: Vec<(&str, i32)> = atomic_product_ion_composition(&b3_ion);
let fragment_map: std::collections::HashMap<&str, i32> = fragment_comp.into_iter().collect();
let complementary = calculate_complementary_fragment_composition(&precursor_comp, &fragment_map);
// Complementary should be TIDE as y-ion (precursor - b-ion)