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

Method fromIdentifications

src/openms/source/METADATA/ExperimentalDesign.cpp:210–253  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

208 }
209
210 ExperimentalDesign ExperimentalDesign::fromIdentifications(const vector <ProteinIdentification> &proteins)
211 {
212 ExperimentalDesign experimental_design;
213 // path of the original MS files (mzML / raw file)
214 StringList ms_run_paths;
215 for (const auto &protein : proteins)
216 {
217 // Due to merging it is valid to have multiple origins in a ProteinIDRun
218 StringList tmp_ms_run_paths;
219 protein.getPrimaryMSRunPath(tmp_ms_run_paths);
220 ms_run_paths.insert(ms_run_paths.end(), tmp_ms_run_paths.begin(), tmp_ms_run_paths.end());
221 //TODO think about uniquifying or warning if duplicates occur
222 }
223
224 // For now and without further info we have to assume a labelfree, unfractionated experiment
225 // no fractionation -> as many fraction_groups as samples
226 // each identification run corresponds to one sample abundance
227 unsigned sample(0);
228 ExperimentalDesign::MSFileSection rows;
229 ExperimentalDesign::SampleSection srows;
230 for (const auto &f : ms_run_paths)
231 {
232 ExperimentalDesign::MSFileSectionEntry r;
233 r.path = f;
234 r.fraction = 1;
235 r.sample = sample;
236 r.sample_name = String(sample);
237 r.fraction_group = sample;
238 r.label = 1;
239
240 rows.push_back(r);
241 srows.addSample(String(sample));
242 ++sample;
243 }
244 experimental_design.setMSFileSection(rows);
245 experimental_design.setSampleSection(srows);
246 OPENMS_LOG_INFO << "Experimental design (Identification derived):\n"
247 << " files: " << experimental_design.getNumberOfMSFiles()
248 << " fractions: " << experimental_design.getNumberOfFractions()
249 << " labels: " << experimental_design.getNumberOfLabels()
250 << " samples: " << experimental_design.getNumberOfSamples() << "\n"
251 << endl;
252 return experimental_design;
253 }
254
255 map<unsigned, vector<String> > ExperimentalDesign::getFractionToMSFilesMapping() const
256 {

Callers

nothing calls this directly

Calls 13

addSampleMethod · 0.80
setMSFileSectionMethod · 0.80
setSampleSectionMethod · 0.80
getNumberOfMSFilesMethod · 0.80
getNumberOfFractionsMethod · 0.80
getNumberOfLabelsMethod · 0.80
getNumberOfSamplesMethod · 0.80
StringClass · 0.50
getPrimaryMSRunPathMethod · 0.45
insertMethod · 0.45
endMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected