public void Run() { IPeptideSequencesGeneratorParameter parameter = new GeneralPeptideGeneratorParameter(Proteases.Trypsin); List <IPeptideSequencesGenerator> generator = new List <IPeptideSequencesGenerator>(); generator.Add(new NGlycosylatedPeptideSequencesGenerator(parameter)); IPeptideSequencesGeneratorParameter parameter2 = new GeneralPeptideGeneratorParameter(Proteases.GluC); generator.Add(new NGlycosylatedPeptideSequencesGenerator(parameter2)); IPeptideSequencesGenerator generators = new DoubleDigestionPeptideSequencesGeneratorProxy(generator); List <string> sequences = generators.Generate("ILGGHLDAKGSFPWQAKMVSHHNLTTGATLINEQWLLTTAK"); IPeptideCreator creator = new GeneralPeptideCreator(generators); List <IPeptide> peptidese = creator.Create(new GeneralProtein("this", "ILGGHLDAKGSFPWQAKMVSHHNLTTGATLINEQWLLTTAK")); foreach (IPeptide s in peptidese) { Console.WriteLine(s.GetSequence()); } Console.Read(); }
public void Run() { var watch = new System.Diagnostics.Stopwatch(); watch.Start(); // protein IProteinDataBuilder proteinBuilder = new GeneralFastaDataBuilder(); IProteinCreator proteinCreator = new GeneralProteinCreator(proteinBuilder); List <IProtein> proteins = proteinCreator.Create(@"C:\Users\iruiz\Desktop\app\HP.fasta"); // peptides List <IPeptideSequencesGenerator> generatorList = new List <IPeptideSequencesGenerator>(); IPeptideSequencesGeneratorParameter parameter = new GeneralPeptideGeneratorParameter(); parameter.SetProtease(Proteases.GluC); NGlycosylatedPeptideSequencesGenerator generatorGluc = new NGlycosylatedPeptideSequencesGenerator(parameter); generatorList.Add(generatorGluc); parameter = new GeneralPeptideGeneratorParameter(); parameter.SetProtease(Proteases.Trypsin); NGlycosylatedPeptideSequencesGenerator generatorTrypsin = new NGlycosylatedPeptideSequencesGenerator(parameter); generatorList.Add(generatorTrypsin); IPeptideSequencesGenerator peptideSequencesGenerator = new DoubleDigestionPeptideSequencesGeneratorProxy(generatorList); IPeptideCreator peptideCreator = new GeneralPeptideCreator(peptideSequencesGenerator); List <IPeptide> peptides = new List <IPeptide>(); HashSet <string> seen = new HashSet <string>(); foreach (IProtein protein in proteins) { foreach (IPeptide peptide in peptideCreator.Create(protein)) { if (!seen.Contains(peptide.GetSequence())) { seen.Add(peptide.GetSequence()); peptides.Add(peptide); } } } // glycans ITableNGlycanProxyGenerator tableNGlycanProxyGenerator = new GeneralTableNGlycanMassProxyGenerator(12, 12, 5, 4, 0); int[] structTable = new int[24]; structTable[0] = 1; ITableNGlycanProxy root = new GeneralTableNGlycanMassProxy(new ComplexNGlycan(structTable)); IGlycanCreator glycanCreator = new GeneralTableNGlycanCreator(tableNGlycanProxyGenerator, root); List <IGlycan> glycans = glycanCreator.Create(); // precursor List <IPoint> points = new List <IPoint>(); foreach (IGlycan glycan in glycans) { points.Add(new GlycanPoint(glycan)); } IComparer <IPoint> comparer = new ToleranceComparer(0.01); ISearch matcher = new BucketSearch(comparer, 0.01); matcher.setData(points); IGlycoPeptideProxyGenerator glycoPeptideProxyGenerator = new GeneralTableNGlycoPeptideMassProxyGenerator(); IGlycoPeptideCreator glycoPeptideCreator = new GeneralNGlycoPeptideSingleSiteCreator(glycoPeptideProxyGenerator); IPrecursorMatcher precursorMatcher = new GeneralPrecursorMatcher(matcher, glycoPeptideCreator); precursorMatcher.SetGlycans(glycans); precursorMatcher.SetPeptides(peptides); // spectrum ISpectrumReader spectrumReader = new ThermoRawSpectrumReader(); spectrumReader.Init(@"C:\Users\iruiz\Desktop\app\ZC_20171218_H95_R1.raw"); ISpectrumFactory spectrumFactory = new GeneralSpectrumFactory(spectrumReader); ISpectrum spectrum = spectrumFactory.GetSpectrum(7039); List <IGlycoPeptide> glycoPeptides = precursorMatcher.Match(spectrum); watch.Stop(); Console.WriteLine(glycoPeptides.Count); foreach (IGlycoPeptide glycoPeptide in glycoPeptides) { Console.WriteLine(glycoPeptide.GetType()); } Console.WriteLine($"Execution Time: {watch.ElapsedMilliseconds} ms"); Console.Read(); }