public static List <string> GeneratePeptides(List <IProtein> proteins) { // peptides List <Proteases> proteases = new List <Proteases>(); foreach (string enzyme in SearchingParameters.Access.DigestionEnzyme) { switch (enzyme) { case "Chymotrypsin": proteases.Add(Proteases.Chymotrypsin); break; case "GluC": proteases.Add(Proteases.GluC); break; case "Pepsin": proteases.Add(Proteases.Pepsin); break; case "Trypsin": proteases.Add(Proteases.Trypsin); break; } } HashSet <string> peptides = new HashSet <string>(); ProteinDigest proteinDigest = new ProteinDigest( SearchingParameters.Access.MissCleavage, SearchingParameters.Access.MiniPeptideLength, proteases[0]); foreach (IProtein protein in proteins) { peptides.UnionWith(proteinDigest.Sequences(protein.Sequence(), ProteinPTM.ContainsNGlycanSite)); } for (int i = 1; i < proteases.Count; i++) { proteinDigest.SetProtease(proteases[i]); List <string> peptidesList = peptides.ToList(); foreach (string seq in peptidesList) { peptides.UnionWith(proteinDigest.Sequences(seq, ProteinPTM.ContainsNGlycanSite)); } } return(ProteinModification.DynamicModification( peptides, ProteinPTM.ContainsNGlycanSite, SearchingParameters.Access.Oxidiatoin, SearchingParameters.Access.Deamidation).ToList()); }
public void test2() { string fasta = @"C:\Users\Rui Zhang\Downloads\haptoglobin.fasta"; // peptides IProteinReader proteinReader = new FastaReader(); List <IProtein> proteins = proteinReader.Read(fasta); List <Proteases> proteases = new List <Proteases>() { Proteases.Trypsin, Proteases.GluC }; HashSet <string> peptides = new HashSet <string>(); ProteinDigest proteinDigest = new ProteinDigest(2, 5, proteases[0]); foreach (IProtein protein in proteins) { peptides.UnionWith(proteinDigest.Sequences(protein.Sequence(), ProteinPTM.ContainsNGlycanSite)); } for (int i = 1; i < proteases.Count; i++) { proteinDigest.SetProtease(proteases[i]); List <string> peptidesList = peptides.ToList(); foreach (string seq in peptidesList) { peptides.UnionWith(proteinDigest.Sequences(seq, ProteinPTM.ContainsNGlycanSite)); } } HashSet <string> peptideModifieds = ProteinModification.DynamicModification( peptides, ProteinPTM.ContainsNGlycanSite); foreach (var s in peptideModifieds) { Console.WriteLine(s); } Console.WriteLine(peptides.Count); Console.WriteLine(peptideModifieds.Count); }