public Task <bool> ReadAndAnalyzeMSFile(string path) { var IsCompleted = false; var c = _analysisResults.Count; var progress = new ReadAndAnalyzeProgressInfo(); var msrun = new MsDataFileImplExtAgg(path); msrun.GetMsDataSpectrums(); msrun.GetChromatograms(_analysisTargets.Proteins, 0.1); _analysisResults.Add(msrun); if (_analysisResults.Count - c == 1) { IsCompleted = true; } return(Task.FromResult(IsCompleted)); }
private void btnTEST_Click(object sender, EventArgs e) { Stopwatch watch = new Stopwatch(); TimeSpan[] TimesToPerform = new TimeSpan[3]; double Toleranse = 0.1; OpenFileDialog _openDlg = new OpenFileDialog(); _openDlg.Filter = "Thermo(*.raw,|*.raw;)"; if (_openDlg.ShowDialog() == DialogResult.OK) { watch.Start(); _msdatafile = new MsDataFileImplExtAgg(_openDlg.FileName); TimesToPerform[0] = TimeSpan.FromMilliseconds(watch.ElapsedMilliseconds); } else { return; } watch.Reset(); watch.Start(); _msdatafile.GetMsDataSpectrums(); TimesToPerform[1] = TimeSpan.FromMilliseconds(watch.ElapsedMilliseconds); watch.Reset(); watch.Start(); _msdatafile.GetChromatograms(GetProteinsFromSkyline(), Toleranse); TimesToPerform[2] = TimeSpan.FromMilliseconds(watch.ElapsedMilliseconds); MessageBox.Show(String.Format("Read: {0}:{1}; GetSpectrums: {2}:{3}; GetChromatograms: {4}:{5} ", TimesToPerform[0].Minutes, TimesToPerform[0].Seconds, TimesToPerform[1].Minutes, TimesToPerform[1].Seconds, TimesToPerform[2].Minutes, TimesToPerform[2].Seconds)); foreach (var chromatogram in _msdatafile.Chromatograms) { var ChromLine = zedGraphControlTest.GraphPane.AddCurve(String.Format("{0} ({1}): [{2}] - {3}", chromatogram.Peptide, chromatogram.IsotopeLabelType, chromatogram.PrecursorMZ, "PosMatch"), chromatogram.RetentionTimes, chromatogram.SumOfPositiveMatch, Color.Green); ChromLine.Symbol.IsVisible = false; } zedGraphControlTest.AxisChange(); zedGraphControlTest.Refresh(); }
private void button7_Click(object sender, EventArgs e) { foreach (object drMzFile in cblSelectedFiles.CheckedItems) { string _fileName = drMzFile.ToString(); string _fileNameRAW = _fileName.Replace(".mxXML", ".raw"); var msrun = new MsDataFileImplExtAgg(_fileNameRAW); // msrun.MsDataFile.RunStartTime MessageBox.Show(msrun.MsDataFile.IsThermoFile.ToString(), "Is Thermo File"); MessageBox.Show(msrun.MsDataFile.IsWatersFile.ToString(), "Is Waters File"); MessageBox.Show(msrun.MsDataFile.RunStartTime.HasValue.ToString(), "RunStartTime.HasValue"); //MessageBox.Show(msrun.MsDataFile. .HasValue.ToString(), "RunStartTime.HasValue"); //string _mzXMLfile = File.ReadAllText(_fileName); //foreach (ListViewItem itemToSub in lVSubsForSkyline.CheckedItems) //{ // _mzXMLfile = _mzXMLfile.Replace(itemToSub.SubItems[2].Text, itemToSub.SubItems[3].Text); //} //string _directoryNameOnly = Path.GetDirectoryName(_fileName); //string _newDirectoryName = Path.Combine(_directoryNameOnly, "Skyline"); //if (!Directory.Exists(_newDirectoryName)) Directory.CreateDirectory(_newDirectoryName); //string _fileNameOnly = Path.GetFileName(_fileName); //string _newFileName = _newDirectoryName + Path.DirectorySeparatorChar + _fileNameOnly; //File.WriteAllText(_newFileName, _mzXMLfile); } MessageBox.Show("Completed"); }