Enabling Fisher Strand for multi-allelics: use the alt allele with max AC. Added minor optimization to the method in the VC.
This commit is contained in:
parent
d34f07dba0
commit
dfdf4f989b
|
|
@ -59,10 +59,10 @@ public class FisherStrand extends InfoFieldAnnotation implements StandardAnnotat
|
||||||
|
|
||||||
int[][] table;
|
int[][] table;
|
||||||
|
|
||||||
if (vc.isBiallelic() && vc.isSNP())
|
if ( vc.isSNP() )
|
||||||
table = getSNPContingencyTable(stratifiedContexts, vc.getReference(), vc.getAlternateAllele(0));
|
table = getSNPContingencyTable(stratifiedContexts, vc.getReference(), vc.getAltAlleleWithHighestAlleleCount());
|
||||||
else if (vc.isIndel() || vc.isMixed()) {
|
else if ( vc.isIndel() || vc.isMixed() ) {
|
||||||
table = getIndelContingencyTable(stratifiedContexts, vc);
|
table = getIndelContingencyTable(stratifiedContexts);
|
||||||
if (table == null)
|
if (table == null)
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
@ -234,7 +234,7 @@ public class FisherStrand extends InfoFieldAnnotation implements StandardAnnotat
|
||||||
* allele2 # #
|
* allele2 # #
|
||||||
* @return a 2x2 contingency table
|
* @return a 2x2 contingency table
|
||||||
*/
|
*/
|
||||||
private static int[][] getIndelContingencyTable(Map<String, AlignmentContext> stratifiedContexts, VariantContext vc) {
|
private static int[][] getIndelContingencyTable(Map<String, AlignmentContext> stratifiedContexts) {
|
||||||
final double INDEL_LIKELIHOOD_THRESH = 0.3;
|
final double INDEL_LIKELIHOOD_THRESH = 0.3;
|
||||||
final HashMap<PileupElement,LinkedHashMap<Allele,Double>> indelLikelihoodMap = IndelGenotypeLikelihoodsCalculationModel.getIndelLikelihoodMap();
|
final HashMap<PileupElement,LinkedHashMap<Allele,Double>> indelLikelihoodMap = IndelGenotypeLikelihoodsCalculationModel.getIndelLikelihoodMap();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1229,12 +1229,15 @@ public class VariantContext implements Feature { // to enable tribble intergrati
|
||||||
}
|
}
|
||||||
|
|
||||||
public Allele getAltAlleleWithHighestAlleleCount() {
|
public Allele getAltAlleleWithHighestAlleleCount() {
|
||||||
// first idea: get two alleles with highest AC
|
// optimization: for bi-allelic sites, just return the 1only alt allele
|
||||||
|
if ( isBiallelic() )
|
||||||
|
return getAlternateAllele(0);
|
||||||
|
|
||||||
Allele best = null;
|
Allele best = null;
|
||||||
int maxAC1 = 0;
|
int maxAC1 = 0;
|
||||||
for (Allele a:this.getAlternateAlleles()) {
|
for ( Allele a : getAlternateAlleles() ) {
|
||||||
int ac = this.getCalledChrCount(a);
|
final int ac = getCalledChrCount(a);
|
||||||
if (ac >=maxAC1) {
|
if ( ac >= maxAC1 ) {
|
||||||
maxAC1 = ac;
|
maxAC1 = ac;
|
||||||
best = a;
|
best = a;
|
||||||
}
|
}
|
||||||
|
|
@ -1244,6 +1247,9 @@ public class VariantContext implements Feature { // to enable tribble intergrati
|
||||||
}
|
}
|
||||||
|
|
||||||
public int[] getGLIndecesOfAllele(Allele inputAllele) {
|
public int[] getGLIndecesOfAllele(Allele inputAllele) {
|
||||||
|
|
||||||
|
// TODO -- this information is cached statically by the UnifiedGenotyperEngine; pull it out into a common utils class for all to use
|
||||||
|
|
||||||
int[] idxVector = new int[3];
|
int[] idxVector = new int[3];
|
||||||
int numAlleles = this.getAlleles().size();
|
int numAlleles = this.getAlleles().size();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue