35 #ifndef OPENMS_FORMAT_MASCOTGENERICFILE_H
36 #define OPENMS_FORMAT_MASCOTGENERICFILE_H
77 void store(
const String& filename,
const PeakMap& experiment);
80 void store(std::ostream& os,
const String& filename,
const PeakMap& experiment);
89 template <
typename MapType>
99 std::ifstream is(filename.c_str());
101 UInt spectrum_number(0);
106 std::vector<std::pair<String, String> > spec;
108 double pre_mz(0), pre_int(0), rt(-1);
112 typename MapType::SpectrumType spectrum;
113 spectrum.setMSLevel(2);
114 spectrum.getPrecursors().resize(1);
116 UInt thread_spectrum_number(-1);
123 has_next = getNextSpectrum_(is, spec, charge, pre_mz, pre_int, rt, title, line_number);
125 thread_spectrum_number = spectrum_number;
127 if (!has_next)
break;
128 spectrum.resize(spec.size());
130 for (
Size i = 0; i < spec.size(); ++i)
132 p.setPosition(spec[i].first.toDouble());
133 p.setIntensity(spec[i].second.toDouble());
136 spectrum.getPrecursors()[0].setMZ(pre_mz);
137 spectrum.getPrecursors()[0].setIntensity(pre_int);
138 spectrum.getPrecursors()[0].setCharge(charge);
142 spectrum.setMetaValue(
"TITLE", title);
146 spectrum.removeMetaValue(
"TITLE");
149 spectrum.setNativeID(
String(
"index=") + (thread_spectrum_number));
154 exp.addSpectrum(spectrum);
160 exp.sortSpectra(
true);
171 std::pair<String, String> getHTTPPeakListEnclosure(
const String& filename)
const;
176 void writeParameterHeader_(
const String& name, std::ostream& os);
179 void writeHeader_(std::ostream& os);
182 void writeSpectrum_(std::ostream& os,
const PeakSpectrum& spec,
const String& filename);
185 void writeMSExperiment_(std::ostream& os,
const String& filename,
const PeakMap& experiment);
188 bool getNextSpectrum_(std::istream& is, std::vector<std::pair<String, String> >& spectrum,
UInt& charge,
double& precursor_mz,
double& precursor_int,
double& rt,
String& title,
Size& line_number);
193 #endif // OPENMS_FORMAT_MASCOTGENERICFILE_H
A more convenient string class.
Definition: String.h:56
Peak2D PeakType
Definition: MassTrace.h:49
File not found exception.
Definition: Exception.h:524
Mascot input file adapter.
Definition: MascotGenericFile.h:64
static bool exists(const String &file)
Method used to test if a file exists.
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:144
Base class for all classes that want to report their progess.
Definition: ProgressLogger.h:56
A base class for all classes handling default parameters.
Definition: DefaultParamHandler.h:90
void load(const String &filename, MapType &exp)
loads a Mascot Generic File into a PeakMap
Definition: MascotGenericFile.h:90