Merge pull request #555 from broadinstitute/eb_add_option_to_CGVCFs_for_all_sites_GVCF

Added an option to CombineGVCFs to create basepair resolution gVCFs from...
This commit is contained in:
ldgauthier 2014-03-12 10:01:18 -04:00
commit 4e74e77e74
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") @Output(doc="File to which the combined gVCF should be written")
protected VariantContextWriter vcfWriter = null; 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; private GenomeLocParser genomeLocParser;
public void initialize() { public void initialize() {
@ -176,7 +179,7 @@ public class CombineGVCFs extends RodWalker<CombineGVCFs.PositionalState, Combin
previousState.VCs.addAll(startingStates.VCs); 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'); endPreviousStates(previousState, currentPos, startingStates.refBases.length > 1 ? startingStates.refBases[1] : (byte)'N');
} }
@ -289,6 +292,7 @@ public class CombineGVCFs extends RodWalker<CombineGVCFs.PositionalState, Combin
// attributes // attributes
final Map<String, Object> attrs = new HashMap<>(1); final Map<String, Object> attrs = new HashMap<>(1);
if ( !USE_BP_RESOLUTION )
attrs.put(VCFConstants.END_KEY, Integer.toString(end)); attrs.put(VCFConstants.END_KEY, Integer.toString(end));
// genotypes // genotypes

View File

@ -165,4 +165,12 @@ public class CombineGVCFsIntegrationTest extends WalkerTest {
spec.disableShadowBCF(); spec.disableShadowBCF();
executeTest("testMD5s", spec); 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);
}
} }