PWIZ_API_DECL void Reader_ABI::read(const string& filename, const string& head, MSData& result, int runIndex, const Config& config) const { try { runIndex++; // one-based index WiffFilePtr wifffile = WiffFile::create(filename); // Loading the experiments is an expensive operation, so cache them. ExperimentsMap experimentsMap; cacheExperiments(wifffile, experimentsMap, runIndex); SpectrumList_ABI* sl = new SpectrumList_ABI(result, wifffile, experimentsMap, runIndex, config); ChromatogramList_ABI* cl = new ChromatogramList_ABI(result, wifffile, experimentsMap, runIndex); result.run.spectrumListPtr = SpectrumListPtr(sl); result.run.chromatogramListPtr = ChromatogramListPtr(cl); fillInMetadata(filename, result, wifffile, experimentsMap, runIndex); } catch (std::exception& e) { throw std::runtime_error(e.what()); } catch (...) { throw runtime_error("[Reader_ABI::read()] unhandled exception"); } }
PWIZ_API_DECL void Reader_ABI::read(const string& filename, const string& head, vector<MSDataPtr>& results, const Config& config) const { try { WiffFilePtr wifffile = WiffFile::create(filename); int sampleCount = wifffile->getSampleCount(); for (int i=1; i <= sampleCount; ++i) { try { MSDataPtr msDataPtr = MSDataPtr(new MSData); MSData& result = *msDataPtr; // Loading the experiments is an expensive operation, so cache them. ExperimentsMap experimentsMap; cacheExperiments(wifffile, experimentsMap, i); SpectrumList_ABI* sl = new SpectrumList_ABI(result, wifffile, experimentsMap, i, config); ChromatogramList_ABI* cl = new ChromatogramList_ABI(result, wifffile, experimentsMap, i); result.run.spectrumListPtr = SpectrumListPtr(sl); result.run.chromatogramListPtr = ChromatogramListPtr(cl); fillInMetadata(filename, result, wifffile, experimentsMap, i); results.push_back(msDataPtr); } catch (exception& e) { // TODO: make this a critical logged warning cerr << "[Reader_ABI::read] Error opening run " << i << " in " << bfs::path(filename).leaf() << ":\n" << e.what() << endl; } } } catch (std::exception& e) { throw std::runtime_error(e.what()); } catch (...) { throw runtime_error("[Reader_ABI::read()] unhandled exception"); } }
PWIZ_API_DECL void Reader_ABI_T2D::read(const string& filename, const string& head, MSData& result, int runIndex, const Config& config) const { if (runIndex != 0) throw ReaderFail("[Reader_ABI_T2D::read] multiple runs not supported"); DataPtr t2d_data = Data::create(filename); fillInSources(filename, result, t2d_data); SpectrumList_ABI_T2D* sl = new SpectrumList_ABI_T2D(result, t2d_data); result.run.spectrumListPtr = SpectrumListPtr(sl); fillInMetadata(filename, result, t2d_data); }