Functional VCF output.

It is outputting a VCF with the 'second best guess' for the alternate allele correctly. Annotations are added at the pool level, but may get overwritten at the lane and site level. Still need to implement the merging of the the annotations at higher levels.
This commit is contained in:
Mauricio Carneiro 2011-08-04 17:49:08 -04:00
parent a58ddab93b
commit b22a3d6508
2 changed files with 34 additions and 0 deletions

View File

@ -436,6 +436,18 @@ public class BaseUtils {
return mostFrequentBaseIndex;
}
static public int mostFrequentBaseIndexNotRef(int[] baseCounts, int refBaseIndex) {
int tmp = baseCounts[refBaseIndex];
baseCounts[refBaseIndex] = -1;
int result = mostFrequentBaseIndex(baseCounts);
baseCounts[refBaseIndex] = tmp;
return result;
}
static public int mostFrequentBaseIndexNotRef(int[] baseCounts, byte refSimpleBase) {
return mostFrequentBaseIndexNotRef(baseCounts, simpleBaseToBaseIndex(refSimpleBase));
}
/**
* Returns the most common base in the basecounts array. To be used with pileup.getBaseCounts.
*

View File

@ -360,6 +360,23 @@ public class MathUtils {
return Math.pow(10,log10MultinomialProbability(n, k, log10P));
}
/**
* calculate the Root Mean Square of an array of integers
* @param x an byte[] of numbers
* @return the RMS of the specified numbers.
*/
public static double rms(byte[] x) {
if ( x.length == 0 )
return 0.0;
double rms = 0.0;
for (int i : x)
rms += i * i;
rms /= x.length;
return Math.sqrt(rms);
}
/**
* calculate the Root Mean Square of an array of integers
* @param x an int[] of numbers
@ -1074,6 +1091,11 @@ public class MathUtils {
return ((-q)/10.0);
}
/**
* Returns the phred scaled value of probability p
* @param p probability (between 0 and 1).
* @return phred scaled probability of p
*/
public static byte probabilityToPhredScale (double p) {
return (byte) ((-10) * Math.log10(p));
}