Esempio n. 1
0
        static void PreExperimentSetUp()
        {
            ConstructDecoyFasta();
            ConstructIDX();
            if (GlobalVar.IsSimulation)
            //if(false)
            {
                ms2SpectraList = Loader.parseMS2File(InputFileOrganizer.MS2SimulationTestFile).getSpectraArray();
                GlobalVar.ExperimentTotalScans = ms2SpectraList.Count;
                FullPepXMLAndProteinProphetSetup();
                baseLinePpr = ProteinProphetEvaluator.getProteinProphetResult(InputFileOrganizer.OriginalProtXMLFile);

                //so in alex's original code, "original experiment" refers to original experiment without any exclusion or manipulation with this program
                //"baseline comparison" refers to the results after "NoExclusion" run, which is a top 6 or top 12 DDA run, which is not implemented in this program
                //So the two are the same in thie program

                int numMS2Analyzed = (int)GlobalVar.ExperimentTotalScans;
                PerformanceEvaluator.setBaselineComparison(baseLinePpr, numMS2Analyzed, 12);
                PerformanceEvaluator.setOriginalExperiment(baseLinePpr.getNum_proteins_identified());
            }
            log.Debug("Setting up Database");
            database = databaseSetUp(InputFileOrganizer.ExclusionDBFasta);
            log.Debug("Done setting up database.");


            CometSingleSearch.InitializeComet(InputFileOrganizer.IDXDataBase, InputFileOrganizer.CometParamsFile);
            //CometSingleSearch.InitializeComet_NonRealTime("C:\\Coding\\2019LavalleeLab\\temp2\\ModifiedDBSearchFiles\\NoExclusionRealTimeCometSearch.tsv");
            //CometSingleSearch.QualityCheck();
            Console.WriteLine("pre-experimental setup finished");
        }
        public static void CometSingleSearchTest()
        {
            String idx = "C:\\Coding\\2019LavalleeLab\\GitProjectRealTimeMS\\TestData\\PreComputedFiles\\uniprot_SwissProt_Human_1_11_2017_decoyConcacenated.fasta.idx";
            //String idx = "C:\\temp\\comet_2019015\\comet_source_2019015\\IDXMake\\uniprot_SwissProt_Human_1_11_2017_decoyConcacenated.fasta.idx";
            String param = "C:\\Coding\\2019LavalleeLab\\temp2\\ExampleDataSet\\2019.comet.params";

            CometSingleSearch.InitializeComet(idx, param);
            CometSingleSearch.QualityCheck();
            Program.ExitProgram(1);
            String dataRoot   = "C:\\Users\\LavalleeLab\\Documents\\JoshTemp\\MealTimeMS_APITestRun\\Data\\";
            String outputRoot = "C:\\Users\\LavalleeLab\\Documents\\JoshTemp\\MealTimeMS_APITestRun\\Output\\";
            //String mzmlPath = dataRoot+"60minMZMLShrink.csv";
            String   mzmlPath   = dataRoot + "8001.ms2.txt";
            String   dbPath     = dataRoot + "tinyDB.fasta.idx"; //
            String   outputPath = outputRoot + "output.txt";
            String   paramsPath = dataRoot + "comet.params";
            MZMLFile mzml       = Loader.parseMS2File(mzmlPath);

            //MZMLFile mzml = null;
            CometSingleSearch.InitializeComet(dbPath, paramsPath);
            var watch   = System.Diagnostics.Stopwatch.StartNew();
            int counter = 0;

            Console.WriteLine("Starting comet search");
            WriterClass.initiateWriter(outputPath);

            for (int i = 0; i < 1; i++)
            {
                if (i % 1 == 0)
                {
                    Spectra spec = mzml.getSpectraArray()[i];
                    if (spec.getMSLevel() != 2)
                    {
                        continue;
                    }
                    Console.WriteLine("scanNum {0} RT {2} Mass {2} MSLevel {3}", spec.getScanNum(), spec.getStartTime(),
                                      spec.getCalculatedPrecursorMass(), spec.getMSLevel());
                    IDs id = null;
                    if (CometSingleSearch.Search(spec, out id))
                    {
                        String outLine = String.Format("{0}\t{1}\txcorr\t{2}\tdcn\t{3}", id.getScanNum(), id.getPeptideSequence(), id.getXCorr(), id.getDeltaCN());
                        Console.WriteLine(outLine);
                        WriterClass.writeln(outLine);
                    }
                    else
                    {
                        Console.WriteLine("Spectrum cannot be matched\n");
                    }
                    counter++;
                }
            }
            watch.Stop();
            Console.WriteLine("Comet search of " + counter + " spectra took " + watch.ElapsedMilliseconds + " milliseconds");
            WriterClass.CloseWriter();
        }
