bug fixes

This commit is contained in:
Guillermo del Angel 2011-07-04 21:04:49 -04:00
parent f26ffeaea0
commit bb85f232b9
1 changed files with 42 additions and 47 deletions

View File

@ -326,15 +326,11 @@ public class SelectVariants extends RodWalker<Integer, Integer> {
} }
else { else {
if (SELECT_RANDOM_FRACTION && KEEP_AF_SPECTRUM ) { if (SELECT_RANDOM_FRACTION && KEEP_AF_SPECTRUM ) {
Collection<VariantContext> compVCs = tracker.getVariantContexts(ref, inputAFRodName, null, context.getLocation(), true, false);
if (compVCs.isEmpty())
return 0;
// ok we have a comp VC and we need to match the AF spectrum of inputAFRodName. // ok we have a comp VC and we need to match the AF spectrum of inputAFRodName.
// We then pick a variant with probablity AF*desiredFraction // We then pick a variant with probablity AF*desiredFraction
for (VariantContext compVC : compVCs) {
if ( compVC.hasAttribute(VCFConstants.ALLELE_FREQUENCY_KEY) ) { if ( sub.hasAttribute(VCFConstants.ALLELE_FREQUENCY_KEY) ) {
String afo = compVC.getAttributeAsString(VCFConstants.ALLELE_FREQUENCY_KEY); String afo = sub.getAttributeAsString(VCFConstants.ALLELE_FREQUENCY_KEY);
double af; double af;
double afBoost = 1.0; double afBoost = 1.0;
@ -375,8 +371,7 @@ public class SelectVariants extends RodWalker<Integer, Integer> {
if (GenomeAnalysisEngine.getRandomGenerator().nextDouble() < fractionRandom * af * afBoost) if (GenomeAnalysisEngine.getRandomGenerator().nextDouble() < fractionRandom * af * afBoost)
vcfWriter.add(sub, ref.getBase()); vcfWriter.add(sub, ref.getBase());
} }
break; // do only one vc
}
} }
} }