Esempio n. 1
0
        private void ProcessWiffFile(FileSystemInfo fiDatasetFile, clsDatasetFileInfo datasetFileInfo)
        {
            try
            {
                // Open the .Wiff file using the ProteoWizardWrapper

                var objPWiz = new pwiz.ProteowizardWrapper.MSDataFileReader(fiDatasetFile.FullName);

                try
                {
                    var dtRunStartTime = Convert.ToDateTime(objPWiz.RunStartTime);

                    // Update AcqTimeEnd if possible
                    // Found out by trial and error that we need to use .ToUniversalTime() to adjust the time reported by ProteoWizard
                    dtRunStartTime = dtRunStartTime.ToUniversalTime();
                    if (dtRunStartTime < datasetFileInfo.AcqTimeEnd)
                    {
                        if (datasetFileInfo.AcqTimeEnd.Subtract(dtRunStartTime).TotalDays < 1)
                        {
                            datasetFileInfo.AcqTimeStart = dtRunStartTime;
                        }
                    }
                }
                catch (Exception)
                {
                    datasetFileInfo.AcqTimeStart = datasetFileInfo.AcqTimeEnd;
                }

                // Instantiate the Proteowizard Data Parser class
                var pWizParser = new clsProteowizardDataParser(objPWiz, mDatasetStatsSummarizer, mTICandBPIPlot,
                                                               mLCMS2DPlot, mSaveLCMS2DPlots, mSaveTICAndBPI,
                                                               mCheckCentroidingStatus)
                {
                    HighResMS1 = true,
                    HighResMS2 = true
                };

                RegisterEvents(pWizParser);

                var    blnTICStored      = false;
                var    blnSRMDataCached  = false;
                double dblRuntimeMinutes = 0;

                // Note that SRM .Wiff files will only have chromatograms, and no spectra

                if (objPWiz.ChromatogramCount > 0)
                {
                    // Process the chromatograms
                    pWizParser.StoreChromatogramInfo(datasetFileInfo, out blnTICStored, out blnSRMDataCached, out dblRuntimeMinutes);
                    pWizParser.PossiblyUpdateAcqTimeStart(datasetFileInfo, dblRuntimeMinutes);
                }

                if (objPWiz.SpectrumCount > 0 & !blnSRMDataCached)
                {
                    // Process the spectral data (though only if we did not process SRM data)
                    pWizParser.StoreMSSpectraInfo(datasetFileInfo, blnTICStored, ref dblRuntimeMinutes);
                    pWizParser.PossiblyUpdateAcqTimeStart(datasetFileInfo, dblRuntimeMinutes);
                }

                objPWiz.Dispose();
                clsProgRunner.GarbageCollectNow();
            }
            catch (Exception ex)
            {
                OnErrorEvent("Error using ProteoWizard reader: " + ex.Message, ex);
            }
        }
Esempio n. 2
0
        private void ReadBinaryData(string strDataFolderPath, clsDatasetFileInfo datasetFileInfo)
        {
            try
            {
                // Open the data folder using the ProteoWizardWrapper

                var objPWiz = new pwiz.ProteowizardWrapper.MSDataFileReader(strDataFolderPath);

                try
                {
                    var dtRunStartTime = Convert.ToDateTime(objPWiz.RunStartTime);

                    // Update AcqTimeEnd if possible
                    if (dtRunStartTime < datasetFileInfo.AcqTimeEnd)
                    {
                        if (datasetFileInfo.AcqTimeEnd.Subtract(dtRunStartTime).TotalDays < 1)
                        {
                            datasetFileInfo.AcqTimeStart = dtRunStartTime;
                        }
                    }
                }
                catch (Exception)
                {
                    // Leave the times unchanged
                }

                // Instantiate the Proteowizard Data Parser class
                var pWizParser = new clsProteowizardDataParser(objPWiz, mDatasetStatsSummarizer, mTICandBPIPlot,
                                                               mLCMS2DPlot, mSaveLCMS2DPlots, mSaveTICAndBPI,
                                                               mCheckCentroidingStatus)
                {
                    HighResMS1 = true,
                    HighResMS2 = true
                };

                RegisterEvents(pWizParser);

                var    blnTICStored      = false;
                double dblRuntimeMinutes = 0;

                if (objPWiz.ChromatogramCount > 0)
                {
                    // Process the chromatograms
                    pWizParser.StoreChromatogramInfo(datasetFileInfo, out blnTICStored, out _, out dblRuntimeMinutes);
                    pWizParser.PossiblyUpdateAcqTimeStart(datasetFileInfo, dblRuntimeMinutes);
                }

                if (objPWiz.SpectrumCount > 0)
                {
                    // Process the spectral data
                    pWizParser.StoreMSSpectraInfo(datasetFileInfo, blnTICStored, ref dblRuntimeMinutes);
                    pWizParser.PossiblyUpdateAcqTimeStart(datasetFileInfo, dblRuntimeMinutes);
                }

                objPWiz.Dispose();
                clsProgRunner.GarbageCollectNow();
            }
            catch (Exception ex)
            {
                OnErrorEvent("Exception reading the Binary Data in the Agilent TOF .D folder using Proteowizard: " + ex.Message, ex);
            }
        }