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(); }
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); }
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); }