Пример #1
0
    virtual void read(const std::string& filename, const std::string& head, MSData& result, int runsIndex = 0) const
    {
        if (runsIndex != 0)
            throw ReaderFail("[Reader_mzXML::read] multiple runs not supported");

        shared_ptr<istream> is(new pwiz::util::random_access_compressed_ifstream(filename.c_str()));
        if (!is.get() || !*is)
            throw runtime_error(("[Reader_mzXML::read] Unable to open file " + filename).c_str());

        try
        {
            // assume there is a scan index
            Serializer_mzXML serializer;
            serializer.read(is, result);
            fillInCommonMetadata(filename, result);
            result.fileDescription.sourceFilePtrs.back()->set(MS_scan_number_only_nativeID_format);
            result.fileDescription.sourceFilePtrs.back()->set(MS_ISB_mzXML_file);
            return;
        }
        catch (SpectrumList_mzXML::index_not_found&)
        {}

        // error looking for index -- try again, but generate index
        is->seekg(0);
        Serializer_mzXML::Config config;
        config.indexed = false;
        Serializer_mzXML serializer(config);
        serializer.read(is, result);
        fillInCommonMetadata(filename, result);
        result.fileDescription.sourceFilePtrs.back()->set(MS_scan_number_only_nativeID_format);
        result.fileDescription.sourceFilePtrs.back()->set(MS_ISB_mzXML_file);
        return;
    }
Пример #2
0
  virtual void read(const string& filename, const string& head, MSData& result, int runIndex = 0) const
  {
      if (runIndex != 0)
          throw ReaderFail("[Reader_MSn::read] multiple runs not supported");
      
      MSn_Type filetype = MSn_Type_UNKNOWN;
      if( (bal::to_lower_copy(bfs::extension(filename)) == ".ms2" )){
        filetype = MSn_Type_MS2;
      }else if( (bal::to_lower_copy(bfs::extension(filename)) == ".cms2" )){
        filetype = MSn_Type_CMS2;
      }else if( (bal::to_lower_copy(bfs::extension(filename)) == ".bms2" )){
        filetype = MSn_Type_BMS2;
      }

     shared_ptr<istream> is(new pwiz::util::random_access_compressed_ifstream(filename.c_str()));
     if (!is.get() || !*is)
       throw runtime_error(("[Reader_MSn::read] Unable to open file " + filename));

     Serializer_MSn serializer(filetype);
     serializer.read(is, result);
     fillInCommonMetadata(filename, result);
     result.fileDescription.sourceFilePtrs.back()->set(MS_scan_number_only_nativeID_format);
     result.fileDescription.sourceFilePtrs.back()->set(MS_MS2_file);
     return;
  }
Пример #3
0
    virtual void read(const std::string& filename, const std::string& head, MSData& result, int runIndex = 0) const
    {
        if (runIndex != 0)
            throw ReaderFail("[Reader_mzML::read] multiple runs not supported");

        shared_ptr<istream> is(new pwiz::util::random_access_compressed_ifstream(filename.c_str()));
        if (!is.get() || !*is)
            throw runtime_error(("[Reader_mzML::read] Unable to open file " + filename).c_str());

        switch (type(*is))
        {
            case Type_mzML:
            {
                Serializer_mzML::Config config;
                config.indexed = false;
                Serializer_mzML serializer(config);
                serializer.read(is, result);
                break;
            }
            case Type_mzML_Indexed:
            {
                Serializer_mzML serializer;
                serializer.read(is, result);
                break;
            }
            case Type_Unknown:
            default:
            {
                throw runtime_error("[MSDataFile::Reader_mzML] This isn't happening.");
            }
        }

        fillInCommonMetadata(filename, result);
    }
Пример #4
0
    virtual void read(const std::string& filename, const std::string& head, TraData& result, int documentIndex = 0) const
    {
        if (documentIndex != 0)
            throw ReaderFail("[Reader_traML::read] multiple documents not supported");

		shared_ptr<istream> is(new pwiz::util::random_access_compressed_ifstream(filename.c_str()));
        if (!is.get() || !*is)
            throw runtime_error(("[Reader_traML::read] Unable to open file " + filename).c_str());

       switch (type(*is))
        {
            case Type_traML:
            {
                Serializer_traML serializer;
                serializer.read(is, result);
                break;
            }
            case Type_Unknown:
            default:
            {
                throw runtime_error("[Reader_traML::read] This isn't happening.");
            }
        }

       fillInCommonMetadata(filename, result);
    }
Пример #5
0
    virtual void read(const string& filename, const string& head, MSData& result, int runIndex = 0) const
    {
        if (runIndex != 0)
            throw ReaderFail("[Reader_MGF::read] multiple runs not supported");

        shared_ptr<istream> is(new pwiz::util::random_access_compressed_ifstream(filename.c_str()));
        if (!is.get() || !*is)
            throw runtime_error(("[Reader_MGF::read] Unable to open file " + filename));

        Serializer_MGF serializer;
        serializer.read(is, result);
        fillInCommonMetadata(filename, result);
        result.fileDescription.sourceFilePtrs.back()->set(MS_multiple_peak_list_nativeID_format);
        result.fileDescription.sourceFilePtrs.back()->set(MS_Mascot_MGF_file);
        return;
    }