Ejemplo n.º 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);
        }
Ejemplo n.º 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)
        {
            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);
        }