public void Run() { ITableNGlycan glycan = new ComplexNGlycan(new int[24]); Console.WriteLine(glycan.GetName()); //glycan.SetNGlycanTable(0, 1); ITableNGlycanProxy glycanProxy = new GeneralTableNGlycanMassProxy(glycan); ITableNGlycanProxyGenerator generator = new GeneralTableNGlycanMassProxyGenerator(); IGlycanCreator glycanCreator = new GeneralTableNGlycanCreator(generator, glycanProxy); List <IGlycan> glycans = glycanCreator.Create(); //foreach(IGlycan g in glycans) //{ // Console.WriteLine(string.Join(" ", g.GetStructure())); //} IGlycoPeptideProxyGenerator glycoPeptideProxyGenerator = new GeneralTableNGlycoPeptideMassProxyGenerator(); IGlycoPeptideCreator glycoPeptideCreator = new GeneralNGlycoPeptideSingleSiteCreator(glycoPeptideProxyGenerator); IPeptide peptide = new GeneralPeptide("test3", "ILGGHLDAKGSFPWQAKMVSHHNLTTGATLINEQWLLTTAK"); foreach (IGlycan g in glycans) { List <IGlycoPeptide> glycoPeptides = glycoPeptideCreator.Create(g, peptide); //Console.WriteLine(glycoPeptides.Count); foreach (IGlycoPeptide glyco in glycoPeptides) { //Console.WriteLine(glyco.GetGlycan().GetName()); //Console.WriteLine(glyco.GetPosition()); } } 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(); }