protected override void Load(ContainerBuilder builder) { builder.Register(c => { List <IPeptideSequencesGenerator> generatorList = new List <IPeptideSequencesGenerator>(); foreach (string enzyme in Enzymes) { IPeptideSequencesGeneratorParameter parameter = new GeneralPeptideGeneratorParameter(); parameter.SetMissCleavage(MissCleavage); parameter.SetMiniLength(MiniLength); switch (enzyme) { case "GluC": parameter.SetProtease(Proteases.GluC); break; case "Chymotrypsin": parameter.SetProtease(Proteases.Chymotrypsin); break; case "Pepsin": parameter.SetProtease(Proteases.Pepsin); break; case "Trypsin": parameter.SetProtease(Proteases.Trypsin); break; default: parameter.SetProtease(Proteases.Trypsin); break; } NGlycosylatedPeptideSequencesGenerator generator = new NGlycosylatedPeptideSequencesGenerator(parameter); generatorList.Add(generator); } IPeptideSequencesGenerator peptideSequencesGenerator = new DoubleDigestionPeptideSequencesGeneratorProxy(generatorList); return(new GeneralPeptideCreator(peptideSequencesGenerator)); }).As <IPeptideCreator>(); }
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(); }