예제 #1
0
        public bool GetChromatogram(ChromKey chromKey, out TimeIntensities timeIntensities)
        {
            int keyIndex = -1;

            if (_chromKeyIndiceses != null)
            {
                var tolerance = (float)ChromTaskList.SrmDocument.Settings.TransitionSettings.Instrument.MzMatchTolerance;
                keyIndex = _chromKeyIndiceses.IndexOf(entry => EqualsTolerant(chromKey, entry.Key, tolerance));
            }
            if (keyIndex == -1 || _chromKeyIndiceses == null)   // Keep ReSharper from complaining
            {
                timeIntensities = null;
                return(false);
            }
            ChromKeyIndices chromKeyIndices = _chromKeyIndiceses[keyIndex];
            var             chromGroupInfo  = _chromatogramCache.LoadChromatogramInfo(chromKeyIndices.GroupIndex);

            chromGroupInfo.ReadChromatogram(_chromatogramCache);
            var tranInfo = chromGroupInfo.GetTransitionInfo(chromKeyIndices.TranIndex);

            if (tranInfo.TimeIntensities == null || tranInfo.TimeIntensities.NumPoints == 0)
            {
                // Chorus returns zero length chromatogram to indicate that no spectra matched
                // the precursor filter.
                timeIntensities = null;
                return(false);
            }
            timeIntensities = CoalesceIntensities(tranInfo.TimeIntensities);
            return(true);
        }
예제 #2
0
        public bool GetChromatogram(ChromKey chromKey, out float[] times, out int[] scanIds, out float[] intensities, out float[] massErrors)
        {
            int keyIndex = -1;

            if (_chromKeyIndiceses != null)
            {
                var tolerance = (float)ChromTaskList.SrmDocument.Settings.TransitionSettings.Instrument.MzMatchTolerance;
                Assume.IsNull(chromKey.OptionalMinTime);
                Assume.IsNull(chromKey.OptionalMaxTime);
                Assume.IsTrue(0 == chromKey.IonMobilityValue);
                Assume.IsTrue(0 == chromKey.IonMobilityExtractionWidth);
                keyIndex = _chromKeyIndiceses.IndexOf(entry => entry.Key.CompareTolerant(chromKey, tolerance) == 0);
            }
            if (keyIndex == -1 || _chromKeyIndiceses == null)   // Keep ReSharper from complaining
            {
                times       = null;
                scanIds     = null;
                intensities = null;
                massErrors  = null;
                return(false);
            }
            ChromKeyIndices chromKeyIndices = _chromKeyIndiceses[keyIndex];
            var             chromGroupInfo  = _chromatogramCache.LoadChromatogramInfo(chromKeyIndices.GroupIndex);

            chromGroupInfo.ReadChromatogram(_chromatogramCache);
            var tranInfo = chromGroupInfo.GetTransitionInfo(chromKeyIndices.TranIndex);

            times = tranInfo.Times;
            if (times.Length == 0)
            {
                // Chorus returns zero length chromatogram to indicate that no spectra matched
                // the precursor filter.
                times       = null;
                scanIds     = null;
                intensities = null;
                massErrors  = null;
                return(false);
            }
            if (null != tranInfo.ScanIndexes)
            {
                scanIds = tranInfo.ScanIndexes[(short)chromKeyIndices.Key.Source];
            }
            else
            {
                scanIds = null;
            }
            intensities = tranInfo.Intensities;
            massErrors  = null;
            if (tranInfo.MassError10Xs != null)
            {
                massErrors = tranInfo.MassError10Xs.Select(m => m / 10.0f).ToArray();
            }
            CoalesceIntensities(ref times, ref scanIds, ref intensities, ref massErrors);
            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);
        }
예제 #4
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);
        }
예제 #5
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);
        }
        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;
        }