////////////////////////////////////////////////////////
// function to add the elution profile to the feature:
  void FTPeakDetectController::addLCelutionProfile(SHFeature * inF, LCElutionPeak * PEAK)
  {

    ////////////////////////////////
    // get parameters of the peak:
    // apex:
    int apex_scan = PEAK->get_scan_apex();
    double apex_MZ = PEAK->get_apex_MZ();
    double apex_TR = PEAK->get_apex_retention_time();
    float apex_Intensity = (float) PEAK->get_apex_intensity();

    // peak shape:
    float peak_area = (float) PEAK->get_total_peak_area();
    int charge_state = PEAK->get_charge_state();

    // create the class:
    FeatureLCProfile * myProfile = new FeatureLCProfile(apex_MZ, apex_TR, apex_Intensity, apex_scan, charge_state,
                                                        peak_area);

    // add the raw individual mono isotopic peaks peaks:
    SIGNAL_iterator P = PEAK->get_signal_list_start();
    while (P != PEAK->get_signal_list_end())
    {

      MSPeak * MSpeak = &(*P).second;
      myProfile->addMS1elutionSignal(MSpeak->get_MZ(), MSpeak->get_intensity(), MSpeak->get_scan_number(),
                                     MSpeak->get_charge_state(), MSpeak->get_retention_time());
      P++;

    }

    inF->setLCelutionProfile(myProfile);

    myProfile = NULL;
  }
Example #2
0
/////////////////////////////////////////////////////////////////////////////
// merge the target to the search feature
  void MS1FeatureMerger::mergeFeatures(SHFeature * target, SHFeature * toMerge)
  {

    double TOT_AREA = target->get_peak_area() + toMerge->get_peak_area();
    // merge the m/z:
    target->set_MZ(
      (target->get_peak_area() * target->get_MZ() + toMerge->get_peak_area() * toMerge->get_MZ()) / TOT_AREA);
    // merge S/N:
    target->setSignalToNoise(
      (target->getSignalToNoise() * target->get_peak_area() + toMerge->getSignalToNoise() * toMerge->get_peak_area())
      / TOT_AREA);
    // merge score:
    target->set_peak_score(
      (target->get_peak_score() * target->get_peak_area() + toMerge->get_peak_score() * toMerge->get_peak_area())
      / TOT_AREA);

    // merge first the elution profiles:
    FeatureLCProfile * targetLC = target->getLCelutionProfile();
    FeatureLCProfile * mergeLC = toMerge->getLCelutionProfile();

    // add points of the toMerge to the target:
    map<int, MS1Signal>::iterator LC = mergeLC->getLCelutionSignalsStart();
    while (LC != mergeLC->getLCelutionSignalsEnd())
    {
      targetLC->addMS1elutionSignal(&(LC->second));
      ++LC;
    }

    // possible extra info:
    if (target->getFeatureExtraInformation().empty())
    {
      target->setFeatureExtraInformation(toMerge->getFeatureExtraInformation());
    }

    // compute new parameters
    computeNewMS1FeatureParameters(target);

    // copy MS/MS information:
    if (toMerge->get_MS2_info(-3.0))
    {
      target->add_MS2_info(toMerge->get_MS2_SCAN_MAP());
    }

  }