Big bad bug fix: feature added to LeftAlignAndTrimVariants to left align multiallelic records didn't work.
-- Corrected logic to pick biallelic vc to left align. -- Added integration test to make sure this feature is tested and feature to trim bases is also tested.
This commit is contained in:
parent
f42bdaee3c
commit
6b8bed34d0
|
|
@ -64,4 +64,14 @@ public class LeftAlignAndTrimVariantsIntegrationTest extends WalkerTest {
|
|||
Arrays.asList("bcf05f56adbb32a47b6d6b27b327d5c2"));
|
||||
executeTest("test left alignment", spec);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLeftAlignmentWithTrimmingAndMultialleliecs() {
|
||||
WalkerTestSpec spec = new WalkerTestSpec(
|
||||
"-T LeftAlignAndTrimVariants -o %s -R " + b37KGReference + " --variant:vcf " + privateTestDir + "forHardLeftAlignVariantsTest.vcf --no_cmdline_in_header -trim -split",
|
||||
1,
|
||||
Arrays.asList("4ae03954f8bd66e73fd005c49ea301db"));
|
||||
executeTest("test left alignment with trimming and hard multiple alleles", spec);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -138,18 +138,22 @@ public class LeftAlignAndTrimVariants extends RodWalker<Integer, Integer> {
|
|||
if (splitMultiallelics) {
|
||||
final List<VariantContext> vcList = GATKVariantContextUtils.splitVariantContextToBiallelics( vc);
|
||||
for (final VariantContext biallelicVC: vcList) {
|
||||
final VariantContext v = (trimAlleles ? GATKVariantContextUtils.trimAlleles(vc,true,true):biallelicVC);
|
||||
final VariantContext v = (trimAlleles ? GATKVariantContextUtils.trimAlleles(biallelicVC,true,true):biallelicVC);
|
||||
result = alignAndWrite(v, ref);
|
||||
|
||||
writer.add(result.first);
|
||||
changedSites += result.second;
|
||||
}
|
||||
}
|
||||
else if (trimAlleles)
|
||||
result = alignAndWrite(GATKVariantContextUtils.trimAlleles(vc,true,true), ref);
|
||||
else
|
||||
result = alignAndWrite(vc,ref);
|
||||
else {
|
||||
if (trimAlleles)
|
||||
result = alignAndWrite(GATKVariantContextUtils.trimAlleles(vc,true,true), ref);
|
||||
else
|
||||
result = alignAndWrite(vc,ref);
|
||||
writer.add(result.first);
|
||||
changedSites += result.second;
|
||||
|
||||
}
|
||||
|
||||
writer.add(result.first);
|
||||
changedSites += result.second;
|
||||
}
|
||||
|
||||
return changedSites;
|
||||
|
|
|
|||
Loading…
Reference in New Issue