CanvasClean.CanvasClean.getLocalStandardDeviation C# (CSharp) Метод

getLocalStandardDeviation() статический приватный Метод

Estimate local standard deviation (SD).
static private getLocalStandardDeviation ( List bins ) : double
bins List Genomic bins from which we filter out local SD outliers associated with FFPE biases.
Результат double
        static double getLocalStandardDeviation(List<GenomicBin> bins)
        {
            // Will hold consecutive bin count difference (approximates Skellam Distribution: mean centred on zero so agnostic to CN changes)
            double[] countsDiffs = new double[bins.Count - 1];

            for (int binIndex = 0; binIndex < bins.Count - 1; binIndex++)
            {
                countsDiffs[binIndex] = Convert.ToDouble(bins[binIndex + 1].Count - bins[binIndex].Count);
            }

            // holder of local SD values (SDs of 20 bins)
            List<double> localSDs = new List<double>();
            List<string> chromosomeBin = new List<string>();

            // calculate local SD metric
            int windowSize = 20;
            for (int windowEnd = windowSize, windowStart = 0; windowEnd < countsDiffs.Length; windowStart += windowSize, windowEnd += windowSize)
            {
                double localSD = Utilities.StandardDeviation(countsDiffs, windowStart, windowEnd);
                localSDs.Add(localSD);
                chromosomeBin.Add(bins[windowStart].Chromosome);
                for (int binIndex = windowStart; binIndex < windowEnd; binIndex += 1)
                {
                    bins[binIndex].MadOfDiffs = localSD;
                }
            }

            // average of local SD metric
            double localSDaverage = GetLocalStandardDeviationAverage(localSDs, chromosomeBin);
            return localSDaverage;
        }