Beispiel #1
0
 virtual void read(const std::string& filename,
                   const std::string& head,
                   std::vector<MSDataPtr>& results) const
 {
     results.push_back(MSDataPtr(new MSData));
     read(filename, head, *results.back());
 }
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");
    }
}