Esempio n. 3
0
        protected IDs performDatabaseSearch(Spectra spec)
        {
            IDs id = null;

            if (CometSingleSearch.Search(spec, out id))
            {
                log.Debug("MS2 scan was identified.");
                log.Debug(id);
                performanceEvaluator.countMS2Identified();
                PSMTSVReaderWriter.WritePSM(id);
            }
            else
            {
                // scan cannot be matched to a peptide
                log.Debug("MS2 scan {0} was not identified by a comet search", spec.getScanNum());
                performanceEvaluator.countMS2Unidentified();
            }

            return(id);
        }
Esempio n. 4
0
 public static void reset()
 {
     isListening = true;
     CometSingleSearch.reset();
 }
Esempio n. 5
0
 public String ReportFailedCometSearchStatistics()
 {
     return(CometSingleSearch.ReportFailedStatistics());
 }
Esempio n. 6
0
        public static void TestValidity()
        {
            HashSet <String> set = new HashSet <String> {
                "sd", "qq", "sdd"
            };

            Console.WriteLine(set);
            String       logOutput = "C:\\Users\\LavalleeLab\\Documents\\JoshTemp\\RealTimeMS\\Output\\CometValidationOutput.txt";
            StreamWriter sw        = new StreamWriter(logOutput);
            String       TSVFile   = "C:\\Users\\LavalleeLab\\Documents\\JoshTemp\\RealTimeMS\\TestData\\MS_QC_120min.tsv\\MSQC120min.tsv";     //obtained from standard comet search
            List <IDs>   idList    = PSMTSVReaderWriter.ParseTSV(TSVFile);

            sw.WriteLine("OriginalCometOutput has {0} PSMs", idList.Count);
            int sdDecoyCount = 0;

            foreach (IDs id in idList)
            {
                if (id.isDecoy())
                {
                    sdDecoyCount++;
                }
            }
            Console.WriteLine("sdDecoy count: {0}", sdDecoyCount);
            sw.WriteLine("sdDecoy count: {0}", sdDecoyCount);

            String         ms2File = "C:\\Users\\LavalleeLab\\Documents\\JoshTemp\\RealTimeMS\\TestData\\MS_QC_120min.ms2";
            List <Spectra> spectra = Loader.parseMS2File(ms2File).getSpectraArray();

            String dbPath     = "C:\\Users\\LavalleeLab\\Documents\\JoshTemp\\RealTimeMS\\TestData\\PreComputedFiles\\uniprot_SwissProt_Human_1_11_2017_decoyConcacenated.fasta.idx";
            String paramsPath = "C:\\Users\\LavalleeLab\\Documents\\JoshTemp\\RealTimeMS\\TestData\\2019.comet.params";

            CometSingleSearch.InitializeComet(dbPath, paramsPath);
            List <IDs> realTimeIDList = new List <IDs>();

            foreach (Spectra spec in spectra)
            {
                IDs id = null;
                if (CometSingleSearch.Search(spec, out id))
                {
                    realTimeIDList.Add(id);
                }
            }
            sw.WriteLine("RealTimeOutput has {0} PSMs", realTimeIDList.Count);
            sw.WriteLine(CometSingleSearch.ReportFailedStatistics());
            sw.WriteLine("ScanNum\tSeq_sd\tSeq_rt\txcorr_sd\txcorr_rt");
            sw.Flush();

            int sameSeq = 0;
            int diffSeq = 0;


            foreach (IDs standardID in idList)
            {
                Boolean matched = false;
                foreach (IDs realTimeID in realTimeIDList)
                {
                    if (standardID.getScanNum() == realTimeID.getScanNum())
                    {
                        matched = true;
                        String output = String.Format("{0}\t{1}\t{2}\t{3}\t{4}", standardID.getScanNum(), standardID.getPeptideSequence(), realTimeID.getPeptideSequence(), standardID.getXCorr(), realTimeID.getXCorr());
                        sw.WriteLine(output);
                        if (standardID.getPeptideSequence().Equals(realTimeID.getPeptideSequence()))
                        {
                            sameSeq++;
                        }
                        else
                        {
                            diffSeq++;
                        }
                        break;
                    }
                }
                if (!matched && !standardID.isDecoy())
                {
                    String output = String.Format("{0}\t{1}\t{2}\t{3}\t{4}\t{5}", standardID.getScanNum(), standardID.getPeptideSequence(), "", standardID.getXCorr(), "", standardID.getParentProteinAccessionsAsString());
                    sw.WriteLine(output);
                }
            }
            sw.WriteLine("sameSequence: {0}\t diffSeq: {1}", sameSeq, diffSeq);
        }