Пример #1
0
        public override bool GetChromatogram(
            int id,
            Target modifiedSequence,
            Color peptideColor,
            out ChromExtra extra,
            out TimeIntensities timeIntensities)
        {
            bool loaded = false;

            extra           = null;
            timeIntensities = null;
            int idRemain = id;

            for (int iTaskList = 0; iTaskList < _chromatogramRequestProviders.Length; iTaskList++)
            {
                ChromatogramRequestProvider requestProvider = _chromatogramRequestProviders[iTaskList];
                if (requestProvider.ChromKeys.Count <= idRemain)
                {
                    idRemain -= requestProvider.ChromKeys.Count;
                    continue;
                }
                ChromTaskList chromTaskList = _chromTaskLists[iTaskList];
                if (null == chromTaskList)
                {
                    chromTaskList = _chromTaskLists[iTaskList] = new ChromTaskList(CheckCancelled, _document, _chorusAccount, requestProvider.ChorusUrl, ChromTaskList.ChunkChromatogramRequest(requestProvider.GetChromatogramRequest(), 1000));
                    chromTaskList.SetMinimumSimultaneousTasks(3);
                }
                ChromKey chromKey = requestProvider.ChromKeys[idRemain];
                loaded = chromTaskList.GetChromatogram(chromKey, out timeIntensities);
                if (loaded)
                {
                    extra = new ChromExtra(id, chromKey.Precursor == 0 ? 0 : -1);
                    if (chromKey.Precursor.IsNegative)
                    {
                        _sourceHasNegativePolarityData = true;
                    }
                    else
                    {
                        _sourceHasPositivePolarityData = true;
                    }
                    if (timeIntensities.NumPoints > 0 && Status is ChromatogramLoadingStatus)
                    {
                        ((ChromatogramLoadingStatus)Status).Transitions.AddTransition(
                            modifiedSequence,
                            peptideColor,
                            extra.StatusId,
                            extra.StatusRank,
                            timeIntensities.Times,
                            timeIntensities.Intensities);
                    }
                }
                break;
            }
            int percentComplete = _chromTaskLists.Sum(taskList => taskList == null ? 0 : taskList.PercentComplete) /
                                  _chromTaskLists.Length;

            percentComplete = Math.Min(percentComplete, 99);
            SetPercentComplete(percentComplete);
            return(loaded);
        }
Пример #2
0
 public override bool GetChromatogram(
     int id, string modifiedSequence, Color peptideColor,
     out ChromExtra extra, out float[] times, out int[] scanIndexes, out float[] intensities, out float[] massErrors)
 {
     return(_cachedChromatogramDataProvider.GetChromatogram(
                id, modifiedSequence, peptideColor,
                out extra, out times, out scanIndexes, out intensities, out massErrors));
 }
Пример #3
0
        public override bool GetChromatogram(
            int id,
            string modifiedSequence,
            Color peptideColor,
            out ChromExtra extra,
            out float[] times,
            out int[] scanIndexes,
            out float[] intensities,
            out float[] massErrors)
        {
            bool loaded = false;

            extra       = null;
            times       = null;
            scanIndexes = null;
            intensities = null;
            massErrors  = null;
            int idRemain = id;

            for (int iTaskList = 0; iTaskList < _chromatogramRequestProviders.Length; iTaskList++)
            {
                ChromatogramRequestProvider requestProvider = _chromatogramRequestProviders[iTaskList];
                if (requestProvider.ChromKeys.Count <= idRemain)
                {
                    idRemain -= requestProvider.ChromKeys.Count;
                    continue;
                }
                ChromTaskList chromTaskList = _chromTaskLists[iTaskList];
                if (null == chromTaskList)
                {
                    chromTaskList = _chromTaskLists[iTaskList] = new ChromTaskList(CheckCancelled, _document, _chorusAccount, requestProvider.ChorusUrl, ChromTaskList.ChunkChromatogramRequest(requestProvider.GetChromatogramRequest(), 1000));
                    chromTaskList.SetMinimumSimultaneousTasks(3);
                }
                ChromKey chromKey = requestProvider.ChromKeys[idRemain];
                loaded = chromTaskList.GetChromatogram(chromKey, out times, out scanIndexes, out intensities, out massErrors);
                if (loaded)
                {
                    extra = new ChromExtra(id, chromKey.Precursor == 0 ? 0 : -1);
                    if (times.Length > 0)
                    {
                        LoadingStatus.Transitions.AddTransition(
                            modifiedSequence,
                            peptideColor,
                            extra.StatusId,
                            extra.StatusRank,
                            times,
                            intensities);
                    }
                }
                break;
            }
            int percentComplete = _chromTaskLists.Sum(taskList => taskList == null ? 0 : taskList.PercentComplete) /
                                  _chromTaskLists.Length;

            percentComplete = Math.Min(percentComplete, 99);
            SetPercentComplete(percentComplete);
            return(loaded);
        }
