示例#1
0
 protected ChromInfoData(MeasuredResults measuredResults, int replicateIndex, ChromFileInfo chromFileInfo, ChromInfo chromInfo)
 {
     MeasuredResults = measuredResults;
     ReplicateIndex = replicateIndex;
     ChromFileInfo = chromFileInfo;
     ChromInfo = chromInfo;
 }
 public RemoteChromDataProvider(SrmDocument document, IRetentionTimePredictor retentionTimePredictor, ChromFileInfo chromFileInfo, ProgressStatus progressStatus, int startPercent,
     int endPercent, ILoadMonitor loader)
     : base(chromFileInfo, progressStatus, startPercent, endPercent, loader)
 {
     _document = document;
     ChorusUrl chorusUrl = (ChorusUrl)chromFileInfo.FilePath;
     _chorusAccount = chorusUrl.FindChorusAccount(Settings.Default.ChorusAccountList);
     var chromatogramRequestProviders = new List<ChromatogramRequestProvider>();
     foreach (bool firstPass in new[] {true, false})
     {
         if (null == retentionTimePredictor && !firstPass)
         {
             continue;
         }
         var chromatogramRequestProvider = new ChromatogramRequestProvider(document, chorusUrl,
             retentionTimePredictor, firstPass);
         if (0 == chromatogramRequestProvider.ChromKeys.Count)
         {
             continue;
         }
         chromatogramRequestProviders.Add(chromatogramRequestProvider);
     }
     _chromatogramRequestProviders = chromatogramRequestProviders.ToArray();
     _chromTaskLists = new ChromTaskList[_chromatogramRequestProviders.Length];
 }
 public PeptideChromDataSets(PeptideDocNode nodePep,
                             SrmDocument document,
                             ChromFileInfo fileInfo,
                             IList <DetailedPeakFeatureCalculator> detailedPeakFeatureCalculators,
                             bool isProcessedScans)
 {
     NodePep  = nodePep;
     FileInfo = fileInfo;
     DetailedPeakFeatureCalculators = detailedPeakFeatureCalculators;
     _document         = document;
     _retentionTimes   = new double[0];
     _isProcessedScans = isProcessedScans;
 }
示例#4
0
        protected ChromDataProvider(ChromFileInfo fileInfo,
                                    IProgressStatus status,
                                    int startPercent,
                                    int endPercent,
                                    IProgressMonitor loader)
        {
            FileInfo = fileInfo;
            Status   = status;

            _startPercent = startPercent;
            _endPercent   = endPercent;
            _loader       = loader;
        }
示例#5
0
        public ChromatogramDataProvider(MsDataFileImpl dataFile,
            ChromFileInfo fileInfo,
            ProgressStatus status,
            int startPercent,
            int endPercent,
            IProgressMonitor loader)
            : base(fileInfo, status, startPercent, endPercent, loader)
        {
            _dataFile = dataFile;

            if (_dataFile.IsThermoFile)
            {
                _readMaxMinutes = 4;
            }

            int len = dataFile.ChromatogramCount;
            _chromIndices = new int[len];

            bool fixCEOptForShimadzu = dataFile.IsShimadzuFile;
            int indexPrecursor = -1;
            double lastPrecursor = 0;
            for (int i = 0; i < len; i++)
            {
                int index;
                string id = dataFile.GetChromatogramId(i, out index);

                if (!ChromKey.IsKeyId(id))
                    continue;

                var chromKey = ChromKey.FromId(id, fixCEOptForShimadzu);
                if (chromKey.Precursor != lastPrecursor)
                {
                    lastPrecursor = chromKey.Precursor;
                    indexPrecursor++;
                }
                var ki = new KeyValuePair<ChromKey, int>(chromKey, index);
                _chromIndices[index] = indexPrecursor;
                _chromIds.Add(ki);
            }

            // Shimadzu can't do the necessary product m/z stepping for itself.
            // So, they provide the CE values in their IDs and we need to adjust
            // product m/z values for them to support CE optimization.
            if (fixCEOptForShimadzu)
                FixCEOptForShimadzu();

            if (_chromIds.Count == 0)
                throw new NoSrmDataException(dataFile.FilePath);

            SetPercentComplete(50);
        }
