示例#1
0
        public RepeatExpansionPhenotypeTests()
        {
            var repeatNumbers = new[] { 7, 8, 9, 10, 11, 12, 13, 15 };

            double[] percentiles = { 0, 1, 1.5, 3.5, 75.5, 86.5, 98.5, 99.5 };

            _phenotype = new RepeatExpansionPhenotype(null, null, null, repeatNumbers, percentiles, null, null);
        }
示例#2
0
        private static (ushort RefIndex, Interval <RepeatExpansionPhenotype> Interval) GetPhenotype(string line, IDictionary <string, IChromosome> refNameToChromosome)
        {
            string[] cols = line.OptimizedSplit('\t');
            if (cols.Length < MinNumberOfColumns)
            {
                throw new InvalidDataException($"Expected at least {MinNumberOfColumns} columns in the STR data file, but found only {cols.Length}.");
            }

            string chromosomeString = cols[ChromIndex];
            int    start            = int.Parse(cols[StartIndex]);
            int    end       = int.Parse(cols[EndIndex]);
            string phenotype = cols[PhenotypeIndex];
            string omimId    = cols[OmimIndex];

            int[]      repeatNumbers        = cols[RepeatNumbersIndex].Split(',').Select(int.Parse).ToArray();
            int[]      alleleCounts         = cols[AlleleCountsIndex].Split(',').Select(int.Parse).ToArray();
            string[]   classifications      = cols[CategoriesIndex].Split(',').ToArray();
            Interval[] classificationRanges = cols[CategoryRangesIndex].Split(',').Select(GetInterval).ToArray();

            if (repeatNumbers.Length != alleleCounts.Length)
            {
                throw new InvalidDataException($"Inconsistent number of repeat numbers ({repeatNumbers.Length}) vs. allele counts ({alleleCounts.Length})");
            }
            if (classifications.Length != classificationRanges.Length)
            {
                throw new InvalidDataException($"Inconsistent number of values of classifications ({classifications.Length}) vs. classification ranges ({classificationRanges.Length})");
            }

            var chromosome         = ReferenceNameUtilities.GetChromosome(refNameToChromosome, chromosomeString);
            var chromosomeInterval = new ChromosomeInterval(chromosome, start, end);

            double[] percentiles = PercentileUtilities.ComputePercentiles(repeatNumbers.Length, alleleCounts);

            var rePhenotype = new RepeatExpansionPhenotype(chromosomeInterval, phenotype, omimId, repeatNumbers, percentiles, classifications, classificationRanges);

            return(chromosome.Index, new Interval <RepeatExpansionPhenotype>(start, end, rePhenotype));
        }
示例#3
0
        public MatcherTests()
        {
            var repeatNumbers = new[] { 7, 8, 9 };

            double[] percentiles = { 0, 1, 1.5 };

            var classificationRanges = new[] { new Interval(0, 27) };
            var classifications      = new[] { "Normal" };

            var aInterval  = new ChromosomeInterval(ChromosomeUtilities.Chr1, 100, 200);
            var aPhenotype = new RepeatExpansionPhenotype(aInterval, "A", null, repeatNumbers, percentiles, classifications, classificationRanges);

            var chr1Phenotypes = new Interval <RepeatExpansionPhenotype> [1];

            chr1Phenotypes[0] = new Interval <RepeatExpansionPhenotype>(aInterval.Start, aInterval.End, aPhenotype);

            var intervalArrays = new IntervalArray <RepeatExpansionPhenotype> [1];

            intervalArrays[ChromosomeUtilities.Chr1.Index] = new IntervalArray <RepeatExpansionPhenotype>(chr1Phenotypes);

            var phenotypeForest = new IntervalForest <RepeatExpansionPhenotype>(intervalArrays);

            _matcher = new Matcher(phenotypeForest);
        }