コード例 #1
0
ファイル: Genome.cs プロジェクト: VJalili/Di4
        internal ExecutionReport Cover(
            CoverVariation coverVariation,
            char strand, int minAcc, int maxAcc, Aggregate aggregate,
            out FunctionOutput <Output <C, I, M> > result,
            MaxDegreeOfParallelism maxDegreeOfParallelism)
        {
            int totalBookmarks = 0;
            var tmpResult      = new FunctionOutput <Output <C, I, M> >();

            foreach (var chr in chrs)
            {
                foreach (var sDi4 in chr.Value)
                {
                    if (!tmpResult.Chrs.ContainsKey(chr.Key))
                    {
                        tmpResult.Chrs.TryAdd(chr.Key, new ConcurrentDictionary <char, List <Output <C, I, M> > >());
                    }
                    if (!tmpResult.Chrs[chr.Key].ContainsKey(sDi4.Key))
                    {
                        tmpResult.Chrs[chr.Key].TryAdd(sDi4.Key, new List <Output <C, I, M> >());
                    }
                }
            }

            _stpWtch.Restart();
            Parallel.ForEach(chrs,
                             new ParallelOptions {
                MaxDegreeOfParallelism = maxDegreeOfParallelism.chrDegree
            },
                             chr =>
            {
                IOutput <C, I, M, Output <C, I, M> > outputStrategy = new AggregateFactory <C, I, M>().GetAggregateFunction(aggregate);

                foreach (var sDi4 in chr.Value)
                {
                    totalBookmarks += sDi4.Value.bookmarkCount;
                    switch (coverVariation)
                    {
                    case CoverVariation.Cover:
                        sDi4.Value.Cover <Output <C, I, M> >(outputStrategy, minAcc, maxAcc, maxDegreeOfParallelism.di4Degree);
                        break;

                    case CoverVariation.Summit:
                        sDi4.Value.Summit <Output <C, I, M> >(outputStrategy, minAcc, maxAcc, maxDegreeOfParallelism.di4Degree);
                        break;
                    }

                    tmpResult.Chrs[chr.Key][sDi4.Key] = outputStrategy.output;
                }
            });
            _stpWtch.Stop();

            result = tmpResult;
            return(new ExecutionReport(totalBookmarks, _stpWtch.Elapsed));
        }
コード例 #2
0
ファイル: Di4B.cs プロジェクト: VJalili/Di4
 public ExecutionReport Cover(CoverVariation coverVariation, char strand, int minAcc, int maxAcc, Aggregate aggregate, out FunctionOutput <Output <C, I, M> > result, MaxDegreeOfParallelism maxDegreeOfParallelism)
 {
     return(genome.Cover(coverVariation, strand, minAcc, maxAcc, aggregate, out result, maxDegreeOfParallelism));
 }