示例#6
0
        public override void ReadXml(XmlReader reader)
        {
            // Read tag attributes
            base.ReadXml(reader);
            UseForRetentionTimeFilter = reader.GetBoolAttribute(ATTR.use_for_retention_time_prediction, false);
            AnalyteConcentration      = reader.GetNullableDoubleAttribute(ATTR.analyte_concentration);
            SampleType = SampleType.FromName(reader.GetAttribute(ATTR.sample_type));
            // Consume tag
            reader.Read();

            // Check if there is an optimization function element, and read
            // if if there is.
            IXmlElementHelper <OptimizableRegression> helper =
                reader.FindHelper(OPTIMIZATION_HELPERS);

            if (helper != null)
            {
                OptimizationFunction = helper.Deserialize(reader);
            }

            var chromFileInfos = new List <ChromFileInfo>();
            var fileLoadIds    = new List <string>();

            while (reader.IsStartElement(EL.sample_file) ||
                   reader.IsStartElement(EL.replicate_file) ||
                   reader.IsStartElement(EL.chromatogram_file))
            {
                // Note that the file path is actually be a URI that encodes things like lockmass correction as well as filename
                ChromFileInfo chromFileInfo = new ChromFileInfo(MsDataFileUri.Parse(reader.GetAttribute(ATTR.file_path)));
                chromFileInfo = chromFileInfo.ChangeHasMidasSpectra(reader.GetBoolAttribute(ATTR.has_midas_spectra, false));
                chromFileInfos.Add(chromFileInfo);

                string id = reader.GetAttribute(ATTR.id) ?? GetOrdinalSaveId(fileLoadIds.Count);
                fileLoadIds.Add(id);
                reader.Read();
                if (reader.IsStartElement(EL.instrument_info_list))
                {
                    reader.Skip();
                    reader.Read();
                }
            }
            Annotations = SrmDocument.ReadAnnotations(reader);

            MSDataFileInfos = chromFileInfos;
            _fileLoadIds    = fileLoadIds.ToArray();

            // Consume end tag
            reader.ReadEndElement();
        }
示例#7
0
 public bool Equals(ChromFileInfo other)
 {
     if (ReferenceEquals(null, other))
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     if (!Equals(other.Id, Id))
     {
         return(false);
     }
     if (!Equals(other.FilePath, FilePath))
     {
         return(false);
     }
     if (!other.FileWriteTime.Equals(FileWriteTime))
     {
         return(false);
     }
     if (!other.RunStartTime.Equals(RunStartTime))
     {
         return(false);
     }
     if (!other.MaxIntensity.Equals(MaxIntensity))
     {
         return(false);
     }
     if (!other.MaxRetentionTime.Equals(MaxRetentionTime))
     {
         return(false);
     }
     if (HasMidasSpectra != other.HasMidasSpectra)
     {
         return(false);
     }
     if (!ArrayUtil.EqualsDeep(other.InstrumentInfoList, InstrumentInfoList))
     {
         return(false);
     }
     if (!ArrayUtil.EqualsDeep(other.RetentionTimeAlignments, RetentionTimeAlignments))
     {
         return(false);
     }
     return(true);
 }
 public ChorusResponseChromDataProvider(SrmDocument document, ChromFileInfo chromFileInfo, ProgressStatus progressStatus, int startPercent,
     int endPercent, ILoadMonitor loader)
     : base(chromFileInfo, progressStatus, startPercent, endPercent, loader)
 {
     ChromatogramCache.RawData rawData;
     MsDataFilePath msDataFilePath = (MsDataFilePath) chromFileInfo.FilePath;
     IPooledStream stream = loader.StreamManager.CreatePooledStream(msDataFilePath.FilePath, false);
     ChromatogramCache.LoadStructs(stream.Stream, out rawData);
     var chromCacheFile = rawData.ChromCacheFiles[0];
     rawData.ChromCacheFiles = new[]
     {
         new ChromCachedFile(chromFileInfo.FilePath, chromCacheFile.Flags, chromCacheFile.FileWriteTime,
             chromCacheFile.RunStartTime, chromCacheFile.MaxRetentionTime, chromCacheFile.MaxIntensity,
             chromCacheFile.InstrumentInfoList),
     };
     var cache = new ChromatogramCache("cachePath", rawData, stream); // Not L10N
     _cachedChromatogramDataProvider = new CachedChromatogramDataProvider(cache, document,
         chromFileInfo.FilePath, chromFileInfo, null, progressStatus, startPercent, endPercent, loader);
 }
