Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle CTX_PP/QQ and CTX_PQ/QP CPX_TYPE values in SVConcordance #8885

Merged
merged 5 commits into from
Jul 1, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -426,10 +426,14 @@ public static List<String> getAlgorithms(final VariantContext variant) {

public static GATKSVVCFConstants.ComplexVariantSubtype getComplexSubtype(final VariantContext variant) {
Utils.nonNull(variant);
final String subtypeString = variant.getAttributeAsString(GATKSVVCFConstants.CPX_TYPE, null);
String subtypeString = variant.getAttributeAsString(GATKSVVCFConstants.CPX_TYPE, null);
if (subtypeString == null) {
return null;
}
else {
// replace / in CTX_PP/QQ and CTX_PQ/QP with _ to match ComplexVariantSubtype constants which cannot contain slashes
subtypeString = subtypeString.replace("/", "_");
}
if (!VALID_CPX_SUBTYPES.contains(subtypeString)) {
throw new IllegalArgumentException("Invalid CPX subtype: " + subtypeString + ", valid values are: " +
String.join(", ", VALID_CPX_SUBTYPES));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import org.broadinstitute.hellbender.exceptions.UserException;
import org.broadinstitute.hellbender.tools.spark.sv.utils.GATKSVVCFConstants;
import org.broadinstitute.hellbender.tools.spark.sv.utils.SVUtils;
import org.broadinstitute.hellbender.tools.sv.SVCallRecordUtils;
import org.broadinstitute.hellbender.utils.SVInterval;
import org.broadinstitute.hellbender.utils.SVIntervalTree;
import org.broadinstitute.hellbender.utils.SimpleInterval;
Expand Down Expand Up @@ -862,12 +863,7 @@ protected static boolean includesDispersedDuplication(final GATKSVVCFConstants.C
protected Map<String, Object> annotateStructuralVariant(final VariantContext variant) {
final Map<String, Set<String>> variantConsequenceDict = new HashMap<>();
final GATKSVVCFConstants.StructuralVariantAnnotationType overallSVType = getSVType(variant);
final String complexTypeString = variant.getAttributeAsString(GATKSVVCFConstants.CPX_TYPE, null);
GATKSVVCFConstants.ComplexVariantSubtype complexType = null;
if (complexTypeString != null) {
// replace / in CTX_PP/QQ and CTX_PQ/QP with _ to match ComplexVariantSubtype constants which cannot contain slashes
complexType = GATKSVVCFConstants.ComplexVariantSubtype.valueOf(complexTypeString.replace("/", "_"));
}
final GATKSVVCFConstants.ComplexVariantSubtype complexType = SVCallRecordUtils.getComplexSubtype(variant);
final boolean includesDispersedDuplication = includesDispersedDuplication(complexType, COMPLEX_SUBTYPES_WITH_DISPERSED_DUP);
final List<SVSegment> svSegmentsForGeneOverlaps = getSVSegments(variant, overallSVType, maxBreakendLen, complexType);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -583,4 +583,57 @@ public void testCreate(final VariantContext variant, final SVCallRecord expected
final SVCallRecord resultKeepAttr = SVCallRecordUtils.create(variant, true);
SVTestUtils.assertEqualsExceptExcludedAttributes(resultKeepAttr, expected, Collections.emptyList());
}

@DataProvider(name = "testGetComplexSubtypeData")
public Object[][] testGetComplexSubtypeData() {
return new Object[][]{
{new VariantContextBuilder()
.source("source")
.id("id")
.chr("chr1")
.start(2000)
.stop(3000)
.alleles(Arrays.asList(Allele.REF_N, Allele.create("<CPX>", false)))
.attributes(Map.of(
GATKSVVCFConstants.SVTYPE, GATKSVVCFConstants.StructuralVariantAnnotationType.CPX,
GATKSVVCFConstants.CPX_TYPE, "dupINVdup"
))
.make(),
GATKSVVCFConstants.ComplexVariantSubtype.dupINVdup
},
{new VariantContextBuilder()
.source("source")
.id("id")
.chr("chr1")
.start(2000)
.stop(3000)
.alleles(Arrays.asList(Allele.REF_N, Allele.create("<CPX>", false)))
.attributes(Map.of(
GATKSVVCFConstants.SVTYPE, GATKSVVCFConstants.StructuralVariantAnnotationType.CPX,
GATKSVVCFConstants.CPX_TYPE, "CTX_PP/QQ"
))
.make(),
GATKSVVCFConstants.ComplexVariantSubtype.CTX_PP_QQ
},
{new VariantContextBuilder()
.source("source")
.id("id")
.chr("chr1")
.start(2000)
.stop(3000)
.alleles(Arrays.asList(Allele.REF_N, Allele.create("<DEL>", false)))
.attributes(Map.of(
GATKSVVCFConstants.SVTYPE, GATKSVVCFConstants.StructuralVariantAnnotationType.DEL
))
.make(),
null
}
};
}

@Test(dataProvider= "testGetComplexSubtypeData")
public void testGetComplexSubtype(final VariantContext variant, final GATKSVVCFConstants.ComplexVariantSubtype expected) {
final GATKSVVCFConstants.ComplexVariantSubtype actual = SVCallRecordUtils.getComplexSubtype(variant);
Assert.assertEquals(actual, expected);
}
}
Loading