private Dictionary <string, List <ProcessedPeak <I> > > ConvertToListOfProcessedPeaks(IPeakConstructor <I> peakConstructor, int degreeOfParallelism) { var rtv = new Dictionary <string, List <ProcessedPeak <I> > >(); foreach (var chr in _consensusPeaks) { rtv.Add(chr.Key, new List <ProcessedPeak <I> >(capacity: chr.Value.Count)); } int counter = 0; Parallel.ForEach( _consensusPeaks, new ParallelOptions { MaxDegreeOfParallelism = degreeOfParallelism }, chr => { foreach (var peak in chr.Value) { rtv[chr.Key].Add(new ProcessedPeak <I>( peakConstructor.Construct( peak.Key.left, peak.Key.right, ChiSqrd.ChiSqrdDistRTP(peak.Key.xSquard, peak.Key.involvedPeaksCount * 2), "MSPC_Peak_" + Interlocked.Increment(ref counter), (peak.Key.right - peak.Key.left) / 2), peak.Key.xSquard, peak.Key.involvedPeaksCount - 1)); } }); return(rtv); }
private void CacheChiSqrdData() { _cachedChiSqrd = new List <double>(); for (int i = 1; i <= _samples.Count; i++) { _cachedChiSqrd.Add(Math.Round(ChiSqrd.ChiSqrdINVRTP(_config.Gamma, i * 2), 3)); } }