Compute dynamic read depth limits

This builds on #189 

Here were use the `windowFoldLoci` to sum up aggregate statistics on the read (average depth, average insert size)  Later I want to change these to be more complete distributions (so we can computer std dev, percentiles).  

There is a new command line option `-approx-depth-limits` which estimates the max and min read depths using the sample statistics.
To add a bit more to that: keeping guacamole deterministic is a fairly high
bar, that will require being careful in a lot of places, so we may want to
have a discussion if it's worth it. For example, a distributed reduction
like sum on floats (but not ints) would break determinism.


On Fri, Oct 10, 2014 at 12:18 PM, Tim O'Donnell <timodonnell@gmail.com>
wrote:

> One reason to use the exact read depth is that otherwise running on
> different number of partitions will change the results. If possible it’d be
> great if Guacamole were totally deterministic. Any idea if we've already
> lost determinism due to other things?
>
> On Fri, Oct 10, 2014 at 10:57 AM, Arun Ahuja <notifications@github.com>
> wrote:
>
>> In
>> src/main/scala/org/bdgenomics/guacamole/callers/SomaticLogOddsVariantCaller.scala:
>>
>> > @@ -73,6 +70,25 @@ object SomaticLogOddsVariantCaller extends Command with Serializable with Loggin
>> >        normalReads.mappedReads
>> >      )
>> >
>> > +    if (args.approxDepthLimits) {
>> > +
>> > +      val averageTumorReadDepth = tumorReads.libraryMetrics(lociPartitions).averageReadDepth
>> > +
>> > +      // Read depth thresholds are set to avg(D) +/- 3 * sqrt(avg(D)) See Li. (2014) - Towards Better Understanding of Variant Artifacts
>> > +      args.maxTumorReadDepth = Math.round(averageTumorReadDepth + 4 * math.sqrt(averageTumorReadDepth)).toInt
>> > +      args.minTumorReadDepth = Math.round(averageTumorReadDepth - 4 * math.sqrt(averageTumorReadDepth)).toInt
>> > +      args.minNormalReadDepth = Math.round(averageTumorReadDepth - 4 * math.sqrt(averageTumorReadDepth)).toInt
>>
>> Yea, we could compute it independently, I wasn't sure it was worth it.
>>
>> —
>> Reply to this email directly or view it on GitHub
>> <https://github.com/hammerlab/guacamole/pull/191/files#r18710648>.
>>
>
>