// Helper function for PrecursorIonFormula and PrecursorNeutralFormula private void GetPrecursorFormulaAndAdduct(out Adduct adduct, out string formula) { if (IsSmallMolecule()) { formula = (DocNode.CustomMolecule.Formula ?? string.Empty); adduct = DocNode.PrecursorAdduct; } else { PeptideDocNode parent = DataSchema.Document.FindNode(IdentityPath.Parent) as PeptideDocNode; if (parent == null) { adduct = Util.Adduct.EMPTY; formula = String.Empty; return; } var molecule = RefinementSettings.ConvertToSmallMolecule( RefinementSettings.ConvertToSmallMoleculesMode.formulas, SrmDocument, parent, out adduct, DocNode.TransitionGroup.PrecursorAdduct.AdductCharge, DocNode.TransitionGroup.LabelType); formula = molecule.Formula ?? string.Empty; } }