public void TestCrosslinkGetNeutralFormula() { var mainPeptide = new Peptide("MERCURY"); var srmSettings = SrmSettingsList.GetDefault(); srmSettings = srmSettings.ChangePeptideSettings( srmSettings.PeptideSettings.ChangeModifications(srmSettings.PeptideSettings.Modifications .ChangeStaticModifications(new StaticMod[0]))); var transitionGroup = new TransitionGroup(mainPeptide, Adduct.SINGLY_PROTONATED, IsotopeLabelType.light); var mainTransitionGroupDocNode = new TransitionGroupDocNode(transitionGroup, Annotations.EMPTY, srmSettings, null, null, ExplicitTransitionGroupValues.EMPTY, null, null, false); var unlinkedFormula = mainTransitionGroupDocNode.GetNeutralFormula(srmSettings, null); Assert.AreEqual("C37H61N13O11S2Se", unlinkedFormula.ToString()); var linkedPeptide = new LinkedPeptide(new Peptide("ARSENIC"), 2, null); var linkedPeptideFormula = linkedPeptide.GetNeutralFormula(srmSettings, IsotopeLabelType.light); Assert.AreEqual("C30H53N11O12S", linkedPeptideFormula.ToString()); var crosslinkMod = new StaticMod("disulfide", null, null, "-H2"); var explicitModsWithCrosslink = new ExplicitMods(mainPeptide, new[] { new ExplicitMod(3, crosslinkMod).ChangeLinkedPeptide(linkedPeptide) }, new TypedExplicitModifications[0]); var crosslinkedFormula = mainTransitionGroupDocNode.GetNeutralFormula(srmSettings, explicitModsWithCrosslink); Assert.AreEqual("C67H112N24O23S3Se", crosslinkedFormula.Molecule.ToString()); }
public void TestSingleAminoAcidLinkedPeptide() { var srmSettings = SrmSettingsList.GetDefault(); var mainPeptide = new Peptide("A"); var staticMod = new StaticMod("crosslinker", null, null, "-C2"); var linkedPeptide = new LinkedPeptide(new Peptide("D"), 0, null); var mainTransitionGroup = new TransitionGroup(mainPeptide, Adduct.SINGLY_PROTONATED, IsotopeLabelType.light); var mainTransitionGroupDocNode = new TransitionGroupDocNode(mainTransitionGroup, Annotations.EMPTY, srmSettings, null, null, ExplicitTransitionGroupValues.EMPTY, null, new TransitionDocNode[0], false); var modsWithoutLinkedPeptide = new ExplicitMods(mainPeptide, new[] { new ExplicitMod(0, staticMod), }, new TypedExplicitModifications[0]); Assert.AreEqual("C3H7NO2", AminoAcidFormulas.Default.GetFormula("A").ToString()); Assert.AreEqual("C3H7NO2", mainTransitionGroupDocNode.GetNeutralFormula(srmSettings, null).Molecule.ToString()); Assert.AreEqual("CH7NO2", mainTransitionGroupDocNode.GetNeutralFormula(srmSettings, modsWithoutLinkedPeptide).Molecule.ToString()); Assert.AreEqual("C4H7NO4", AminoAcidFormulas.Default.GetFormula("D").ToString()); var modsWithLinkedPeptide = new ExplicitMods(mainPeptide, new[] { new ExplicitMod(0, staticMod).ChangeLinkedPeptide(linkedPeptide) }, new TypedExplicitModifications[0]); Assert.AreEqual("C5H14N2O6", mainTransitionGroupDocNode.GetNeutralFormula(srmSettings, modsWithLinkedPeptide).Molecule.ToString()); var mainComplexFragmentIon = new ComplexFragmentIon(new Transition(mainTransitionGroup, IonType.precursor, mainPeptide.Length - 1, 0, Adduct.SINGLY_PROTONATED), null, modsWithLinkedPeptide.Crosslinks); var linkedComplexFragmentIon = new ComplexFragmentIon( new Transition(linkedPeptide.GetTransitionGroup(IsotopeLabelType.light, Adduct.SINGLY_PROTONATED), IonType.precursor, linkedPeptide.Peptide.Length - 1, 0, Adduct.SINGLY_PROTONATED), null, LinkedPeptide.EMPTY_CROSSLINK_STRUCTURE); var complexFragmentIon = mainComplexFragmentIon.AddChild(new ModificationSite(0, staticMod.Name), linkedComplexFragmentIon); var transition = complexFragmentIon.MakeTransitionDocNode(srmSettings, modsWithLinkedPeptide, null); var sequenceMassCalc = new SequenceMassCalc(MassType.Monoisotopic); var expectedMz = sequenceMassCalc.GetPrecursorMass("A") + sequenceMassCalc.GetPrecursorMass("D") - 24 - BioMassCalc.MassProton; Assert.AreEqual(expectedMz, transition.Mz, .00001); }
public void TestCrosslinkModSerialization() { var settings = SrmSettingsList.GetDefault(); var crosslinkerDef = new StaticMod("disulfide", null, null, "-H2") .ChangeCrosslinkerSettings(CrosslinkerSettings.EMPTY); settings = settings.ChangePeptideSettings(settings.PeptideSettings.ChangeModifications( settings.PeptideSettings.Modifications.ChangeStaticModifications(new[] { crosslinkerDef }))); settings = settings.ChangeTransitionSettings(settings.TransitionSettings.ChangeFilter( settings.TransitionSettings.Filter .ChangeFragmentRangeFirstName(TransitionFilter.StartFragmentFinder.ION_1.Name) .ChangeFragmentRangeLastName(@"last ion") .ChangePeptideIonTypes(new[] { IonType.precursor, IonType.y, IonType.b }) )); var mainPeptide = new Peptide("MERCURY"); var transitionGroup = new TransitionGroup(mainPeptide, Adduct.DOUBLY_PROTONATED, IsotopeLabelType.light); var linkedPeptide = new LinkedPeptide(new Peptide("ARSENIC"), 2, null); var crosslinkMod = new ExplicitMod(3, crosslinkerDef).ChangeLinkedPeptide(linkedPeptide); var explicitModsWithCrosslink = new ExplicitMods(mainPeptide, new[] { crosslinkMod }, new TypedExplicitModifications[0]); var transitionGroupDocNode = new TransitionGroupDocNode(transitionGroup, Annotations.EMPTY, settings, explicitModsWithCrosslink, null, ExplicitTransitionGroupValues.EMPTY, null, null, true); var peptideDocNode = new PeptideDocNode(mainPeptide, settings, explicitModsWithCrosslink, null, ExplicitRetentionTimeInfo.EMPTY, new [] { transitionGroupDocNode }, false); peptideDocNode = peptideDocNode.ChangeSettings(settings, SrmSettingsDiff.ALL); Assert.AreNotEqual(0, peptideDocNode.TransitionCount); var peptideGroupDocNode = new PeptideGroupDocNode(new PeptideGroup(), Annotations.EMPTY, "Peptides", null, new [] { peptideDocNode }); var srmDocument = (SrmDocument) new SrmDocument(settings).ChangeChildren(new[] { peptideGroupDocNode }); AssertEx.Serializable(srmDocument); string docXML = null; AssertEx.RoundTrip(srmDocument, ref docXML); Assert.IsNotNull(docXML); }
public void TestComplexIonMz() { var srmSettings = SrmSettingsList.GetDefault(); var peptide = new Peptide("DLGEEHFKGLVLIAFSQYLQQCPFDEHVK"); var linkedPeptide = new LinkedPeptide(new Peptide("LVNELTEFAKTCVADESHAGCEK"), 9, null); var transitionGroup = new TransitionGroup(peptide, Adduct.QUADRUPLY_PROTONATED, IsotopeLabelType.light); var crosslinkMod = new StaticMod("linker", "K", null, "C8H10O2"); var explicitMod = new ExplicitMod(7, crosslinkMod).ChangeLinkedPeptide(linkedPeptide); var explicitMods = new ExplicitMods(peptide, new[] { explicitMod }, new List <TypedExplicitModifications>()); var linkedTransition = new Transition(linkedPeptide.GetTransitionGroup(IsotopeLabelType.light, Adduct.SINGLY_PROTONATED), IonType.precursor, linkedPeptide.Peptide.Length - 1, 0, Adduct.SINGLY_PROTONATED); var expectedMzs = new[] { Tuple.Create(IonType.b, 2, 1, 229.1183), Tuple.Create(IonType.b, 10, 3, 1291.2766) }; foreach (var tuple in expectedMzs) { int offset = Transition.OrdinalToOffset(tuple.Item1, tuple.Item2, peptide.Sequence.Length); var transition = new Transition(transitionGroup, tuple.Item1, offset, 0, Adduct.FromChargeProtonated(tuple.Item3)); var complexFragmentIon = new ComplexFragmentIon(transition, null, explicitMods.Crosslinks); if (complexFragmentIon.IncludesAaIndex(explicitMod.IndexAA)) { complexFragmentIon = complexFragmentIon.AddChild(explicitMod.ModificationSite, new ComplexFragmentIon(linkedTransition, null, LinkedPeptide.EMPTY_CROSSLINK_STRUCTURE)); } var complexTransitionDocNode = complexFragmentIon.MakeTransitionDocNode(srmSettings, explicitMods, null); Assert.AreEqual(tuple.Item4, complexTransitionDocNode.Mz, .0001, "{0}{1}{2}", tuple.Item1, tuple.Item2, Transition.GetChargeIndicator(Adduct.FromChargeProtonated(tuple.Item3))); } }
public void TestPermuteComplexIons() { var mainPeptide = new Peptide("MERCURY"); var srmSettings = SrmSettingsList.GetDefault(); var transitionFilter = srmSettings.TransitionSettings.Filter; transitionFilter = transitionFilter .ChangeFragmentRangeFirstName(TransitionFilter.StartFragmentFinder.ION_1.Name) .ChangeFragmentRangeLastName(@"last ion") .ChangePeptideIonTypes(new[] { IonType.precursor, IonType.y, IonType.b }); srmSettings = srmSettings.ChangeTransitionSettings( srmSettings.TransitionSettings.ChangeFilter(transitionFilter)); var transitionGroup = new TransitionGroup(mainPeptide, Adduct.SINGLY_PROTONATED, IsotopeLabelType.light); var crosslinkerDef = new StaticMod("disulfide", "C", null, "-H2"); var linkedPeptide = new LinkedPeptide(new Peptide("ARSENIC"), 6, null); var crosslinkMod = new ExplicitMod(3, crosslinkerDef).ChangeLinkedPeptide(linkedPeptide); var explicitModsWithCrosslink = new ExplicitMods(mainPeptide, new[] { crosslinkMod }, new TypedExplicitModifications[0]); var transitionGroupDocNode = new TransitionGroupDocNode(transitionGroup, Annotations.EMPTY, srmSettings, explicitModsWithCrosslink, null, ExplicitTransitionGroupValues.EMPTY, null, null, false); var choices = transitionGroupDocNode.GetPrecursorChoices(srmSettings, explicitModsWithCrosslink, true) .Cast <TransitionDocNode>().ToArray(); var complexFragmentIons = choices.Select(transition => transition.ComplexFragmentIon.GetName()).ToArray(); Assert.AreNotEqual(0, complexFragmentIons.Length); }
private bool TryMakeLinkedPeptide(out LinkedPeptide linkedPeptide) { linkedPeptide = null; Peptide peptide; if (!TryMakePeptide(out peptide)) { return(false); } string peptideSequence = peptide == null ? ParentPeptide.Peptide.Sequence : peptide.Sequence; var messageBoxHelper = new MessageBoxHelper(this); int aaOrdinal; if (!messageBoxHelper.ValidateNumberTextBox(tbxAttachmentOrdinal, 1, peptideSequence.Length, out aaOrdinal)) { return(false); } string validAminoAcids = _crosslinkMod?.AAs; if (!string.IsNullOrEmpty(validAminoAcids)) { char aa = peptideSequence[aaOrdinal - 1]; if (!validAminoAcids.Contains(aa)) { string message = string.Format(Resources.EditLinkedPeptideDlg_TryMakeLinkedPeptide_The_crosslinker___0___cannot_attach_to_the_amino_acid___1___, _crosslinkMod.Name, aa); messageBoxHelper.ShowTextBoxError(tbxAttachmentOrdinal, message); return(false); } } linkedPeptide = new LinkedPeptide(peptide, aaOrdinal - 1, MakeExplicitMods(peptide, _explicitMods)); return(true); }
public void OkDialog() { LinkedPeptide linkedPeptide; if (!TryMakeLinkedPeptide(out linkedPeptide)) { return; } LinkedPeptide = linkedPeptide; DialogResult = DialogResult.OK; }
private void WriteLinkedPeptide(XmlWriter writer, LinkedPeptide linkedPeptide) { writer.WriteStartElement(EL.linked_peptide); writer.WriteAttribute(ATTR.index_aa, linkedPeptide.IndexAa); if (linkedPeptide.Peptide != null) { writer.WriteAttributeIfString(ATTR.sequence, linkedPeptide.Peptide.Sequence); if (null != linkedPeptide.ExplicitMods) { WriteExplicitMods(writer, linkedPeptide.Peptide.Sequence, linkedPeptide.ExplicitMods); } } writer.WriteEndElement(); }
public void TestTwoAminoAcidLinkedPeptide() { const string modName = "crosslinker"; var srmSettings = SrmSettingsList.GetDefault(); srmSettings = srmSettings.ChangeTransitionSettings(srmSettings.TransitionSettings.ChangeFilter( srmSettings.TransitionSettings.Filter .ChangeFragmentRangeFirstName(TransitionFilter.StartFragmentFinder.ION_1.Name) .ChangeFragmentRangeLastName(@"last ion") .ChangePeptideIonTypes(new[] { IonType.precursor, IonType.y, IonType.b }) )); var mainPeptide = new Peptide("AD"); var staticMod = new StaticMod(modName, null, null, "-C2"); var linkedPeptide = new LinkedPeptide(new Peptide("EF"), 1, null); var mainTransitionGroup = new TransitionGroup(mainPeptide, Adduct.DOUBLY_PROTONATED, IsotopeLabelType.light); var mainTransitionGroupDocNode = new TransitionGroupDocNode(mainTransitionGroup, Annotations.EMPTY, srmSettings, null, null, ExplicitTransitionGroupValues.EMPTY, null, new TransitionDocNode[0], false); var modsWithLinkedPeptide = new ExplicitMods(mainPeptide, new[] { new ExplicitMod(0, staticMod).ChangeLinkedPeptide(linkedPeptide) }, new TypedExplicitModifications[0]); Assert.AreEqual(1, srmSettings.PeptideSettings.Modifications.MaxNeutralLosses); var oneNeutralLossChoices = mainTransitionGroupDocNode.GetTransitions( srmSettings, modsWithLinkedPeptide, mainTransitionGroupDocNode.PrecursorMz, mainTransitionGroupDocNode.IsotopeDist, null, null, true).Select(transition => transition.ComplexFragmentIon.GetName()).ToList(); var modSite = new ModificationSite(0, modName); var expectedFragmentIons = new[] { ComplexFragmentIonName.PRECURSOR.AddChild(modSite, ComplexFragmentIonName.PRECURSOR), ComplexFragmentIonName.PRECURSOR.AddChild(modSite, new ComplexFragmentIonName(IonType.y, 1)), new ComplexFragmentIonName(IonType.y, 1), new ComplexFragmentIonName(IonType.b, 1).AddChild(modSite, new ComplexFragmentIonName(IonType.precursor, 0)), ComplexFragmentIonName.ORPHAN.AddChild(modSite, new ComplexFragmentIonName(IonType.b, 1)), }; CollectionAssert.AreEquivalent(expectedFragmentIons, oneNeutralLossChoices); }
public void TestCrosslinkPrecursorMz() { var srmSettings = SrmSettingsList.GetDefault(); srmSettings = srmSettings.ChangePeptideSettings( srmSettings.PeptideSettings.ChangeModifications( srmSettings.PeptideSettings.Modifications.ChangeStaticModifications(new StaticMod[0]))); var mainPeptide = new Peptide("WQEGNVFSCSVMHEALHNHYTQK"); var otherPeptide = new Peptide("NQVSLTCLVK"); var linkedPeptide = new LinkedPeptide(otherPeptide, 6, ExplicitMods.EMPTY); var crosslinkMod = new StaticMod("disulfide", "C", null, "-H2").ChangeCrosslinkerSettings(CrosslinkerSettings.EMPTY); var transitionGroup = new TransitionGroup(mainPeptide, Adduct.DOUBLY_PROTONATED, IsotopeLabelType.light); var explicitMod = new ExplicitMod(8, crosslinkMod).ChangeLinkedPeptide(linkedPeptide); var explicitMods = new ExplicitMods(mainPeptide, new[] { explicitMod }, new List <TypedExplicitModifications>()); var transitionGroupDocNode = new TransitionGroupDocNode(transitionGroup, Annotations.EMPTY, srmSettings, explicitMods, null, ExplicitTransitionGroupValues.EMPTY, null, null, false); Assert.AreEqual(1923.9111, transitionGroupDocNode.PrecursorMz, .001); }
public void TestLooplink() { var peptide = new Peptide("PEPTIDE"); var srmSettings = SrmSettingsList.GetDefault(); var transitionFilter = srmSettings.TransitionSettings.Filter; transitionFilter = transitionFilter .ChangeFragmentRangeFirstName(TransitionFilter.StartFragmentFinder.ION_1.Name) .ChangeFragmentRangeLastName(@"last ion") .ChangePeptideIonTypes(new[] { IonType.precursor, IonType.y, IonType.b }); srmSettings = srmSettings.ChangeTransitionSettings( srmSettings.TransitionSettings.ChangeFilter(transitionFilter)); var transitionGroup = new TransitionGroup(peptide, Adduct.SINGLY_PROTONATED, IsotopeLabelType.light); var crosslinkerDef = new StaticMod("dss", null, null, "C8H10O2"); var linkedPeptide = new LinkedPeptide(null, 5, null); var crosslinkMod = new ExplicitMod(2, crosslinkerDef).ChangeLinkedPeptide(linkedPeptide); var explicitModsWithCrosslink = new ExplicitMods(peptide, new[] { crosslinkMod }, new TypedExplicitModifications[0]); var transitionGroupDocNode = new TransitionGroupDocNode(transitionGroup, Annotations.EMPTY, srmSettings, explicitModsWithCrosslink, null, ExplicitTransitionGroupValues.EMPTY, null, null, false); var modifiedSequence = ModifiedSequence.GetModifiedSequence(srmSettings, peptide.Sequence, explicitModsWithCrosslink, IsotopeLabelType.light); Assert.AreEqual("PEPTIDE-[dss@3-6]", modifiedSequence.FullNames); var choices = transitionGroupDocNode.GetPrecursorChoices(srmSettings, explicitModsWithCrosslink, true) .Cast <TransitionDocNode>().ToArray(); var complexFragmentIons = choices.Select(transition => transition.ComplexFragmentIon.GetName()).ToArray(); // Make sure none of the transitions involve a cleavage in between the two ends of the looplink // PEpTIdE var yOrdinals = complexFragmentIons.Where(ion => ion.IonType == IonType.y).Select(ion => ion.Ordinal) .Distinct().ToList(); var bOrdinals = complexFragmentIons.Where(ion => ion.IonType == IonType.b).Select(ion => ion.Ordinal) .Distinct().ToList(); CollectionAssert.AreEquivalent(new[] { 6, 5, 1 }, yOrdinals); CollectionAssert.AreEquivalent(new[] { 1, 2, 6 }, bOrdinals); }
public EditLinkedPeptideDlg(SrmSettings settings, PeptideDocNode parentPeptide, LinkedPeptide linkedPeptide, StaticMod crosslinkMod) { InitializeComponent(); _settings = settings; ParentPeptide = parentPeptide; _crosslinkMod = crosslinkMod; if (linkedPeptide != null) { if (linkedPeptide.Peptide != null) { tbxPeptideSequence.Text = linkedPeptide.Peptide.Sequence; } else { cbxLooplink.Checked = true; } tbxAttachmentOrdinal.Text = (linkedPeptide.IndexAa + 1).ToString(); _explicitMods = linkedPeptide.ExplicitMods; } }