Exemplo n.º 1
0
        /// <summary>
        /// Set the matches
        /// </summary>
        /// <param name="monoIsotopicMass"></param>
        /// <param name="minScanNum"></param>
        /// <param name="maxScanNum"></param>
        public void SetMatches(double monoIsotopicMass, int minScanNum, int maxScanNum)
        {
            var range = new IntRange(minScanNum, maxScanNum);

            var binNum = GetBinNumber(monoIsotopicMass);

            if (_map.TryGetValue(binNum, out var ranges))
            {
                var newRanges = new List <IntRange>();
                foreach (var existingRange in ranges)
                {
                    if (range.Overlaps(existingRange))
                    {
                        range = IntRange.Union(range, existingRange);
                    }
                    else
                    {
                        newRanges.Add(existingRange);
                    }
                }
                newRanges.Add(range);
                _map[binNum] = newRanges;
            }
            else
            {
                _map[binNum] = new List <IntRange> {
                    range
                };
            }
        }
Exemplo n.º 2
0
        public void SetMatches(double monoIsotopicMass, int minScanNum, int maxScanNum)
        {
            var range = new IntRange(minScanNum, maxScanNum);

            var binNum = GetBinNumber(monoIsotopicMass);
            IList<IntRange> ranges;
            if (_map.TryGetValue(binNum, out ranges))
            {
                var newRanges = new List<IntRange>();
                foreach (var existingRange in ranges)
                {
                    if (range.Overlaps(existingRange))
                    {
                        range = IntRange.Union(range, existingRange);
                    }
                    else
                    {
                        newRanges.Add(existingRange);
                    }
                }
                newRanges.Add(range);
                _map[binNum] = newRanges;
            }
            else
            {
                _map[binNum] = new List<IntRange> {range};
            }
        }