示例#9
0
        public ChorusResponseChromDataProvider(SrmDocument document, ChromFileInfo chromFileInfo, IProgressStatus progressStatus, int startPercent,
                                               int endPercent, ILoadMonitor loader) : base(chromFileInfo, progressStatus, startPercent, endPercent, loader)
        {
            ChromatogramCache.RawData rawData;
            MsDataFilePath            msDataFilePath = (MsDataFilePath)chromFileInfo.FilePath;
            IPooledStream             stream         = loader.StreamManager.CreatePooledStream(msDataFilePath.FilePath, false);

            ChromatogramCache.LoadStructs(stream.Stream, out rawData);
            var chromCacheFile = rawData.ChromCacheFiles[0];

            rawData.ChromCacheFiles = new[]
            {
                new ChromCachedFile(chromFileInfo.FilePath, chromCacheFile.Flags, chromCacheFile.FileWriteTime,
                                    chromCacheFile.RunStartTime, chromCacheFile.MaxRetentionTime, chromCacheFile.MaxIntensity,
                                    chromCacheFile.InstrumentInfoList),
            };
            var cache = new ChromatogramCache("cachePath", rawData, stream); // Not L10N

            _cachedChromatogramDataProvider = new CachedChromatogramDataProvider(cache, document,
                                                                                 chromFileInfo.FilePath, chromFileInfo, null, progressStatus, startPercent, endPercent, loader);
        }
 public CachedChromatogramDataProvider(ChromatogramCache cache,
     SrmDocument document,
     MsDataFileUri dataFilePath,
     ChromFileInfo fileInfo,
     bool? singleMatchMz,
     ProgressStatus status,
     int startPercent,
     int endPercent,
     ILoadMonitor loader)
     : base(fileInfo, status, startPercent, endPercent, loader)
 {
     _cache = cache;
     _fileIndex = cache.CachedFiles.IndexOf(f => Equals(f.FilePath, dataFilePath));
     _chromKeyIndices = cache.GetChromKeys(dataFilePath).OrderBy(v => v.LocationPoints).ToArray();
     _cache.GetStatusDimensions(dataFilePath, out _maxRetentionTime, out _maxIntensity);
     _singleMatchMz = singleMatchMz.HasValue
                          ? singleMatchMz.Value
                          // Unfortunately, before the single matching status was
                          // written into the cache file, we can only guess about its
                          // status based on the overall document settings
                          : document.Settings.TransitionSettings.FullScan.IsEnabled;
 }
示例#11
0
 public CachedChromatogramDataProvider(ChromatogramCache cache,
                                       SrmDocument document,
                                       MsDataFileUri dataFilePath,
                                       ChromFileInfo fileInfo,
                                       bool?singleMatchMz,
                                       ProgressStatus status,
                                       int startPercent,
                                       int endPercent,
                                       ILoadMonitor loader)
     : base(fileInfo, status, startPercent, endPercent, loader)
 {
     _cache           = cache;
     _fileIndex       = cache.CachedFiles.IndexOf(f => Equals(f.FilePath, dataFilePath));
     _chromKeyIndices = cache.GetChromKeys(dataFilePath).OrderBy(v => v.LocationPoints).ToArray();
     _cache.GetStatusDimensions(dataFilePath, out _maxRetentionTime, out _maxIntensity);
     _singleMatchMz = singleMatchMz.HasValue
                          ? singleMatchMz.Value
                      // Unfortunately, before the single matching status was
                      // written into the cache file, we can only guess about its
                      // status based on the overall document settings
                          : document.Settings.TransitionSettings.FullScan.IsEnabled;
 }
