16 #include <boost/dynamic_bitset.hpp>
184 double logMz = -1000;
190 bool is_positive =
true;
192 int isotopeIndex = -1;
227 explicit Tag(
String seq,
double n_mass,
double c_mass, std::vector<double>& mzs, std::vector<int>& scores,
int scan);
268 const std::vector<double>&
getMzs()
const;
272 double n_mass_ = -1, c_mass_ = -1;
287 explicit DAG(
Size vertice_count): vertex_count_(vertice_count)
293 return vertex_count_;
298 if (vertex1 >= vertex_count_ || vertex2 >= vertex_count_)
return false;
299 if (! visited[vertex2])
return false;
300 visited[vertex1] =
true;
301 adj_list_for_speed_up_[vertex2].insert(vertex1);
307 auto iter = adj_list_for_speed_up_.find(vertex2);
308 if (iter == adj_list_for_speed_up_.end())
return false;
309 return iter->second.find(vertex1) != iter->second.end();
314 std::unordered_set<Size> visited;
315 std::vector<Size> path;
317 if (adj_list_.empty())
319 for (
const auto& [v2, vertices] : adj_list_for_speed_up_)
321 for (
const auto& v1 : vertices)
323 adj_list_[v1].push_back(v2);
326 for (
auto& v : adj_list_)
328 std::sort(v.second.begin(), v.second.end());
332 findAllPaths_(source, sink, visited, path, all_paths, max_count);
342 std::unordered_set<Size>& visited,
343 std::vector<Size>& path,
344 std::vector<std::vector<Size>>& all_paths,
347 if (max_count > 0 && all_paths.size() >= max_count)
return;
349 visited.insert(current);
350 path.push_back(current);
352 if (current == destination) { all_paths.push_back(path);}
355 for (
Size i : adj_list_[current])
357 if (visited.find(i) == visited.end()) { findAllPaths_(i, destination, visited, path, all_paths, max_count); }
363 visited.erase(current);
Isotope pattern generator for coarse isotope distributions.
Definition: CoarseIsotopePatternGenerator.h:79
Definition: FLASHHelperClasses.h:282
std::unordered_map< Size, std::unordered_set< Size > > adj_list_for_speed_up_
Definition: FLASHHelperClasses.h:339
void findAllPaths(Size source, Size sink, std::vector< std::vector< Size >> &all_paths, Size max_count)
Definition: FLASHHelperClasses.h:312
Size vertex_count_
Definition: FLASHHelperClasses.h:336
bool addEdge(Size vertex1, Size vertex2, boost::dynamic_bitset<> &visited)
Definition: FLASHHelperClasses.h:296
std::map< Size, std::vector< Size > > adj_list_
Definition: FLASHHelperClasses.h:338
bool hasEdge(Size vertex1, Size vertex2) const
Definition: FLASHHelperClasses.h:305
DAG(Size vertice_count)
Definition: FLASHHelperClasses.h:287
Size size() const
Definition: FLASHHelperClasses.h:291
DAG()
Definition: FLASHHelperClasses.h:284
void findAllPaths_(Size current, Size destination, std::unordered_set< Size > &visited, std::vector< Size > &path, std::vector< std::vector< Size >> &all_paths, Size max_count)
Definition: FLASHHelperClasses.h:340
log transformed peak. After deconvolution, all necessary information from deconvolution such as charg...
Definition: FLASHHelperClasses.h:177
bool operator>(const LogMzPeak &a) const
bool operator<(const LogMzPeak &a) const
log mz values are compared
LogMzPeak(const Peak1D &peak, bool positive)
constructor from Peak1D.
LogMzPeak()=default
default constructor
bool operator==(const LogMzPeak &other) const
LogMzPeak(const LogMzPeak &)=default
copy constructor
~LogMzPeak()=default
destructor
double getUnchargedMass() const
Averagine patterns pre-calculated for speed up. Other variables are also calculated for fast cosine c...
Definition: FLASHHelperClasses.h:35
Size getApexIndex(double mass) const
get index of most abundant isotope. If input mass exceeds the maximum mass (specified in constructor)...
double getSNRMultiplicationFactor(double mass) const
void setMaxIsotopeIndex(int index)
set max isotope index
std::vector< double > norms_
L2 norms_ for masses.
Definition: FLASHHelperClasses.h:40
std::vector< double > average_mono_mass_difference_
mass differences between average mass and monoisotopic mass
Definition: FLASHHelperClasses.h:42
PrecalculatedAveragine(double min_mass, double max_mass, double delta, CoarseIsotopePatternGenerator &generator, bool use_RNA_averagine, double decoy_iso_distance=-1, bool is_centroid=true)
constructor with parameters such as mass ranges and bin size.
PrecalculatedAveragine()=default
default constructor
Size max_isotope_index_
max isotope index
Definition: FLASHHelperClasses.h:55
PrecalculatedAveragine & operator=(PrecalculatedAveragine &&pc) noexcept=default
move assignment operator
size_t getMaxIsotopeIndex() const
get max isotope index
Size getRightCountFromApex(double mass) const
double min_mass_
min mass for calculation
Definition: FLASHHelperClasses.h:59
double getAverageMassDelta(double mass) const
double mass_interval_
mass interval for calculation
Definition: FLASHHelperClasses.h:57
PrecalculatedAveragine & operator=(const PrecalculatedAveragine &pc)=default
copy assignment operator
Size massToIndex_(double mass) const
calculate the mass bin index from mass
double getMostAbundantMassDelta(double mass) const
std::vector< double > abundant_mono_mass_difference_
mass differences between most abundant mass and monoisotopic mass
Definition: FLASHHelperClasses.h:44
std::vector< double > snr_mul_factor_
Definition: FLASHHelperClasses.h:46
~PrecalculatedAveragine()=default
destructor
Size getLastIndex(double mass) const
get index of last isotope. If input mass exceeds the maximum mass (specified in constructor),...
IsotopeDistribution get(double mass) const
get distribution for input mass. If input mass exceeds the maximum mass (specified in constructor),...
std::vector< IsotopeDistribution > isotopes_
isotope distributions for different (binned) masses
Definition: FLASHHelperClasses.h:38
std::vector< Size > apex_index_
most abundant isotope index
Definition: FLASHHelperClasses.h:52
std::vector< int > left_count_from_apex_
Isotope start indices: isotopes of the indices less than them have very low intensities.
Definition: FLASHHelperClasses.h:48
PrecalculatedAveragine(PrecalculatedAveragine &&other) noexcept=default
move constructor
PrecalculatedAveragine(const PrecalculatedAveragine &)=default
copy constructor
std::vector< int > right_count_from_apex_
Isotope end indices: isotopes of the indices larger than them have very low intensities.
Definition: FLASHHelperClasses.h:50
Size getLeftCountFromApex(double mass) const
Sequence tag. No mass gap is allowed in the seq. The mass gap containing tag should be enumerated int...
Definition: FLASHHelperClasses.h:224
double getCtermMass() const
int scan_
Definition: FLASHHelperClasses.h:276
String seq_
Definition: FLASHHelperClasses.h:271
int getIndex() const
Definition: FLASHHelperClasses.h:247
void setRetentionTime(float i)
Definition: FLASHHelperClasses.h:261
float getRetentionTime() const
Definition: FLASHHelperClasses.h:256
std::vector< int > scores_
Definition: FLASHHelperClasses.h:275
void setIndex(int i)
Definition: FLASHHelperClasses.h:252
Size length_
Definition: FLASHHelperClasses.h:278
const String & getUppercaseSequence() const
const std::vector< double > & getMzs() const
const String & getSequence() const
double getNtermMass() const
int index_
Definition: FLASHHelperClasses.h:277
Tag(const Tag &)=default
copy constructor
bool operator<(const Tag &a) const
std::vector< double > mzs_
Definition: FLASHHelperClasses.h:274
bool operator>(const Tag &a) const
bool operator==(const Tag &other) const
int getScore(int pos) const
Tag(String seq, double n_mass, double c_mass, std::vector< double > &mzs, std::vector< int > &scores, int scan)
constructor
Definition: IsotopeDistribution.h:39
A container type that gathers peaks similar in m/z and moving along retention time.
Definition: MassTrace.h:36
A 1-dimensional raw data point or peak.
Definition: Peak1D.h:28
A more convenient string class.
Definition: String.h:34
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:97
FLASHIda C++ to C# (or vice versa) bridge functions The functions here are called in C# to invoke fun...
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19
Isobaric quantities.
Definition: FLASHHelperClasses.h:163
int scan
Definition: FLASHHelperClasses.h:165
std::vector< double > quantities
Definition: FLASHHelperClasses.h:169
std::vector< double > merged_quantities
Definition: FLASHHelperClasses.h:170
double precursor_mass
Definition: FLASHHelperClasses.h:168
double rt
Definition: FLASHHelperClasses.h:166
double precursor_mz
Definition: FLASHHelperClasses.h:167
Mass feature (Deconvolved masses in spectra are traced by Mass tracing to generate mass features - li...
Definition: FLASHHelperClasses.h:131
bool operator<(const MassFeature &a) const
features are compared
Definition: FLASHHelperClasses.h:147
double avg_mass
Definition: FLASHHelperClasses.h:140
std::vector< float > per_charge_intensity
Definition: FLASHHelperClasses.h:136
uint index
feature index;
Definition: FLASHHelperClasses.h:134
bool operator>(const MassFeature &a) const
Definition: FLASHHelperClasses.h:151
bool is_decoy
Definition: FLASHHelperClasses.h:144
int iso_offset
Definition: FLASHHelperClasses.h:138
std::vector< float > per_isotope_intensity
Definition: FLASHHelperClasses.h:137
uint ms_level
Definition: FLASHHelperClasses.h:145
double rep_mz
Definition: FLASHHelperClasses.h:143
MassTrace mt
Definition: FLASHHelperClasses.h:135
bool operator==(const MassFeature &other) const
Definition: FLASHHelperClasses.h:155
int charge_count
Definition: FLASHHelperClasses.h:141
double isotope_score
Definition: FLASHHelperClasses.h:142
int max_scan_number
Definition: FLASHHelperClasses.h:139
Wrapper struct for all the structs needed by the FLASHDeconv Three structures are defined: Precalcula...
Definition: FLASHHelperClasses.h:32
static double getLogMz(double mz, bool positive)
calculate log mzs from mzs
static float getChargeMass(bool positive_ioniziation_mode)
get charge carrier mass : positive mode mass of (Constants::PROTON_MASS_U) and negative mode mass of ...