Exemplo n.º 1
0
        public void Run()
        {
            List <IPoint> points = new List <IPoint>();

            for (int i = 0; i < 1200; i++)
            {
                points.Add(new MassPoint(i));
            }


            var watch = new System.Diagnostics.Stopwatch();

            watch.Start();
            IComparer <IPoint> comparer = new ToleranceComparer(1.1);

            Console.WriteLine(comparer.Compare(new MassPoint(122), new MassPoint(123)));
            BinarySearch bins = new BinarySearch(comparer);

            bins.setData(points);
            List <IPoint> found = new List <IPoint>();

            for (int j = 122; j < 123; j += 10)
            {
                found.AddRange(bins.Search(new MassPoint(j)));
            }
            //BucketSearch bucket = new BucketSearch(points, 1.1);
            //List<IPoint> result = bucket.Search(new MassPoint(3));

            watch.Stop();
            Console.WriteLine(found.Count);
            Console.WriteLine($"Execution Time: {watch.ElapsedMilliseconds} ms");

            found.Clear();
            watch = new System.Diagnostics.Stopwatch();
            watch.Start();
            //BinarySearch bins = new BinarySearch(points, 1.1);
            //List<IPoint> result = bins.Search(new MassPoint(3));
            BucketSearch bucket = new BucketSearch(comparer, 1.1);

            bucket.setData(points);

            for (int j = 122; j < 123; j += 10)
            {
                found.AddRange(bucket.Search(new MassPoint(j)));
            }

            watch.Stop();
            Console.WriteLine(found.Count);
            Console.WriteLine($"Execution Time: {watch.ElapsedMilliseconds} ms");



            //foreach (IPoint p in result)
            //{
            //    Console.WriteLine(p.GetValue());
            //}

            Console.ReadLine();
        }
Exemplo n.º 2
0
        protected override void Load(ContainerBuilder builder)
        {
            builder.Register(c =>
            {
                IComparer <IPoint> comparer = new ToleranceComparer(Tolerance);
                ISearch matcher             = new BinarySearch(comparer);

                return(new OxoniumSpectrumFilter(matcher));
            }).As <ISpectrumFilter>();
        }
        protected override void Load(ContainerBuilder builder)
        {
            builder.Register(c =>
            {
                IComparer <IPoint> comparer = new ToleranceComparer(Tolerance);
                ISearch matcherPeaks        = new BinarySearch(comparer);

                Dictionary <MassType, double> weights = new Dictionary <MassType, double>();
                weights.Add(MassType.Core, coreGlycanWeight);
                weights.Add(MassType.Branch, branchGlycanWeight);
                weights.Add(MassType.Glycan, glycanWeight);
                weights.Add(MassType.Peptide, peptideWeight);
                IScoreFactory scoreFactory = new VectorScoreFactory(alpha, beta, weights);
                IGlycoPeptidePointsCreator glycoPeptidePointsCreator = new GeneralGlycoPeptideMassProxyPointsCreator();

                return(new GeneralSearchEThcD(matcherPeaks, scoreFactory, glycoPeptidePointsCreator));
            }).As <ISearchEThcD>();
        }
Exemplo n.º 4
0
        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();
        }