示例#12
0
        public CachedChromatogramDataProvider(ChromatogramCache cache,
                                              SrmDocument document,
                                              MsDataFileUri dataFilePath,
                                              ChromFileInfo fileInfo,
                                              bool?singleMatchMz,
                                              IProgressStatus status,
                                              int startPercent,
                                              int endPercent,
                                              ILoadMonitor loader)
            : base(fileInfo, status, startPercent, endPercent, loader)
        {
            // Deal with older cache formats where we did not record chromatogram polarity
            var assumeNegativeChargesInPreV11Caches = document.MoleculeTransitionGroups.All(p => p.PrecursorMz.IsNegative);

            // Need a newly loaded copy to allow for concurrent loading for multiple cached files
            _cache = ChromatogramCache.Load(cache.CachePath, new ProgressStatus(), loader, assumeNegativeChargesInPreV11Caches);

            _fileIndex       = cache.CachedFiles.IndexOf(f => Equals(f.FilePath, dataFilePath));
            _chromKeyIndices = cache.GetChromKeys(dataFilePath).OrderBy(v => v.LocationPoints).ToArray();
            foreach (var c in _chromKeyIndices.Where(i => i.Key.Precursor != 0))
            {
                if (c.Key.Precursor.IsNegative)
                {
                    _sourceHasNegativePolarityData = true;
                }
                else
                {
                    _sourceHasPositivePolarityData = true;
                }
            }
            _cache.GetStatusDimensions(dataFilePath, out _maxRetentionTime, out _maxIntensity);
            _singleMatchMz = singleMatchMz.HasValue
                                 ? singleMatchMz.Value
                             // Unfortunately, before the single matching status was
                             // written into the cache file, we can only guess about its
                             // status based on the overall document settings
                                 : document.Settings.TransitionSettings.FullScan.IsEnabled;
        }
示例#13
0
 private TransitionChromInfoData(MeasuredResults measuredResults, int replicateIndex, ChromFileInfo chromFileInfo, TransitionChromInfo transitionChromInfo)
     : base(measuredResults, replicateIndex, chromFileInfo, transitionChromInfo)
 {
 }
示例#14
0
        private static double?GetApexRT(TransitionGroupDocNode nodeGroup, int resultIndex, ChromFileInfo chromFileInfo, bool ms1Trans)
        {
            double?apexRT = null;
            float  ms1Max = 0;
            var    trans  = ms1Trans
                ? nodeGroup.GetMsTransitions(true)
                : nodeGroup.GetMsMsTransitions(true);

            foreach (var nodeTran in trans)
            {
                foreach (var peakInfo in nodeTran.GetChromInfos(resultIndex).Where(c =>
                                                                                   ReferenceEquals(c.FileId, chromFileInfo.FileId)))
                {
                    if (peakInfo.Area > ms1Max)
                    {
                        apexRT = peakInfo.RetentionTime;
                        ms1Max = peakInfo.Area;
                    }
                }
            }
            return(apexRT);
        }
 private bool IsCachedFile(SrmDocument doc, ChromFileInfo info)
 {
     return doc.Settings.MeasuredResults.IsCachedFile(info.FilePath);
 }
示例#16
0
        public ChromatogramDataProvider(MsDataFileImpl dataFile,
                                        ChromFileInfo fileInfo,
                                        IProgressStatus status,
                                        int startPercent,
                                        int endPercent,
                                        IProgressMonitor loader)
            : base(fileInfo, status, startPercent, endPercent, loader)
        {
            _dataFile = dataFile;

            if (_dataFile.IsThermoFile)
            {
                _readMaxMinutes = 4;
            }

            int len = dataFile.ChromatogramCount;

            _chromIndices = new int[len];

            bool fixCEOptForShimadzu = dataFile.IsShimadzuFile;
            int  indexPrecursor      = -1;
            var  lastPrecursor       = SignedMz.ZERO;

            for (int i = 0; i < len; i++)
            {
                int    index;
                string id = dataFile.GetChromatogramId(i, out index);

                if (!ChromKey.IsKeyId(id))
                {
                    continue;
                }

                var chromKey = ChromKey.FromId(id, fixCEOptForShimadzu);
                if (chromKey.Precursor != lastPrecursor)
                {
                    lastPrecursor = chromKey.Precursor;
                    indexPrecursor++;
                }
                var ki = new ChromKeyProviderIdPair(chromKey, index);
                _chromIndices[index] = indexPrecursor;
                _chromIds.Add(ki);
            }

            // Shimadzu can't do the necessary product m/z stepping for itself.
            // So, they provide the CE values in their IDs and we need to adjust
            // product m/z values for them to support CE optimization.
            if (fixCEOptForShimadzu)
            {
                FixCEOptForShimadzu();
            }

            if (_chromIds.Count == 0)
            {
                throw new NoSrmDataException(FileInfo.FilePath);
            }

            // CONSIDER(kaipot): Some way to support mzML files converted from MIDAS wiff files
            _hasMidasSpectra = (dataFile.IsABFile) && SpectraChromDataProvider.HasSpectrumData(dataFile);

            SetPercentComplete(50);
        }
