38 #include <OpenMS/config.h>
47 #include <boost/random/mersenne_twister.hpp>
92 residue((
Residue::ResidueType) 0),
100 residue(local_residue),
108 residue(rhs.residue),
133 return charge < rhs.
charge;
214 return mp_.ion_types;
249 inline void scaleSingleFeature_(
double & value,
double feature_min,
double feature_max,
double lower = -1.0,
double upper = 1.0);
272 if (feature_max == feature_min)
277 if (value <= feature_min)
281 else if (value >= feature_max)
287 value = lower + (upper - lower) *
288 (value - feature_min) /
289 (feature_max - feature_min);
294 std::cerr <<
"negative value!! " << value <<
" l: " << lower <<
" u: " << upper <<
" fm: " << feature_min <<
" fma: " << feature_max <<
" prev: " << prev << std::endl;
Representation of a peptide/protein sequence.
Definition: AASequence.h:112
A base class for all classes handling default parameters.
Definition: DefaultParamHandler.h:93
The representation of a 1D spectrum.
Definition: MSSpectrum.h:70
Representation of a residue.
Definition: Residue.h:63
ResidueType
Definition: Residue.h:152
A more convenient string class.
Definition: String.h:60
Train SVM models that are used by SvmTheoreticalSpectrumGenerator.
Definition: SvmTheoreticalSpectrumGeneratorTrainer.h:67
Simulates MS2 spectra with support vector machines.
Definition: SvmTheoreticalSpectrumGenerator.h:73
void scaleSingleFeature_(double &value, double feature_min, double feature_max, double lower=-1.0, double upper=1.0)
scale value to the interval [lower,max] given the maximal and minimal entries for a feature
Definition: SvmTheoreticalSpectrumGenerator.h:269
const std::vector< IonType > & getIonTypes() const
return the set of ion types that are modeled by the loaded SVMs
Definition: SvmTheoreticalSpectrumGenerator.h:212
double scaling_upper
Definition: SvmTheoreticalSpectrumGenerator.h:173
String ResidueTypeToString_(Residue::ResidueType type)
Returns the ResidueType (e.g. AIon, BIon) as string for peak annotation.
static std::map< String, double > basicity_
basicity values for each AA
Definition: SvmTheoreticalSpectrumGenerator.h:243
std::vector< svm_node > DescriptorSetType
Definition: SvmTheoreticalSpectrumGenerator.h:221
void simulate(PeakSpectrum &spectrum, const AASequence &peptide, boost::random::mt19937_64 &rng, Size precursor_charge)
Generate the MS/MS according to the given probabilistic model.
std::vector< double > intensity_bin_values
Definition: SvmTheoreticalSpectrumGenerator.h:179
std::map< Residue::ResidueType, double > static_intensities
Definition: SvmTheoreticalSpectrumGenerator.h:149
SvmModelParameterSet mp_
set of model parameters read from model file
Definition: SvmTheoreticalSpectrumGenerator.h:231
Size number_regions
Definition: SvmTheoreticalSpectrumGenerator.h:161
std::vector< double > feature_max
Definition: SvmTheoreticalSpectrumGenerator.h:164
std::vector< boost::shared_ptr< SVMWrapper > > reg_models
Definition: SvmTheoreticalSpectrumGenerator.h:146
double scaling_lower
Definition: SvmTheoreticalSpectrumGenerator.h:170
DescriptorSetType descriptors
Definition: SvmTheoreticalSpectrumGenerator.h:222
std::map< std::pair< IonType, Size >, std::vector< std::vector< double > > > conditional_prob
Definition: SvmTheoreticalSpectrumGenerator.h:182
static std::map< String, Size > aa_to_index_
map AA to integers
Definition: SvmTheoreticalSpectrumGenerator.h:234
Size generateDescriptorSet_(AASequence peptide, Size position, IonType type, Size precursor_charge, DescriptorSet &desc_set)
generate the descriptors for an input peptide and a given fragmentation position
std::map< IonType, std::vector< IonType > > secondary_types
Definition: SvmTheoreticalSpectrumGenerator.h:155
void load()
Load a trained Svm and Prob. models.
void scaleDescriptorSet_(DescriptorSet &desc, double lower, double upper)
scale value to the interval [lower,max] given the maximal and minimal entries for a feature
std::vector< double > feature_min
Definition: SvmTheoreticalSpectrumGenerator.h:167
SvmTheoreticalSpectrumGenerator(const SvmTheoreticalSpectrumGenerator &source)
Copy constructor.
std::vector< double > intensity_bin_boarders
Definition: SvmTheoreticalSpectrumGenerator.h:176
static std::map< String, double > hydrophobicity_
hydrophobicity values for each AA
Definition: SvmTheoreticalSpectrumGenerator.h:237
static bool initializedMaps_
flag to indicate if the hydrophobicity, helicity, and basicity maps were already initialized
Definition: SvmTheoreticalSpectrumGenerator.h:264
static void initializeMaps_()
initialized the maps
Size precursor_charge_
charge of the precursors used for training
Definition: SvmTheoreticalSpectrumGenerator.h:228
Size number_intensity_levels
Definition: SvmTheoreticalSpectrumGenerator.h:158
SvmTheoreticalSpectrumGenerator & operator=(const SvmTheoreticalSpectrumGenerator &tsg)
Assignment operator.
void updateMembers_() override
This method is used to update extra member variables at the end of the setParameters() method.
std::map< IonType, double > IntensityMap
Definition: SvmTheoreticalSpectrumGenerator.h:225
static std::map< String, double > helicity_
helicity values for each AA
Definition: SvmTheoreticalSpectrumGenerator.h:240
std::vector< boost::shared_ptr< SVMWrapper > > class_models
Definition: SvmTheoreticalSpectrumGenerator.h:143
~SvmTheoreticalSpectrumGenerator() override
Destructor.
std::map< IonType, bool > hide_type_
whether ion types are hidden or not
Definition: SvmTheoreticalSpectrumGenerator.h:246
SvmTheoreticalSpectrumGenerator()
Default constructor.
std::vector< IonType > ion_types
Definition: SvmTheoreticalSpectrumGenerator.h:152
A set of descriptors for a single training row.
Definition: SvmTheoreticalSpectrumGenerator.h:220
Simple container storing the model parameters required for simulation.
Definition: SvmTheoreticalSpectrumGenerator.h:141
int Int
Signed integer type.
Definition: Types.h:102
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:127
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
nested class
Definition: SvmTheoreticalSpectrumGenerator.h:83
Int charge
Definition: SvmTheoreticalSpectrumGenerator.h:86
IonType()
Definition: SvmTheoreticalSpectrumGenerator.h:91
bool operator<(const IonType &rhs) const
Definition: SvmTheoreticalSpectrumGenerator.h:126
IonType & operator=(const IonType &rhs)
Definition: SvmTheoreticalSpectrumGenerator.h:115
IonType(const IonType &rhs)
Definition: SvmTheoreticalSpectrumGenerator.h:107
EmpiricalFormula loss
Definition: SvmTheoreticalSpectrumGenerator.h:85
IonType(Residue::ResidueType local_residue, EmpiricalFormula local_loss=EmpiricalFormula(), Int local_charge=1)
Definition: SvmTheoreticalSpectrumGenerator.h:99
Residue::ResidueType residue
Definition: SvmTheoreticalSpectrumGenerator.h:84