Don't try to calculate ratios when DoC is zero (which happens when calls are made by an LD-aware genotyper)
git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@2025 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
parent
697d7e02c8
commit
0922400ca9
|
|
@ -41,11 +41,14 @@ public class VECAlleleBalance extends RatioFilter {
|
||||||
*/
|
*/
|
||||||
protected Pair<Integer, Integer> getRatioCounts(char ref, ReadBackedPileup pileup, RodGeliText variant) {
|
protected Pair<Integer, Integer> getRatioCounts(char ref, ReadBackedPileup pileup, RodGeliText variant) {
|
||||||
final String genotype = variant.getBestGenotype();
|
final String genotype = variant.getBestGenotype();
|
||||||
final String bases = pileup.getBases();
|
|
||||||
|
|
||||||
if ( genotype.length() > 2 )
|
if ( genotype.length() > 2 )
|
||||||
throw new IllegalArgumentException(String.format("Can only handle diploid genotypes: %s", genotype));
|
throw new IllegalArgumentException(String.format("Can only handle diploid genotypes: %s", genotype));
|
||||||
|
|
||||||
|
final String bases = pileup.getBases();
|
||||||
|
if ( bases.length() == 0 ) {
|
||||||
|
ratio = 0.0;
|
||||||
|
return new Pair<Integer, Integer>(0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
char a = genotype.toUpperCase().charAt(0);
|
char a = genotype.toUpperCase().charAt(0);
|
||||||
char b = genotype.toUpperCase().charAt(1);
|
char b = genotype.toUpperCase().charAt(1);
|
||||||
|
|
|
||||||
|
|
@ -36,13 +36,16 @@ public class VECOnOffGenotypeRatio extends RatioFilter {
|
||||||
*/
|
*/
|
||||||
protected Pair<Integer, Integer> getRatioCounts(char ref, ReadBackedPileup pileup, RodGeliText variant) {
|
protected Pair<Integer, Integer> getRatioCounts(char ref, ReadBackedPileup pileup, RodGeliText variant) {
|
||||||
final String genotype = variant.getBestGenotype().toUpperCase();
|
final String genotype = variant.getBestGenotype().toUpperCase();
|
||||||
final String bases = pileup.getBases();
|
|
||||||
|
|
||||||
if ( genotype.length() > 2 )
|
if ( genotype.length() > 2 )
|
||||||
throw new IllegalArgumentException(String.format("Can only handle diploid genotypes: %s", genotype));
|
throw new IllegalArgumentException(String.format("Can only handle diploid genotypes: %s", genotype));
|
||||||
|
|
||||||
int on = 0, off = 0;
|
final String bases = pileup.getBases();
|
||||||
|
if ( bases.length() == 0 ) {
|
||||||
|
ratio = 0.0;
|
||||||
|
return new Pair<Integer, Integer>(0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
int on = 0, off = 0;
|
||||||
for ( char base : BaseUtils.BASES ) {
|
for ( char base : BaseUtils.BASES ) {
|
||||||
int count = BasicPileup.countBase(base, bases);
|
int count = BasicPileup.countBase(base, bases);
|
||||||
if ( Utils.countOccurrences(base, genotype) > 0 )
|
if ( Utils.countOccurrences(base, genotype) > 0 )
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue