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

Method loadSplit

src/openms/source/FORMAT/SwathFile.cpp:31–116  ·  view source on GitHub ↗

Loads a Swath run from a list of split mzML files

Source from the content-addressed store, hash-verified

29
30 /// Loads a Swath run from a list of split mzML files
31 std::vector<OpenSwath::SwathMap> SwathFile::loadSplit(StringList file_list,
32 const String& tmp,
33 boost::shared_ptr<ExperimentalSettings>& exp_meta,
34 const String& readoptions)
35 {
36 int progress = 0;
37 startProgress(0, file_list.size(), "Loading data");
38
39 std::vector<OpenSwath::SwathMap> swath_maps(file_list.size());
40#ifdef _OPENMP
41#pragma omp parallel for
42#endif
43 for (SignedSize i = 0; i < boost::numeric_cast<SignedSize>(file_list.size()); ++i)
44 {
45
46#ifdef _OPENMP
47#pragma omp critical (OPENMS_SwathFile_loadSplit)
48#endif
49 {
50 std::cout << "Loading file " << i << " with name " << file_list[i] << " using readoptions " << readoptions << std::endl;
51 }
52
53 String tmp_fname = "openswath_tmpfile_" + String(i) + ".mzML";
54
55 boost::shared_ptr<PeakMap > exp(new PeakMap);
56 OpenSwath::SpectrumAccessPtr spectra_ptr;
57
58 // Populate meta-data
59 if (i == 0)
60 {
61 exp_meta = populateMetaData_(file_list[i]);
62 }
63
64 if (readoptions == "normal")
65 {
66 MzMLFile().load(file_list[i], *exp.get());
67 spectra_ptr = SimpleOpenMSSpectraFactory::getSpectrumAccessOpenMSPtr(exp);
68 }
69 else if (readoptions == "cache")
70 {
71 // Cache and load the exp (metadata only) file again
72 spectra_ptr = doCacheFile_(file_list[i], tmp, tmp_fname, exp);
73 }
74 else
75 {
76 throw Exception::IllegalArgument(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION,
77 "Unknown option " + readoptions);
78 }
79
80 OpenSwath::SwathMap swath_map;
81
82 bool ms1 = false;
83 double upper = -1, lower = -1, center = -1;
84 if (exp->empty())
85 {
86 std::cerr << "WARNING: File " << file_list[i] << "\n does not have any scans - I will skip it" << std::endl;
87 continue;
88 }

Callers 2

loadSwathFiles_Method · 0.80
START_SECTIONFunction · 0.80

Calls 7

MzMLFileClass · 0.85
getPrecursorsMethod · 0.80
StringClass · 0.50
sizeMethod · 0.45
loadMethod · 0.45
getMethod · 0.45
emptyMethod · 0.45

Tested by 1

START_SECTIONFunction · 0.64