示例#17
0
        public void RemoveResults(DateTime? removeBefore)
        {
            if (removeBefore.HasValue)
                _out.WriteLine(Resources.CommandLine_RemoveResults_Removing_results_before_ + removeBefore.Value.ToShortDateString() + "..."); // Not L10N
            else
                _out.WriteLine(Resources.CommandLine_RemoveResults_Removing_all_results);
            var filteredChroms = new List<ChromatogramSet>();
            if (_doc.Settings.MeasuredResults == null)
            {
                // No imported results in the document.
                return;
            }
            foreach (var chromSet in _doc.Settings.MeasuredResults.Chromatograms)
            {
                var listFileInfosRemaining = new ChromFileInfo[0];
                if (removeBefore.HasValue)
                {
                    listFileInfosRemaining = chromSet.MSDataFileInfos.Where(fileInfo =>
                        fileInfo.RunStartTime == null || fileInfo.RunStartTime >= removeBefore).ToArray();
                }
                if (ArrayUtil.ReferencesEqual(listFileInfosRemaining, chromSet.MSDataFileInfos))
                    filteredChroms.Add(chromSet);
                else
                {
                    foreach (var fileInfo in chromSet.MSDataFileInfos.Except(listFileInfosRemaining))
                        _out.WriteLine(Resources.CommandLine_RemoveResults_Removed__0__, fileInfo.FilePath);
                    if (listFileInfosRemaining.Any())
                        filteredChroms.Add(chromSet.ChangeMSDataFileInfos(listFileInfosRemaining));
                }
            }
            if (!ArrayUtil.ReferencesEqual(filteredChroms, _doc.Settings.MeasuredResults.Chromatograms))
            {
                MeasuredResults newMeasuredResults = filteredChroms.Any() ?
                    _doc.Settings.MeasuredResults.ChangeChromatograms(filteredChroms) : null;

                _doc = _doc.ChangeMeasuredResults(newMeasuredResults);
            }
        }
示例#18
0
 private TransitionChromInfoData(MeasuredResults measuredResults, int replicateIndex, ChromFileInfo chromFileInfo, TransitionChromInfo transitionChromInfo)
     : base(measuredResults, replicateIndex, chromFileInfo, transitionChromInfo)
 {
 }
示例#19
0
 public bool Equals(ChromFileInfo other)
 {
     if (ReferenceEquals(null, other)) return false;
     if (ReferenceEquals(this, other)) return true;
     if (!Equals(other.Id, Id))
         return false;
     if (!Equals(other.FilePath, FilePath))
         return false;
     if (!other.FileWriteTime.Equals(FileWriteTime))
         return false;
     if (!other.RunStartTime.Equals(RunStartTime))
         return false;
     if (!other.MaxIntensity.Equals(MaxIntensity))
         return false;
     if (!other.MaxRetentionTime.Equals(MaxRetentionTime))
         return false;
     if (!ArrayUtil.EqualsDeep(other.InstrumentInfoList, InstrumentInfoList))
         return false;
     if (!ArrayUtil.EqualsDeep(other.RetentionTimeAlignments, RetentionTimeAlignments))
         return false;
     return true;
 }
