Merge pull request #1265 from broadinstitute/rhl_hc_stdout_1259
Fix exception when writing gVCF to stdout
This commit is contained in:
commit
4b3b5636c6
|
|
@ -104,6 +104,7 @@ import org.broadinstitute.gatk.utils.sam.GATKSAMRecord;
|
|||
import org.broadinstitute.gatk.utils.sam.ReadUtils;
|
||||
import org.broadinstitute.gatk.utils.variant.*;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.util.*;
|
||||
|
||||
|
|
@ -1245,10 +1246,15 @@ 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 or .g.vcf.gz extension
|
||||
* @return true if the VCF output file has a .g.vcf or .g.vcf.gz extension or if no output file
|
||||
*/
|
||||
private boolean isGVCF() {
|
||||
String fileName = ((VariantContextWriterStub) vcfWriter).getOutputFile().getName();
|
||||
return ( fileName.endsWith("." + GATKVCFUtils.GVCF_EXT) || fileName.endsWith("." + GATKVCFUtils.GVCF_GZ_EXT) );
|
||||
final File file = ((VariantContextWriterStub) vcfWriter).getOutputFile();
|
||||
if ( file == null ){
|
||||
return true;
|
||||
} else {
|
||||
final String fileName = file.getName();
|
||||
return ( fileName.endsWith("." + GATKVCFUtils.GVCF_EXT) || fileName.endsWith("." + GATKVCFUtils.GVCF_GZ_EXT) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -368,6 +368,15 @@ public class HaplotypeCallerIntegrationTest extends WalkerTest {
|
|||
executeTest("testGraphBasedNoSuchEdgeBugFix", spec);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWriteGVCFStdout() {
|
||||
final String commandLine = String.format("-T HaplotypeCaller -R %s -I %s -L %s -dontTrimActiveRegions -ERC GVCF ",
|
||||
b37KGReferenceWithDecoy, privateTestDir + "graphbased_no_such_edge_bug.bam", privateTestDir + "graphbased_no_such_edge_bug.intervals.bed");
|
||||
final WalkerTestSpec spec = new WalkerTestSpec(commandLine, Arrays.asList(""));
|
||||
spec.disableShadowBCF();
|
||||
executeTest("testWriteGVCFStdout", spec);
|
||||
}
|
||||
|
||||
// This test takes longer than 15 secs ... ~ 25-35 ,
|
||||
@Test
|
||||
public void testLackSensitivityDueToBadHaplotypeSelectionFix() {
|
||||
|
|
|
|||
Loading…
Reference in New Issue