Пример #4
0
        public override bool GetChromatogram(int id, Target modifiedSequence, Color color, out ChromExtra extra, out TimeIntensities timeIntensities)
        {
            // No mass errors in SRM
            if (_readChromatograms == 0)
            {
                _readStartTime = DateTime.UtcNow; // Said to be 117x faster than Now and this is for a delta
            }

            float[] times, intensities;
            if (!_globalChromatogramExtractor.GetChromatogram(id, out times, out intensities))
            {
                _dataFile.GetChromatogram(id, out string chromId, out times, out intensities);
            }

            timeIntensities = new TimeIntensities(times, intensities, null, null);

            // Assume that each chromatogram will be read once, though this may
            // not always be completely true.
            _readChromatograms++;

            if (!System.Diagnostics.Debugger.IsAttached)
            {
                double predictedMinutes = ExpectedReadDurationMinutes;
                if (_readMaxMinutes > 0 && predictedMinutes > _readMaxMinutes)
                {
                    // TODO: This warning isn't checked in the command line version of Skyline.  Maybe we should do that.
                    if (Status is ChromatogramLoadingStatus)
                    {
                        Status =
                            ((ChromatogramLoadingStatus)Status).ChangeWarningMessage(Resources.ChromatogramDataProvider_GetChromatogram_This_import_appears_to_be_taking_longer_than_expected__If_importing_from_a_network_drive__consider_canceling_this_import__copying_to_local_disk_and_retrying_);
                    }
                }
            }

            if (_readChromatograms < _chromIds.Count)
            {
                SetPercentComplete(50 + _readChromatograms * 50 / _chromIds.Count);
            }

            int index = _chromIndices[id];

            extra = new ChromExtra(index, -1);  // TODO: is zero the right value?

            // Display in AllChromatogramsGraph
            var loadingStatus = Status as ChromatogramLoadingStatus;

            if (loadingStatus != null)
            {
                loadingStatus.Transitions.AddTransition(
                    modifiedSequence,
                    color,
                    index, -1,
                    times,
                    intensities);
            }
            return(true);
        }
        public override bool GetChromatogram(
            int id, string modifiedSequence, Color peptideColor,
            out ChromExtra extra, out float[] times, out int[] scanIndexes, out float[] intensities, out float[] massErrors)
        {
            var chromKeyIndices = _chromKeyIndices[id];

            if (_lastChromGroupInfo == null || _lastIndices.GroupIndex != chromKeyIndices.GroupIndex)
            {
                _lastChromGroupInfo = _cache.LoadChromatogramInfo(chromKeyIndices.GroupIndex);
                _lastChromGroupInfo.ReadChromatogram(_cache);
            }
            _lastIndices = chromKeyIndices;
            var tranInfo = _lastChromGroupInfo.GetTransitionInfo(chromKeyIndices.TranIndex);

            times       = tranInfo.Times;
            intensities = tranInfo.Intensities;
            massErrors  = null;
            if (tranInfo.MassError10Xs != null)
            {
                massErrors = tranInfo.MassError10Xs.Select(m => m / 10.0f).ToArray();
            }
            scanIndexes = null;
            if (tranInfo.ScanIndexes != null)
            {
                scanIndexes = tranInfo.ScanIndexes[(int)chromKeyIndices.Key.Source];
            }

            // Assume that each chromatogram will be read once, though this may
            // not always be completely true.
            _readChromatograms++;

            // But avoid reaching 100% before reading is actually complete
            SetPercentComplete(Math.Min(99, 100 * _readChromatograms / _chromKeyIndices.Length));

            extra = new ChromExtra(chromKeyIndices.StatusId, chromKeyIndices.StatusRank);

            // Display in AllChromatogramsGraph
            if (chromKeyIndices.Key.Precursor != 0 && Status is ChromatogramLoadingStatus)
            {
                ((ChromatogramLoadingStatus)Status).Transitions.AddTransition(
                    modifiedSequence,
                    peptideColor,
                    chromKeyIndices.StatusId,
                    chromKeyIndices.StatusRank,
                    times,
                    intensities);
            }
            return(true);
        }
