private void PopulateProteaseList() { string proteaseDirectory = System.IO.Path.Combine(GlobalVariables.DataDir, @"ProteolyticDigestion"); string proteaseFilePath = System.IO.Path.Combine(proteaseDirectory, @"proteases.tsv"); var myLines = File.ReadAllLines(proteaseFilePath); myLines = myLines.Skip(1).ToArray(); Dictionary <string, Protease> dict = new Dictionary <string, Protease>(); foreach (string line in myLines) { if (line.Trim() != string.Empty) // skip empty lines { string[] fields = line.Split('\t'); List <DigestionMotif> motifList = DigestionMotif.ParseDigestionMotifsFromString(fields[1]); string name = fields[0]; var cleavageSpecificity = ((CleavageSpecificity)Enum.Parse(typeof(CleavageSpecificity), fields[4], true)); string psiMsAccessionNumber = fields[5]; string psiMsName = fields[6]; var protease = new Protease(name, cleavageSpecificity, psiMsAccessionNumber, psiMsName, motifList); dict.Add(protease.Name, protease); } } foreach (Protease protease in dict.Values) { ProteaseSelectedForUse.Items.Add(protease); } }
public static void TestWrongSyntax() { Assert.Throws <MzLibException>(() => { var protease = DigestionMotif.ParseDigestionMotifsFromString("X[Y,P]"); Assert.Fail("Exception shold be thrown for incorrect syntax."); }); }
public static void TestParseProtease() { var argn = DigestionMotif.ParseDigestionMotifsFromString("|D"); Assert.AreEqual(argn.Count, 1); var c = argn[0]; Assert.AreEqual(c.InducingCleavage, "D"); Assert.AreEqual(c.PreventingCleavage, null); Assert.AreEqual(c.CutIndex, 0); var chymotrypsin = DigestionMotif.ParseDigestionMotifsFromString("F[P]|,W[P]|,Y[P]|"); Assert.AreEqual(chymotrypsin.Count, 3); }
public static void MultipleProteaseSelectionTestPreventCleavage() { Protein ParentProtein = new Protein("MOAT", "accession1"); var motifList = DigestionMotif.ParseDigestionMotifsFromString("O[A]|,|T"); var protease = new Protease("TestProtease3", CleavageSpecificity.Full, null, null, motifList); ProteaseDictionary.Dictionary.Add(protease.Name, protease); DigestionParams multiProtease = new DigestionParams(protease: protease.Name, maxMissedCleavages: 0, minPeptideLength: 1, initiatorMethionineBehavior: InitiatorMethionineBehavior.Retain); var digestedList = ParentProtein.Digest(multiProtease, new List <Modification>(), new List <Modification>()).ToList(); var sequences = digestedList.Select(p => p.BaseSequence).ToList(); Assert.That(sequences.Count == 2); Assert.That(sequences.Contains("MOA")); Assert.That(sequences.Contains("T")); }
public static void TestGlycoPeptide() { var prot = new Protein("MNNNYTKQQQQKS", null); var motifList = DigestionMotif.ParseDigestionMotifsFromString("K|"); var protease = new Protease("CustomizedProtease", CleavageSpecificity.Full, null, null, motifList); ProteaseDictionary.Dictionary.Add(protease.Name, protease); DigestionParams digestionParams = new DigestionParams( protease: protease.Name, maxMissedCleavages: 0, minPeptideLength: 1, initiatorMethionineBehavior: InitiatorMethionineBehavior.Retain, keepNGlycopeptide: true, keepOGlycopeptide: true); List <Modification> variableModifications = new List <Modification>(); var ye = prot.Digest(digestionParams, new List <Modification>(), variableModifications).ToList(); Assert.AreEqual(2, ye.Count); }
public static void TestBadPeptide() { var prot = new Protein("MNNNKQQXQ", null); var motifList = DigestionMotif.ParseDigestionMotifsFromString("K|"); var protease = new Protease("Custom Protease7", CleavageSpecificity.Full, null, null, motifList); ProteaseDictionary.Dictionary.Add(protease.Name, protease); DigestionParams digestionParams = new DigestionParams( protease: protease.Name, maxMissedCleavages: 0, minPeptideLength: 1, initiatorMethionineBehavior: InitiatorMethionineBehavior.Retain); var ye = prot.Digest(digestionParams, new List <Modification>(), new List <Modification>()).ToList(); Assert.AreEqual(2, ye.Count); var pep1 = ye[0]; Assert.IsTrue(pep1.MonoisotopicMass > 0); var fragments = new List <Product>(); pep1.Fragment(DissociationType.HCD, FragmentationTerminus.Both, fragments); foreach (var huh in fragments) { Assert.IsTrue(huh.NeutralMass > 0); } var pep2 = ye[1]; Assert.IsNaN(pep2.MonoisotopicMass); var cool = new List <Product>(); pep2.Fragment(DissociationType.HCD, FragmentationTerminus.Both, cool); Assert.IsTrue(cool[0].NeutralMass > 0); Assert.IsTrue(cool[1].NeutralMass > 0); Assert.IsTrue(cool[2].NeutralMass > 0); Assert.IsTrue(double.IsNaN(cool[3].NeutralMass)); Assert.IsTrue(double.IsNaN(cool[4].NeutralMass)); Assert.IsTrue(double.IsNaN(cool[5].NeutralMass)); Assert.IsTrue(cool.Count == 6); }
public static void TestWildCardExclusion() { var empty = new List <Modification>(); var digestionmotifs = DigestionMotif.ParseDigestionMotifsFromString("RX{P}|"); Protease multiletter = new Protease("multiletter", CleavageSpecificity.Full, "", "", digestionmotifs); ProteaseDictionary.Dictionary.Add(multiletter.Name, multiletter); DigestionParams myDigestionParams = new DigestionParams("multiletter", minPeptideLength: 1, maxMissedCleavages: 0); // create a protein Protein myProtein = new Protein("PROPRPPM", "myAccession"); // digest it into peptides var myPeptides = myProtein.Digest(myDigestionParams, empty, empty).ToList(); string first = myPeptides.First().ToString(); string last = myPeptides.Last().ToString(); Assert.AreEqual(first, "PRO"); Assert.AreEqual(last, "PRPPM"); }
public static void TestOneMotifMultiplePreventing() { var empty = new List <Modification>(); var digestionmotifs = DigestionMotif.ParseDigestionMotifsFromString("N[M]|,N[C]|,N[A]|"); Protease customProtease = new Protease("custom", CleavageSpecificity.Full, "", "", digestionmotifs); ProteaseDictionary.Dictionary.Add(customProtease.Name, customProtease); DigestionParams myDigestionParams = new DigestionParams("custom", minPeptideLength: 1, maxMissedCleavages: 0); // create a protein Protein myProtein = new Protein("PRONFNMMHFHAA", "myAccession"); // digest it into peptides var myPeptides = myProtein.Digest(myDigestionParams, empty, empty).ToList(); string first = myPeptides.First().ToString(); string last = myPeptides.Last().ToString(); Assert.AreEqual(myPeptides.Count, 2); Assert.AreEqual(first, "PRON"); }
public static void TestCutIndexDifferentSyntax() { var empty = new List <Modification>(); var digestionmotifs = DigestionMotif.ParseDigestionMotifsFromString("K|[P]"); // same as K[P]| Protease protease = new Protease("lys-c", CleavageSpecificity.Full, "", "", digestionmotifs); ProteaseDictionary.Dictionary.Add(protease.Name, protease); DigestionParams myDigestionParams = new DigestionParams("lys-c", minPeptideLength: 1, maxMissedCleavages: 0); // create a protein Protein myProtein = new Protein("PROKPKMKP", "myAccession"); // digest it into peptides var myPeptides = myProtein.Digest(myDigestionParams, empty, empty).ToList(); string first = myPeptides.First().ToString(); string last = myPeptides.Last().ToString(); Assert.AreEqual(first, "PROKPK"); Assert.AreEqual(last, "MKP"); }
public static void TestGoodPeptide() { var prot = new Protein("MNNNKQQQQ", null); var motifList = DigestionMotif.ParseDigestionMotifsFromString("K|"); var protease = new Protease("CustomizedProtease", CleavageSpecificity.Full, null, null, motifList); ProteaseDictionary.Dictionary.Add(protease.Name, protease); DigestionParams digestionParams = new DigestionParams( protease: protease.Name, maxMissedCleavages: 0, minPeptideLength: 1, initiatorMethionineBehavior: InitiatorMethionineBehavior.Retain); List <Modification> variableModifications = new List <Modification>(); var ye = prot.Digest(digestionParams, new List <Modification>(), variableModifications).ToList(); Assert.AreEqual(2, ye.Count); var pep1 = ye[0]; Assert.IsTrue(pep1.MonoisotopicMass > 0); var test = new List <Product>(); pep1.Fragment(DissociationType.HCD, FragmentationTerminus.Both, test); foreach (var huh in test) { Assert.IsTrue(huh.NeutralMass > 0); } var pep2 = ye[1]; pep1.Fragment(DissociationType.HCD, FragmentationTerminus.Both, test); Assert.IsTrue(pep2.MonoisotopicMass > 0); foreach (var huh in test) { Assert.IsTrue(huh.NeutralMass > 0); } }