Added RMS calculation for consensus MQ

Consensus MQ is now the average of the RMS of the mapping qualities of the reads making each site.
This commit is contained in:
Mauricio Carneiro 2011-08-29 18:15:26 -04:00
parent 7271998735
commit fd540592ab
1 changed files with 11 additions and 1 deletions

View File

@ -27,7 +27,6 @@ package org.broadinstitute.sting.utils;
import com.google.java.contract.Requires;
import net.sf.samtools.SAMRecord;
import org.apache.lucene.messages.NLS;
import org.broadinstitute.sting.gatk.GenomeAnalysisEngine;
import org.broadinstitute.sting.utils.exceptions.UserException;
@ -409,6 +408,17 @@ public class MathUtils {
return Math.sqrt(rms);
}
public static double rms(Collection<Double> l) {
if (l.size() == 0)
return 0.0;
double rms = 0.0;
for (Double i : l)
rms += i*i;
rms /= l.size();
return Math.sqrt(rms);
}
public static double distanceSquared( final double[] x, final double[] y ) {
double dist = 0.0;
for(int iii = 0; iii < x.length; iii++) {