use of org.broadinstitute.hellbender.tools.exome.ACNVModeledSegment in project gatk by broadinstitute.
the class CNLOHCaller method calculateVarianceOfCopyNeutralSegmentMeans.
/**
* Attempt to get an idea of segment mean variance near copy neutral.
*
* @param segments Never {@code null}
* @return variance of segment mean (in CR space) of segments that are "close enough" to copy neutral.
* Zero if no segments are "close enough"
*/
private double calculateVarianceOfCopyNeutralSegmentMeans(final List<ACNVModeledSegment> segments, final double meanBiasInCR) {
Utils.nonNull(segments);
// Only consider values "close enough" to copy neutral (CR == 1).
final double neutralCR = 1 + meanBiasInCR;
final double[] neutralSegmentMeans = segments.stream().mapToDouble(ACNVModeledSegment::getSegmentMeanInCRSpace).filter(m -> Math.abs(m - neutralCR) < CLOSE_ENOUGH_TO_COPY_NEUTRAL_IN_CR).toArray();
return new Variance().evaluate(neutralSegmentMeans);
}
Aggregations