public bool Equals(IsotopeDistInfo other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return(other._monoisotopicMass.Equals(_monoisotopicMass) && other._adduct == _adduct && ArrayUtil.EqualsDeep(other._expectedDistribution, _expectedDistribution) && other.MonoMassIndex == MonoMassIndex && other.BaseMassIndex == BaseMassIndex); }
// For test purposes public bool IsSimilar(IsotopeDistInfo other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } // ReSharper disable ImpureMethodCallOnReadonlyValueField return(_monoisotopicMass.Equivalent(other._monoisotopicMass) && // Allows comparison of massH and straight mass other._adduct.AdductFormula == _adduct.AdductFormula && ArrayUtil.EqualsDeep(other._expectedDistribution, _expectedDistribution) && other.MonoMassIndex == MonoMassIndex && other.BaseMassIndex == BaseMassIndex); // ReSharper restore ImpureMethodCallOnReadonlyValueField }
private double GetFragmentMass(string seq, IonType type, int ordinal, int? decoyMassShift, int massIndex, IsotopeDistInfo isotopeDists, ExplicitSequenceMods mods) { if (Transition.IsPrecursor(type)) { if (isotopeDists != null) { int i = isotopeDists.MassIndexToPeakIndex(massIndex); if (0 > i || i >= isotopeDists.CountPeaks) { throw new IndexOutOfRangeException( string.Format(Resources.SequenceMassCalc_GetFragmentMass_Precursor_isotope__0__is_outside_the_isotope_distribution__1__to__2__, GetMassIDescripion(massIndex), isotopeDists.PeakIndexToMassIndex(0), isotopeDists.PeakIndexToMassIndex(isotopeDists.CountPeaks - 1))); } return isotopeDists.GetMassI(massIndex, decoyMassShift); } return GetPrecursorMass(seq, mods); } int len = seq.Length - 1; bool nterm = Transition.IsNTerminal(type); double mass = GetTermMass(nterm ? IonType.b : IonType.y, mods) + BioMassCalc.MassProton; int iA = (nterm ? 0 : len); int inc = (nterm ? 1 : -1); var modMasses = GetModMasses(mods); mass += (nterm ? modMasses._aminoNTermModMasses[seq[iA]] : modMasses._aminoCTermModMasses[seq[iA]]); for (int i = 0; i < ordinal; i++) { char aa = seq[iA]; mass += _aminoMasses[aa] + modMasses._aminoModMasses[aa]; if (mods != null && iA < mods.ModMasses.Count) mass += mods.ModMasses[iA]; iA += inc; } mass += GetTermDeltaMass(type); // Exactly match GetFragmentIonMasses() return mass; }
public double GetFragmentMass(IsotopeLabelType labelType, ExplicitMods mods, Transition transition, IsotopeDistInfo isotopeDist) { // Return the singly protonated mass of the peptide fragment, or custom ion mass before electron removal IFragmentMassCalc calc = GetFragmentCalc(labelType, mods); if (calc == null && transition.IsCustom()) { // Small molecules provide their own ion formula, just use the standard calculator calc = GetDefaultFragmentCalc(); } if (calc == null) { Assume.Fail(string.Format("Unable to locate fragment calculator for isotope label type {0} and mods {1}", // Not L10N labelType == null ? "(null)" : labelType.ToString(), // Not L10N mods == null ? "(null)" : mods.ToString())); // Not L10N return 0; // Keep resharper happy } return calc.GetFragmentMass(transition, isotopeDist); }
public double GetFragmentMass(Transition transition, IsotopeDistInfo isotopeDist, ExplicitSequenceMods mods) { if (transition.IsCustom()) { var type = transition.IonType; var massIndex = transition.MassIndex; if (Transition.IsPrecursor(type) && (isotopeDist != null)) { var i = isotopeDist.MassIndexToPeakIndex(massIndex); if (0 > i || i >= isotopeDist.CountPeaks) { throw new IndexOutOfRangeException( string.Format(Resources.SequenceMassCalc_GetFragmentMass_Precursor_isotope__0__is_outside_the_isotope_distribution__1__to__2__, GetMassIDescripion(massIndex), isotopeDist.PeakIndexToMassIndex(0), isotopeDist.PeakIndexToMassIndex(isotopeDist.CountPeaks - 1))); } return isotopeDist.GetMassI(massIndex); } return (MassType == MassType.Average) ? transition.CustomIon.AverageMass : transition.CustomIon.MonoisotopicMass; } return GetFragmentMass(transition.Group.Peptide.Sequence, transition.IonType, transition.Ordinal, transition.DecoyMassShift, transition.MassIndex, isotopeDist, mods); }
public double GetFragmentMass(Transition transition, IsotopeDistInfo isotopeDist) { return GetFragmentMass(transition, isotopeDist, null); }
public double GetFragmentMass(Transition transition, IsotopeDistInfo isotopeDist) { return _massCalcBase.GetFragmentMass(transition, isotopeDist, _mods); }
private static double GetMassDelta(IsotopeDistInfo isotopeDist, int massIndex) { return isotopeDist.GetMassI(massIndex) - isotopeDist.GetMassI(massIndex - 1); }
public bool Equals(IsotopeDistInfo other) { if (ReferenceEquals(null, other)) return false; if (ReferenceEquals(this, other)) return true; return other._monoisotopicMass.Equals(_monoisotopicMass) && other._charge == _charge && ArrayUtil.EqualsDeep(other._expectedDistribution, _expectedDistribution) && other.MonoMassIndex == MonoMassIndex && other.BaseMassIndex == BaseMassIndex; }