Exemple #1
0
        internal void Run(Config config, BackgroundWorker worker, DoWorkEventArgs e)
        {
            _config          = config;
            _worker          = worker;
            _workerEventArgs = e;

            int step = 1, stepCount = 4;

            OnProgressUpdate(new ProgressReport(step++, stepCount, "Initializing"));
            CacheChiSqrdData();
            BuildDataStructures();

            if (CheckCancellationPending())
            {
                return;
            }
            OnProgressUpdate(new ProgressReport(step++, stepCount, "Processing samples"));
            ProcessSamples();

            if (CheckCancellationPending())
            {
                return;
            }
            OnProgressUpdate(new ProgressReport(step++, stepCount, "Performing Multiple testing correction"));
            var fdr = new FalseDiscoveryRate <I>();

            fdr.PerformMultipleTestingCorrection(_analysisResults, _config.Alpha, DegreeOfParallelism);

            if (CheckCancellationPending())
            {
                return;
            }
            OnProgressUpdate(new ProgressReport(step, stepCount, "Creating consensus peaks set"));
            _consensusPeaks = new ConsensusPeaks <I>().Compute(_analysisResults, _peakConstructor, DegreeOfParallelism, _config.Alpha);
        }
Exemple #2
0
        public Dictionary <string, List <ProcessedPeak <I> > > Compute(
            Dictionary <uint, Result <I> > analysisResults,
            IPeakConstructor <I> peakConstructor,
            int degreeOfParallelisim,
            float alpha)
        {
            // Initialize data structures.
            _consensusPeaks = new Dictionary <string, SortedDictionary <Interval, Interval> >();
            foreach (var result in analysisResults)
            {
                foreach (var chr in result.Value.Chromosomes)
                {
                    if (!_consensusPeaks.ContainsKey(chr.Key))
                    {
                        _consensusPeaks.Add(chr.Key, new SortedDictionary <Interval, Interval>());
                    }
                }
            }

            // Determin consensus peaks; stored in mutable and light-weight types.
            foreach (var result in analysisResults)
            {
                Parallel.ForEach(
                    result.Value.Chromosomes,
                    new ParallelOptions {
                    MaxDegreeOfParallelism = degreeOfParallelisim
                },
                    chr =>
                {
                    DetermineConsensusPeaks(chr.Key, chr.Value.Get(Attributes.Confirmed));
                });
            }

            // Convert the type of determined consensus peaks.
            var processedPeaks = ConvertToListOfProcessedPeaks(peakConstructor, degreeOfParallelisim);
            var fdr            = new FalseDiscoveryRate <I>();

            fdr.PerformMultipleTestingCorrection(processedPeaks, alpha);
            return(processedPeaks);
        }