public IPrecursorMassCalc GetPrecursorCalc(IsotopeLabelType labelType, ExplicitMods mods) { var precursorCalc = TryGetPrecursorCalc(labelType, mods); if (precursorCalc == null) { // Try to track down this exception: // https://skyline.gs.washington.edu/labkey/announcements/home/issues/exceptions/thread.view?entityId=217d79c8-9a84-1032-ae5f-da2025829168&_anchor=19667#row:19667 throw new InvalidDataException( String.Format("unable to locate precursor 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 precursorCalc; }
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); }