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

Method transform

src/openms/source/FORMAT/SqMassFile.cpp:35–92  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

33 }
34
35 void SqMassFile::transform(const String& filename_in, Interfaces::IMSDataConsumer* consumer, bool /* skip_full_count */, bool /* skip_first_pass */) const
36 {
37 OpenMS::Internal::MzMLSqliteHandler sql_mass(filename_in, 0);
38 sql_mass.setConfig(config_.write_full_meta, config_.use_lossy_numpress, config_.linear_fp_mass_acc);
39
40 // First pass through the file -> get the meta-data and hand it to the consumer
41 // if (!skip_first_pass) transformFirstPass_(filename_in, consumer, skip_full_count);
42 consumer->setExpectedSize(sql_mass.getNrSpectra(), sql_mass.getNrChromatograms());
43 MSExperiment experimental_settings;
44 sql_mass.readExperiment(experimental_settings, true);
45 consumer->setExperimentalSettings(experimental_settings);
46
47 {
48 int batch_size = 500;
49 std::vector<int> indices;
50 for (size_t batch_idx = 0; batch_idx <= (sql_mass.getNrSpectra() / batch_size); batch_idx++)
51 {
52 int idx_start, idx_end;
53 idx_start = batch_idx * batch_size;
54 idx_end = std::max(batch_idx * (batch_size+1), sql_mass.getNrSpectra());
55
56 indices.resize(idx_end - idx_start);
57 for (int k = 0; k < idx_end-idx_start; k++)
58 {
59 indices[k] = idx_start + k;
60 }
61 std::vector<MSSpectrum> tmp_spectra;
62 sql_mass.readSpectra(tmp_spectra, indices, false);
63 for (Size k = 0; k < tmp_spectra.size(); k++)
64 {
65 consumer->consumeSpectrum(tmp_spectra[k]);
66 }
67 }
68 }
69
70 {
71 int batch_size = 500;
72 std::vector<int> indices;
73 for (size_t batch_idx = 0; batch_idx <= (sql_mass.getNrChromatograms() / batch_size); batch_idx++)
74 {
75 int idx_start, idx_end;
76 idx_start = batch_idx * batch_size;
77 idx_end = std::max(batch_idx * (batch_size+1), sql_mass.getNrChromatograms());
78
79 indices.resize(idx_end - idx_start);
80 for (int k = 0; k < idx_end-idx_start; k++)
81 {
82 indices[k] = idx_start + k;
83 }
84 std::vector<MSChromatogram> tmp_chroms;
85 sql_mass.readChromatograms(tmp_chroms, indices, false);
86 for (Size k = 0; k < tmp_chroms.size(); k++)
87 {
88 consumer->consumeChromatogram(tmp_chroms[k]);
89 }
90 }
91 }
92 }

Callers

nothing calls this directly

Calls 11

readExperimentMethod · 0.80
readSpectraMethod · 0.80
readChromatogramsMethod · 0.80
setExpectedSizeMethod · 0.45
getNrSpectraMethod · 0.45
getNrChromatogramsMethod · 0.45
resizeMethod · 0.45
sizeMethod · 0.45
consumeSpectrumMethod · 0.45
consumeChromatogramMethod · 0.45

Tested by

no test coverage detected