コード例 #1
0
ファイル: IDMapper.C プロジェクト: BioITer/OpenMS
  void IDMapper::getIDDetails_(const PeptideIdentification & id, DoubleReal & rt_pep, DoubleList & mz_values, IntList & charges, bool use_avg_mass) const
  {
    mz_values.clear();
    charges.clear();

    rt_pep = id.getMetaValue("RT");

    // collect m/z values of pepId
    if (param_.getValue("mz_reference") == "precursor") // use precursor m/z of pepId
    {
      mz_values.push_back(id.getMetaValue("MZ"));
    }

    for (vector<PeptideHit>::const_iterator hit_it = id.getHits().begin();
         hit_it != id.getHits().end(); ++hit_it)
    {
      Int charge = hit_it->getCharge();
      charges.push_back(charge);

      if (param_.getValue("mz_reference") == "peptide") // use mass of each pepHit (assuming H+ adducts)
      {
        DoubleReal mass = use_avg_mass ?
                          hit_it->getSequence().getAverageWeight(Residue::Full, charge) :
                          hit_it->getSequence().getMonoWeight(Residue::Full, charge);

        mz_values.push_back( mass / (DoubleReal) charge);
      }
    }
  }
コード例 #2
0
ファイル: IDFilter.C プロジェクト: aiche/open-ms-mirror
  void IDFilter::filterIdentificationsByMzError(const PeptideIdentification& identification, DoubleReal mass_error, bool unit_ppm, PeptideIdentification& filtered_identification)
  {
    vector<PeptideHit> hits;
    filtered_identification = identification;
    vector<PeptideHit> temp_hits = identification.getHits();

    for (vector<PeptideHit>::iterator it = temp_hits.begin(); it != temp_hits.end(); ++it)
    {
      Int charge = it->getCharge();

      if (charge == 0)
      {
        charge = 1;
      }

      DoubleReal exp_mz = (DoubleReal)identification.getMetaValue("MZ");
      DoubleReal theo_mz =  (it->getSequence().getMonoWeight() + (DoubleReal)charge * Constants::PROTON_MASS_U) / (DoubleReal)charge;
      DoubleReal error(exp_mz - theo_mz);

      if (unit_ppm)
      {
        error = error / theo_mz * (DoubleReal)1e6;
      }

      if (fabs(error) <= mass_error)
      {
        hits.push_back(*it);
      }
    }
    filtered_identification.setHits(hits);
  }
コード例 #3
0
ファイル: IDFilter.C プロジェクト: aiche/open-ms-mirror
  bool IDFilter::filterIdentificationsByMetaValueRange(const PeptideIdentification& identification, const String& key, DoubleReal low, DoubleReal high, bool missing)
  {
    if (!identification.metaValueExists(key)) return missing;

    DoubleReal value = identification.getMetaValue(key);
    return (value >= low) && (value <= high);
  }