示例#20
0
        public ChromatogramDataProvider(MsDataFileImpl dataFile,
                                        ChromFileInfo fileInfo,
                                        IProgressStatus status,
                                        int startPercent,
                                        int endPercent,
                                        IProgressMonitor loader)
            : base(fileInfo, status, startPercent, endPercent, loader)
        {
            _dataFile = dataFile;
            _globalChromatogramExtractor = new GlobalChromatogramExtractor(dataFile);

            if (_dataFile.IsThermoFile)
            {
                _readMaxMinutes = 4;
            }

            int len = dataFile.ChromatogramCount;

            _chromIndices = new int[len];

            bool fixCEOptForShimadzu = dataFile.IsShimadzuFile;
            int  indexPrecursor      = -1;
            var  lastPrecursor       = SignedMz.ZERO;

            for (int i = 0; i < len; i++)
            {
                int    index;
                string id = dataFile.GetChromatogramId(i, out index);

                if (!ChromKey.IsKeyId(id))
                {
                    continue;
                }

                var chromKey = ChromKey.FromId(id, fixCEOptForShimadzu);
                if (chromKey.Precursor != lastPrecursor)
                {
                    lastPrecursor = chromKey.Precursor;
                    indexPrecursor++;
                }
                if (chromKey.Precursor.IsNegative)
                {
                    _sourceHasNegativePolarityData = true;
                }
                else
                {
                    _sourceHasPositivePolarityData = true;
                }
                var ki = new ChromKeyProviderIdPair(chromKey, index);
                _chromIndices[index] = indexPrecursor;
                _chromIds.Add(ki);
            }

            // Shimadzu can't do the necessary product m/z stepping for itself.
            // So, they provide the CE values in their IDs and we need to adjust
            // product m/z values for them to support CE optimization.
            if (fixCEOptForShimadzu)
            {
                FixCEOptForShimadzu();
            }

            if (_chromIds.Count == 0)
            {
                throw new NoSrmDataException(FileInfo.FilePath);
            }

            // CONSIDER: TIC and BPC are not well defined for SRM and produced chromatograms with over 100,000 points in
            // Agilent CE optimization data. So, keep them off for now.
//            foreach (int globalIndex in _globalChromatogramExtractor.GlobalChromatogramIndexes)
//            {
//                _chromIndices[globalIndex] = globalIndex;
//                _chromIds.Add(new ChromKeyProviderIdPair(ChromKey.FromId(_globalChromatogramExtractor.GetChromatogramId(globalIndex, out int indexId), false), globalIndex));
//            }

            foreach (var qcTracePair in _globalChromatogramExtractor.QcTraceByIndex)
            {
                _chromIndices[qcTracePair.Key] = qcTracePair.Key;
                _chromIds.Add(new ChromKeyProviderIdPair(ChromKey.FromQcTrace(qcTracePair.Value), qcTracePair.Key));
            }

            // CONSIDER(kaipot): Some way to support mzML files converted from MIDAS wiff files
            _hasMidasSpectra = (dataFile.IsABFile) && SpectraChromDataProvider.HasSpectrumData(dataFile);

            _ionMobilityUnits       = dataFile.IonMobilityUnits;
            _hasIonMobilityCombined = dataFile.HasCombinedIonMobilitySpectra;  // When true, data source provides IMS data in 3-array format, which affects spectrum ID format

            SetPercentComplete(50);
        }
示例#21
0
        public ChromatogramSet ChangeMSDataFilePaths(IList<MsDataFileUri> prop)
        {
            var set = ImClone(this);

            // Be sure to preserve existing file info objects
            var dictPathToFileInfo = MSDataFileInfos.ToDictionary(info => info.FilePath);
            var listFileInfos = new List<ChromFileInfo>();
            foreach (var filePath in prop)
            {
                ChromFileInfo chromFileInfo;
                if (!dictPathToFileInfo.TryGetValue(filePath, out chromFileInfo))
                {
                    chromFileInfo = new ChromFileInfo(filePath);
                }
                listFileInfos.Add(chromFileInfo);
            }

            set.MSDataFileInfos = listFileInfos;

            if (ReferenceEquals(MSDataFileInfos, set.MSDataFileInfos))
                return this;

            return set;
        }
