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