OpenMS
Loading...
Searching...
No Matches
FragmentIndex.h
Go to the documentation of this file.
1// Copyright (c) 2002-present, OpenMS Inc. -- EKU Tuebingen, ETH Zurich, and FU Berlin
2// SPDX-License-Identifier: BSD-3-Clause
3//
4// --------------------------------------------------------------------------
5// $Maintainer: $
6// $Authors: $
7// --------------------------------------------------------------------------
8
9#pragma once
10
18
19
20#include <array>
21#include <mutex>
22#include <vector>
23#include <functional>
24#include <algorithm> // std::max (used by inline static isOpenSearchMode)
25
26namespace OpenMS
27{
34 class OPENMS_DLLAPI FragmentIndex : public DefaultParamHandler
35 {
36 public:
37
38
52 struct Peptide {
53
56 // We need a constructor in order to emplace back
57 Peptide(UInt32 protein_idx, uint32_t mod_bitmask, std::pair<uint16_t , uint16_t> sequence, float precursor_mz):
58 protein_idx(protein_idx),
59 mod_bitmask_(mod_bitmask),
60 sequence_(sequence),
61 precursor_mz_(precursor_mz)
62 {}
63
67 struct Span
68 {
69 Span() = default;
70 Span(std::pair<uint16_t, uint16_t> span) : first(span.first), second(span.second) {}
71 operator std::pair<uint16_t, uint16_t>() const { return {first, second}; }
72 bool operator==(const Span&) const = default;
73 uint16_t first;
74 uint16_t second;
75 };
76
78 uint32_t mod_bitmask_;
81 };
82
87 {
88 uint32_t num_matched_{};
89 uint32_t subset_bitmask_{};
90 float sigma_delta_{};
91 uint16_t precursor_charge_{};
92 int16_t isotope_error_{};
93 size_t peptide_idx_{};
94 };
95
96
101 {
102 std::vector<SpectrumMatch> hits_;
103
105
112 {
113 this->hits_.insert(this->hits_.end(), other.hits_.begin(), other.hits_.end());
114 return *this;
115 }
116
117 void clear()
118 {
119 hits_.clear();
120 }
121 };
132
139 ~FragmentIndex() override = default;
140
148 FragmentIndex(const FragmentIndex&) = default;
152
162 bool isBuild() const;
163
179 const std::vector<Peptide>& getPeptides() const;
180
193
203 const std::vector<RemovedOccurrence>& getRemovedOccurrences() const noexcept { return removed_occurrences_; }
204
218 bool hasProteinOccurrences(const std::vector<FASTAFile::FASTAEntry>& fasta_entries) const;
219
234 void getProteinOccurrences(Size peptide_idx, const std::vector<FASTAFile::FASTAEntry>& fasta_entries,
235 std::vector<std::pair<UInt32, UInt32>>& occurrences) const;
236
239 Size getNumFragments() const noexcept { return fi_fragments_.size() + electron_fragments_.size(); }
240
241#ifdef DEBUG_FRAGMENT_INDEX
265 void addSpecialPeptide(AASequence& peptide, Size source_idx);
266#endif
267
275 void build(const std::vector<FASTAFile::FASTAEntry> & fasta_entries);
276
291 void build(const std::vector<FASTAFile::FASTAEntry>& fasta_entries,
292 const std::function<const MSExperiment*(Size)>& searched_spectra);
293
295 void clear();
296
297
309 std::pair<size_t, size_t> getPeptidesInMassWindow(float precursor_mass,
310 const std::pair<float, float>& window) const;
311
316 static bool isOpenSearchMode(double lower_magnitude,
317 double upper_magnitude,
318 bool unit_ppm) noexcept
319 {
320 const double threshold = unit_ppm ? 1000.0 : 1.0;
321 return std::max(lower_magnitude, upper_magnitude) > threshold;
322 }
323
336 static void checkFixedModifications(const StringList& fixed_modifications);
337
351 const StringList& variable_modifications);
352
366 const StringList& variable_modifications);
367
387 static constexpr uint32_t SNES_KIND_BIT_MASK = 1u << 31;
388 static constexpr uint32_t SNES_SLOT_MASK = ~SNES_KIND_BIT_MASK;
389
393 enum class SnesAnchor
394 {
395 NONE,
396 PROT_NTERM,
397 PROT_CTERM
398 };
399
402 static bool isSingleCMother(uint32_t mod_bitmask) noexcept
403 {
404 return (mod_bitmask & SNES_KIND_BIT_MASK) != 0;
405 }
407 static bool isSingleNMother(uint32_t mod_bitmask) noexcept
408 {
409 return (mod_bitmask & SNES_KIND_BIT_MASK) == 0;
410 }
411
417 bool isSnesMode() const noexcept { return is_snes_mode_; }
418
419
423 struct Hit
424 {
425 Hit(UInt32 peptide_idx, float fragment_mz) :
426 peptide_idx(peptide_idx),
427 fragment_mz(fragment_mz)
428 {}
429 UInt32 peptide_idx; // index in database
431 };
432
440 std::vector<Hit> query(const Peak1D& peak,
441 const std::pair<size_t,size_t>& peptide_idx_range,
442 uint16_t peak_charge);
443
451 void querySpectrum(const MSSpectrum& spectrum,
453
465 void querySpectrum(const MSSpectrum& spectrum,
466 const std::vector<FASTAFile::FASTAEntry>& fasta_entries,
468
484 void querySpectrum(const MSSpectrum& spectrum,
485 const std::vector<FASTAFile::FASTAEntry>& fasta_entries,
487 bool with_electron_ions);
488
500 const std::vector<FASTAFile::FASTAEntry>& fasta_entries) const;
501
523 int realizeSNESLength(const Peptide& mother,
524 const std::vector<FASTAFile::FASTAEntry>& fasta_entries,
525 double target_mh_plus,
526 double tolerance_lower_magnitude,
527 double tolerance_upper_magnitude,
528 bool tolerance_ppm) const;
529
538 const std::vector<FASTAFile::FASTAEntry>& fasta_entries,
539 size_t realized_length,
540 uint32_t subset_bitmask = 0) const;
541
542protected:
543
544
547 struct Fragment
548 {
552 Fragment(UInt32 peptide_idx, float fragment_mz):
553 peptide_idx_(peptide_idx),
554 fragment_mz_(fragment_mz)
555 {}
556 UInt32 peptide_idx_; // 32 bit in sage
558 };
559
560 bool is_build_{false};
561
562 void updateMembers_() override;
563
570 void generatePeptides(const std::vector<FASTAFile::FASTAEntry>& fasta_entries);
571
593 void generateSNESMothers_(const std::vector<FASTAFile::FASTAEntry>& fasta_entries);
594
605 static void sortPeptides_(std::vector<Peptide>& peptides, size_t min_task_size = 8192);
606
609 {
611 std::vector<std::pair<const ResidueModification*, uint32_t>> mod_class;
615 bool runs_hold_peptidoforms{true};
617 bool unique_variable_renderings{true};
619 bool slots_depend_on_context{false};
620
622 uint32_t classOf(const ResidueModification* mod) const
623 {
624 for (const auto& [ptr, cls] : mod_class)
625 {
626 if (ptr == mod) return cls;
627 }
628 return 0;
629 }
630 };
631
634
637 void renderPeptidoform_(const Peptide& peptide, const std::vector<FASTAFile::FASTAEntry>& fasta_entries,
638 const PeptidoformRendering_& rendering, std::vector<uint32_t>& tokens) const;
639
645 bool samePeptidoform_(const Peptide& a, const Peptide& b, const std::vector<FASTAFile::FASTAEntry>& fasta_entries,
646 const PeptidoformRendering_& rendering, std::vector<uint32_t>& tokens_a,
647 std::vector<uint32_t>& tokens_b) const;
648
656 Size deduplicateByString_(const std::vector<FASTAFile::FASTAEntry>& fasta_entries);
657
665
671 struct ModSlot
672 {
673 uint16_t position;
674 double delta_mass;
676
677 static constexpr uint16_t NTERM_SLOT = UINT16_MAX - 1;
678 static constexpr uint16_t CTERM_SLOT = UINT16_MAX;
679 };
680
681 static constexpr size_t MAX_MOD_SLOTS = 32;
682
686
700 size_t buildModSlots_(const char* sequence, size_t seq_len, ModSlot* out_slots,
701 bool is_protein_nterm = false, bool is_protein_cterm = false) const;
702
711 std::vector<double> computeSnesSigmaDeltaSet_(bool include_prot_nterm_mods,
712 bool include_prot_cterm_mods) const;
713
716
718 std::array<double, 128> fixed_mod_deltas_{};
720 std::array<const ResidueModification*, 128> fixed_mod_ptrs_{};
721 double fixed_nterm_delta_{0.0};
722 double fixed_cterm_delta_{0.0};
723 const ResidueModification* fixed_nterm_mod_ptr_{nullptr};
724 const ResidueModification* fixed_cterm_mod_ptr_{nullptr};
725
727 std::array<std::vector<VarModEntry>, 128> variable_mod_table_{};
729 std::vector<VarModEntry> variable_nterm_mods_;
731 std::vector<VarModEntry> variable_cterm_mods_;
732
733 bool mod_tables_initialized_{false};
734
740 bool is_snes_mode_{false};
741
747 bool snes_enabled_{false};
748
751 std::vector<double> snes_sigma_delta_set_;
760 bool snes_zero_sigma_subsets_{false};
761
764 static std::array<double, 128> residue_mass_table_;
765 static std::once_flag mass_table_once_flag_;
767
770 {
771 double b_offset{0.0};
772 double y_offset{0.0};
773 double a_offset{0.0};
774 double c_offset{0.0};
775 double x_offset{0.0};
776 double z_offset{0.0};
777 double zp1_offset{0.0};
778 };
780
798 template <typename FragmentSink>
800 FragmentSink& fragments,
801 FragmentSink& electron_fragments,
802 const char* sequence,
803 size_t seq_len,
804 UInt32 peptide_idx,
805 double n_term_mod_mass,
806 double c_term_mod_mass,
807 const double* residue_masses,
808 const double* residue_mod_masses) const;
809
832 template <typename FragmentSink>
834 FragmentSink& fragments,
835 const char* sequence,
836 size_t seq_len,
837 UInt32 peptide_idx,
838 double n_term_mod_mass,
839 double c_term_mod_mass,
840 const double* residue_masses,
841 const double* residue_mod_masses,
842 bool add_b,
843 bool add_a,
844 bool add_c,
845 bool add_y,
846 bool add_x,
847 bool add_z,
848 bool add_zp1) const;
849
850 std::vector<Peptide> fi_peptides_;
851 std::vector<RemovedOccurrence> removed_occurrences_;
852 std::vector<Fragment> fi_fragments_;
855 std::vector<Fragment> electron_fragments_;
856 std::vector<float> electron_bucket_min_mz_;
857
860 std::vector<uint32_t> protein_lengths_;
861
864 size_t min_ion_index_{0};
865 size_t bucketsize_;
866 std::vector<float> bucket_min_mz_;
867 double precursor_mass_tolerance_lower_{20.0};
868 double precursor_mass_tolerance_upper_{20.0};
869 bool precursor_mass_tolerance_unit_ppm_{true};
871 bool fragment_mz_tolerance_unit_ppm_{true};
872private:
873
874
916 void querySpectrumSNES_(const MSSpectrum& spectrum,
917 const std::vector<FASTAFile::FASTAEntry>& fasta_entries,
919
922 {
923 size_t first;
924 size_t second;
925 size_t cell_offset;
927 };
928
951 const MSSpectrum& spectrum,
952 const std::vector<CandidateBlock_>& blocks,
953 const uint16_t precursor_charge,
954 const bool with_electron_ions);
955
958 static constexpr size_t SKIP_STRIDE_ = 64;
959 size_t skip_per_bucket_{0};
960 std::vector<UInt32> bucket_skip_;
961 std::vector<UInt32> electron_bucket_skip_;
964
975 float precursor_mass,
977 uint16_t charge,
978 bool with_electron_ions);
979
982 void sortAndBucketFragments_(std::vector<Fragment>& fragments,
983 std::vector<float>& bucket_min_mz,
984 int num_threads);
985
989 void trimHits(SpectrumMatchesTopN& init_hits) const;
990
991 //since we work with TheoreticalSpectrumGenerator, we must transfer some of those member variables
999 bool electron_ions_{false};
1000
1001 // SpectrumGenerator independend member variables
1003 EnzymaticDigestion::Specificity enzyme_specificity_{EnzymaticDigestion::SPEC_FULL};
1004
1006 bool isProteinNTerminal_(const std::string& protein, Size start) const;
1007
1008 bool clip_nterm_methionine_ {false};
1014
1018
1019 // Search Related member variables
1020
1028
1030 bool isOpenSearchMode_() const noexcept
1031 {
1032 return isOpenSearchMode(precursor_mass_tolerance_lower_,
1033 precursor_mass_tolerance_upper_,
1034 precursor_mass_tolerance_unit_ppm_);
1035 }
1036
1041 std::pair<float, float> computeMassWindow_(float precursor_mass) const;
1042
1047
1048 };
1049
1050}
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:865
uint16_t min_matched_peaks_
PSM with less hits are discarded.
Definition FragmentIndex.h:1021
UInt32 peptide_idx
index into getPeptides() of the kept entry of the same peptidoform
Definition FragmentIndex.h:189
bool add_x_ions_
Definition FragmentIndex.h:996
void generateFragmentsForSeries_(FragmentSink &fragments, const char *sequence, size_t seq_len, UInt32 peptide_idx, double n_term_mod_mass, double c_term_mod_mass, const double *residue_masses, 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 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 collects the candidate ranges of all isotope errors and loops over all peaks once fo...
Size deduplicateByString_(const std::vector< FASTAFile::FASTAEntry > &fasta_entries)
Keeps the first entry of fi_peptides_ of every reconstructModifiedSequence(...).toString(),...
FragmentIndex & operator=(const FragmentIndex &)=default
AASequence reconstructRealizedSubSequence(const Peptide &mother, const std::vector< FASTAFile::FASTAEntry > &fasta_entries, size_t realized_length, uint32_t subset_bitmask=0) const
uint16_t start
0-based start of the removed entry in that protein
Definition FragmentIndex.h:191
std::vector< UInt32 > electron_bucket_skip_
Definition FragmentIndex.h:961
std::vector< RemovedOccurrence > removed_occurrences_
occurrences removed by peptide:deduplicate (getRemovedOccurrences())
Definition FragmentIndex.h:851
const ResidueModification * mod_ptr
pointer to the modification (for AASequence reconstruction)
Definition FragmentIndex.h:662
static StringList shadowedVariableResidueModifications(const StringList &fixed_modifications, const StringList &variable_modifications)
Variable residue modifications that a fixed modification of the same residue excludes.
bool add_a_ions_
Definition FragmentIndex.h:994
static void sortPeptides_(std::vector< Peptide > &peptides, size_t min_task_size=8192)
Sorts peptides by (precursor_mz_, protein_idx), exactly as std::sort does with that comparator.
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:856
bool add_b_ions_
Definition FragmentIndex.h:992
static bool isOpenSearchMode(double lower_magnitude, double upper_magnitude, bool unit_ppm) noexcept
Definition FragmentIndex.h:316
static IonOffsets ion_offsets_
Definition FragmentIndex.h:779
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:663
void renderPeptidoform_(const Peptide &peptide, const std::vector< FASTAFile::FASTAEntry > &fasta_entries, const PeptidoformRendering_ &rendering, std::vector< uint32_t > &tokens) const
FragmentIndex(const FragmentIndex &)=default
Copy and move operations.
static std::once_flag mass_table_once_flag_
Definition FragmentIndex.h:765
void getProteinOccurrences(Size peptide_idx, const std::vector< FASTAFile::FASTAEntry > &fasta_entries, std::vector< std::pair< UInt32, UInt32 > > &occurrences) const
Appends the protein occurrences {protein index, start} of the residues of getPeptides()[peptide_idx].
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:1015
static void checkFixedModifications(const StringList &fixed_modifications)
Rejects fixed terminal modifications that the index cannot restrict to the peptides they apply to.
static bool isSingleCMother(uint32_t mod_bitmask) noexcept
Definition FragmentIndex.h:402
float fragment_mz_tolerance_
Definition FragmentIndex.h:870
bool add_y_ions_
Definition FragmentIndex.h:993
std::vector< Peptide > fi_peptides_
vector of all (digested) peptides
Definition FragmentIndex.h:850
std::vector< VarModEntry > variable_cterm_mods_
Pure C-terminal variable mods (not residue-specific)
Definition FragmentIndex.h:731
size_t missed_cleavages_
number of missed cleavages
Definition FragmentIndex.h:1009
float fragment_min_mz_
smallest fragment mz
Definition FragmentIndex.h:862
uint16_t min_precursor_charge_
minimal possible precursor charge (usually always 1)
Definition FragmentIndex.h:1024
uint32_t max_processed_hits_
The amount of PSM that will be used. the rest is filtered out.
Definition FragmentIndex.h:1027
static bool isSingleNMother(uint32_t mod_bitmask) noexcept
Definition FragmentIndex.h:407
float peptide_max_mass_
Definition FragmentIndex.h:1011
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:998
void queryPeaks(SpectrumMatchesTopN &candidates, const MSSpectrum &spectrum, const std::vector< CandidateBlock_ > &blocks, const uint16_t precursor_charge, const bool with_electron_ions)
Counts fragment matches for the (isotope error) blocks of ONE precursor charge and appends the surviv...
std::vector< Fragment > electron_fragments_
Definition FragmentIndex.h:855
uint16_t max_fragment_charge_
The maximal possible charge of the fragments.
Definition FragmentIndex.h:1026
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:757
int16_t isotope_error
the applied isotope error
Definition FragmentIndex.h:926
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...
void keepPeptidesInPrecursorWindows_(const MSExperiment &spectra)
bool isOpenSearchMode_() const noexcept
Instance delegate — same rule, reads the member bounds.
Definition FragmentIndex.h:1030
FragmentIndex & operator=(FragmentIndex &&)=default
std::vector< Fragment > fi_fragments_
Definition FragmentIndex.h:852
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:751
int16_t max_isotope_error_
Maximal possible isotope error (both only used for closed search)
Definition FragmentIndex.h:1023
float fragment_max_mz_
largest fragment mz
Definition FragmentIndex.h:863
std::string digestion_enzyme_
Definition FragmentIndex.h:1002
void build(const std::vector< FASTAFile::FASTAEntry > &fasta_entries, const std::function< const MSExperiment *(Size)> &searched_spectra)
Builds the index like build(fasta_entries), but only with the peptides that the spectra to be searche...
void buildSkipTables_()
Fills the skip tables; called by build() once the buckets are sorted.
bool samePeptidoform_(const Peptide &a, const Peptide &b, const std::vector< FASTAFile::FASTAEntry > &fasta_entries, const PeptidoformRendering_ &rendering, std::vector< uint32_t > &tokens_a, std::vector< uint32_t > &tokens_b) const
Whether reconstructModifiedSequence() renders a and b to the same AASequence::toString().
void generateFragmentsLightweight_(FragmentSink &fragments, FragmentSink &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_masses, const double *residue_mod_masses) const
bool isBuild() const
Indicates whether the fragment index has been built.
static StringList shadowedVariableTerminalModifications(const StringList &fixed_modifications, const StringList &variable_modifications)
Variable terminal modifications that a fixed terminal modification excludes.
size_t peptide_max_length_
Definition FragmentIndex.h:1013
~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.
UInt32 protein_idx
protein of the removed entry (index into the FASTA entries passed to build())
Definition FragmentIndex.h:190
PeptidoformRendering_ peptidoformRendering_() const
Rendering classes of the configured modifications. Requires the modification tables (generatePeptides...
bool nonemptyZeroSigmaSubsetExists_() const
Whether a nonempty subset of at most max_variable_mods_per_peptide_ variable modifications has Σ = 0 ...
std::vector< double > snes_sigma_delta_set_with_prot_nterm_
Definition FragmentIndex.h:754
bool hasProteinOccurrences(const std::vector< FASTAFile::FASTAEntry > &fasta_entries) const
Whether getProteinOccurrences() lists every span of the digest that has the residues of an index pept...
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:866
double delta_mass
mass delta from this modification
Definition FragmentIndex.h:661
float peptide_min_mass_
Definition FragmentIndex.h:1010
int16_t min_isotope_error_
Minimal possible isotope error.
Definition FragmentIndex.h:1022
uint16_t max_precursor_charge_
maximal possible precursor charge
Definition FragmentIndex.h:1025
std::vector< UInt32 > bucket_skip_
Definition FragmentIndex.h:960
std::vector< uint32_t > protein_lengths_
Definition FragmentIndex.h:860
void updateMembers_() override
This method is used to update extra member variables at the end of the setParameters() method.
FragmentIndex(FragmentIndex &&)=default
void clear()
Delete fragment index. Sets is_build=false.
StringList modifications_variable_
Variable Modification -> all possible comibnations are created.
Definition FragmentIndex.h:1016
size_t max_variable_mods_per_peptide_
Definition FragmentIndex.h:1017
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...
const std::vector< RemovedOccurrence > & getRemovedOccurrences() const noexcept
The protein occurrences that peptide:deduplicate removed, ordered by RemovedOccurrence::peptide_idx a...
Definition FragmentIndex.h:203
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:417
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:239
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:729
size_t peptide_min_length_
Definition FragmentIndex.h:1012
size_t cell_offset
sum of the range sizes of the preceding blocks of the call
Definition FragmentIndex.h:925
static void initResidueMassTable_()
size_t first
half-open range [first, second) of peptides the precursor could belong to
Definition FragmentIndex.h:923
bool add_c_ions_
Definition FragmentIndex.h:995
FragmentIndex()
Default constructor.
SnesAnchor
Definition FragmentIndex.h:394
bool add_z_ions_
Definition FragmentIndex.h:997
static std::array< double, 128 > residue_mass_table_
Definition FragmentIndex.h:764
size_t second
Definition FragmentIndex.h:924
std::vector< double > computeSnesSigmaDeltaSet_(bool include_prot_nterm_mods, bool include_prot_cterm_mods) const
One (precursor charge, isotope error) block of a queryPeaks() call.
Definition FragmentIndex.h:922
Precomputed ion-type mass offsets (from Residue::getInternalTo*Ion formulas)
Definition FragmentIndex.h:770
A protein occurrence of an indexed peptidoform that peptide:deduplicate removed from the index.
Definition FragmentIndex.h:188
Match between a query peak and an entry in the DB.
Definition FragmentIndex.h:87
Entry in the per-AA variable modification lookup table.
Definition FragmentIndex.h:660
In-Memory representation of a mass spectrometry run.
Definition MSExperiment.h:49
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
OpenMS looks in the< code > OPENMS_THERMO_MANAGED_DIR</code > environment variable first
Definition common-cmake-parameters.doxygen:197
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:548
Fragment(UInt32 peptide_idx, float fragment_mz)
Definition FragmentIndex.h:552
Fragment()
Definition FragmentIndex.h:551
UInt32 peptide_idx_
Definition FragmentIndex.h:556
float fragment_mz_
Definition FragmentIndex.h:557
Definition FragmentIndex.h:424
UInt32 peptide_idx
Definition FragmentIndex.h:429
Hit(UInt32 peptide_idx, float fragment_mz)
Definition FragmentIndex.h:425
float fragment_mz
Definition FragmentIndex.h:430
A candidate modification slot for a specific peptide.
Definition FragmentIndex.h:672
const ResidueModification * mod_ptr
for AASequence reconstruction
Definition FragmentIndex.h:675
uint16_t position
residue index, or NTERM_SLOT/CTERM_SLOT
Definition FragmentIndex.h:673
double delta_mass
mass delta
Definition FragmentIndex.h:674
Definition FragmentIndex.h:68
bool operator==(const Span &) const =default
uint16_t second
Definition FragmentIndex.h:74
Span(std::pair< uint16_t, uint16_t > span)
Definition FragmentIndex.h:70
uint16_t first
Definition FragmentIndex.h:73
Compact descriptor of a peptide instance held by the FragmentIndex.
Definition FragmentIndex.h:52
Peptide()
Leaves the members uninitialised: resizing a vector of peptides then writes nothing (see generatePept...
Definition FragmentIndex.h:55
Span sequence_
{start, length} within the source protein sequence (start is 0-based; length in residues)
Definition FragmentIndex.h:79
uint32_t mod_bitmask_
Bitmask of active variable mod slots (0 = unmodified/fixed-only; up to 32 slots)
Definition FragmentIndex.h:78
UInt32 protein_idx
0-based index into FASTA entries provided to build(); identifies the source protein
Definition FragmentIndex.h:77
float precursor_mz_
Mono-isotopic m/z at charge 1 (M+H)+ of this peptide; used for sorting/filtering.
Definition FragmentIndex.h:80
Peptide(UInt32 protein_idx, uint32_t mod_bitmask, std::pair< uint16_t, uint16_t > sequence, float precursor_mz)
Definition FragmentIndex.h:57
Rendering classes of the configured modifications, for samePeptidoform_() (peptide:deduplicate)
Definition FragmentIndex.h:609
std::vector< std::pair< const ResidueModification *, uint32_t > > mod_class
Modification -> class of its toString(); classes start at 256, above the residue bytes.
Definition FragmentIndex.h:611
uint32_t classOf(const ResidueModification *mod) const
Class of mod (0 for nullptr or a modification not configured)
Definition FragmentIndex.h:622
container for SpectrumMatch. Also keeps count of total number of candidates and total number of match...
Definition FragmentIndex.h:101
SpectrumMatchesTopN & operator+=(const SpectrumMatchesTopN &other)
Appends a SpectrumMatchesTopN to another one.
Definition FragmentIndex.h:111
void clear()
Definition FragmentIndex.h:117
std::vector< SpectrumMatch > hits_
The preliminary candidates.
Definition FragmentIndex.h:102