55 Peptide(
UInt32 protein_idx, uint32_t mod_bitmask, std::pair<uint16_t , uint16_t> sequence,
float precursor_mz):
56 protein_idx(protein_idx),
57 mod_bitmask_(mod_bitmask),
59 precursor_mz_(precursor_mz)
73 uint32_t num_matched_{};
74 uint32_t subset_bitmask_{};
76 uint16_t precursor_charge_{};
77 int16_t isotope_error_{};
78 size_t peptide_idx_{};
87 std::vector<SpectrumMatch>
hits_;
101 this->hits_.insert(this->hits_.end(), other.
hits_.begin(), other.
hits_.end());
161#ifdef DEBUG_FRAGMENT_INDEX
195 void build(
const std::vector<FASTAFile::FASTAEntry> & fasta_entries);
213 const std::pair<float, float>& window)
const;
220 double upper_magnitude,
221 bool unit_ppm)
noexcept
223 const double threshold = unit_ppm ? 1000.0 : 1.0;
224 return std::max(lower_magnitude, upper_magnitude) > threshold;
246 static constexpr uint32_t SNES_KIND_BIT_MASK = 1u << 31;
247 static constexpr uint32_t SNES_SLOT_MASK = ~SNES_KIND_BIT_MASK;
263 return (mod_bitmask & SNES_KIND_BIT_MASK) != 0;
268 return (mod_bitmask & SNES_KIND_BIT_MASK) == 0;
285 peptide_idx(peptide_idx),
286 fragment_mz(fragment_mz)
300 const std::pair<size_t,size_t>& peptide_idx_range,
301 uint16_t peak_charge);
325 const std::vector<FASTAFile::FASTAEntry>& fasta_entries,
344 const std::vector<FASTAFile::FASTAEntry>& fasta_entries,
346 bool with_electron_ions);
359 const std::vector<FASTAFile::FASTAEntry>& fasta_entries)
const;
383 const std::vector<FASTAFile::FASTAEntry>& fasta_entries,
384 double target_mh_plus,
385 double tolerance_lower_magnitude,
386 double tolerance_upper_magnitude,
387 bool tolerance_ppm)
const;
397 const std::vector<FASTAFile::FASTAEntry>& fasta_entries,
398 size_t realized_length,
399 uint32_t subset_bitmask = 0)
const;
410 peptide_idx_(peptide_idx),
411 fragment_mz_(fragment_mz)
414 float fragment_mz_{};
417 bool is_build_{
false};
471 static constexpr uint16_t NTERM_SLOT = UINT16_MAX - 1;
472 static constexpr uint16_t CTERM_SLOT = UINT16_MAX;
475 static constexpr size_t MAX_MOD_SLOTS = 32;
491 bool is_protein_nterm =
false,
bool is_protein_cterm =
false)
const;
502 bool include_prot_cterm_mods)
const;
505 std::array<double, 128> fixed_mod_deltas_{};
507 std::array<const ResidueModification*, 128> fixed_mod_ptrs_{};
508 double fixed_nterm_delta_{0.0};
509 double fixed_cterm_delta_{0.0};
514 std::array<std::vector<VarModEntry>, 128> variable_mod_table_{};
520 bool mod_tables_initialized_{
false};
527 bool is_snes_mode_{
false};
534 bool snes_enabled_{
false};
555 double b_offset{0.0};
556 double y_offset{0.0};
557 double a_offset{0.0};
558 double c_offset{0.0};
559 double x_offset{0.0};
560 double z_offset{0.0};
561 double zp1_offset{0.0};
580 std::vector<Fragment>& fragments,
581 std::vector<Fragment>& electron_fragments,
582 const char* sequence,
585 double n_term_mod_mass,
586 double c_term_mod_mass,
587 const double* residue_mod_masses)
const;
611 std::vector<Fragment>& fragments,
612 const char* sequence,
615 double n_term_mod_mass,
616 double c_term_mod_mass,
617 const double* residue_mod_masses,
639 size_t min_ion_index_{0};
642 double precursor_mass_tolerance_lower_{20.0};
643 double precursor_mass_tolerance_upper_{20.0};
644 bool precursor_mass_tolerance_unit_ppm_{
true};
646 bool fragment_mz_tolerance_unit_ppm_{
true};
692 const std::vector<FASTAFile::FASTAEntry>& fasta_entries,
717 const std::pair<size_t, size_t>& candidates_range,
718 const int16_t isotope_error,
719 const uint16_t precursor_charge,
720 const bool with_electron_ions);
731 float precursor_mass,
734 bool with_electron_ions);
739 std::vector<float>& bucket_min_mz,
755 bool electron_ions_{
false};
764 bool clip_nterm_methionine_ {
false};
788 return isOpenSearchMode(precursor_mass_tolerance_lower_,
789 precursor_mass_tolerance_upper_,
790 precursor_mass_tolerance_unit_ppm_);
Definition AASequence.h:96
A base class for all classes handling default parameters.
Definition DefaultParamHandler.h:66
Specificity
when querying for valid digestion products, this determines if the specificity of the two peptide end...
Definition EnzymaticDigestion.h:41
Generates from a set of Fasta files a 2D-datastructure which stores all theoretical masses of all b a...
Definition FragmentIndex.h:35
size_t bucketsize_
number of fragments per outer node
Definition FragmentIndex.h:640
uint16_t min_matched_peaks_
PSM with less hits are discarded.
Definition FragmentIndex.h:777
bool add_x_ions_
Definition FragmentIndex.h:752
bool isProteinNTerminal_(const std::string &protein, Size start) const
Whether a position is the original or, with Met clipping enabled, mature protein N-terminus.
void generateSNESMothers_(const std::vector< FASTAFile::FASTAEntry > &fasta_entries)
SNES-mode peptide enumeration: emit Single-N + Single-C mother peptides.
void searchDifferentPrecursorRanges(const MSSpectrum &spectrum, float precursor_mass, SpectrumMatchesTopN &sms, uint16_t charge, bool with_electron_ions)
If closed search loops over all isotope errors. For each iteration loop over all peaks with queryPeak...
AASequence reconstructRealizedSubSequence(const Peptide &mother, const std::vector< FASTAFile::FASTAEntry > &fasta_entries, size_t realized_length, uint32_t subset_bitmask=0) const
const ResidueModification * mod_ptr
pointer to the modification (for AASequence reconstruction)
Definition FragmentIndex.h:456
bool add_a_ions_
Definition FragmentIndex.h:750
void querySpectrum(const MSSpectrum &spectrum, SpectrumMatchesTopN &sms)
: queries one complete experimental spectra against the Database. Loops over all precursor charges St...
std::vector< float > electron_bucket_min_mz_
smallest fragment m/z of each bucket of electron_fragments_
Definition FragmentIndex.h:631
bool add_b_ions_
Definition FragmentIndex.h:748
static bool isOpenSearchMode(double lower_magnitude, double upper_magnitude, bool unit_ppm) noexcept
Definition FragmentIndex.h:219
static IonOffsets ion_offsets_
Definition FragmentIndex.h:563
size_t buildModSlots_(const char *sequence, size_t seq_len, ModSlot *out_slots, bool is_protein_nterm=false, bool is_protein_cterm=false) const
ResidueModification::TermSpecificity term_spec
where this mod can be applied
Definition FragmentIndex.h:457
static std::once_flag mass_table_once_flag_
Definition FragmentIndex.h:549
void sortAndBucketFragments_(std::vector< Fragment > &fragments, std::vector< float > &bucket_min_mz, int num_threads)
std::pair< float, float > computeMassWindow_(float precursor_mass) const
StringList modifications_fixed_
Modification that are one all peptides.
Definition FragmentIndex.h:771
static bool isSingleCMother(uint32_t mod_bitmask) noexcept
Definition FragmentIndex.h:261
float fragment_mz_tolerance_
Definition FragmentIndex.h:645
bool add_y_ions_
Definition FragmentIndex.h:749
std::vector< Peptide > fi_peptides_
vector of all (digested) peptides
Definition FragmentIndex.h:626
std::vector< VarModEntry > variable_cterm_mods_
Pure C-terminal variable mods (not residue-specific)
Definition FragmentIndex.h:518
void generateFragmentsLightweight_(std::vector< Fragment > &fragments, std::vector< Fragment > &electron_fragments, const char *sequence, size_t seq_len, UInt32 peptide_idx, double n_term_mod_mass, double c_term_mod_mass, const double *residue_mod_masses) const
size_t missed_cleavages_
number of missed cleavages
Definition FragmentIndex.h:765
float fragment_min_mz_
smallest fragment mz
Definition FragmentIndex.h:637
uint16_t min_precursor_charge_
minimal possible precursor charge (usually always 1)
Definition FragmentIndex.h:780
uint32_t max_processed_hits_
The amount of PSM that will be used. the rest is filtered out.
Definition FragmentIndex.h:783
static bool isSingleNMother(uint32_t mod_bitmask) noexcept
Definition FragmentIndex.h:266
float peptide_max_mass_
Definition FragmentIndex.h:767
void querySpectrumSNES_(const MSSpectrum &spectrum, const std::vector< FASTAFile::FASTAEntry > &fasta_entries, SpectrumMatchesTopN &sms)
SNES-mode spectrum query (MetaMorpheus-style: byte-count + b-ion filter).
bool add_zp1_ions_
Definition FragmentIndex.h:754
std::vector< Fragment > electron_fragments_
Definition FragmentIndex.h:630
uint16_t max_fragment_charge_
The maximal possible charge of the fragments.
Definition FragmentIndex.h:782
std::pair< size_t, size_t > getPeptidesInMassWindow(float precursor_mass, const std::pair< float, float > &window) const
std::vector< double > snes_sigma_delta_set_with_prot_cterm_
Definition FragmentIndex.h:544
std::vector< Hit > query(const Peak1D &peak, const std::pair< size_t, size_t > &peptide_idx_range, uint16_t peak_charge)
Queries one peak (against the ion series of the ions:add_*_ions parameters, not the c and z+1 ions of...
bool isOpenSearchMode_() const noexcept
Instance delegate — same rule, reads the member bounds.
Definition FragmentIndex.h:786
std::vector< Fragment > fi_fragments_
Definition FragmentIndex.h:627
void querySpectrum(const MSSpectrum &spectrum, const std::vector< FASTAFile::FASTAEntry > &fasta_entries, SpectrumMatchesTopN &sms)
Query a spectrum against the fragment index with FASTA context.
std::vector< double > snes_sigma_delta_set_
Definition FragmentIndex.h:538
int16_t max_isotope_error_
Maximal possible isotope error (both only used for closed search)
Definition FragmentIndex.h:779
float fragment_max_mz_
largest fragment mz
Definition FragmentIndex.h:638
std::string digestion_enzyme_
Definition FragmentIndex.h:758
void generateFragmentsForSeries_(std::vector< Fragment > &fragments, const char *sequence, size_t seq_len, UInt32 peptide_idx, double n_term_mod_mass, double c_term_mod_mass, const double *residue_mod_masses, bool add_b, bool add_a, bool add_c, bool add_y, bool add_x, bool add_z, bool add_zp1) const
bool isBuild() const
Indicates whether the fragment index has been built.
size_t peptide_max_length_
Definition FragmentIndex.h:769
~FragmentIndex() override=default
Default destructor.
void querySpectrum(const MSSpectrum &spectrum, const std::vector< FASTAFile::FASTAEntry > &fasta_entries, SpectrumMatchesTopN &sms, bool with_electron_ions)
Query a spectrum, optionally also against the c and z+1 ions of ions:electron_ions.
std::vector< double > snes_sigma_delta_set_with_prot_nterm_
Definition FragmentIndex.h:541
void generatePeptides(const std::vector< FASTAFile::FASTAEntry > &fasta_entries)
Generates all peptides from given fasta entries. If Bottom-up is set to false skips digestion....
std::vector< float > bucket_min_mz_
vector of the smalles fragment mz of each bucket
Definition FragmentIndex.h:641
double delta_mass
mass delta from this modification
Definition FragmentIndex.h:455
float peptide_min_mass_
Definition FragmentIndex.h:766
int16_t min_isotope_error_
Minimal possible isotope error.
Definition FragmentIndex.h:778
uint16_t max_precursor_charge_
maximal possible precursor charge
Definition FragmentIndex.h:781
std::vector< uint32_t > protein_lengths_
Definition FragmentIndex.h:635
void updateMembers_() override
This method is used to update extra member variables at the end of the setParameters() method.
void queryPeaks(SpectrumMatchesTopN &candidates, const MSSpectrum &spectrum, const std::pair< size_t, size_t > &candidates_range, const int16_t isotope_error, const uint16_t precursor_charge, const bool with_electron_ions)
Counts fragment matches for ONE (precursor charge, isotope error) block and appends the surviving can...
void clear()
Delete fragment index. Sets is_build=false.
StringList modifications_variable_
Variable Modification -> all possible comibnations are created.
Definition FragmentIndex.h:772
size_t max_variable_mods_per_peptide_
Definition FragmentIndex.h:773
void build(const std::vector< FASTAFile::FASTAEntry > &fasta_entries)
Given a set of Fasta files, builds the Fragment Index datastructure (FID). First all fragments are so...
void initModificationTables_()
int realizeSNESLength(const Peptide &mother, const std::vector< FASTAFile::FASTAEntry > &fasta_entries, double target_mh_plus, double tolerance_lower_magnitude, double tolerance_upper_magnitude, bool tolerance_ppm) const
Find the realized sub-peptide length of a SNES mother that best matches the observed precursor mass.
bool isSnesMode() const noexcept
Definition FragmentIndex.h:276
void trimHits(SpectrumMatchesTopN &init_hits) const
places the k-largest elements in the front of the input array. Inside of the k-largest elements and o...
Size getNumFragments() const noexcept
Definition FragmentIndex.h:159
const std::vector< Peptide > & getPeptides() const
Returns a reference to the internal peptide container.
AASequence reconstructModifiedSequence(const Peptide &peptide, const std::vector< FASTAFile::FASTAEntry > &fasta_entries) const
Reconstruct a fully modified AASequence from a Peptide's bitmask.
std::vector< VarModEntry > variable_nterm_mods_
Pure N-terminal variable mods (not residue-specific)
Definition FragmentIndex.h:516
size_t peptide_min_length_
Definition FragmentIndex.h:768
static void initResidueMassTable_()
bool add_c_ions_
Definition FragmentIndex.h:751
FragmentIndex()
Default constructor.
SnesAnchor
Definition FragmentIndex.h:253
bool add_z_ions_
Definition FragmentIndex.h:753
static std::array< double, 128 > residue_mass_table_
Definition FragmentIndex.h:548
std::vector< double > computeSnesSigmaDeltaSet_(bool include_prot_nterm_mods, bool include_prot_cterm_mods) const
Precomputed ion-type mass offsets (from Residue::getInternalTo*Ion formulas)
Definition FragmentIndex.h:554
Match between a query peak and an entry in the DB.
Definition FragmentIndex.h:72
Entry in the per-AA variable modification lookup table.
Definition FragmentIndex.h:454
The representation of a 1D spectrum.
Definition MSSpectrum.h:44
A 1-dimensional raw data point or peak.
Definition Peak1D.h:30
Representation of a modification on an amino acid residue.
Definition ResidueModification.h:55
TermSpecificity
Position where the modification is allowed to occur.
Definition ResidueModification.h:74
uint32_t UInt32
Unsigned integer type (32bit)
Definition Types.h:33
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition Types.h:97
std::vector< std::string > StringList
Vector of String.
Definition TypeAliases.h:39
Main OpenMS namespace.
Definition openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19
One entry in the fragment index.
Definition FragmentIndex.h:407
Fragment(UInt32 peptide_idx, float fragment_mz)
Definition FragmentIndex.h:409
Definition FragmentIndex.h:283
UInt32 peptide_idx
Definition FragmentIndex.h:288
Hit(UInt32 peptide_idx, float fragment_mz)
Definition FragmentIndex.h:284
float fragment_mz
Definition FragmentIndex.h:289
A candidate modification slot for a specific peptide.
Definition FragmentIndex.h:466
const ResidueModification * mod_ptr
for AASequence reconstruction
Definition FragmentIndex.h:469
uint16_t position
residue index, or NTERM_SLOT/CTERM_SLOT
Definition FragmentIndex.h:467
double delta_mass
mass delta
Definition FragmentIndex.h:468
Compact descriptor of a peptide instance held by the FragmentIndex.
Definition FragmentIndex.h:52
std::pair< uint16_t, uint16_t > sequence_
{start, length} within the source protein sequence (start is 0-based; length in residues)
Definition FragmentIndex.h:64
uint32_t mod_bitmask_
Bitmask of active variable mod slots (0 = unmodified/fixed-only; up to 32 slots)
Definition FragmentIndex.h:63
UInt32 protein_idx
0-based index into FASTA entries provided to build(); identifies the source protein
Definition FragmentIndex.h:62
float precursor_mz_
Mono-isotopic m/z at charge 1 (M+H)+ of this peptide; used for sorting/filtering.
Definition FragmentIndex.h:65
Peptide(UInt32 protein_idx, uint32_t mod_bitmask, std::pair< uint16_t, uint16_t > sequence, float precursor_mz)
Definition FragmentIndex.h:55
container for SpectrumMatch. Also keeps count of total number of candidates and total number of match...
Definition FragmentIndex.h:86
SpectrumMatchesTopN & operator+=(const SpectrumMatchesTopN &other)
Appends the a SpectrumMatchesTopN to another one. Add the number of all matched peaks up....
Definition FragmentIndex.h:98
SpectrumMatchesTopN()=default
void clear()
Definition FragmentIndex.h:105
std::vector< SpectrumMatch > hits_
The preliminary candidates.
Definition FragmentIndex.h:87