示例#22
0
        /// <summary>
        /// Calculates the fileCacheFlags from a collection of cached paths.
        /// This function modifies 'this', and should only be called on a clone
        /// before it is returned from a change operation.
        /// <para>
        /// If a path is not found in the cached set, its name is checked in
        /// the names set, and if found, then disk is checked to see if the
        /// file location has been moved.</para>
        /// </summary>
        /// <param name="cachedPaths">Set of known cached paths</param>
        /// <param name="cachedFileNames">Set of known cached file names</param>
        /// <param name="cachePath">Final cache path</param>
        private void CalcCachedFlags(IDictionary<MsDataFileUri, ChromCachedFile> cachedPaths,
            ICollection<string> cachedFileNames, string cachePath)
        {
            ChromFileInfo[] fileInfos = new ChromFileInfo[FileCount];
            for (int i = 0; i < fileInfos.Length; i++)
            {
                fileInfos[i] = MSDataFileInfos[i];

                var path = fileInfos[i].FilePath;

                ChromCachedFile fileInfo;
                if (cachedPaths.TryGetValue(path, out fileInfo))
                    fileInfos[i] = fileInfos[i].ChangeInfo(fileInfo);
                else if (cachedFileNames == null || cachedFileNames.Contains(path.GetFileName()))
                {
                    // If the name but not the file was found, check for an
                    // existing file in the cache file's directory.
                    var dataFilePath = GetExistingDataFilePath(cachePath, path);
                    if (dataFilePath != null && cachedPaths.TryGetValue(dataFilePath, out fileInfo))
                        fileInfos[i] = fileInfos[i].ChangeInfo(fileInfo);
                }
            }

            if (!ArrayUtil.EqualsDeep(MSDataFileInfos, fileInfos))
                MSDataFileInfos = fileInfos;
        }
示例#23
0
 private PeptideChromInfoData(MeasuredResults measuredResults, int replicateIndex, ChromFileInfo chromFileInfo, PeptideChromInfo peptideChromInfo, PeptideDocNode peptideDocNode)
     : base(measuredResults, replicateIndex, chromFileInfo, peptideChromInfo, peptideDocNode, null)
 {
 }
示例#24
0
 private TransitionChromInfoData(MeasuredResults measuredResults, int replicateIndex, ChromFileInfo chromFileInfo, TransitionChromInfo transitionChromInfo, PeptideDocNode peptideDocNode, TransitionGroupDocNode transitionGroupDocNode, TransitionDocNode transitionDocNode)
     : base(measuredResults, replicateIndex, chromFileInfo, transitionChromInfo, peptideDocNode, transitionGroupDocNode)
 {
     TransitionDocNode = transitionDocNode;
 }
 private ChromFileInfo StripFilePathInfo(ChromFileInfo chromFileInfo)
 {
     // Remove the everything but the filename from the FilePath, and zero out the FileModifiedTime.
     var chromCachedFile = new ChromCachedFile(new MsDataFilePath(chromFileInfo.FilePath.GetFileName()), 0,
         new DateTime(0), chromFileInfo.RunStartTime, (float) chromFileInfo.MaxRetentionTime,
         (float) chromFileInfo.MaxIntensity, chromFileInfo.InstrumentInfoList);
     return chromFileInfo.ChangeInfo(chromCachedFile);
 }
示例#26
0
        public RemoteChromDataProvider(SrmDocument document, IRetentionTimePredictor retentionTimePredictor, ChromFileInfo chromFileInfo, IProgressStatus progressStatus, int startPercent,
                                       int endPercent, ILoadMonitor loader)
            : base(chromFileInfo, progressStatus, startPercent, endPercent, loader)
        {
            _document = document;
            ChorusUrl chorusUrl = (ChorusUrl)chromFileInfo.FilePath;

            _chorusAccount = chorusUrl.FindChorusAccount(Settings.Default.RemoteAccountList);
            var chromatogramRequestProviders = new List <ChromatogramRequestProvider>();

            foreach (bool firstPass in new[] { true, false })
            {
                if (null == retentionTimePredictor && !firstPass)
                {
                    continue;
                }
                var chromatogramRequestProvider = new ChromatogramRequestProvider(document, chorusUrl,
                                                                                  retentionTimePredictor, firstPass);
                if (0 == chromatogramRequestProvider.ChromKeys.Count)
                {
                    continue;
                }
                chromatogramRequestProviders.Add(chromatogramRequestProvider);
            }
            _chromatogramRequestProviders = chromatogramRequestProviders.ToArray();
            _chromTaskLists = new ChromTaskList[_chromatogramRequestProviders.Length];
        }
