public static void ExampleProteinGrouping(IProtease protease, double percentIdentified = 0.01, int maxMissed = 3, int minLength = 5, int maxLength = 50)
{
Stopwatch watch = new Stopwatch();
watch.Start();
List<Peptide> peps = new List<Peptide>(1000000);
List<Protein> proteins = new List<Protein>(7000);
using (FastaReader reader = new FastaReader("Resources/yeast_uniprot_120226.fasta"))
{
foreach (Protein protein in reader.ReadNextProtein())
{
peps.AddRange(protein.Digest(protease, maxMissed, minLength, maxLength));
proteins.Add(protein);
}
}
Console.WriteLine("Loaded {0:N0} peptides from {1:N0} proteins in {2} ms", peps.Count, proteins.Count, watch.ElapsedMilliseconds);
watch.Restart();
Random random = new Random(480912341);
// Take the first x % to act as our identified peptides
List<Peptide> identifiedPeptides = peps.OrderBy(x => random.Next()).Take((int) (peps.Count*percentIdentified)).ToList();
List<ProteinGroup> proteinGroups = ProteinGroup.GroupProteins(proteins, protease, identifiedPeptides, new AminoAcidLeucineSequenceComparer(), maxMissed).ToList();
watch.Stop();
Console.WriteLine("{0:N0} proteins produced {1:N0} protein groups from {2:N0} identified sequences", proteins.Count, proteinGroups.Count, identifiedPeptides.Count);
Console.WriteLine();
Console.WriteLine("Time elapsed: {0} ms", watch.ElapsedMilliseconds);
}