コード例 #1
0
ファイル: DigestionTask.cs プロジェクト: zrolfs/ProteaseGuru
        public override MyTaskResults RunSpecific(string OutputFolder, List <DbForDigestion> dbFileList)
        {
            PeptideByFile =
                new Dictionary <string, Dictionary <string, Dictionary <Protein, List <InSilicoPep> > > >(dbFileList.Count);
            int threads_1 = Environment.ProcessorCount - 1 > dbFileList.Count() ? dbFileList.Count : Environment.ProcessorCount - 1;

            int[] threadArray_1 = Enumerable.Range(0, threads_1).ToArray();

            Parallel.ForEach(threadArray_1, (j) =>
            {
                for (; j < dbFileList.Count(); j += threads_1)
                {
                    var database = dbFileList[j];
                    Status("Loading Protein Database(s)...", "loadDbs");
                    List <Protein> proteins = LoadProteins(database);
                    int maxThreads          = Environment.ProcessorCount - 1;
                    int[] threads           = Enumerable.Range(0, maxThreads).ToArray();
                    Parallel.ForEach(threads, (i) =>
                    {
                        for (; i < DigestionParameters.ProteasesForDigestion.Count; i += maxThreads)
                        {
                            Status("Digesting Proteins...", "digestDbs");

                            var peptides          = DigestDatabase(proteins, DigestionParameters.ProteasesForDigestion[i], DigestionParameters);
                            var peptidesFormatted = DeterminePeptideStatus(database.FileName, peptides, DigestionParameters);
                            lock (PeptideByFile)
                            {
                                if (PeptideByFile.ContainsKey(database.FileName))
                                {
                                    PeptideByFile[database.FileName].Add(DigestionParameters.ProteasesForDigestion[i].Name, peptidesFormatted);
                                }
                                else
                                {
                                    Dictionary <string, Dictionary <Protein, List <InSilicoPep> > > peptidesByProtease = new Dictionary <string, Dictionary <Protein, List <InSilicoPep> > >();
                                    peptidesByProtease.Add(DigestionParameters.ProteasesForDigestion[i].Name, peptidesFormatted);
                                    PeptideByFile.Add(database.FileName, peptidesByProtease);
                                }
                            }
                        }
                    });
                }
            });
            Status("Writing Peptide Output...", "peptides");
            WritePeptidesToTsv(PeptideByFile, OutputFolder, DigestionParameters);
            MyTaskResults myRunResults = new MyTaskResults(this);

            Status("Writing Results Summary...", "summary");

            return(myRunResults);
        }
コード例 #2
0
        public override MyTaskResults RunSpecific(string OutputFolder, List <DbForDigestion> dbFileList)
        {
            PeptideByFile =
                new Dictionary <string, Dictionary <string, Dictionary <Protein, List <InSilicoPep> > > >(dbFileList.Count);
            foreach (var database in dbFileList)
            {
                PeptideByFile.Add(database.FileName, new Dictionary <string, Dictionary <Protein, List <InSilicoPep> > >(DigestionParameters.ProteasesForDigestion.Count));
                Dictionary <string, Dictionary <Protein, List <InSilicoPep> > > peptidesByProtease = new Dictionary <string, Dictionary <Protein, List <InSilicoPep> > >();
                List <Protein> proteins = LoadProteins(database);
                foreach (var protease in DigestionParameters.ProteasesForDigestion)
                {
                    PeptideByFile[database.FileName].Add(protease.Name, DeterminePeptideStatus(database.FileName, DigestDatabase(proteins, protease, DigestionParameters), DigestionParameters));
                }
            }
            PeptideByFile = WritePeptidesToTsv(PeptideByFile, OutputFolder, DigestionParameters);
            MyTaskResults myRunResults = new MyTaskResults(this);

            return(myRunResults);
        }
コード例 #3
0
        public override MyTaskResults RunSpecific(string OutputFolder, List <DbForDigestion> dbFileList)
        {
            Dictionary <string, Dictionary <Protease, Dictionary <Protein, List <InSilicoPeptide> > > > peptideByFile =
                new Dictionary <string, Dictionary <Protease, Dictionary <Protein, List <InSilicoPeptide> > > >();

            foreach (var database in dbFileList)
            {
                Dictionary <Protease, Dictionary <Protein, List <InSilicoPeptide> > > peptidesByProtease = new Dictionary <Protease, Dictionary <Protein, List <InSilicoPeptide> > >();
                List <Protein> proteins = LoadProteins(database);
                foreach (var protease in DigestionParameters.ProteasesForDigestion)
                {
                    var peptides = DigestDatabase(proteins, protease, DigestionParameters);
                    var inSilicoPeptidesByFile = DeterminePeptideStatus(peptides, DigestionParameters);
                    peptidesByProtease.Add(protease, inSilicoPeptidesByFile);
                }
                peptideByFile.Add(database.FileName, peptidesByProtease);
            }

            MyTaskResults myRunResults = new MyTaskResults(this);

            return(myRunResults);
        }
コード例 #4
0
 public override MyTaskResults RunSpecific(MyTaskResults digestionResults, List <string> peptideFilePaths)
 {
     throw new NotImplementedException();
 }
コード例 #5
0
 public abstract MyTaskResults RunSpecific(MyTaskResults digestionResults, List <string> peptideFilePaths);
コード例 #6
0
        public override MyTaskResults RunSpecific(MyTaskResults digestionResults, List <string> peptideFilePaths)
        {
            MyTaskResults results = new MyTaskResults(this);

            return(results);
        }