Have CombineVariants throw a UserError when trying to combine GVCFs from the HaplotypeCaller.
Was previously throwing an IllegalArgumentException (in the wrong place in the code). Error message tells users to use CombineGVCFs.
This commit is contained in:
parent
7117bebb5e
commit
3b1c337401
|
|
@ -204,4 +204,17 @@ public class CombineVariantsIntegrationTest extends WalkerTest {
|
|||
Arrays.asList("f8c014d0af7e014475a2a448dc1f9cef"));
|
||||
cvExecuteTest("combineLeavesUnfilteredRecordsUnfiltered: ", spec, false);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void combiningGVCFsFails() {
|
||||
try {
|
||||
WalkerTestSpec spec = new WalkerTestSpec(
|
||||
"-T CombineVariants --no_cmdline_in_header -o %s "
|
||||
+ " -R " + b37KGReference
|
||||
+ " -V " + privateTestDir + "gvcfExample1.vcf",
|
||||
1,
|
||||
Arrays.asList("FAILFAILFAILFAILFAILFAILFAILFAIL"));
|
||||
executeTest("combiningGVCFsFails", spec);
|
||||
} catch (Exception e) { } // do nothing
|
||||
}
|
||||
}
|
||||
|
|
@ -326,6 +326,9 @@ public class CombineVariants extends RodWalker<Integer, Integer> implements Tree
|
|||
if ( mergedVC == null )
|
||||
continue;
|
||||
|
||||
if ( mergedVC.hasAllele(GATKVariantContextUtils.NON_REF_SYMBOLIC_ALLELE) )
|
||||
throw new UserException("CombineVariants should not be used to merge gVCFs produced by the HaplotypeCaller; use CombineGVCFs instead");
|
||||
|
||||
final VariantContextBuilder builder = new VariantContextBuilder(mergedVC);
|
||||
// re-compute chromosome counts
|
||||
VariantContextUtils.calculateChromosomeCounts(builder, false);
|
||||
|
|
|
|||
|
|
@ -1921,10 +1921,6 @@ public class GATKVariantContextUtils {
|
|||
final HashMap<VariantContext.Type, List<VariantContext>> mappedVCs = new HashMap<>();
|
||||
for ( final VariantContext vc : VCs ) {
|
||||
VariantContext.Type vcType = vc.getType();
|
||||
if( vc.hasAllele(NON_REF_SYMBOLIC_ALLELE) ) {
|
||||
if( vc.getAlternateAlleles().size() > 1 ) { throw new IllegalStateException("Reference records should not have more than one alternate allele"); }
|
||||
vcType = VariantContext.Type.NO_VARIATION;
|
||||
}
|
||||
|
||||
// look at previous variant contexts of different type. If:
|
||||
// a) otherVC has alleles which are subset of vc, remove otherVC from its list and add otherVC to vc's list
|
||||
|
|
|
|||
Loading…
Reference in New Issue