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

Method main_

src/topp/MzMLSplitter.cpp:74–179  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

72 }
73
74 ExitCodes main_(int, const char**) override
75 {
76 String in = getStringOption_("in"), out = getStringOption_("out");
77
78 if (out.empty())
79 {
80 out = FileHandler::stripExtension(in);
81 }
82
83 bool no_chrom = getFlag_("no_chrom"), no_spec = getFlag_("no_spec");
84 if (no_chrom && no_spec)
85 {
86 writeLogError_("Error: 'no_chrom' and 'no_spec' cannot be used together");
87 return ILLEGAL_PARAMETERS;
88 }
89
90 Size parts = getIntOption_("parts"), size = getIntOption_("size");
91 if (parts == 1)
92 {
93 if (size == 0)
94 {
95 writeLogError_("Error: Higher value for parameter 'parts' or 'size' required");
96 return ILLEGAL_PARAMETERS;
97 }
98
99 QFile mzml_file(in.toQString());
100 // use float here to avoid too many decimals in output below:
101 float total_size = mzml_file.size();
102 String unit = getStringOption_("unit");
103 if (unit == "KB")
104 total_size /= 1024;
105 else if (unit == "MB")
106 total_size /= (1024 * 1024);
107 else
108 total_size /= (1024 * 1024 * 1024); // "GB"
109
110 writeLogInfo_("File size: " + String(total_size) + " " + unit);
111 parts = ceil(total_size / size);
112 }
113 writeLogInfo_("Splitting file into " + String(parts) + " parts...");
114
115 PeakMap experiment;
116 MzMLFile().load(in, experiment);
117
118 vector<MSSpectrum> spectra;
119 vector<MSChromatogram> chromatograms;
120
121 if (no_spec)
122 {
123 experiment.getSpectra().clear();
124 }
125 else
126 {
127 experiment.getSpectra().swap(spectra);
128 }
129
130 if (no_chrom)
131 {

Callers

nothing calls this directly

Calls 15

MzMLFileClass · 0.85
addDataProcessing_Function · 0.85
getChromatogramsMethod · 0.80
reserveSpaceSpectraMethod · 0.80
addSpectrumMethod · 0.80
StringClass · 0.50
emptyMethod · 0.45
toQStringMethod · 0.45
sizeMethod · 0.45
loadMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected