Exemplo n.º 1
0
        /// <summary>
        /// Enumerates all unique types. If B5701 is a type, then will NOT enumerate B57.
        /// If B5701 and B58 are types, then will enumerate both.
        /// </summary>
        /// <returns></returns>
        public IEnumerable <string> EnumerateAll()
        {
            HashSet <string> reportedTwoDigit  = new HashSet <string>();
            HashSet <string> reportedFourDigit = new HashSet <string>();

            foreach (string six in _synChanges)
            {
                reportedFourDigit.Add(six.Substring(0, 4));
                reportedTwoDigit.Add(GetGroupStringFromHigherResolution(six));
                yield return(Locus.ToString() + six);
            }

            foreach (string four in _proteins)
            {
                if (!reportedFourDigit.Contains(four))
                {
                    reportedTwoDigit.Add(GetGroupStringFromHigherResolution(four));
                    yield return(Locus.ToString() + four);
                }
            }

            foreach (string two in _groups)
            {
                if (!reportedTwoDigit.Contains(two))
                {
                    yield return(Locus.ToString() + two);
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Enumerates all values at the given resolution.
        /// </summary>
        /// <param name="resolution"></param>
        /// <returns></returns>
        public IEnumerable <string> Enumerate(HlaIResolution resolution)
        {
            switch (resolution)
            {
            case HlaIResolution.Group:
                return(_groups.Select(type => Locus.ToString() + type));

            case HlaIResolution.Protein:
                return(_proteins.Select(type => Locus.ToString() + type));

            case HlaIResolution.Synonymous:
                return(_synChanges.Select(type => Locus.ToString() + type));

            default:
                throw new NotImplementedException("Can't get here.");
            }
        }