private void ReadBinaryData(string dataDirectoryPath, DatasetFileInfo datasetFileInfo, double acquisitionLengthMinutes)
        {
            try
            {
                // Open the data directory using the ProteoWizardWrapper

                var pWiz = new pwiz.ProteowizardWrapper.MSDataFileReader(dataDirectoryPath);

                try
                {
                    var runStartTime = Convert.ToDateTime(pWiz.RunStartTime);

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

                // Instantiate the ProteoWizard Data Parser class
                var pWizParser = new clsProteoWizardDataParser(pWiz, mDatasetStatsSummarizer, mTICAndBPIPlot,
                                                               mLCMS2DPlot, mSaveLCMS2DPlots, mSaveTICAndBPI,
                                                               mCheckCentroidingStatus)
                {
                    HighResMS1 = true,
                    HighResMS2 = true
                };

                RegisterEvents(pWizParser);

                var    ticStored      = false;
                double runtimeMinutes = 0;

                if (pWiz.ChromatogramCount > 0)
                {
                    // Process the chromatograms
                    pWizParser.StoreChromatogramInfo(datasetFileInfo, out ticStored, out _, out runtimeMinutes);
                    pWizParser.PossiblyUpdateAcqTimeStart(datasetFileInfo, runtimeMinutes);
                }

                if (pWiz.SpectrumCount > 0)
                {
                    // Process the spectral data
                    var skipExistingScans = (pWiz.ChromatogramCount > 0);

                    pWizParser.StoreMSSpectraInfo(ticStored, ref runtimeMinutes,
                                                  skipExistingScans,
                                                  skipScansWithNoIons: true,
                                                  maxScansToTrackInDetail: MAX_SCANS_TO_TRACK_IN_DETAIL,
                                                  maxScansForTicAndBpi: MAX_SCANS_FOR_TIC_AND_BPI);

                    pWizParser.PossiblyUpdateAcqTimeStart(datasetFileInfo, runtimeMinutes);
                }

                pWiz.Dispose();
                ProgRunner.GarbageCollectNow();
            }
            catch (Exception ex)
            {
                OnErrorEvent("Exception reading the Binary Data in the Agilent TOF .D directory using ProteoWizard: " + ex.Message, ex);
            }
        }
Beispiel #2
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);
            }
        }
Beispiel #3
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);
            }
        }