Skip to content

Commit

Permalink
Merge pull request #666 from awab-ahmed/fix-spanning-deletion-error-a…
Browse files Browse the repository at this point in the history
…nd-conseqTypes

fix spanning deletion annotation
  • Loading branch information
julie-sullivan authored Sep 21, 2023
2 parents c9af263 + a3149be commit 85fbba4
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1071,7 +1071,12 @@ private ProteinVariantAnnotation getProteinAnnotation(ConsequenceType consequenc
}

private ConsequenceTypeCalculator getConsequenceTypeCalculator(Variant variant) throws UnsupportedURLVariantFormat {
switch (VariantAnnotationUtils.getVariantType(variant)) {
VariantType variantType = VariantAnnotationUtils.getVariantType(variant);
if (variantType == null) {
logger.error("There is no ConsequenceTypeCalculator for variant %s because it doesn't have a valid type", variant);
throw new UnsupportedURLVariantFormat("Invalid variant type");
}
switch (variantType) {
case SNV:
return new ConsequenceTypeSNVCalculator();
case INSERTION:
Expand All @@ -1097,7 +1102,7 @@ private ConsequenceTypeCalculator getConsequenceTypeCalculator(Variant variant)
default:
logger.error("There is no ConsequenceTypeCalculator for variant %s of type %s",
variant,
VariantAnnotationUtils.getVariantType(variant)
variantType
);
throw new UnsupportedURLVariantFormat();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -658,6 +658,9 @@ protected static StringBuilder appendChromosome(String chromosome, StringBuilder
}

public static VariantType getVariantType(Variant variant) throws UnsupportedURLVariantFormat {
if (variant.isSpanningDeletion()) {
return null;
}
if (variant.getType() == null) {
variant.setType(Variant.inferType(variant.getReference(), variant.getAlternate()));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.*;
import java.util.concurrent.ExecutionException;
import java.util.stream.Collectors;

import static org.junit.Assert.*;
Expand Down Expand Up @@ -2537,6 +2538,26 @@ public void testLongMNVConsequenceTypesFailsForAboveThresholdLength() throws Exc
variantAnnotationCalculator.getAllConsequenceTypesByVariant(aboveThresholdVariant, queryOptions);
}

@Test
public void testSpanningDeletionAnnotation() throws ExecutionException, InterruptedException {
Variant variant = new Variant("10:133754330:GCCC:*");
QueryOptions queryOptions = new QueryOptions("useCache", false);
queryOptions.put("include", "consequenceType,hgvs");
queryOptions.put("normalize", true);
queryOptions.put("skipDecompose", false);
QueryResult<VariantAnnotation> cellBaseDataResult = variantAnnotationCalculator
.getAnnotationByVariant(variant, queryOptions);
assertTrue(cellBaseDataResult.getResult().get(0).getConsequenceTypes().isEmpty());
assertTrue(cellBaseDataResult.getResult().get(0).getHgvs().isEmpty());
}

@Test(expected = UnsupportedURLVariantFormat.class)
public void testSpanningDeletionConsequenceTypeThrowsException() {
Variant variant = new Variant("10:133754330:GCCC:*");
QueryOptions queryOptions = new QueryOptions("useCache", false);
variantAnnotationCalculator.getAllConsequenceTypesByVariant(variant, queryOptions);
}

public String getSequenceOntologyTerms(String transcriptID, List<ConsequenceType> consequenceTypeList){
for (ConsequenceType consequenceType : consequenceTypeList) {
if (consequenceType.getEnsemblTranscriptId().equals(transcriptID)){
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<cellbase.version>4.12.6</cellbase.version>
<compileSource>1.8</compileSource>
<java-common-libs.version>3.7.5</java-common-libs.version>
<biodata.version>1.5.6</biodata.version>
<biodata.version>1.5.7</biodata.version>
<bionetdb.version>0.1.0</bionetdb.version>
<jackson.version>2.10.5</jackson.version>
<protobuf.version>3.1.0</protobuf.version>
Expand Down

0 comments on commit 85fbba4

Please sign in to comment.