Merge pull request #1019 from broadinstitute/rhl_var_index_param_gz
Indexing parameters not required if output file has the g.vcf.gz exte…
This commit is contained in:
commit
719bb15340
|
|
@ -1204,9 +1204,10 @@ public class HaplotypeCaller extends ActiveRegionWalker<List<VariantContext>, In
|
|||
/**
|
||||
* Is writing to an output GVCF file?
|
||||
*
|
||||
* @return true if the VCF output file has a .g.vcf extension
|
||||
* @return true if the VCF output file has a .g.vcf or .g.vcf.gz extension
|
||||
*/
|
||||
private boolean isGVCF() {
|
||||
return ((VariantContextWriterStub) vcfWriter).getOutputFile().getName().endsWith("." + GATKVCFUtils.GVCF_EXT);
|
||||
String fileName = ((VariantContextWriterStub) vcfWriter).getOutputFile().getName();
|
||||
return ( fileName.endsWith("." + GATKVCFUtils.GVCF_EXT) || fileName.endsWith("." + GATKVCFUtils.GVCF_GZ_EXT) );
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -224,6 +224,18 @@ public class HaplotypeCallerGVCFIntegrationTest extends WalkerTest {
|
|||
executeTest("testGVCFIndexNoThrow", spec);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test HaplotypeCaller to ensure it does not throw an exception when a .g.vcf.gz output file is specified and the indexing arguments are omitted
|
||||
*/
|
||||
@Test()
|
||||
public void testGVCFGzIndexNoThrow() {
|
||||
final String commandLine = String.format("-T HaplotypeCaller --pcr_indel_model NONE -pairHMMSub %s %s -R %s -I %s -L %s -ERC GVCF",
|
||||
HMM_SUB_IMPLEMENTATION, ALWAYS_LOAD_VECTOR_HMM, b37KGReference, privateTestDir + "noCallRefModel.bam", "20:17000000-17000100");
|
||||
final WalkerTestSpec spec = new WalkerTestSpec(commandLine + " -o %s", Arrays.asList(GATKVCFUtils.GVCF_GZ_EXT), Arrays.asList(""));
|
||||
spec.disableShadowBCF();
|
||||
executeTest("testGVCFIndexNoThrow", spec);
|
||||
}
|
||||
|
||||
@Test()
|
||||
public void testWrongParameterGVCFIndexException() {
|
||||
final String commandLine = String.format("-T HaplotypeCaller --pcr_indel_model NONE -pairHMMSub %s %s -R %s -I %s -L %s -ERC GVCF -variant_index_type %s -variant_index_parameter %d",
|
||||
|
|
|
|||
|
|
@ -69,8 +69,9 @@ public class GATKVCFUtils {
|
|||
public final static GATKVCFIndexType DEFAULT_GVCF_INDEX_TYPE = GATKVCFIndexType.LINEAR;
|
||||
public final static Integer DEFAULT_GVCF_INDEX_PARAMETER = 128000;
|
||||
|
||||
// GVCF file extension
|
||||
// GVCF file extensions
|
||||
public final static String GVCF_EXT = "g.vcf";
|
||||
public final static String GVCF_GZ_EXT = "g.vcf.gz";
|
||||
|
||||
// Message for using the deprecated --variant_index_type or --variant_index_parameter arguments.
|
||||
public final static String DEPRECATED_INDEX_ARGS_MSG = "Naming your output file using the .g.vcf extension will automatically set the appropriate values " +
|
||||
|
|
@ -389,7 +390,7 @@ public class GATKVCFUtils {
|
|||
indexType = variantIndexType;
|
||||
indexParameter = variantIndexParameter;
|
||||
logger.warn(DEPRECATED_INDEX_ARGS_MSG);
|
||||
} else if (outputFile.getName().endsWith("." + GVCF_EXT)) {
|
||||
} else if (outputFile.getName().endsWith("." + GVCF_EXT) || outputFile.getName().endsWith("." + GVCF_GZ_EXT)) {
|
||||
indexType = DEFAULT_GVCF_INDEX_TYPE;
|
||||
indexParameter = DEFAULT_GVCF_INDEX_PARAMETER;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -246,4 +246,20 @@ public class CatVariantsIntegrationTest {
|
|||
ProcessSettings ps = new ProcessSettings(Utils.escapeExpressions(cmdLine));
|
||||
pc.execAndCheck(ps);
|
||||
}
|
||||
|
||||
@Test()
|
||||
public void testCatVariantsGVCFGzIndexCreation() throws IOException{
|
||||
|
||||
String cmdLine = String.format("java -cp \"%s\" %s -R %s -V %s -V %s -out %s",
|
||||
StringUtils.join(RuntimeUtils.getAbsoluteClassPaths(), File.pathSeparatorChar),
|
||||
CatVariants.class.getCanonicalName(),
|
||||
BaseTest.b37KGReference,
|
||||
CatVariantsVcf1,
|
||||
CatVariantsVcf2,
|
||||
BaseTest.createTempFile("CatVariantsGVCFIndexCreationTest", "." + GATKVCFUtils.GVCF_GZ_EXT));
|
||||
|
||||
ProcessController pc = ProcessController.getThreadLocal();
|
||||
ProcessSettings ps = new ProcessSettings(Utils.escapeExpressions(cmdLine));
|
||||
pc.execAndCheck(ps);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue