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

Method loadMzXML

src/openms/source/FORMAT/SwathFile.cpp:189–244  ·  view source on GitHub ↗

Loads a Swath run from a single mzXML file

Source from the content-addressed store, hash-verified

187
188 /// Loads a Swath run from a single mzXML file
189 std::vector<OpenSwath::SwathMap> SwathFile::loadMzXML(const String& file,
190 const String& tmp,
191 boost::shared_ptr<ExperimentalSettings>& exp_meta,
192 const String& readoptions)
193 {
194 std::cout << "Loading mzXML file " << file << " using readoptions " << readoptions << std::endl;
195 String tmp_fname = "openswath_tmpfile";
196
197 startProgress(0, 1, "Loading metadata file " + file);
198 boost::shared_ptr<PeakMap > experiment_metadata(new PeakMap);
199 MzXMLFile f;
200 f.getOptions().setAlwaysAppendData(true);
201 f.getOptions().setFillData(false);
202 f.load(file, *experiment_metadata);
203 exp_meta = experiment_metadata;
204
205 // First pass through the file -> get the meta data
206 std::cout << "Will analyze the metadata first to determine the number of SWATH windows and the window sizes." << std::endl;
207 std::vector<int> swath_counter;
208 int nr_ms1_spectra;
209 std::vector<OpenSwath::SwathMap> known_window_boundaries;
210 countScansInSwath_(experiment_metadata->getSpectra(), swath_counter, nr_ms1_spectra, known_window_boundaries);
211 std::cout << "Determined there to be " << swath_counter.size() <<
212 " SWATH windows and in total " << nr_ms1_spectra << " MS1 spectra" << std::endl;
213 endProgress();
214
215 FullSwathFileConsumer* dataConsumer;
216 startProgress(0, 1, "Loading data file " + file);
217 if (readoptions == "normal")
218 {
219 dataConsumer = new RegularSwathFileConsumer(known_window_boundaries);
220 MzXMLFile().transform(file, dataConsumer);
221 }
222 else if (readoptions == "cache")
223 {
224 dataConsumer = new CachedSwathFileConsumer(known_window_boundaries, tmp, tmp_fname, nr_ms1_spectra, swath_counter);
225 MzXMLFile().transform(file, dataConsumer);
226 }
227 else if (readoptions == "split")
228 {
229 dataConsumer = new MzMLSwathFileConsumer(known_window_boundaries, tmp, tmp_fname, nr_ms1_spectra, swath_counter);
230 MzXMLFile().transform(file, dataConsumer);
231 }
232 else
233 {
234 throw Exception::IllegalArgument(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION,
235 "Unknown or unsupported option " + readoptions);
236 }
237 OPENMS_LOG_DEBUG << "Finished parsing Swath file " << std::endl;
238 std::vector<OpenSwath::SwathMap> swath_maps;
239 dataConsumer->retrieveSwathMaps(swath_maps);
240 delete dataConsumer;
241
242 endProgress();
243 return swath_maps;
244 }
245
246 /// Loads a Swath run from a single sqMass file

Callers 2

loadSwathFilesMethod · 0.80
loadSwathFiles_Method · 0.80

Calls 5

setAlwaysAppendDataMethod · 0.80
setFillDataMethod · 0.80
loadMethod · 0.45
sizeMethod · 0.45
transformMethod · 0.45

Tested by

no test coverage detected