MCPcopy Create free account
hub / github.com/OpenMS/OpenMS / main

Function main

doc/code_examples/Tutorial_TheoreticalSpectrumGenerator.cpp:16–54  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14using namespace std;
15
16int main()
17{
18 // initialize a TheoreticalSpectrumGenerator
19 TheoreticalSpectrumGenerator tsg;
20
21 // get current parameters
22 // in this case default parameters, since we have not changed any yet
23 Param tsg_settings = tsg.getParameters();
24
25 // with default parameters, only b- and y-ions are generated,
26 // so we will add a-ions
27 tsg_settings.setValue("add_a_ions", "true");
28
29 // store ion types for each peak
30 tsg_settings.setValue("add_metainfo", "true");
31
32 // set the changed parameters for the TSG
33 tsg.setParameters(tsg_settings);
34
35
36 PeakSpectrum theoretical_spectrum;
37
38 // initialize peptide to be fragmented
39 AASequence peptide = AASequence::fromString("DEFIANGER");
40
41 // generate a-, b- and y- ion spectrum of the peptide
42 // with all fragment charges from 1 to 2
43 tsg.getSpectrum(theoretical_spectrum, peptide, 1, 2);
44
45 // output of masses and meta information (ion-types) of some peaks
46 const PeakSpectrum::StringDataArray& ion_types = theoretical_spectrum.getStringDataArrays().at(0);
47 cout << "Mass of second peak: " << theoretical_spectrum[1].getMZ()
48 << " | Ion type of second peak: " << ion_types[1] << endl;
49
50 cout << "Mass of tenth peak: " << theoretical_spectrum[9].getMZ()
51 << " | Ion type of tenth peak: " << ion_types[9] << endl;
52
53 return 0;
54} //end of main
55
56//! [TSG]

Callers

nothing calls this directly

Calls 6

setParametersMethod · 0.80
atMethod · 0.80
getParametersMethod · 0.45
setValueMethod · 0.45
getSpectrumMethod · 0.45
getMZMethod · 0.45

Tested by

no test coverage detected