Added an option to CombineGVCFs to create basepair resolution gVCFs from banded ones.

Use the --convertToBasePairResolution argument to enable this functionality.
This commit is contained in:
Eric Banks 2014-03-12 01:32:51 -04:00
parent 35aa24ab54
commit d697e0144f
2 changed files with 14 additions and 2 deletions

View File

@ -134,6 +134,9 @@ public class CombineGVCFs extends RodWalker<CombineGVCFs.PositionalState, Combin
@Output(doc="File to which the combined gVCF should be written")
protected VariantContextWriter vcfWriter = null;
@Argument(fullName="convertToBasePairResolution", shortName="bpResolution", doc = "If specified, convert banded gVCFs to all-sites gVCFs", required=false)
protected boolean USE_BP_RESOLUTION = false;
private GenomeLocParser genomeLocParser;
public void initialize() {
@ -176,7 +179,7 @@ public class CombineGVCFs extends RodWalker<CombineGVCFs.PositionalState, Combin
previousState.VCs.addAll(startingStates.VCs);
}
if ( containsEndingContext(previousState.VCs, currentPos) ) {
if ( USE_BP_RESOLUTION || containsEndingContext(previousState.VCs, currentPos) ) {
endPreviousStates(previousState, currentPos, startingStates.refBases.length > 1 ? startingStates.refBases[1] : (byte)'N');
}
@ -289,7 +292,8 @@ public class CombineGVCFs extends RodWalker<CombineGVCFs.PositionalState, Combin
// attributes
final Map<String, Object> attrs = new HashMap<>(1);
attrs.put(VCFConstants.END_KEY, Integer.toString(end));
if ( !USE_BP_RESOLUTION )
attrs.put(VCFConstants.END_KEY, Integer.toString(end));
// genotypes
final GenotypesContext genotypes = GenotypesContext.create();

View File

@ -165,4 +165,12 @@ public class CombineGVCFsIntegrationTest extends WalkerTest {
spec.disableShadowBCF();
executeTest("testMD5s", spec);
}
@Test
public void testBasepairResolution() throws Exception {
final String cmd = baseTestString(" -L 1:69485-69791 --convertToBasePairResolution");
final WalkerTestSpec spec = new WalkerTestSpec(cmd, 1, Arrays.asList("a068fb2c35cdd14df1e8f1f92f4114b4"));
spec.disableShadowBCF();
executeTest("testBasepairResolution", spec);
}
}