diff --git a/src/main/java/org/broadinstitute/hellbender/tools/sv/SVCallRecord.java b/src/main/java/org/broadinstitute/hellbender/tools/sv/SVCallRecord.java index 9119720a2d8..50bb8490867 100644 --- a/src/main/java/org/broadinstitute/hellbender/tools/sv/SVCallRecord.java +++ b/src/main/java/org/broadinstitute/hellbender/tools/sv/SVCallRecord.java @@ -52,6 +52,8 @@ public class SVCallRecord implements SVLocatable { private final List altAlleles; private final GenotypesContext genotypes; private final Map attributes; + private final Set filters; + private final Double log10PError; // CPX related fields private final GATKSVVCFConstants.ComplexVariantSubtype cpxSubtype; @@ -70,8 +72,10 @@ public SVCallRecord(final String id, final List alleles, final List genotypes, final Map attributes, + final Set filters, + final Double log10PError, final SAMSequenceDictionary dictionary) { - this(id, contigA, positionA, strandA, contigB, positionB, strandB, type, cpxSubtype, length, algorithms, alleles, genotypes, attributes); + this(id, contigA, positionA, strandA, contigB, positionB, strandB, type, cpxSubtype, length, algorithms, alleles, genotypes, attributes, filters, log10PError); validateCoordinates(dictionary); } @@ -88,11 +92,14 @@ protected SVCallRecord(final String id, final List algorithms, final List alleles, final List genotypes, - final Map attributes) { + final Map attributes, + final Set filters, + final Double log10PError) { Utils.nonNull(algorithms); Utils.nonNull(alleles); Utils.nonNull(genotypes); Utils.nonNull(attributes); + Utils.nonNull(filters); this.id = Utils.nonNull(id); this.contigA = contigA; this.positionA = positionA; @@ -112,6 +119,8 @@ protected SVCallRecord(final String id, final Pair strands = inferStrands(type, strandA, strandB); this.strandA = strands.getLeft(); this.strandB = strands.getRight(); + this.filters = filters; + this.log10PError = log10PError; } /** @@ -366,4 +375,16 @@ public SimpleInterval getPositionAInterval() { public SimpleInterval getPositionBInterval() { return new SimpleInterval(contigB, positionB, positionB); } + + public Set getFilters() { + return filters; + } + + public Double getLog10PError() { + return log10PError; + } + + public GATKSVVCFConstants.ComplexVariantSubtype getCpxSubtype() { + return cpxSubtype; + } } diff --git a/src/main/java/org/broadinstitute/hellbender/tools/sv/SVCallRecordUtils.java b/src/main/java/org/broadinstitute/hellbender/tools/sv/SVCallRecordUtils.java index f4eb2d66825..6fdedd52321 100644 --- a/src/main/java/org/broadinstitute/hellbender/tools/sv/SVCallRecordUtils.java +++ b/src/main/java/org/broadinstitute/hellbender/tools/sv/SVCallRecordUtils.java @@ -100,6 +100,13 @@ public static VariantContextBuilder getVariantBuilder(final SVCallRecord record) && record.getStrandA() != null && record.getStrandB() != null) { builder.attribute(GATKSVVCFConstants.STRANDS_ATTRIBUTE, getStrandString(record)); } + if (!record.getFilters().isEmpty()) { + builder.filters(record.getFilters()); + } + if (record.getLog10PError() != null) { + builder.log10PError(record.getLog10PError()); + } + // htsjdk vcf encoder does not allow genotypes to have empty alleles builder.genotypes(record.getGenotypes().stream().map(SVCallRecordUtils::sanitizeEmptyGenotype).collect(Collectors.toList())); sanitizeNullAttributes(builder); @@ -176,12 +183,12 @@ public static GenotypesContext populateGenotypesForMissingSamplesWithAlleles(fin public static SVCallRecord copyCallWithNewGenotypes(final SVCallRecord record, final GenotypesContext genotypes) { return new SVCallRecord(record.getId(), record.getContigA(), record.getPositionA(), record.getStrandA(), record.getContigB(), record.getPositionB(), record.getStrandB(), record.getType(), record.getComplexSubtype(), record.getLength(), record.getAlgorithms(), record.getAlleles(), - genotypes, record.getAttributes()); + genotypes, record.getAttributes(), record.getFilters(), record.getLog10PError()); } public static SVCallRecord copyCallWithNewAttributes(final SVCallRecord record, final Map attr) { return new SVCallRecord(record.getId(), record.getContigA(), record.getPositionA(), record.getStrandA(), record.getContigB(), record.getPositionB(), record.getStrandB(), record.getType(), record.getComplexSubtype(), record.getLength(), record.getAlgorithms(), record.getAlleles(), - record.getGenotypes(), attr); + record.getGenotypes(), attr, record.getFilters(), record.getLog10PError()); } /** @@ -293,10 +300,10 @@ public static Stream convertInversionsToBreakends(final SVCallReco Utils.validateArg(record.isIntrachromosomal(), "Inversion " + record.getId() + " is not intrachromosomal"); final SVCallRecord positiveBreakend = new SVCallRecord(record.getId(), record.getContigA(), record.getPositionA(), true, record.getContigB(), record.getPositionB(), true, GATKSVVCFConstants.StructuralVariantAnnotationType.BND, null,null, - record.getAlgorithms(), record.getAlleles(), record.getGenotypes(), record.getAttributes(), dictionary); + record.getAlgorithms(), record.getAlleles(), record.getGenotypes(), record.getAttributes(), record.getFilters(), record.getLog10PError(), dictionary); final SVCallRecord negativeBreakend = new SVCallRecord(record.getId(), record.getContigA(), record.getPositionA(), false, record.getContigB(), record.getPositionB(), false, GATKSVVCFConstants.StructuralVariantAnnotationType.BND, null,null, - record.getAlgorithms(), record.getAlleles(), record.getGenotypes(), record.getAttributes(), dictionary); + record.getAlgorithms(), record.getAlleles(), record.getGenotypes(), record.getAttributes(), record.getFilters(), record.getLog10PError(), dictionary); return Stream.of(positiveBreakend, negativeBreakend); } @@ -385,10 +392,11 @@ public static SVCallRecord create(final VariantContext variant, boolean keepVari positionB = variant.getEnd(); } } + final Double log10PError = variant.hasLog10PError() ? variant.getLog10PError() : null; final Map sanitizedAttributes = sanitizeAttributes(attributes); return new SVCallRecord(id, contigA, positionA, strand1, contigB, positionB, strand2, type, cpxSubtype, length, algorithms, - variant.getAlleles(), variant.getGenotypes(), sanitizedAttributes); + variant.getAlleles(), variant.getGenotypes(), sanitizedAttributes, variant.getFilters(), log10PError); } private static Map sanitizeAttributes(final Map attributes) { diff --git a/src/main/java/org/broadinstitute/hellbender/tools/sv/cluster/CanonicalSVCollapser.java b/src/main/java/org/broadinstitute/hellbender/tools/sv/cluster/CanonicalSVCollapser.java index 0ecd85cba56..8521430932e 100644 --- a/src/main/java/org/broadinstitute/hellbender/tools/sv/cluster/CanonicalSVCollapser.java +++ b/src/main/java/org/broadinstitute/hellbender/tools/sv/cluster/CanonicalSVCollapser.java @@ -182,8 +182,12 @@ public SVCallRecord collapse(final SVClusterEngine.OutputCluster cluster) { final Boolean strandA = type == GATKSVVCFConstants.StructuralVariantAnnotationType.CNV ? null : representative.getStrandA(); final Boolean strandB = type == GATKSVVCFConstants.StructuralVariantAnnotationType.CNV ? null : representative.getStrandB(); + final Set filters = collapseFilters(items); + final Double quality = collapseQuality(items); + return new SVCallRecord(representative.getId(), representative.getContigA(), start, strandA, representative.getContigB(), - end, strandB, type, representative.getComplexSubtype(), length, algorithms, alleles, genotypes, attributes, dictionary); + end, strandB, type, representative.getComplexSubtype(), length, algorithms, alleles, genotypes, attributes, + filters, quality, dictionary); } protected List collapseAlleles(final List altAlleles, final Allele refAllele) { @@ -193,6 +197,21 @@ protected List collapseAlleles(final List altAlleles, final Alle return alleles; } + protected Set collapseFilters(final List items) { + return items.stream() + .map(SVCallRecord::getFilters) + .flatMap(Collection::stream) + .collect(Collectors.toSet()); + } + + protected Double collapseQuality(final List items) { + if (items.size() == 1) { + return items.get(0).getLog10PError(); + } else { + return null; + } + } + /** * Asserts that the given records are valid for collapsing. */ diff --git a/src/main/java/org/broadinstitute/hellbender/tools/walkers/sv/SVCluster.java b/src/main/java/org/broadinstitute/hellbender/tools/walkers/sv/SVCluster.java index 50f7b188498..03ac3093841 100644 --- a/src/main/java/org/broadinstitute/hellbender/tools/walkers/sv/SVCluster.java +++ b/src/main/java/org/broadinstitute/hellbender/tools/walkers/sv/SVCluster.java @@ -453,7 +453,8 @@ public VariantContext buildVariantContext(final SVCallRecord call) { // Build new variant final SVCallRecord finalCall = new SVCallRecord(newId, call.getContigA(), call.getPositionA(), call.getStrandA(), call.getContigB(), call.getPositionB(), call.getStrandB(), call.getType(), call.getComplexSubtype(), call.getLength(), - call.getAlgorithms(), call.getAlleles(), filledGenotypes, call.getAttributes(), dictionary); + call.getAlgorithms(), call.getAlleles(), filledGenotypes, call.getAttributes(), call.getFilters(), + call.getLog10PError(), dictionary); final VariantContextBuilder builder = SVCallRecordUtils.getVariantBuilder(finalCall); if (omitMembers) { builder.rmAttribute(GATKSVVCFConstants.CLUSTER_MEMBER_IDS_KEY); diff --git a/src/test/java/org/broadinstitute/hellbender/tools/sv/SVCallRecordUnitTest.java b/src/test/java/org/broadinstitute/hellbender/tools/sv/SVCallRecordUnitTest.java index 03d0371da8d..170df7984f6 100644 --- a/src/test/java/org/broadinstitute/hellbender/tools/sv/SVCallRecordUnitTest.java +++ b/src/test/java/org/broadinstitute/hellbender/tools/sv/SVCallRecordUnitTest.java @@ -1,6 +1,9 @@ package org.broadinstitute.hellbender.tools.sv; import com.google.common.collect.Lists; +import htsjdk.variant.variantcontext.Allele; +import htsjdk.variant.variantcontext.GenotypeBuilder; +import htsjdk.variant.variantcontext.GenotypesContext; import org.broadinstitute.hellbender.tools.spark.sv.utils.GATKSVVCFConstants; import org.testng.Assert; import org.testng.annotations.DataProvider; @@ -73,7 +76,7 @@ public Object[][] testCreateInvalidCoordinatesData() { public void testCreateInvalidCoordinates(final String contigA, final int posA, final String contigB, final int posB) { new SVCallRecord("var1", contigA, posA, true, contigB, posB, false, GATKSVVCFConstants.StructuralVariantAnnotationType.BND, null, null, SVTestUtils.PESR_ONLY_ALGORITHM_LIST, Collections.emptyList(), Collections.emptyList(), - Collections.emptyMap(), SVTestUtils.hg38Dict); + Collections.emptyMap(), Collections.emptySet(), null, SVTestUtils.hg38Dict); Assert.fail("Expected exception not thrown"); } @@ -90,6 +93,26 @@ public Object[][] testCreateValidCoordinatesData() { public void testCreateValidCoordinates(final String contigA, final int posA, final String contigB, final int posB) { new SVCallRecord("var1", contigA, posA, true, contigB, posB, false, GATKSVVCFConstants.StructuralVariantAnnotationType.BND, null, null, SVTestUtils.PESR_ONLY_ALGORITHM_LIST, Collections.emptyList(), Collections.emptyList(), - Collections.emptyMap(), SVTestUtils.hg38Dict); + Collections.emptyMap(), Collections.emptySet(), null, SVTestUtils.hg38Dict); + } + + public void testGetters() { + final SVCallRecord record = new SVCallRecord("var1", "chr1", 100, true, "chr1", 200, false, GATKSVVCFConstants.StructuralVariantAnnotationType.DEL, + GATKSVVCFConstants.ComplexVariantSubtype.dDUP, null, SVTestUtils.PESR_ONLY_ALGORITHM_LIST, Lists.newArrayList(Allele.REF_N, Allele.SV_SIMPLE_DEL), + GenotypesContext.create(GenotypeBuilder.create("sample1", Lists.newArrayList(Allele.SV_SIMPLE_DEL, Allele.SV_SIMPLE_DEL))), + Collections.singletonMap("TEST_KEY", "TEST_VALUE"), Collections.singleton("TEST_FILTER"), Double.valueOf(30), SVTestUtils.hg38Dict); + Assert.assertEquals(record.getId(), "var1"); + Assert.assertEquals(record.getContigA(), "chr1"); + Assert.assertEquals(record.getPositionA(), 100); + Assert.assertEquals(record.getStrandA(), Boolean.TRUE); + Assert.assertEquals(record.getContigB(), "chr1"); + Assert.assertEquals(record.getPositionB(), 200); + Assert.assertEquals(record.getStrandA(), Boolean.FALSE); + Assert.assertEquals(record.getAlgorithms(), SVTestUtils.PESR_ONLY_ALGORITHM_LIST); + Assert.assertEquals(record.getGenotypes().get("sample1").getAlleles(), Lists.newArrayList(Allele.SV_SIMPLE_DEL, Allele.SV_SIMPLE_DEL)); + Assert.assertEquals(record.getAttributes(), Collections.singletonMap("TEST_KEY", "TEST_VALUE")); + Assert.assertEquals(record.getAlleles(), Lists.newArrayList(Allele.REF_N, Allele.SV_SIMPLE_DEL)); + Assert.assertEquals(record.getFilters(), Collections.singleton("TEST_FILTER")); + Assert.assertEquals(record.getLog10PError(), Double.valueOf(30)); } } \ No newline at end of file diff --git a/src/test/java/org/broadinstitute/hellbender/tools/sv/SVCallRecordUtilsUnitTest.java b/src/test/java/org/broadinstitute/hellbender/tools/sv/SVCallRecordUtilsUnitTest.java index f73f6f78fed..548d13239ab 100644 --- a/src/test/java/org/broadinstitute/hellbender/tools/sv/SVCallRecordUtilsUnitTest.java +++ b/src/test/java/org/broadinstitute/hellbender/tools/sv/SVCallRecordUtilsUnitTest.java @@ -66,15 +66,16 @@ public Object[][] testGetVariantBuilderData() { { new SVCallRecord("var1", "chr1", 1000, true, "chr1", 1999, false, GATKSVVCFConstants.StructuralVariantAnnotationType.DEL, null, 1000, SVTestUtils.DEPTH_ONLY_ALGORITHM_LIST, - ALLELES_DEL, - Lists.newArrayList(GENOTYPE_DEL_1, GENOTYPE_DEL_2), - Collections.emptyMap()), + ALLELES_DEL, + Lists.newArrayList(GENOTYPE_DEL_1, GENOTYPE_DEL_2), Collections.emptyMap(), Collections.singleton("TEST_FILTER"), Double.valueOf(-3)), new VariantContextBuilder("", "chr1", 1000, 1999, ALLELES_DEL) .id("var1") .genotypes(GENOTYPE_DEL_1, GENOTYPE_DEL_2) .attribute(VCFConstants.END_KEY, 1999) .attribute(GATKSVVCFConstants.ALGORITHMS_ATTRIBUTE, SVTestUtils.DEPTH_ONLY_ALGORITHM_LIST) .attribute(GATKSVVCFConstants.SVTYPE, GATKSVVCFConstants.StructuralVariantAnnotationType.DEL) + .filter("TEST_FILTER") + .log10PError(Double.valueOf(-3)) .make(), Collections.emptyList() }, @@ -84,7 +85,7 @@ public Object[][] testGetVariantBuilderData() { SVTestUtils.DEPTH_ONLY_ALGORITHM_LIST, Collections.singletonList(Allele.SV_SIMPLE_DEL), Collections.singletonList(GENOTYPE_DEL_3), - Collections.emptyMap()), + Collections.emptyMap(), Collections.emptySet(), null), new VariantContextBuilder("", "chr1", 1000, 1999, ALLELES_DEL) .id("var1") .genotypes(GENOTYPE_DEL_3) @@ -100,7 +101,7 @@ public Object[][] testGetVariantBuilderData() { SVTestUtils.PESR_ONLY_ALGORITHM_LIST, ALLELES_INS, Lists.newArrayList(GENOTYPE_INS_1), - Collections.emptyMap()), + Collections.emptyMap(), Collections.emptySet(), null), new VariantContextBuilder("", "chr1", 1000, 1000, ALLELES_INS) .id("var2") .genotypes(GENOTYPE_INS_1) @@ -116,7 +117,7 @@ public Object[][] testGetVariantBuilderData() { SVTestUtils.PESR_ONLY_ALGORITHM_LIST, ALLELES_INS, Lists.newArrayList(GENOTYPE_INS_1), - Collections.emptyMap()), + Collections.emptyMap(), Collections.emptySet(), null), new VariantContextBuilder("", "chr1", 1000, 1000, ALLELES_INS) .id("var2") .genotypes(GENOTYPE_INS_1) @@ -132,7 +133,7 @@ public Object[][] testGetVariantBuilderData() { SVTestUtils.PESR_ONLY_ALGORITHM_LIST, ALLELES_BND, Lists.newArrayList(GENOTYPE_BND_1), - Collections.emptyMap()), + Collections.emptyMap(), Collections.emptySet(), null), new VariantContextBuilder("", "chr1", 1000, 1000, ALLELES_BND) .id("var3") .genotypes(GENOTYPE_BND_1) @@ -160,7 +161,7 @@ public void testGetVariantBuilderHasSanitizedNullAttributes() { SVTestUtils.PESR_ONLY_ALGORITHM_LIST, ALLELES_BND, Lists.newArrayList(GENOTYPE_BND_1), - Collections.emptyMap()); + Collections.emptyMap(), Collections.emptySet(), null); final VariantContext result = SVCallRecordUtils.getVariantBuilder(record).make(); // BNDs shouldn't have a length Assert.assertFalse(result.hasAttribute(GATKSVVCFConstants.SVLEN)); @@ -237,14 +238,14 @@ public void testCopyCallWithNewGenotypes() { SVTestUtils.DEPTH_ONLY_ALGORITHM_LIST, ALLELES_DEL, Lists.newArrayList(GENOTYPE_DEL_1, GENOTYPE_DEL_2), - Collections.singletonMap(GATKSVVCFConstants.CLUSTER_MEMBER_IDS_KEY, Collections.singletonList("sample"))); + Collections.singletonMap(GATKSVVCFConstants.CLUSTER_MEMBER_IDS_KEY, Collections.singletonList("sample")), Collections.emptySet(), null); final GenotypesContext genotypes = GenotypesContext.copy(Collections.singletonList(GENOTYPE_DEL_3)); final SVCallRecord result = SVCallRecordUtils.copyCallWithNewGenotypes(record, genotypes); final SVCallRecord expected = new SVCallRecord("var1", "chr1", 1000, true, "chr1", 1999, false, GATKSVVCFConstants.StructuralVariantAnnotationType.DEL, null, 1000, SVTestUtils.DEPTH_ONLY_ALGORITHM_LIST, ALLELES_DEL, genotypes, - Collections.singletonMap(GATKSVVCFConstants.CLUSTER_MEMBER_IDS_KEY, Collections.singletonList("sample"))); + Collections.singletonMap(GATKSVVCFConstants.CLUSTER_MEMBER_IDS_KEY, Collections.singletonList("sample")), Collections.emptySet(), null); SVTestUtils.assertEqualsExceptMembership(result, expected); } @@ -386,7 +387,7 @@ public void testConvertInversionsToBreakends() { SVTestUtils.PESR_ONLY_ALGORITHM_LIST, Collections.emptyList(), Collections.emptyList(), - Collections.emptyMap()); + Collections.emptyMap(), Collections.emptySet(), null); final List inversionResult = SVCallRecordUtils.convertInversionsToBreakends(inversion, SVTestUtils.hg38Dict).collect(Collectors.toList()); Assert.assertEquals(inversionResult.size(), 2); @@ -459,7 +460,7 @@ public Object[][] testCreateData() { TEST_ATTRIBUTES), new SVCallRecord("var1", "chr1", 1000, true, "chr1", 1999, false, GATKSVVCFConstants.StructuralVariantAnnotationType.DEL, null, 1000, Collections.singletonList(GATKSVVCFConstants.DEPTH_ALGORITHM), ALLELES_DEL, Lists.newArrayList(GENOTYPE_DEL_1, GENOTYPE_DEL_2), - TEST_ATTRIBUTES) + TEST_ATTRIBUTES, Collections.emptySet(), null) }, { SVTestUtils.newVariantContext("var1", "chr1", 1000, 1999, @@ -469,7 +470,7 @@ public Object[][] testCreateData() { TEST_ATTRIBUTES), new SVCallRecord("var1", "chr1", 1000, true, "chr1", 1999, false, GATKSVVCFConstants.StructuralVariantAnnotationType.DEL, null, 1000, Collections.singletonList(GATKSVVCFConstants.DEPTH_ALGORITHM), ALLELES_DEL, Lists.newArrayList(GENOTYPE_DEL_1, GENOTYPE_DEL_2), - TEST_ATTRIBUTES) + TEST_ATTRIBUTES, Collections.emptySet(), null) }, { SVTestUtils.newVariantContext("var2", "chr1", 1000, 1000, @@ -478,7 +479,7 @@ public Object[][] testCreateData() { null, null, TEST_ATTRIBUTES), new SVCallRecord("var2", "chr1", 1000, true, "chr1", 1000, false, GATKSVVCFConstants.StructuralVariantAnnotationType.INS, null, 500, SVTestUtils.PESR_ONLY_ALGORITHM_LIST, ALLELES_INS, Lists.newArrayList(GENOTYPE_INS_1, GENOTYPE_INS_2), - TEST_ATTRIBUTES) + TEST_ATTRIBUTES, Collections.emptySet(), null) }, { SVTestUtils.newVariantContext("var3", "chr1", 1000, 1000, @@ -487,7 +488,7 @@ public Object[][] testCreateData() { "chrX", 2000, TEST_ATTRIBUTES), new SVCallRecord("var3", "chr1", 1000, true, "chrX", 2000, true, GATKSVVCFConstants.StructuralVariantAnnotationType.BND, null, null, SVTestUtils.PESR_ONLY_ALGORITHM_LIST, ALLELES_BND, Collections.singletonList(GENOTYPE_BND_1), - TEST_ATTRIBUTES) + TEST_ATTRIBUTES, Collections.emptySet(), null) }, { SVTestUtils.newVariantContext("var4", "chr1", 1000, 1000, @@ -496,7 +497,7 @@ public Object[][] testCreateData() { "chrX", 2000, TEST_ATTRIBUTES), new SVCallRecord("var4", "chr1", 1000, true, "chrX", 2000, true, GATKSVVCFConstants.StructuralVariantAnnotationType.BND, null, null, SVTestUtils.PESR_ONLY_ALGORITHM_LIST, ALLELES_BND, Collections.singletonList(GENOTYPE_BND_1), - TEST_ATTRIBUTES) + TEST_ATTRIBUTES, Collections.emptySet(), null) }, { SVTestUtils.newVariantContext("var4", "chr1", 1000, 1000, @@ -505,7 +506,7 @@ public Object[][] testCreateData() { "chrX", 2000, TEST_ATTRIBUTES_CPX), new SVCallRecord("var4", "chr1", 1000, null, "chrX", 2000, null, GATKSVVCFConstants.StructuralVariantAnnotationType.CPX, GATKSVVCFConstants.ComplexVariantSubtype.dDUP, 250, SVTestUtils.PESR_ONLY_ALGORITHM_LIST, ALLELES_CPX, Collections.singletonList(GENOTYPE_CPX_1), - TEST_ATTRIBUTES) + TEST_ATTRIBUTES, Collections.emptySet(), null) }, }; } diff --git a/src/test/java/org/broadinstitute/hellbender/tools/sv/SVTestUtils.java b/src/test/java/org/broadinstitute/hellbender/tools/sv/SVTestUtils.java index d1d2554dae7..217ab8b483f 100644 --- a/src/test/java/org/broadinstitute/hellbender/tools/sv/SVTestUtils.java +++ b/src/test/java/org/broadinstitute/hellbender/tools/sv/SVTestUtils.java @@ -135,7 +135,7 @@ public final static SVCallRecord makeRecord(final String id, genotypes.add(makeGenotypeWithRefAllele(builder, refAllele)); } return new SVCallRecord(id, contigA, positionA, strandA, contigB, positionB, strandB, type, null, length, algorithms, - newAlleles, genotypes, Collections.emptyMap(), hg38Dict); + newAlleles, genotypes, Collections.emptyMap(), Collections.emptySet(), null, hg38Dict); } public static final Genotype makeGenotypeWithRefAllele(final GenotypeBuilder builder, final Allele refAllele) { @@ -375,7 +375,7 @@ public static SVCallRecord newCallRecordWithAllelesAndSampleName(final String sa svtype, null, 100, Collections.singletonList(GATKSVVCFConstants.DEPTH_ALGORITHM), variantAlleles, Collections.singletonList(builder.make()), - Collections.emptyMap()); + Collections.emptyMap(), Collections.emptySet(), null); } public static SVCallRecord newNamedDeletionRecordWithAttributes(final String id, final Map attributes) { @@ -384,7 +384,7 @@ public static SVCallRecord newNamedDeletionRecordWithAttributes(final String id, 100, Collections.singletonList(GATKSVVCFConstants.DEPTH_ALGORITHM), Collections.emptyList(), Collections.emptyList(), - attributes); + attributes, Collections.emptySet(), null); } public static SVCallRecord newNamedDeletionRecordWithAttributesAndGenotypes(final String id, @@ -395,7 +395,7 @@ public static SVCallRecord newNamedDeletionRecordWithAttributesAndGenotypes(fina 100, Collections.singletonList(GATKSVVCFConstants.DEPTH_ALGORITHM), Lists.newArrayList(Allele.REF_N, Allele.SV_SIMPLE_DEL), genotypes, - attributes); + attributes, Collections.emptySet(), null); } public static final Map keyValueArraysToMap(final String[] keys, final Object[] values) { @@ -411,40 +411,40 @@ public static SVCallRecord newCallRecordWithLengthAndType(final Integer length, final int positionB = length == null ? 1 : CoordMath.getEnd(1, length); return new SVCallRecord("", "chr1", 1, getValidTestStrandA(svtype), "chr1", positionB, getValidTestStrandB(svtype), svtype, null, length, PESR_ONLY_ALGORITHM_LIST, Collections.emptyList(), Collections.emptyList(), - Collections.emptyMap()); + Collections.emptyMap(), Collections.emptySet(), null); } public static SVCallRecord newDeletionCallRecordWithIdAndAlgorithms(final String id, final List algorithms) { return new SVCallRecord(id, "chr1", 1, true, "chr1", 100, false, GATKSVVCFConstants.StructuralVariantAnnotationType.DEL, null, 100, algorithms, Collections.emptyList(), - Collections.emptyList(), Collections.emptyMap()); + Collections.emptyList(), Collections.emptyMap(), Collections.emptySet(), null); } // Note strands and length may not be set properly public static SVCallRecord newPESRCallRecordWithIntervalAndType(final int start, final int end, final GATKSVVCFConstants.StructuralVariantAnnotationType svtype) { return new SVCallRecord("", "chr1", start, getValidTestStrandA(svtype), "chr1", end, getValidTestStrandB(svtype), svtype, null, getLength(start, end, svtype), PESR_ONLY_ALGORITHM_LIST, Collections.emptyList(), - Collections.emptyList(), Collections.emptyMap()); + Collections.emptyList(), Collections.emptyMap(), Collections.emptySet(), null); } // Note strands and length may not be set properly public static SVCallRecord newInsertionWithPositionAndLength(final int start, final int length) { return new SVCallRecord("", "chr1", start, true, "chr1", start + 1, false, GATKSVVCFConstants.StructuralVariantAnnotationType.INS, null, length, PESR_ONLY_ALGORITHM_LIST, Collections.emptyList(), - Collections.emptyList(), Collections.emptyMap()); + Collections.emptyList(), Collections.emptyMap(), Collections.emptySet(), null); } public static SVCallRecord newDepthCallRecordWithIntervalAndType(final int start, final int end, final GATKSVVCFConstants.StructuralVariantAnnotationType svtype) { return new SVCallRecord("", "chr1", start, getValidTestStrandA(svtype), "chr1", end, getValidTestStrandB(svtype), svtype, null, getLength(start, end, svtype), DEPTH_ONLY_ALGORITHM_LIST, Collections.emptyList(), - Collections.emptyList(), Collections.emptyMap()); + Collections.emptyList(), Collections.emptyMap(), Collections.emptySet(), null); } // Note strands and length may not be set properly public static SVCallRecord newCallRecordWithContigsIntervalAndType(final String startContig, final int start, final String endContig, final int end, final GATKSVVCFConstants.StructuralVariantAnnotationType svtype) { return new SVCallRecord("", startContig, start, getValidTestStrandA(svtype), endContig, end, getValidTestStrandB(svtype), svtype, null, getLength(start, end, svtype), PESR_ONLY_ALGORITHM_LIST, Collections.emptyList(), - Collections.emptyList(), Collections.emptyMap()); + Collections.emptyList(), Collections.emptyMap(), Collections.emptySet(), null); } public static Integer getLength(final int start, final int end, final GATKSVVCFConstants.StructuralVariantAnnotationType type) { @@ -461,7 +461,7 @@ public static SVCallRecord newBndCallRecordWithStrands(final boolean strandA, fi Collections.singletonList(PESR_ALGORITHM), Collections.emptyList(), Collections.emptyList(), - Collections.emptyMap()); + Collections.emptyMap(), Collections.emptySet(), null); } public static SVCallRecord newCtxCallRecord() { @@ -469,7 +469,7 @@ public static SVCallRecord newCtxCallRecord() { Collections.singletonList(PESR_ALGORITHM), Collections.emptyList(), Collections.emptyList(), - Collections.emptyMap()); + Collections.emptyMap(), Collections.emptySet(), null); } public static SVCallRecord newCpxCallRecordWithLength(final int length) { @@ -477,7 +477,7 @@ public static SVCallRecord newCpxCallRecordWithLength(final int length) { Collections.singletonList(PESR_ALGORITHM), Collections.emptyList(), Collections.emptyList(), - Collections.emptyMap()); + Collections.emptyMap(), Collections.emptySet(), null); } public static SVCallRecord newCnvCallRecordWithStrands(final Boolean strandA, final Boolean strandB) { @@ -485,7 +485,7 @@ public static SVCallRecord newCnvCallRecordWithStrands(final Boolean strandA, fi Collections.singletonList(GATKSVVCFConstants.DEPTH_ALGORITHM), Collections.emptyList(), Collections.emptyList(), - Collections.emptyMap()); + Collections.emptyMap(), Collections.emptySet(), null); } public static SVCallRecord newCallRecordWithCoordinates(final String id, final String chrA, final int posA, final String chrB, final int posB) { @@ -493,7 +493,7 @@ public static SVCallRecord newCallRecordWithCoordinates(final String id, final S Collections.singletonList("peser"), Collections.emptyList(), Collections.emptyList(), - Collections.emptyMap()); + Collections.emptyMap(), Collections.emptySet(), null); } public static SVCallRecord newCallRecordWithCoordinatesAndType(final String id, final String chrA, final int posA, final String chrB, final int posB, final GATKSVVCFConstants.StructuralVariantAnnotationType type) { @@ -501,7 +501,7 @@ public static SVCallRecord newCallRecordWithCoordinatesAndType(final String id, Collections.singletonList(GATKSVVCFConstants.DEPTH_ALGORITHM), Collections.emptyList(), Collections.emptyList(), - Collections.emptyMap()); + Collections.emptyMap(), Collections.emptySet(), null); } public static SVCallRecord newCallRecordWithAlgorithms(final List algorithms) { @@ -509,7 +509,7 @@ public static SVCallRecord newCallRecordWithAlgorithms(final List algori algorithms, Collections.emptyList(), Collections.emptyList(), - Collections.emptyMap()); + Collections.emptyMap(), Collections.emptySet(), null); } public static SVCallRecord newCallRecordInsertionWithLength(final Integer length) { @@ -517,7 +517,7 @@ public static SVCallRecord newCallRecordInsertionWithLength(final Integer length PESR_ONLY_ALGORITHM_LIST, Collections.emptyList(), Collections.emptyList(), - Collections.emptyMap()); + Collections.emptyMap(), Collections.emptySet(), null); } public static VariantContext newVariantContext(final String id, final String chrA, final int posA, diff --git a/src/test/java/org/broadinstitute/hellbender/tools/sv/cluster/CNVDefragmenterTest.java b/src/test/java/org/broadinstitute/hellbender/tools/sv/cluster/CNVDefragmenterTest.java index 24fefe40298..56ab174a353 100644 --- a/src/test/java/org/broadinstitute/hellbender/tools/sv/cluster/CNVDefragmenterTest.java +++ b/src/test/java/org/broadinstitute/hellbender/tools/sv/cluster/CNVDefragmenterTest.java @@ -23,47 +23,47 @@ public void testClusterTogether() { final SVCallRecord deletion = new SVCallRecord("test_del", "chr1", 1000, true, "chr1", 1999, false, GATKSVVCFConstants.StructuralVariantAnnotationType.DEL, null, 1000, Collections.singletonList(GATKSVVCFConstants.DEPTH_ALGORITHM), Lists.newArrayList(Allele.REF_N, Allele.SV_SIMPLE_DEL), - Collections.emptyList(), Collections.emptyMap(), dictionary); + Collections.emptyList(), Collections.emptyMap(), Collections.emptySet(), null, dictionary); final SVCallRecord duplication = new SVCallRecord("test_dup", "chr1", 1000, false, "chr1", 1999, true, GATKSVVCFConstants.StructuralVariantAnnotationType.DUP, null, 1000, Collections.singletonList(GATKSVVCFConstants.DEPTH_ALGORITHM), Lists.newArrayList(Allele.REF_N, Allele.SV_SIMPLE_DUP), - Collections.emptyList(), Collections.emptyMap(), dictionary); + Collections.emptyList(), Collections.emptyMap(), Collections.emptySet(), null, dictionary); Assert.assertFalse(defragmenter.areClusterable(deletion, duplication), "Different sv types should not cluster"); final SVCallRecord duplicationNonDepthOnly = new SVCallRecord("test_dup", "chr1", 1000, false, "chr1", 1999, true, GATKSVVCFConstants.StructuralVariantAnnotationType.DUP, null, 1000, Lists.newArrayList(GATKSVVCFConstants.DEPTH_ALGORITHM, SVTestUtils.PESR_ALGORITHM), Lists.newArrayList(Allele.REF_N, Allele.SV_SIMPLE_DUP), - Collections.emptyList(), Collections.emptyMap(), dictionary); + Collections.emptyList(), Collections.emptyMap(), Collections.emptySet(), null, dictionary); Assert.assertFalse(defragmenter.areClusterable(duplication, duplicationNonDepthOnly), "Clustered records must be depth-only"); final SVCallRecord cnv = new SVCallRecord("test_cnv", "chr1", 1000, null, "chr1", 1999, null, GATKSVVCFConstants.StructuralVariantAnnotationType.CNV, null, 1000, Collections.singletonList(GATKSVVCFConstants.DEPTH_ALGORITHM), Lists.newArrayList(Allele.REF_N, Allele.SV_SIMPLE_DEL, Allele.SV_SIMPLE_DUP), - Collections.emptyList(), Collections.emptyMap(), dictionary); + Collections.emptyList(), Collections.emptyMap(), Collections.emptySet(), null, dictionary); Assert.assertFalse(defragmenter.areClusterable(deletion, cnv), "Different sv types should not cluster"); final SVCallRecord insertion = new SVCallRecord("test_ins", "chr1", 1000, true, "chr1", 1001, false, GATKSVVCFConstants.StructuralVariantAnnotationType.INS, null, 1000, SVTestUtils.PESR_ONLY_ALGORITHM_LIST, Lists.newArrayList(Allele.REF_N, Allele.SV_SIMPLE_INS), - Collections.emptyList(), Collections.emptyMap(), dictionary); + Collections.emptyList(), Collections.emptyMap(), Collections.emptySet(), null, dictionary); Assert.assertFalse(defragmenter.areClusterable(insertion, insertion), "Only CNVs should be valid"); final SVCallRecord deletion2 = new SVCallRecord("test_del2", "chr1", 1000, true, "chr1", 1999, false, GATKSVVCFConstants.StructuralVariantAnnotationType.DEL, null, 1000, Collections.singletonList(GATKSVVCFConstants.DEPTH_ALGORITHM), Lists.newArrayList(Allele.REF_N, Allele.SV_SIMPLE_DEL), - Collections.emptyList(), Collections.emptyMap(), dictionary); + Collections.emptyList(), Collections.emptyMap(), Collections.emptySet(), null, dictionary); Assert.assertTrue(defragmenter.areClusterable(deletion, deletion2), "Valid identical records should cluster"); final SVCallRecord deletion3 = new SVCallRecord("test_del3", "chr1", 2999, true, "chr1", 3998, false, GATKSVVCFConstants.StructuralVariantAnnotationType.DEL, null, 1000, Collections.singletonList(GATKSVVCFConstants.DEPTH_ALGORITHM), Lists.newArrayList(Allele.REF_N, Allele.SV_SIMPLE_DEL), - Collections.emptyList(), Collections.emptyMap(), dictionary); + Collections.emptyList(), Collections.emptyMap(), Collections.emptySet(), null, dictionary); Assert.assertTrue(defragmenter.areClusterable(deletion, deletion3), "Should cluster due to overlap"); final SVCallRecord deletion4 = new SVCallRecord("test_del3", "chr1", 3000, true, "chr1", 3999, false, GATKSVVCFConstants.StructuralVariantAnnotationType.DEL, null, 1000, Collections.singletonList(GATKSVVCFConstants.DEPTH_ALGORITHM), Lists.newArrayList(Allele.REF_N, Allele.SV_SIMPLE_DEL), - Collections.emptyList(), Collections.emptyMap(), dictionary); + Collections.emptyList(), Collections.emptyMap(), Collections.emptySet(), null, dictionary); Assert.assertFalse(defragmenter.areClusterable(deletion, deletion4), "Should barely not cluster"); } @@ -192,7 +192,7 @@ public void testGetMaxClusterableStartingPosition(final int start, final int end final SVCallRecord call1 = new SVCallRecord("call1", "chr1", start, true, "chr1", end, false, GATKSVVCFConstants.StructuralVariantAnnotationType.DEL, null, end - start + 1, Collections.singletonList(GATKSVVCFConstants.DEPTH_ALGORITHM), Lists.newArrayList(Allele.REF_N, Allele.SV_SIMPLE_DEL), - Collections.emptyList(), Collections.emptyMap(), dictionary); + Collections.emptyList(), Collections.emptyMap(), Collections.emptySet(), null, dictionary); final int maxClusterableStart = defragmenter.getMaxClusterableStartingPosition(call1); final int call2Start = maxClusterableStart; @@ -200,7 +200,7 @@ public void testGetMaxClusterableStartingPosition(final int start, final int end final SVCallRecord call2 = new SVCallRecord("call2", "chr1", call2Start, true, "chr1", call2End, false, GATKSVVCFConstants.StructuralVariantAnnotationType.DEL, null, call2End - call2Start + 1, Collections.singletonList(GATKSVVCFConstants.DEPTH_ALGORITHM), Lists.newArrayList(Allele.REF_N, Allele.SV_SIMPLE_DEL), - Collections.emptyList(), Collections.emptyMap(), dictionary); + Collections.emptyList(), Collections.emptyMap(), Collections.emptySet(), null, dictionary); Assert.assertTrue(defragmenter.areClusterable(call1, call2)); final int call3Start = maxClusterableStart + 1; @@ -208,7 +208,7 @@ public void testGetMaxClusterableStartingPosition(final int start, final int end final SVCallRecord call3 = new SVCallRecord("call3", "chr1", call3Start, true, "chr1", call3End, false, GATKSVVCFConstants.StructuralVariantAnnotationType.DEL, null, call3End - call3Start + 1, Collections.singletonList(GATKSVVCFConstants.DEPTH_ALGORITHM), Lists.newArrayList(Allele.REF_N, Allele.SV_SIMPLE_DEL), - Collections.emptyList(), Collections.emptyMap(), dictionary); + Collections.emptyList(), Collections.emptyMap(), Collections.emptySet(), null, dictionary); Assert.assertFalse(defragmenter.areClusterable(call1, call3)); } } \ No newline at end of file diff --git a/src/test/java/org/broadinstitute/hellbender/tools/sv/cluster/SVClusterEngineTest.java b/src/test/java/org/broadinstitute/hellbender/tools/sv/cluster/SVClusterEngineTest.java index 3480e2c94ac..942feab95f6 100644 --- a/src/test/java/org/broadinstitute/hellbender/tools/sv/cluster/SVClusterEngineTest.java +++ b/src/test/java/org/broadinstitute/hellbender/tools/sv/cluster/SVClusterEngineTest.java @@ -151,11 +151,11 @@ public void testClusterTogetherInvalidInterval() { final SVCallRecord deletion1 = new SVCallRecord("test_del", "chr1", 1000, true, "chr1", 248956423 + SVTestUtils.defaultEvidenceParameters.getWindow(), false, GATKSVVCFConstants.StructuralVariantAnnotationType.DEL, null, null, Collections.singletonList(SVTestUtils.PESR_ALGORITHM), Lists.newArrayList(Allele.REF_N, Allele.SV_SIMPLE_DEL), - Collections.emptyList(), Collections.emptyMap(), SVTestUtils.hg38Dict); + Collections.emptyList(), Collections.emptyMap(), Collections.emptySet(), null, SVTestUtils.hg38Dict); final SVCallRecord deletion2 = new SVCallRecord("test_del", "chr1", 1000, true, "chr1", 248956422, false, GATKSVVCFConstants.StructuralVariantAnnotationType.DEL, null, null, Collections.singletonList(SVTestUtils.PESR_ALGORITHM), Lists.newArrayList(Allele.REF_N, Allele.SV_SIMPLE_DEL), - Collections.emptyList(), Collections.emptyMap(), SVTestUtils.hg38Dict); + Collections.emptyList(), Collections.emptyMap(), Collections.emptySet(), null, SVTestUtils.hg38Dict); engine.getLinkage().areClusterable(deletion1, deletion2); Assert.fail("Expected exception not thrown"); } @@ -186,29 +186,29 @@ private void testGetMaxClusterableStartingPositionWithAlgorithm(final int start, final SVCallRecord call1 = new SVCallRecord("call1", "chr1", start, true, "chr1", end, false, GATKSVVCFConstants.StructuralVariantAnnotationType.DEL, null, end - start + 1, Collections.singletonList(algorithm), Lists.newArrayList(Allele.REF_N, Allele.SV_SIMPLE_DEL), - Collections.emptyList(), Collections.emptyMap(), SVTestUtils.hg38Dict); + Collections.emptyList(), Collections.emptyMap(), Collections.emptySet(), null, SVTestUtils.hg38Dict); final int maxClusterableStart = engine.getLinkage().getMaxClusterableStartingPosition(call1); final int call2Start = maxClusterableStart; final SVCallRecord call2Depth = new SVCallRecord("call2", "chr1", call2Start, true, "chr1", call2Start + call1.getLength() - 1, false, GATKSVVCFConstants.StructuralVariantAnnotationType.DEL, null, call1.getLength(), Collections.singletonList(GATKSVVCFConstants.DEPTH_ALGORITHM), Lists.newArrayList(Allele.REF_N, Allele.SV_SIMPLE_DEL), - Collections.emptyList(), Collections.emptyMap(), SVTestUtils.hg38Dict); + Collections.emptyList(), Collections.emptyMap(), Collections.emptySet(), null, SVTestUtils.hg38Dict); final SVCallRecord call2Pesr = new SVCallRecord("call2", "chr1", call2Start, true, "chr1", call2Start + call1.getLength() - 1, false, GATKSVVCFConstants.StructuralVariantAnnotationType.DEL, null, call1.getLength(), SVTestUtils.PESR_ONLY_ALGORITHM_LIST, Lists.newArrayList(Allele.REF_N, Allele.SV_SIMPLE_DEL), - Collections.emptyList(), Collections.emptyMap(), SVTestUtils.hg38Dict); + Collections.emptyList(), Collections.emptyMap(), Collections.emptySet(), null, SVTestUtils.hg38Dict); Assert.assertTrue(engine.getLinkage().areClusterable(call1, call2Depth) || engine.getLinkage().areClusterable(call1, call2Pesr)); final int call3Start = maxClusterableStart + 1; final SVCallRecord call3Depth = new SVCallRecord("call2", "chr1", call3Start, true, "chr1", call3Start + call1.getLength() - 1, false, GATKSVVCFConstants.StructuralVariantAnnotationType.DEL, null, call1.getLength(), Collections.singletonList(GATKSVVCFConstants.DEPTH_ALGORITHM), Lists.newArrayList(Allele.REF_N, Allele.SV_SIMPLE_DEL), - Collections.emptyList(), Collections.emptyMap(), SVTestUtils.hg38Dict); + Collections.emptyList(), Collections.emptyMap(), Collections.emptySet(), null, SVTestUtils.hg38Dict); final SVCallRecord call3Pesr = new SVCallRecord("call2", "chr1", call3Start, true, "chr1", call3Start + call1.getLength() - 1, false, GATKSVVCFConstants.StructuralVariantAnnotationType.DEL, null, call1.getLength(), SVTestUtils.PESR_ONLY_ALGORITHM_LIST, Lists.newArrayList(Allele.REF_N, Allele.SV_SIMPLE_DEL), - Collections.emptyList(), Collections.emptyMap(), SVTestUtils.hg38Dict); + Collections.emptyList(), Collections.emptyMap(), Collections.emptySet(), null, SVTestUtils.hg38Dict); Assert.assertFalse(engine.getLinkage().areClusterable(call1, call3Depth) || engine.getLinkage().areClusterable(call1, call3Pesr)); } @@ -264,12 +264,12 @@ public void testClusterTogetherVaryPositions(final int start1, final int end1, f "chr1", end1, false, GATKSVVCFConstants.StructuralVariantAnnotationType.DEL, null, end1 - start1 + 1, SVTestUtils.PESR_ONLY_ALGORITHM_LIST, Lists.newArrayList(Allele.REF_N, Allele.SV_SIMPLE_DEL, Allele.SV_SIMPLE_DUP), - SVTestUtils.threeGenotypes, Collections.emptyMap(), SVTestUtils.hg38Dict); + SVTestUtils.threeGenotypes, Collections.emptyMap(), Collections.emptySet(), null, SVTestUtils.hg38Dict); final SVCallRecord call2 = new SVCallRecord("call2", "chr1", start2, true, "chr1", end2, false, GATKSVVCFConstants.StructuralVariantAnnotationType.DEL, null, end2 - start2 + 1, Lists.newArrayList(GATKSVVCFConstants.DEPTH_ALGORITHM), Lists.newArrayList(Allele.REF_N, Allele.SV_SIMPLE_DEL, Allele.SV_SIMPLE_DUP), - SVTestUtils.threeGenotypes, Collections.emptyMap(), SVTestUtils.hg38Dict); + SVTestUtils.threeGenotypes, Collections.emptyMap(), Collections.emptySet(), null, SVTestUtils.hg38Dict); Assert.assertEquals(engine.getLinkage().areClusterable(call1, call2), result); } @@ -280,12 +280,12 @@ public void testClusterTogetherVaryTypes() { final SVCallRecord call1 = new SVCallRecord("call1", "chr1", 1000, SVTestUtils.getValidTestStrandA(type1), "chr1", 2001, SVTestUtils.getValidTestStrandB(type1), type1, null, SVTestUtils.getLength(1000, 2001, type1), Lists.newArrayList(GATKSVVCFConstants.DEPTH_ALGORITHM), - Collections.emptyList(), Collections.emptyList(), Collections.emptyMap(), SVTestUtils.hg38Dict); + Collections.emptyList(), Collections.emptyList(), Collections.emptyMap(), Collections.emptySet(), null, SVTestUtils.hg38Dict); for (final GATKSVVCFConstants.StructuralVariantAnnotationType type2 : GATKSVVCFConstants.StructuralVariantAnnotationType.values()) { final SVCallRecord call2 = new SVCallRecord("call2", "chr1", 1000, SVTestUtils.getValidTestStrandA(type2), "chr1", 2001, SVTestUtils.getValidTestStrandB(type2), type2, null, SVTestUtils.getLength(1000, 2001, type2), Lists.newArrayList(GATKSVVCFConstants.DEPTH_ALGORITHM), - Collections.emptyList(), Collections.emptyList(), Collections.emptyMap(), SVTestUtils.hg38Dict); + Collections.emptyList(), Collections.emptyList(), Collections.emptyMap(), Collections.emptySet(), null, SVTestUtils.hg38Dict); // Should only cluster together if same type, except CNVs if ((type1 == GATKSVVCFConstants.StructuralVariantAnnotationType.CNV && call2.isSimpleCNV()) || (type2 == GATKSVVCFConstants.StructuralVariantAnnotationType.CNV && call1.isSimpleCNV())) { @@ -305,13 +305,13 @@ public void testClusterTogetherVaryStrands() { final SVCallRecord call1 = new SVCallRecord("call1", "chr1", 1000, strand1A, "chr1", 2001, strand1B, GATKSVVCFConstants.StructuralVariantAnnotationType.BND, null, null, Lists.newArrayList(GATKSVVCFConstants.DEPTH_ALGORITHM), - Collections.emptyList(), Collections.emptyList(), Collections.emptyMap(), SVTestUtils.hg38Dict); + Collections.emptyList(), Collections.emptyList(), Collections.emptyMap(), Collections.emptySet(), null, SVTestUtils.hg38Dict); for (final Boolean strand2A : bools) { for (final Boolean strand2B : bools) { final SVCallRecord call2 = new SVCallRecord("call2", "chr1", 1000, strand2A, "chr1", 2001, strand2B, GATKSVVCFConstants.StructuralVariantAnnotationType.BND, null, null, Lists.newArrayList(GATKSVVCFConstants.DEPTH_ALGORITHM), - Collections.emptyList(), Collections.emptyList(), Collections.emptyMap(), SVTestUtils.hg38Dict); + Collections.emptyList(), Collections.emptyList(), Collections.emptyMap(), Collections.emptySet(), null, SVTestUtils.hg38Dict); // Should only cluster if strands match Assert.assertEquals(engine.getLinkage().areClusterable(call1, call2), strand1A == strand2A && strand1B == strand2B); } @@ -330,7 +330,7 @@ public void testClusterTogetherVaryContigs() { final SVCallRecord call1 = new SVCallRecord("call1", contig1A, 1000, true, contig1B, 2001, false, GATKSVVCFConstants.StructuralVariantAnnotationType.BND, null, null, SVTestUtils.PESR_ONLY_ALGORITHM_LIST, - Collections.emptyList(), Collections.emptyList(), Collections.emptyMap(), SVTestUtils.hg38Dict); + Collections.emptyList(), Collections.emptyList(), Collections.emptyMap(), Collections.emptySet(), null, SVTestUtils.hg38Dict); for (int k = 0; k < contigs.size(); k++) { final String contig2A = contigs.get(k); for (int m = k; m < contigs.size(); m++) { @@ -338,7 +338,7 @@ public void testClusterTogetherVaryContigs() { final SVCallRecord call2 = new SVCallRecord("call2", contig2A, 1000, true, contig2B, 2001, false, GATKSVVCFConstants.StructuralVariantAnnotationType.BND, null, null, SVTestUtils.PESR_ONLY_ALGORITHM_LIST, - Collections.emptyList(), Collections.emptyList(), Collections.emptyMap(), SVTestUtils.hg38Dict); + Collections.emptyList(), Collections.emptyList(), Collections.emptyMap(), Collections.emptySet(), null, SVTestUtils.hg38Dict); // Should only cluster if contigs match Assert.assertEquals(engine.getLinkage().areClusterable(call1, call2), contig1A.equals(contig2A) && contig1B.equals(contig2B)); } @@ -357,11 +357,11 @@ public void testClusterTogetherVaryAlgorithms() { for (final List algorithms1 : algorithmsList) { final SVCallRecord call1 = new SVCallRecord("call1", "chr1", 1000, true, "chr1", 2001, false, GATKSVVCFConstants.StructuralVariantAnnotationType.DEL, null, - 1002, algorithms1, Collections.emptyList(), Collections.emptyList(), Collections.emptyMap(), SVTestUtils.hg38Dict); + 1002, algorithms1, Collections.emptyList(), Collections.emptyList(), Collections.emptyMap(), Collections.emptySet(), null, SVTestUtils.hg38Dict); for (final List algorithms2 : algorithmsList) { final SVCallRecord call2 = new SVCallRecord("call2", "chr1", 1000, true, "chr1", 2001, false, GATKSVVCFConstants.StructuralVariantAnnotationType.DEL, null, - 1002, algorithms2, Collections.emptyList(), Collections.emptyList(), Collections.emptyMap(), SVTestUtils.hg38Dict); + 1002, algorithms2, Collections.emptyList(), Collections.emptyList(), Collections.emptyMap(), Collections.emptySet(), null, SVTestUtils.hg38Dict); // All combinations should cluster Assert.assertTrue(engine.getLinkage().areClusterable(call1, call2)); } @@ -406,10 +406,10 @@ public void testClusterTogetherVaryParameters() { final SVClusterEngine testEngine1 = SVTestUtils.getNewDefaultSingleLinkageEngine(); final SVCallRecord call1 = new SVCallRecord("call1", "chr1", 1000, true, "chr1", 2001, false, GATKSVVCFConstants.StructuralVariantAnnotationType.DEL, null, - 1002, Collections.singletonList(GATKSVVCFConstants.DEPTH_ALGORITHM), Collections.emptyList(), Collections.emptyList(), Collections.emptyMap(), SVTestUtils.hg38Dict); + 1002, Collections.singletonList(GATKSVVCFConstants.DEPTH_ALGORITHM), Collections.emptyList(), Collections.emptyList(), Collections.emptyMap(), Collections.emptySet(), null, SVTestUtils.hg38Dict); final SVCallRecord call2 = new SVCallRecord("call2", "chr1", 1100, true, "chr1", 2101, false, GATKSVVCFConstants.StructuralVariantAnnotationType.DEL, null, - 1002, Collections.singletonList(GATKSVVCFConstants.DEPTH_ALGORITHM), Collections.emptyList(), Collections.emptyList(), Collections.emptyMap(), SVTestUtils.hg38Dict); + 1002, Collections.singletonList(GATKSVVCFConstants.DEPTH_ALGORITHM), Collections.emptyList(), Collections.emptyList(), Collections.emptyMap(), Collections.emptySet(), null, SVTestUtils.hg38Dict); // Cluster with default parameters Assert.assertTrue(testEngine1.getLinkage().areClusterable(call1, call2)); final ClusteringParameters exactMatchParameters = ClusteringParameters.createDepthParameters(1.0, 0, 0, 1.0); @@ -449,15 +449,15 @@ public void testAddVaryPositions(final int positionA1, final int positionB1, final SVCallRecord call1 = new SVCallRecord("call1", "chr1", positionA1, true, "chr1", positionB1, false, GATKSVVCFConstants.StructuralVariantAnnotationType.DEL, null, positionB1 - positionA1 + 1, Collections.singletonList(GATKSVVCFConstants.DEPTH_ALGORITHM), - Collections.emptyList(), Collections.emptyList(), Collections.emptyMap(), SVTestUtils.hg38Dict); + Collections.emptyList(), Collections.emptyList(), Collections.emptyMap(), Collections.emptySet(), null, SVTestUtils.hg38Dict); final SVCallRecord call2 = new SVCallRecord("call1", "chr1", positionA2, true, "chr1", positionB2, false, GATKSVVCFConstants.StructuralVariantAnnotationType.DEL, null, positionB2 - positionA2 + 1, Collections.singletonList(GATKSVVCFConstants.DEPTH_ALGORITHM), - Collections.emptyList(), Collections.emptyList(), Collections.emptyMap(), SVTestUtils.hg38Dict); + Collections.emptyList(), Collections.emptyList(), Collections.emptyMap(), Collections.emptySet(), null, SVTestUtils.hg38Dict); final SVCallRecord call3 = new SVCallRecord("call1", "chr1", positionA3, true, "chr1", positionB3, false, GATKSVVCFConstants.StructuralVariantAnnotationType.DEL, null, positionB3 - positionA3 + 1, Collections.singletonList(GATKSVVCFConstants.DEPTH_ALGORITHM), - Collections.emptyList(), Collections.emptyList(), Collections.emptyMap(), SVTestUtils.hg38Dict); + Collections.emptyList(), Collections.emptyList(), Collections.emptyMap(), Collections.emptySet(), null, SVTestUtils.hg38Dict); engine.add(call1); engine.add(call2); engine.add(call3); @@ -586,7 +586,7 @@ public void testGetCarrierSamplesBiallelic(final int ploidy, final Allele refAll final SVCallRecord recordWithCopyNumber = new SVCallRecord("", "chr1", 1000, SVTestUtils.getValidTestStrandA(svtype), "chr1", 1999, SVTestUtils.getValidTestStrandB(svtype), svtype, null, 1000, Collections.singletonList(GATKSVVCFConstants.DEPTH_ALGORITHM), - alleles, GenotypesContext.copy(genotypesWithCopyNumber), Collections.emptyMap(), SVTestUtils.hg38Dict); + alleles, GenotypesContext.copy(genotypesWithCopyNumber), Collections.emptyMap(), Collections.emptySet(), null, SVTestUtils.hg38Dict); final Set resultWithCopyNumber = recordWithCopyNumber.getCarrierSampleSet(); Assert.assertEquals(resultWithCopyNumber, expectedResult); @@ -601,7 +601,7 @@ public void testGetCarrierSamplesBiallelic(final int ploidy, final Allele refAll final SVCallRecord recordWithGenotype = new SVCallRecord("", "chr1", 1000, SVTestUtils.getValidTestStrandA(svtype), "chr1", 1999, SVTestUtils.getValidTestStrandB(svtype), svtype, null, 1000, Collections.singletonList(GATKSVVCFConstants.DEPTH_ALGORITHM), - alleles, GenotypesContext.copy(genotypesWithGenotype), Collections.emptyMap(), SVTestUtils.hg38Dict); + alleles, GenotypesContext.copy(genotypesWithGenotype), Collections.emptyMap(), Collections.emptySet(), null, SVTestUtils.hg38Dict); final Set resultWithGenotype = recordWithGenotype.getCarrierSampleSet(); Assert.assertEquals(resultWithGenotype, expectedResult); diff --git a/src/test/java/org/broadinstitute/hellbender/tools/walkers/sv/SVConcordanceIntegrationTest.java b/src/test/java/org/broadinstitute/hellbender/tools/walkers/sv/SVConcordanceIntegrationTest.java index 6ca685a1b3b..7f846624de4 100644 --- a/src/test/java/org/broadinstitute/hellbender/tools/walkers/sv/SVConcordanceIntegrationTest.java +++ b/src/test/java/org/broadinstitute/hellbender/tools/walkers/sv/SVConcordanceIntegrationTest.java @@ -122,6 +122,8 @@ public void testRefPanel() { Assert.assertEquals(outputVariant.getStart(), expectedVariant.getStart()); Assert.assertEquals(outputVariant.getEnd(), expectedVariant.getEnd()); Assert.assertEquals(outputVariant.getAlleles(), expectedVariant.getAlleles()); + Assert.assertEquals(outputVariant.getFilters(), expectedVariant.getFilters()); + Assert.assertEquals(outputVariant.getPhredScaledQual(), expectedVariant.getPhredScaledQual()); Assert.assertEquals(outputVariant.getAttributeAsString(GATKSVVCFConstants.SVTYPE, "test_default"), expectedVariant.getAttributeAsString(GATKSVVCFConstants.SVTYPE, "expected_default")); checkTruthVariantId(outputVariant, expectedVariant); Assert.assertEquals(outputVariant.getAttributeAsString(Concordance.TRUTH_STATUS_VCF_ATTRIBUTE, "test_default"), expectedVariant.getAttributeAsString(Concordance.TRUTH_STATUS_VCF_ATTRIBUTE, "expected_default")); @@ -219,6 +221,8 @@ public void testSelf() { Assert.assertEquals(outputVariant.getStart(), expectedVariant.getStart()); Assert.assertEquals(outputVariant.getEnd(), expectedVariant.getEnd()); Assert.assertEquals(outputVariant.getAlleles(), expectedVariant.getAlleles()); + Assert.assertEquals(outputVariant.getFilters(), expectedVariant.getFilters()); + Assert.assertEquals(outputVariant.getPhredScaledQual(), expectedVariant.getPhredScaledQual()); final String svtype = outputVariant.getAttributeAsString(GATKSVVCFConstants.SVTYPE, "test_default"); Assert.assertEquals(svtype, expectedVariant.getAttributeAsString(GATKSVVCFConstants.SVTYPE, "expected_default")); // check the variant matched itself with perfect concordance @@ -300,6 +304,8 @@ private void assertPerfectConcordance(final File output, final String evalVcfPat Assert.assertEquals(outputVariant.getStart(), expectedVariant.getStart()); Assert.assertEquals(outputVariant.getEnd(), expectedVariant.getEnd()); Assert.assertEquals(outputVariant.getAlleles(), expectedVariant.getAlleles()); + Assert.assertEquals(outputVariant.getFilters(), expectedVariant.getFilters()); + Assert.assertEquals(outputVariant.getPhredScaledQual(), expectedVariant.getPhredScaledQual()); final String svtype = outputVariant.getAttributeAsString(GATKSVVCFConstants.SVTYPE, "test_default"); Assert.assertEquals(svtype, expectedVariant.getAttributeAsString(GATKSVVCFConstants.SVTYPE, "expected_default")); // check the variant matched itself with perfect concordance