public IFragmentMassCalc GetFragmentCalc(IsotopeLabelType labelType, ExplicitMods mods) { var massCalcBase = GetBaseCalc(labelType, mods, _fragmentMassCalcs); if (massCalcBase != null) { // If this type is not explicitly modified, then it must be // heavy with explicit light modifications. if (!mods.IsModified(labelType)) labelType = IsotopeLabelType.light; if (!labelType.IsLight && !mods.HasModifications(labelType)) return null; return new ExplicitSequenceMassCalc(mods, massCalcBase, labelType); } return GetMassCalc(labelType, _fragmentMassCalcs); }
public RelativeRT GetRelativeRT(IsotopeLabelType labelType, string seq, ExplicitMods mods) { if (labelType.IsLight) return RelativeRT.Matching; // Default is matching RelativeRT relativeRT = RelativeRT.Matching; // One unkown modification makes everything unknown // One preceding modification with no unknowns make relative RT preceding // Overlapping overrides matching if (mods != null && mods.IsModified(labelType)) { foreach (var mod in mods.GetModifications(labelType)) { if (mod.Modification.RelativeRT == RelativeRT.Unknown) return RelativeRT.Unknown; if (mod.Modification.RelativeRT == RelativeRT.Preceding) relativeRT = RelativeRT.Preceding; else if (mod.Modification.RelativeRT == RelativeRT.Overlapping && relativeRT == RelativeRT.Matching) relativeRT = RelativeRT.Overlapping; } } else { foreach (var mod in PeptideSettings.Modifications.GetModifications(labelType)) { if (!mod.IsMod(seq)) continue; if (mod.RelativeRT == RelativeRT.Unknown) return RelativeRT.Unknown; if (mod.RelativeRT == RelativeRT.Preceding) relativeRT = RelativeRT.Preceding; else if (mod.RelativeRT == RelativeRT.Overlapping && relativeRT == RelativeRT.Matching) relativeRT = RelativeRT.Overlapping; } } return relativeRT; }
private static SequenceMassCalc GetBaseCalc(IsotopeLabelType labelType, ExplicitMods mods, IList<TypedMassCalc> massCalcs) { if (mods == null) return null; var calcLightImplicit = massCalcs[0].MassCalc; // If the light type is not modified if (!mods.IsModified(IsotopeLabelType.light)) { // If requesting the light calculator or an unmodified heavy, // then no explicit calculator is required. if (labelType.IsLight || !mods.IsModified(labelType)) return null; // Otherwise, use its calculator as the base for a heavy type // to make sure the implicit light modifications are included. return calcLightImplicit; } // If the type requested is not modified, it must be a heavy type // with the light type modified. In this case, return the heavy // calculator as the base, to which the light explicit modifications // may be applied to get modified masses. if (!mods.IsModified(labelType)) return GetMassCalc(labelType, massCalcs); // If the light modifications are variable, and this is a type for // which explicit modifications exist (including the light type itself), // then return the light calculator as base. if (mods.IsVariableStaticMods) return calcLightImplicit; // If both light and this type are modified, then us a base calculator // that contains no modifications at all. return (calcLightImplicit.MassType == MassType.Monoisotopic ? MonoisotopicMassCalc : AverageMassCalc); }