コード例 #1
0
 @Override
 public double getPrecursorMass(int charge) {
   double chargeRatio = getMassChargeRatio();
   double protonMass = XTandemUtilities.getProtonMass();
   final double ret = ((chargeRatio - protonMass) * charge) + protonMass;
   return ret;
   // return getMassChargeRatio() * getPrecursorCharge();
 }
コード例 #2
0
 /**
  * return true if a mass such as that of a throretical peak is within the range to scpre
  *
  * @param mass positive testMass
  * @return as above
  */
 @Override
 public boolean isMassWithinRange(double mass, int charge, IScoringAlgorithm alg) {
   if (m_PrecursorCharge == 0) {
     // try charge 2
     double test1 =
         (getMassChargeRatio() - XTandemUtilities.getProtonMass()) * 2
             + XTandemUtilities.getProtonMass();
     if (alg.isWithinLimits(test1, mass, 0)) return true;
     // try charge 3
     double test2 =
         (getMassChargeRatio() - XTandemUtilities.getProtonMass()) * 3
             + XTandemUtilities.getProtonMass();
     if (alg.isWithinLimits(test2, mass, 0)) return true;
     // try charge 1 -NOTE THIS IS NEW
     double test3 = getMassChargeRatio();
     if (alg.isWithinLimits(test3, mass, 0)) return true;
     return false; // give up
   } else {
     double test = getPrecursorMass();
     boolean withinLimits = alg.isWithinLimits(test, mass, m_PrecursorCharge);
     if (withinLimits) return true;
     return false; // give up
   }
 }
コード例 #3
0
 public static double chargeRatioFromMass(double mass, int charge) {
   double protonMass = XTandemUtilities.getProtonMass();
   return ((mass - protonMass) / charge) + protonMass;
 }