示例#27
0
 private static double? GetApexRT(TransitionGroupDocNode nodeGroup, int resultIndex, ChromFileInfo chromFileInfo, bool ms1Trans)
 {
     double? apexRT = null;
     float ms1Max = 0;
     var trans = ms1Trans
         ? nodeGroup.GetMsTransitions(true)
         : nodeGroup.GetMsMsTransitions(true);
     foreach (var nodeTran in trans)
     {
         foreach (var peakInfo in nodeTran.GetChromInfos(resultIndex).Where(c =>
             ReferenceEquals(c.FileId, chromFileInfo.FileId)))
         {
             if (peakInfo.Area > ms1Max)
             {
                 apexRT = peakInfo.RetentionTime;
                 ms1Max = peakInfo.Area;
             }
         }
     }
     return apexRT;
 }
        public SpectraChromDataProvider(MsDataFileImpl dataFile,
            ChromFileInfo fileInfo,
            SrmDocument document,
            IRetentionTimePredictor retentionTimePredictor,
            string cachePath, // We'll write tempfiles in this directory
            ProgressStatus status,
            int startPercent,
            int endPercent,
            IProgressMonitor loader)
            : base(fileInfo, status, startPercent, endPercent, loader)
        {
            _document = document;
            _filePath = dataFile.FilePath;
            _cachePath = cachePath;

            // If no SRM spectra, then full-scan filtering must be enabled
            _isSrm = dataFile.HasSrmSpectra;
            if (!_isSrm)
            {
                if (!document.Settings.TransitionSettings.FullScan.IsEnabled)
                    throw new NoFullScanFilteringException(dataFile.FilePath);

                // Only use the retention time predictor on non-SRM data, and only when
                // there are enough transitions to cause performance issues with extracting
                // full-gradient in a single pass, and then trimming.
                if (_document.Settings.TransitionSettings.FullScan.RetentionTimeFilterType == RetentionTimeFilterType.scheduling_windows &&
                    _document.MoleculeTransitionCount > MAX_FULL_GRADIENT_TRANSITIONS)
                {
                    _retentionTimePredictor = retentionTimePredictor;
                }
            }

            // Only mzXML from mzWiff requires the introduction of zero values
            // during interpolation.
            _isProcessedScans = dataFile.IsMzWiffXml;

            UpdatePercentComplete();

            // Create the filter responsible for chromatogram extraction
            bool firstPass = (_retentionTimePredictor != null);
            _filter = new SpectrumFilter(_document, FileInfo.FilePath, new DataFileInstrumentInfo(dataFile),
                _retentionTimePredictor, firstPass);

            if (!_isSrm && (_filter.EnabledMs || _filter.EnabledMsMs))
            {
                // Full-scan filtering should always match a single precursor
                // m/z value to a single precursor node in the document tree,
                // because that is the way the filters are constructed in the
                // first place.
                _isSingleMzMatch = true;
            }

            // Get data object used to graph all of the chromatograms.
            if (_loader.HasUI)
                _allChromData = LoadingStatus.Transitions;

            try
            {
                InitSpectrumReader(dataFile);
                InitChromatogramExtraction();
            }
            catch(Exception)
            {
                // If exception thrown before construction is complete than Dispose will not be called.
                if (_spectra == null)
                    dataFile.Dispose();
                else
                    _spectra.Dispose();

                throw;
            }
        }
示例#29
0
        protected ChromDataProvider(ChromFileInfo fileInfo,
            ProgressStatus status,
            int startPercent,
            int endPercent,
            IProgressMonitor loader)
        {
            FileInfo = fileInfo;
            Status = status;

            _startPercent = startPercent;
            _endPercent = endPercent;
            _loader = loader;
        }