Exemplo n.º 1
0
  //  @Test
  //  public void statMzXMLs() throws IOException
  //  {
  //    root = "/Volumes/PPP_Data/JHU DATA/141112 Project 7_MS2/P7M1/Data-QE/";
  //    //String[] rawfiles =
  // {"20081129_Orbi6_NaNa_SA_FASP_blacktips_01","20081129_Orbi6_NaNa_SA_FASP_blacktips_02"};
  //    String[] rawfiles =
  // {"RC-CS-141112_Medimmune_HD_P7M1_Fr19","RC-CS-141112_Medimmune_HD_P7M1_Fr8"};
  //
  ////    Dataframe test = MsReaders.surveyMzXML(rawfiles, root, "/tmp/survey01",
  // Range.openClosed(20d, 21d), 2);
  //    Dataframe test = MsReaders.surveyMzXML(rawfiles, root, "survey01", null, 2);
  //
  //    IOs.write(root+"surveys.txt", test.display().toString());
  //  }
  //  @Test
  //  public void statMzXMLsByFolder() throws IOException
  //  {
  //    //root = "/Volumes/PPP_Data/JHU DATA/141112 Project 7_MS2/P7M1/Data-QE/";
  //    root = "/Volumes/PPP_Data/JHU DATA/141112 Project 7_MS2/P7M2/";
  //
  //    Dataframe test = MsReaders.surveyMzXML(root, "survey02", null, 2);
  //
  //    IOs.write(root+"surveys.txt", test.display().toString());
  //  }
  //  @Test
  //  public void surveyMzXMLs() throws IOException
  //  {
  //    LcMsMsDataset test = new MaxQuant("survey");
  //    test.setRawFilename(root+"20081129_Orbi6_NaNa_SA_FASP_blacktips_01.mzXML");
  //
  //    test = MsReaders.surveyMzXML(test, null, 2);
  //
  //    // write the examples out in MGF format
  //    Collection<Long> ids = test.getMzRtFileOffset().subset(495.2d, 495.35d, 0d,
  // Double.MAX_VALUE);
  //    RandomAccessFile bin = test.getSpCacheFile(2);
  //    MgfWriter mgf = new MgfWriter(new File("/tmp/examples495_3.mgf"),
  // PeakList.Precision.DOUBLE);
  //    for (Long id : ids)
  //    {
  //      bin.find(id);
  //      MsnSpectrum ms = MsIO.readSpectrumIdentifier(bin, new MsnSpectrum());
  //      mgf.write(ms);
  //    }
  //    mgf.close(); bin.close();
  //
  //    assertEquals(test.getMzRtFileOffset().size(), 36831);
  //  }
  @Test
  public void nextSpec() throws IOException {
    Logger.getLogger(MzxmlReader.class.getName()).setLevel(Level.SEVERE);

    File data = new File(root + "20081129_Orbi6_NaNa_SA_FASP_blacktips_01.mzXML");
    MzxmlReader reader = MzxmlReader.newTolerantReader(data, PeakList.Precision.FLOAT);

    int counts = 0;
    while (reader.hasNext()) {
      MsnSpectrum spec = reader.next();
      if (++counts % 100 == 0) System.out.print(".");
      if (counts % 10000 == 0) System.out.println(counts);
    }
    reader.close();

    System.out.println("\n" + counts + " spectra imported");
  }
Exemplo n.º 2
0
  private MsnSpectrum[] firstScan(String file, int msLevel, int len) throws IOException {
    Logger.getLogger(MzxmlReader.class.getName()).setLevel(Level.SEVERE);

    //    File          data = new File(root+"20081129_Orbi6_NaNa_SA_FASP_blacktips_01.mzXML");
    int order = 0;
    File data = new File(file);
    MsnSpectrum[] spectra = new MsnSpectrum[len];
    MzxmlReader reader = MzxmlReader.newTolerantReader(data, PeakList.Precision.FLOAT);
    while (reader.hasNext()) {
      if (order >= len) break;

      MsnSpectrum spec = reader.next();
      if (spec != null && spec.getMsLevel() == msLevel) {
        spectra[order] = spec;
        order++;
      }
    }
    reader.close();

    return spectra;
  }