private void buttonXtract_Click(object sender, EventArgs e) { if (textBoxScanNo.Text.Length == 0) { MessageBox.Show("Please enter a valid scan number"); return; } double theoreticalMH = double.Parse(textBoxTheoreticalMass.Text); int scanNo = int.Parse(textBoxScanNo.Text); SQTLight s = new SQTLight(null); s.PeptideSequenceCleaned = "N/A"; XQuantClusteringParameters myParams = parameters1.GetFromScreen(); Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); Dictionary <string, List <Quant> > theQuants = Core35.Quant(getter, s, theoreticalMH, isotopicSignal, scanNo, myParams); stopwatch.Stop(); Console.WriteLine("Time elapsed: {0}", stopwatch.Elapsed); foreach (var kvp in theQuants) { foreach (Quant q in kvp.Value) { //XICViewer viewer = new XICViewer(); //viewer.Plot(q.PrecursorMZ, q.GetIonsLight(), new List<int>() { q.ScanNoMS2 }); //viewer.ShowDialog(); } } }
public void Process() { myQuantPkgs = new List <QuantPackage2>(); SignalGenerator isotopicSignal = new SignalGenerator(); foreach (SEProFileInfo sfi in SEProFiles) { foreach (string file in sfi.MyFilesFullPath) { Console.WriteLine("Processing for " + file); ResultPackage rp = ResultPackage.Load(file); List <string> filesInSEPro = (from sqt in rp.MyProteins.AllSQTScans select sqt.FileName).Distinct().ToList(); FileInfo fi = new FileInfo(file); foreach (string msFile in filesInSEPro) { QuantPackage2 qp = new QuantPackage2(msFile, fi.Directory.FullName, sfi.ClassLabel); Console.WriteLine("\t" + msFile); List <string> ms1OrRawOrmzMLFiles = fi.Directory.GetFiles("*.ms1").ToList().Concat(fi.Directory.GetFiles("*.RAW")).Concat(fi.Directory.GetFiles("*.mzML")).ToList().Select(a => a.Name).ToList(); int fileToRead = ms1OrRawOrmzMLFiles.FindIndex(a => RemoveExtension(a).Equals(RemoveExtension(msFile))); XICGet5 xic = new XICGet5(fi.DirectoryName + "/" + ms1OrRawOrmzMLFiles[fileToRead]); List <SQTScan> scansTMP = rp.MyProteins.AllSQTScans.FindAll(a => a.FileName.Equals(msFile)); if (MyClusterParams.OnlyUniquePeptides) { int removedForNotUnique = scansTMP.RemoveAll(a => a.IsUnique); Console.WriteLine("Scans removed for not dealing with unique peptides: " + removedForNotUnique); } List <SQTLight> scans = scansTMP.Select(a => new SQTLight(a)).ToList(); int counter = 0; for (int i = 0; i < scans.Count; i++) { Dictionary <string, List <Quant> > theseQuants = Core35.Quant(xic, scans[i], scans[i].TheoreticalMH, isotopicSignal, scans[i].ScanNumber, MyClusterParams); foreach (var kvp in theseQuants) { kvp.Value.RemoveAll(a => a.MyIons.GetLength(1) < MyClusterParams.MinMS1Counts); if (kvp.Value.Count > 0) { if (qp.MyQuants.ContainsKey(kvp.Key)) { qp.MyQuants[kvp.Key].AddRange(kvp.Value); } else { qp.MyQuants.Add(kvp.Key, kvp.Value); } } } counter++; Console.Write("\rScans Processed: " + counter + "/" + scans.Count); } //Store them myQuantPkgs.Add(qp); Console.WriteLine("\nTotal quants stored so far = " + myQuantPkgs.Sum(a => a.MyQuants.Count)); Console.WriteLine("Total files analyzed so far = " + myQuantPkgs.Count); Console.WriteLine("Done procesing :" + msFile); System.GC.Collect(); System.GC.WaitForPendingFinalizers(); System.GC.Collect(); } } } GenerateAssociationItems(); }