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:
ebanks 2009-11-12 02:51:44 +00:00
parent 697d7e02c8
commit 0922400ca9
2 changed files with 11 additions and 5 deletions

View File

@ -41,11 +41,14 @@ public class VECAlleleBalance extends RatioFilter {
*/
protected Pair<Integer, Integer> getRatioCounts(char ref, ReadBackedPileup pileup, RodGeliText variant) {
final String genotype = variant.getBestGenotype();
final String bases = pileup.getBases();
if ( genotype.length() > 2 )
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 b = genotype.toUpperCase().charAt(1);

View File

@ -36,13 +36,16 @@ public class VECOnOffGenotypeRatio extends RatioFilter {
*/
protected Pair<Integer, Integer> getRatioCounts(char ref, ReadBackedPileup pileup, RodGeliText variant) {
final String genotype = variant.getBestGenotype().toUpperCase();
final String bases = pileup.getBases();
if ( genotype.length() > 2 )
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 ) {
int count = BasicPileup.countBase(base, bases);
if ( Utils.countOccurrences(base, genotype) > 0 )