Initial, raw, mostly untested version of new pool caller that also does allele discovery. Still needs debugging/refining. Main modification is that there is a new operation mode, set by argument -ALLELE_DISCOVERY_MODE, which if true will determine optimal alt allele at each computable site and will compute AC distribution on it. Current implementation is not working yet if there's more than one pool and it will only output biallelic sites, no functionality for true multi-allelics yet

This commit is contained in:
Guillermo del Angel 2012-01-18 20:54:10 -05:00
parent 34cf2fe43b
commit 2eb45340e1
1 changed files with 44 additions and 0 deletions

View File

@ -1557,4 +1557,48 @@ public class MathUtils {
}
return shuffled;
}
/**
* Vector operations
*/
public static double[] vectorSum(double v1[], double v2[]) {
if (v1.length != v2.length)
throw new UserException("BUG: vectors v1, v2 of different size in vectorSum()");
double result[] = new double[v1.length];
for (int k=0; k < v1.length; k++)
result[k] = v1[k]+v2[k];
return result;
}
public static double[] scalarTimesIntVector(double a, int[] v1) {
double result[] = new double[v1.length];
for (int k=0; k < v1.length; k++)
result[k] = a*v1[k];
return result;
}
public static double dotProduct(double v1[], double v2[]) {
if (v1.length != v2.length)
throw new UserException("BUG: vectors v1, v2 of different size in vectorSum()");
double result = 0.0;
for (int k=0; k < v1.length; k++)
result += v1[k]*v2[k];
return result;
}
public static double[] vectorLog10(double v1[]) {
double result[] = new double[v1.length];
for (int k=0; k < v1.length; k++)
result[k] = Math.log10(v1[k]);
return result;
}
}