Пример #6
0
        public override bool GetChromatogram(
            int id, string modifiedSequence, Color peptideColor,
            out ChromExtra extra, out float[] times, out int[] scanIndexes, out float[] intensities, out float[] massErrors)
        {
            var chromKeyIndices = _chromKeyIndices[id];

            if (_lastChromGroupInfo == null || _lastIndices.GroupIndex != chromKeyIndices.GroupIndex)
            {
                _lastChromGroupInfo = _cache.LoadChromatogramInfo(chromKeyIndices.GroupIndex);
                _lastChromGroupInfo.ReadChromatogram(_cache);
            }
            _lastIndices = chromKeyIndices;
            var tranInfo = _lastChromGroupInfo.GetTransitionInfo(chromKeyIndices.TranIndex);

            times       = tranInfo.Times;
            intensities = tranInfo.Intensities;
            massErrors  = null;
            if (tranInfo.MassError10Xs != null)
            {
                massErrors = tranInfo.MassError10Xs.Select(m => m / 10.0f).ToArray();
            }
            scanIndexes = null;
            if (tranInfo.ScanIndexes != null)
            {
                scanIndexes = tranInfo.ScanIndexes[(int)chromKeyIndices.Key.Source];
            }

            SetPercentComplete(100 * id / _chromKeyIndices.Length);

            extra = new ChromExtra(chromKeyIndices.StatusId, chromKeyIndices.StatusRank);

            // Display in AllChromatogramsGraph
            if (chromKeyIndices.Key.Precursor != 0)
            {
                LoadingStatus.Transitions.AddTransition(
                    modifiedSequence,
                    peptideColor,
                    chromKeyIndices.StatusId,
                    chromKeyIndices.StatusRank,
                    times,
                    intensities);
            }
            return(true);
        }
Пример #7
0
        public override bool GetChromatogram(int id, Target modifiedSequence, Color color, out ChromExtra extra, out TimeIntensities timeIntensities)
        {
            float[] times, intensities;
            if (!_globalChromatogramExtractor.GetChromatogram(id, out times, out intensities))
            {
                _dataFile.GetChromatogram(id, out _, out times, out intensities);
            }

            timeIntensities = new TimeIntensities(times, intensities, null, null);

            // Assume that each chromatogram will be read once, though this may
            // not always be completely true.
            _readChromatograms++;

            if (_readChromatograms < _chromIds.Count)
            {
                SetPercentComplete(50 + _readChromatograms * 50 / _chromIds.Count);
            }

            int index = _chromIndices[id];

            extra = new ChromExtra(index, -1);  // TODO: is zero the right value?

            // Display in AllChromatogramsGraph
            var loadingStatus = Status as ChromatogramLoadingStatus;

            if (loadingStatus != null)
            {
                loadingStatus.Transitions.AddTransition(
                    modifiedSequence,
                    color,
                    index, -1,
                    times,
                    intensities);
            }
            return(true);
        }
