diff --git a/cellbase-app/pom.xml b/cellbase-app/pom.xml index ade62138f5..3d95e0b09e 100644 --- a/cellbase-app/pom.xml +++ b/cellbase-app/pom.xml @@ -6,7 +6,7 @@ org.opencb.cellbase cellbase - 4.12.6 + 4.12.7 ../pom.xml diff --git a/cellbase-client/pom.xml b/cellbase-client/pom.xml index 6adb767a33..817870d588 100644 --- a/cellbase-client/pom.xml +++ b/cellbase-client/pom.xml @@ -6,7 +6,7 @@ org.opencb.cellbase cellbase - 4.12.6 + 4.12.7 ../pom.xml diff --git a/cellbase-core/pom.xml b/cellbase-core/pom.xml index bd7acfad54..2fc5c47bba 100644 --- a/cellbase-core/pom.xml +++ b/cellbase-core/pom.xml @@ -6,7 +6,7 @@ org.opencb.cellbase cellbase - 4.12.6 + 4.12.7 ../pom.xml diff --git a/cellbase-core/src/main/java/org/opencb/cellbase/core/variant/annotation/VariantAnnotationCalculator.java b/cellbase-core/src/main/java/org/opencb/cellbase/core/variant/annotation/VariantAnnotationCalculator.java index 4bac571215..88b7853f60 100644 --- a/cellbase-core/src/main/java/org/opencb/cellbase/core/variant/annotation/VariantAnnotationCalculator.java +++ b/cellbase-core/src/main/java/org/opencb/cellbase/core/variant/annotation/VariantAnnotationCalculator.java @@ -671,11 +671,14 @@ private void adjustPhasedConsequenceTypes(Object[] variantArray) { // negative strand if ("-".equals(consequenceType1.getStrand())) { - alternateCodon = "" + VariantAnnotationUtils.COMPLEMENTARY_NT.get(variant2.getAlternate().toUpperCase().toCharArray()[0]) - + VariantAnnotationUtils.COMPLEMENTARY_NT.get(variant1.getAlternate().toUpperCase().toCharArray()[0]) - + VariantAnnotationUtils.COMPLEMENTARY_NT.get(variant0.getAlternate().toUpperCase().toCharArray()[0]); + alternateCodon = "" + + VariantAnnotationUtils.COMPLEMENTARY_NT.get(variant2.getAlternate().toUpperCase().toCharArray()[0]) + + VariantAnnotationUtils.COMPLEMENTARY_NT.get(variant1.getAlternate().toUpperCase().toCharArray()[0]) + + VariantAnnotationUtils.COMPLEMENTARY_NT.get(variant0.getAlternate().toUpperCase().toCharArray()[0]); } else { - alternateCodon = variant0.getAlternate().toUpperCase() + variant1.getAlternate().toUpperCase() + variant2.getAlternate().toUpperCase(); + alternateCodon = variant0.getAlternate().toUpperCase() + + variant1.getAlternate().toUpperCase() + + variant2.getAlternate().toUpperCase(); } diff --git a/cellbase-core/src/main/java/org/opencb/cellbase/core/variant/annotation/VariantAnnotationUtils.java b/cellbase-core/src/main/java/org/opencb/cellbase/core/variant/annotation/VariantAnnotationUtils.java index 383d122ba5..367a6635c7 100644 --- a/cellbase-core/src/main/java/org/opencb/cellbase/core/variant/annotation/VariantAnnotationUtils.java +++ b/cellbase-core/src/main/java/org/opencb/cellbase/core/variant/annotation/VariantAnnotationUtils.java @@ -667,7 +667,12 @@ public static VariantType getVariantType(Variant variant) throws UnsupportedURLV // FIXME: remove the if block below as soon as the Variant.inferType method is able to differentiate between // FIXME: insertions and deletions // if (variant.getType().equals(VariantType.INDEL) || variant.getType().equals(VariantType.SV)) { - if (variant.getType().equals(VariantType.INDEL)) { + if (variant.getType().equals(VariantType.INDEL) + || (variant.getType().equals(VariantType.SV) + && !variant.isSymbolic() + && variant.getReference().length() <= MAX_MNV_THRESHOLD + && variant.getAlternate().length() <= MAX_MNV_THRESHOLD) + ) { if (variant.getReference().isEmpty()) { // variant.setType(VariantType.INSERTION); return VariantType.INSERTION; @@ -677,15 +682,6 @@ public static VariantType getVariantType(Variant variant) throws UnsupportedURLV } else { return VariantType.MNV; } - } else if (!variant.isSymbolic() && (variant.getReference().length() > 1 || variant.getAlternate().length() > 1) - && - (!variant.getReference().startsWith(variant.getAlternate()) && !variant.getAlternate().startsWith(variant.getReference())) - ) { - if (variant.getReference().length() <= MAX_MNV_THRESHOLD && variant.getAlternate().length() <= MAX_MNV_THRESHOLD) { - return VariantType.MNV; - } else { - logger.warn("Provided alleles for variant are too long to be considered an MNV: %s", variant); - } } return variant.getType(); // return getVariantType(variant.getReferenceStart(), variant.getAlternate()); diff --git a/cellbase-core/src/test/java/org/opencb/cellbase/core/variant/VariantAnnotationUtilsTest.java b/cellbase-core/src/test/java/org/opencb/cellbase/core/variant/VariantAnnotationUtilsTest.java new file mode 100644 index 0000000000..2014a24038 --- /dev/null +++ b/cellbase-core/src/test/java/org/opencb/cellbase/core/variant/VariantAnnotationUtilsTest.java @@ -0,0 +1,42 @@ +package org.opencb.cellbase.core.variant; + +import org.junit.Test; +import org.junit.experimental.runners.Enclosed; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.opencb.biodata.models.variant.Variant; +import org.opencb.biodata.models.variant.avro.VariantType; +import org.opencb.cellbase.core.variant.annotation.VariantAnnotationUtils; + +import java.util.Arrays; +import java.util.Collection; + +import static org.junit.Assert.assertEquals; + +@RunWith(Enclosed.class) +public class VariantAnnotationUtilsTest { + @RunWith(Parameterized.class) + public static class GetVariantAnnotationTest { + private String variant; + private VariantType expectedVariantType; + public GetVariantAnnotationTest(String variant, VariantType expectedVariantType){ + this.variant = variant; + this.expectedVariantType = expectedVariantType; + } + @Test + public void test() { + assertEquals(VariantAnnotationUtils.getVariantType(new Variant(variant)), expectedVariantType); + } + @Parameterized.Parameters + public static Collection data() { + return Arrays.asList(new Object[][] { + {"13:52718051:N:TGTGTGTGTGTGTGTGTGTGTGTGTGTGTGTGTGTGTGTGTGTGTGTGTGTGTGTGTGTGTGTGTGTGTGN", VariantType.INSERTION}, + {"13:52718051:C:TGTGTGTGTGTGTGTGTGTGTGTGTGTGTGTGTGTGTGTGTGTGTGTGTGTGTGTGTGTGTGTGTGTGTG", VariantType.MNV}, + {"13:52718051:C:TGTGTG", VariantType.MNV}, + {"13:52718051:C:G", VariantType.SNV}, + {"13:52718051:C:", VariantType.DELETION}, + {"13:52718051::G", VariantType.INSERTION} + }); + } + } +} diff --git a/cellbase-lib/pom.xml b/cellbase-lib/pom.xml index 7f7695d3db..cd45303505 100644 --- a/cellbase-lib/pom.xml +++ b/cellbase-lib/pom.xml @@ -6,7 +6,7 @@ org.opencb.cellbase cellbase - 4.12.6 + 4.12.7 ../pom.xml diff --git a/cellbase-lib/src/test/java/org/opencb/cellbase/lib/impl/VariantAnnotationCalculatorTest.java b/cellbase-lib/src/test/java/org/opencb/cellbase/lib/impl/VariantAnnotationCalculatorTest.java index 722d8b60f3..d60f9603bb 100644 --- a/cellbase-lib/src/test/java/org/opencb/cellbase/lib/impl/VariantAnnotationCalculatorTest.java +++ b/cellbase-lib/src/test/java/org/opencb/cellbase/lib/impl/VariantAnnotationCalculatorTest.java @@ -2512,14 +2512,14 @@ public void testLongMNVConsequenceTypes() throws Exception { sequenceOntologyTerms = getSequenceOntologyTerms("ENST00000399839", consequenceTypeList); assertEquals("[{\"accession\": \"SO:0001627\", \"name\": \"intron_variant\"}]", sequenceOntologyTerms); - // MNV with alt length = 1 + // Deletion instead of MNV produces feature_truncation in addition to intron_variant variant = new Variant("22", 17668822, "TCTCTACTAAAAATACAAAAAATTAGCCAGGCGTGGTGGCAGGTGCCTGTAGTAC", "C"); queryResult = variantAnnotationCalculator .getAnnotationByVariant(variant, queryOptions); consequenceTypeList = queryResult.getResult().get(0).getConsequenceTypes(); assertFalse(consequenceTypeList.isEmpty()); sequenceOntologyTerms = getSequenceOntologyTerms("ENST00000399839", consequenceTypeList); - assertEquals("[{\"accession\": \"SO:0001627\", \"name\": \"intron_variant\"}]", sequenceOntologyTerms); + assertEquals("[{\"accession\": \"SO:0001906\", \"name\": \"feature_truncation\"}, {\"accession\": \"SO:0001627\", \"name\": \"intron_variant\"}]", sequenceOntologyTerms); } @Test(expected = UnsupportedURLVariantFormat.class) diff --git a/cellbase-server/pom.xml b/cellbase-server/pom.xml index e1ff880c0b..6cc6892f2e 100644 --- a/cellbase-server/pom.xml +++ b/cellbase-server/pom.xml @@ -6,7 +6,7 @@ org.opencb.cellbase cellbase - 4.12.6 + 4.12.7 ../pom.xml diff --git a/cellbase-test/pom.xml b/cellbase-test/pom.xml index b5e38dcf39..e2fc71a03c 100644 --- a/cellbase-test/pom.xml +++ b/cellbase-test/pom.xml @@ -22,7 +22,7 @@ org.opencb.cellbase cellbase-test - 4.12.6 + 4.12.7 pom diff --git a/pom.xml b/pom.xml index 81d0bfa401..cbe54fa11a 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ org.opencb.cellbase cellbase - 4.12.6 + 4.12.7 pom CellBase project @@ -22,7 +22,7 @@ - 4.12.6 + 4.12.7 1.8 3.7.5 1.5.7