예제 #1
0
RichPeakChromatogram get_chrom(int i)
{
  // this is a simulated SRM experiment where the two traces are not sampled at
  // the exact same time points, thus a resampling is necessary before applying
  // the algorithm.
  static const double rtdata_1[] = {1474.34, 1477.11,  1479.88, 1482.64, 1485.41, 1488.19, 1490.95, 1493.72, 1496.48, 1499.25, 1502.03, 1504.8 , 1507.56, 1510.33, 1513.09, 1515.87, 1518.64, 1521.42};
  static const double rtdata_2[] = {1473.55, 1476.31,  1479.08, 1481.84, 1484.61, 1487.39, 1490.15, 1492.92, 1495.69, 1498.45, 1501.23, 1504   , 1506.76, 1509.53, 1512.29, 1515.07, 1517.84, 1520.62};

  static const double intdata_1[] = {3.26958, 3.74189, 3.31075, 86.1901, 3.47528, 387.864, 13281  , 6375.84, 39852.6, 2.66726, 612.747, 3.34313, 793.12 , 3.29156, 4.00586, 4.1591 , 3.23035, 3.90591};
  static const double intdata_2[] = {3.44054, 2142.31, 3.58763, 3076.97, 6663.55, 45681 ,  157694 , 122844 , 86034.7, 85391.1, 15992.8, 2293.94, 6934.85, 2735.18, 459.413, 3.93863, 3.36564, 3.44005};

  RichPeakChromatogram chromatogram;
  for (int k = 0; k < 18; k++)
  {   
    ChromatogramPeak peak;
    if (i == 0)
    {
      peak.setMZ(rtdata_1[k]);
      peak.setIntensity(intdata_1[k]);
    }
    else if (i == 1)
    {
      peak.setMZ(rtdata_2[k]);
      peak.setIntensity(intdata_2[k]);
    }
    chromatogram.push_back(peak);
  } 
  return chromatogram;
  
}
예제 #2
0
void OpenSwathDataAccessHelper::convertToOpenMSChromatogram(OpenMS::MSChromatogram<> & chromatogram, const OpenSwath::ChromatogramPtr cptr)
{
    OpenSwath::BinaryDataArrayPtr rt_arr = cptr->getTimeArray();
    OpenSwath::BinaryDataArrayPtr int_arr = cptr->getIntensityArray();
    chromatogram.reserve(rt_arr->data.size());
    for (Size i = 0; i < rt_arr->data.size(); i++)
    {
        ChromatogramPeak p;
        p.setRT(rt_arr->data[i]);
        p.setIntensity(int_arr->data[i]);
        chromatogram.push_back(p);
    }
}
예제 #3
0
  MSChromatogram<> toChromatogram(const MSSpectrum<>& in)
  {
    MSChromatogram<> out;
    for (Size ic = 0; ic < in.size(); ++ic)
    {
      ChromatogramPeak peak;
      peak.setMZ(in[ic].getMZ());
      peak.setIntensity(in[ic].getIntensity());
      out.push_back(peak);
    }
    out.setChromatogramType(ChromatogramSettings::SELECTED_ION_CURRENT_CHROMATOGRAM);

    return out;
  }
예제 #4
0
  void PeakPickerHiRes::pick(const MSChromatogram& input, MSChromatogram& output, std::vector<PeakBoundary>& boundaries) const
  {
    // copy meta data of the input chromatogram
    output.clear(true);
    output.ChromatogramSettings::operator=(input);
    output.MetaInfoInterface::operator=(input);
    output.setName(input.getName());

    MSSpectrum input_spectrum;
    MSSpectrum output_spectrum;
    for (MSChromatogram::const_iterator it = input.begin(); it != input.end(); ++it)
    {
      Peak1D p;
      p.setMZ(it->getRT());
      p.setIntensity(it->getIntensity());
      input_spectrum.push_back(p);
    }

    pick(input_spectrum, output_spectrum, boundaries, false); // no spacing checks!

    for (MSSpectrum::const_iterator it = output_spectrum.begin(); it != output_spectrum.end(); ++it)
    {
      ChromatogramPeak p;
      p.setRT(it->getMZ());
      p.setIntensity(it->getIntensity());
      output.push_back(p);
    }

    // copy float data arrays (for FWHM)
    output.getFloatDataArrays().resize(output_spectrum.getFloatDataArrays().size());
    for (Size i = 0; i < output_spectrum.getFloatDataArrays().size(); ++i)
    {
      output.getFloatDataArrays()[i].insert(output.getFloatDataArrays()[i].begin(), output_spectrum.getFloatDataArrays()[i].begin(), output_spectrum.getFloatDataArrays()[i].end());
      output.getFloatDataArrays()[i].setName(output_spectrum.getFloatDataArrays()[i].getName());
    }
  }
예제 #5
0
END_SECTION

START_SECTION((PositionType const& getPosition() const))
  TEST_REAL_SIMILAR(ChromatogramPeak().getPosition()[0], 0.0)
END_SECTION

START_SECTION((CoordinateType getRT() const))
  TEST_REAL_SIMILAR(ChromatogramPeak().getRT(), 0.0)
END_SECTION

START_SECTION((CoordinateType getPos() const))
  TEST_REAL_SIMILAR(ChromatogramPeak().getPos(), 0.0)
END_SECTION

START_SECTION((void setIntensity(IntensityType intensity)))
  ChromatogramPeak p;
  p.setIntensity(17.8f);
  TEST_REAL_SIMILAR(p.getIntensity(), 17.8)
END_SECTION

START_SECTION((void setPosition(PositionType const &position)))
  ChromatogramPeak::PositionType pos;
  pos[0] = 1.0;
  ChromatogramPeak p;
  p.setPosition(pos);
  TEST_REAL_SIMILAR(p.getPosition()[0], 1.0)
END_SECTION

START_SECTION((PositionType& getPosition()))
  ChromatogramPeak::PositionType pos;
  pos[0] = 1.0;