Пример #8
0
        public override bool GetChromatogram(int id, Target modifiedSequence, Color peptideColor, out ChromExtra extra, out TimeIntensities timeIntensities)
        {
            var chromKeyIndices = _chromKeyIndices[id];

            if (_lastChromGroupInfo == null || _lastIndices.GroupIndex != chromKeyIndices.GroupIndex)
            {
                _lastChromGroupInfo = _cache.LoadChromatogramInfo(chromKeyIndices.GroupIndex);
                _lastChromGroupInfo.ReadChromatogram(_cache);
            }
            _lastIndices = chromKeyIndices;
            var tranInfo = _lastChromGroupInfo.GetTransitionInfo(chromKeyIndices.TranIndex);

            timeIntensities = tranInfo.TimeIntensities;

            // Assume that each chromatogram will be read once, though this may
            // not always be completely true.
            _readChromatograms++;

            // But avoid reaching 100% before reading is actually complete
            SetPercentComplete(Math.Min(99, 100 * _readChromatograms / _chromKeyIndices.Length));

            extra = new ChromExtra(chromKeyIndices.StatusId, chromKeyIndices.StatusRank);

            // Display in AllChromatogramsGraph
            if (chromKeyIndices.Key.Precursor != 0 && Status is ChromatogramLoadingStatus)
            {
                ((ChromatogramLoadingStatus)Status).Transitions.AddTransition(
                    modifiedSequence,
                    peptideColor,
                    chromKeyIndices.StatusId,
                    chromKeyIndices.StatusRank,
                    timeIntensities.Times,
                    timeIntensities.Intensities);
            }
            return(true);
        }
Пример #9
0
 public abstract bool GetChromatogram(int id, string modifiedSequence, Color color, out ChromExtra extra,
                                      out float[] times, out int[] scanIndexes, out float[] intensities, out float[] massErrors);
Пример #10
0
 public abstract bool GetChromatogram(int id, Target modifiedSequence, Color color, out ChromExtra extra, out TimeIntensities timeIntensities);
Пример #11
0
 public abstract bool GetChromatogram(int id, string modifiedSequence, Color color, out ChromExtra extra,
     out float[] times, out int[] scanIndexes, out float[] intensities, out float[] massErrors);
        public override bool GetChromatogram(
            int id, string modifiedSequence, Color peptideColor,
            out ChromExtra extra, out float[] times, out int[] scanIndexes, out float[] intensities, out float[] massErrors)
        {
            var chromKeyIndices = _chromKeyIndices[id];
            if (_lastChromGroupInfo == null || _lastIndices.GroupIndex != chromKeyIndices.GroupIndex)
            {
                _lastChromGroupInfo = _cache.LoadChromatogramInfo(chromKeyIndices.GroupIndex);
                _lastChromGroupInfo.ReadChromatogram(_cache);
            }
            _lastIndices = chromKeyIndices;
            var tranInfo = _lastChromGroupInfo.GetTransitionInfo(chromKeyIndices.TranIndex);
            times = tranInfo.Times;
            intensities = tranInfo.Intensities;
            massErrors = null;
            if (tranInfo.MassError10Xs != null)
                massErrors = tranInfo.MassError10Xs.Select(m => m/10.0f).ToArray();
            scanIndexes = null;
            if (tranInfo.ScanIndexes != null)
                scanIndexes = tranInfo.ScanIndexes[(int) chromKeyIndices.Key.Source];

            SetPercentComplete(100 * id / _chromKeyIndices.Length);

            extra = new ChromExtra(chromKeyIndices.StatusId, chromKeyIndices.StatusRank);

            // Display in AllChromatogramsGraph
            if (chromKeyIndices.Key.Precursor != 0)
            {
                LoadingStatus.Transitions.AddTransition(
                    modifiedSequence,
                    peptideColor,
                    chromKeyIndices.StatusId,
                    chromKeyIndices.StatusRank,
                    times,
                    intensities);
            }
            return true;
        }
        public override bool GetChromatogram(
            int id, string modifiedSequence, Color peptideColor,
            out ChromExtra extra, out float[] times, out int[] scanIndexes, out float[] intensities, out float[] massErrors)
        {
            var statusId = _collectors.ReleaseChromatogram(id, _chromGroups,
                out times, out intensities, out massErrors, out scanIndexes);
            extra = new ChromExtra(statusId, LoadingStatus.Transitions.GetRank(id));  // TODO: Get rank

            // Each chromatogram will be read only once!
            _readChromatograms++;

            UpdatePercentComplete();
            return times.Length > 0;
        }
Пример #14
0
        public override bool GetChromatogram(
            int id,
            string modifiedSequence,
            Color peptideColor,
            out ChromExtra extra,
            out float[] times,
            out int[] scanIndexes,
            out float[] intensities,
            out float[] massErrors)
        {
            bool loaded = false;
            extra = null;
            times = null;
            scanIndexes = null;
            intensities = null;
            massErrors = null;
            int idRemain = id;
            for (int iTaskList = 0; iTaskList < _chromatogramRequestProviders.Length; iTaskList++)
            {
                ChromatogramRequestProvider requestProvider = _chromatogramRequestProviders[iTaskList];
                if (requestProvider.ChromKeys.Count <= idRemain)
                {
                    idRemain -= requestProvider.ChromKeys.Count;
                    continue;
                }
                ChromTaskList chromTaskList = _chromTaskLists[iTaskList];
                if (null == chromTaskList)
                {
                    chromTaskList = _chromTaskLists[iTaskList] = new ChromTaskList(CheckCancelled, _document, _chorusAccount, requestProvider.ChorusUrl, ChromTaskList.ChunkChromatogramRequest(requestProvider.GetChromatogramRequest(), 1000));
                    chromTaskList.SetMinimumSimultaneousTasks(3);
                }
                ChromKey chromKey = requestProvider.ChromKeys[idRemain];
                loaded = chromTaskList.GetChromatogram(chromKey, out times, out scanIndexes, out intensities, out massErrors);
                if (loaded)
                {
                    extra = new ChromExtra(id, chromKey.Precursor == 0 ? 0 : -1);
                    if (times.Length > 0)
                    {
                        LoadingStatus.Transitions.AddTransition(
                                modifiedSequence,
                                peptideColor,
                                extra.StatusId,
                                extra.StatusRank,
                                times,
                                intensities);
                    }
                }
                break;
            }
            int percentComplete = _chromTaskLists.Sum(taskList => taskList == null ? 0 : taskList.PercentComplete)/
                                  _chromTaskLists.Length;

            percentComplete = Math.Min(percentComplete, 99);
            SetPercentComplete(percentComplete);
            return loaded;
        }
 public override bool GetChromatogram(
     int id, string modifiedSequence, Color peptideColor,
     out ChromExtra extra, out float[] times, out int[] scanIndexes, out float[] intensities, out float[] massErrors)
 {
     return _cachedChromatogramDataProvider.GetChromatogram(
         id, modifiedSequence, peptideColor,
         out extra, out times, out scanIndexes, out intensities, out massErrors);
 }
Пример #16
0
 public override bool GetChromatogram(int id, Target modifiedSequence, Color peptideColor, out ChromExtra extra, out TimeIntensities timeIntensities)
 {
     return(_cachedChromatogramDataProvider.GetChromatogram(
                id, modifiedSequence, peptideColor,
                out extra, out timeIntensities));
 }
Пример #17
0
        public override bool GetChromatogram(int id, string modifiedSequence, Color color, out ChromExtra extra, out float[] times, out int[] scanIndexes, out float[] intensities, out float[] massErrors)
        {
            // No mass errors in SRM
            massErrors = null;
            if (_readChromatograms == 0)
            {
                _readStartTime = DateTime.Now;
            }

            string chromId;
            _dataFile.GetChromatogram(id, out chromId, out times, out intensities);
            scanIndexes = null;

            // Assume that each chromatogram will be read once, though this may
            // not always be completely true.
            _readChromatograms++;

            if (!System.Diagnostics.Debugger.IsAttached)
            {
                double predictedMinutes = ExpectedReadDurationMinutes;
                if (_readMaxMinutes > 0 && predictedMinutes > _readMaxMinutes)
                {
                    // TODO: This warning isn't checked in the command line version of Skyline.  Maybe we should do that.
                    Status =
                        Status.ChangeWarningMessage(Resources.ChromatogramDataProvider_GetChromatogram_This_import_appears_to_be_taking_longer_than_expected__If_importing_from_a_network_drive__consider_canceling_this_import__copying_to_local_disk_and_retrying_);
                }
            }

            if (_readChromatograms < _chromIds.Count)
                SetPercentComplete(50 + _readChromatograms * 50 / _chromIds.Count);

            int index = _chromIndices[id];
            extra = new ChromExtra(index, -1);  // TODO: is zero the right value?

            // Display in AllChromatogramsGraph
            LoadingStatus.Transitions.AddTransition(
                modifiedSequence,
                color,
                index, -1,
                times,
                intensities);
            return true;
        }