diff --git a/cellbase-app/pom.xml b/cellbase-app/pom.xml index 51411ab8f..ade62138f 100644 --- a/cellbase-app/pom.xml +++ b/cellbase-app/pom.xml @@ -6,7 +6,7 @@ org.opencb.cellbase cellbase - 4.12.5 + 4.12.6 ../pom.xml diff --git a/cellbase-client/pom.xml b/cellbase-client/pom.xml index fe90001eb..6adb767a3 100644 --- a/cellbase-client/pom.xml +++ b/cellbase-client/pom.xml @@ -6,7 +6,7 @@ org.opencb.cellbase cellbase - 4.12.5 + 4.12.6 ../pom.xml diff --git a/cellbase-core/pom.xml b/cellbase-core/pom.xml index 226d2e2f4..bd7acfad5 100644 --- a/cellbase-core/pom.xml +++ b/cellbase-core/pom.xml @@ -6,7 +6,7 @@ org.opencb.cellbase cellbase - 4.12.5 + 4.12.6 ../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 356b11a90..4bac57121 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 @@ -652,9 +652,6 @@ private void adjustPhasedConsequenceTypes(Object[] variantArray) { = findCodingOverlappingConsequenceType(consequenceType1, variant1.getAnnotation().getConsequenceTypes()); // The two first variants affect the same codon if (consequenceType2 != null) { - // WARNING: assumes variants are sorted according to their coordinates - int cdnaPosition = consequenceType1.getCdnaPosition(); - int cdsPosition = consequenceType1.getCdsPosition(); String codon = null; String alternateAA = null; List soTerms = null; @@ -673,12 +670,12 @@ private void adjustPhasedConsequenceTypes(Object[] variantArray) { String alternateCodon = null; // negative strand - if ("-".equals(variant0.getStrand())) { - alternateCodon = "" + VariantAnnotationUtils.COMPLEMENTARY_NT.get(variant2.getAlternate()) - + VariantAnnotationUtils.COMPLEMENTARY_NT.get(variant1.getAlternate()) - + VariantAnnotationUtils.COMPLEMENTARY_NT.get(variant0.getAlternate()); + 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]); } else { - alternateCodon = variant0.getAlternate() + variant1.getAlternate() + variant2.getAlternate(); + alternateCodon = variant0.getAlternate().toUpperCase() + variant1.getAlternate().toUpperCase() + variant2.getAlternate().toUpperCase(); } @@ -689,8 +686,6 @@ private void adjustPhasedConsequenceTypes(Object[] variantArray) { variant1.getChromosome().equals("MT")); // Update consequenceType3 - consequenceType3.setCdnaPosition(cdnaPosition); - consequenceType3.setCdsPosition(cdsPosition); consequenceType3.setCodon(codon); consequenceType3.getProteinVariantAnnotation().setAlternate(alternateAA); newProteinVariantAnnotation = getProteinAnnotation(consequenceType3); @@ -716,7 +711,7 @@ private void adjustPhasedConsequenceTypes(Object[] variantArray) { char[] alternateCodonArray = referenceCodonArray.clone(); // negative strand - if ("-".equals(variant0.getStrand())) { + if ("-".equals(consequenceType1.getStrand())) { alternateCodonArray[codonIdx1] = VariantAnnotationUtils.COMPLEMENTARY_NT.get(variant0.getAlternate().toUpperCase().toCharArray()[0]); alternateCodonArray[codonIdx2] = @@ -739,8 +734,6 @@ private void adjustPhasedConsequenceTypes(Object[] variantArray) { consequenceType1.setProteinVariantAnnotation(newProteinVariantAnnotation == null ? getProteinAnnotation(consequenceType1) : newProteinVariantAnnotation); consequenceType1.setSequenceOntologyTerms(soTerms); - consequenceType2.setCdnaPosition(cdnaPosition); - consequenceType2.setCdsPosition(cdsPosition); consequenceType2.setCodon(codon); consequenceType2.getProteinVariantAnnotation().setAlternate(alternateAA); consequenceType2.setProteinVariantAnnotation(consequenceType1.getProteinVariantAnnotation()); diff --git a/cellbase-lib/pom.xml b/cellbase-lib/pom.xml index ec2de8e4f..7f7695d3d 100644 --- a/cellbase-lib/pom.xml +++ b/cellbase-lib/pom.xml @@ -6,7 +6,7 @@ org.opencb.cellbase cellbase - 4.12.5 + 4.12.6 ../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 c712d4c4e..722d8b60f 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 @@ -800,6 +800,106 @@ public void testQueryResultGroupingDecomposedMNVs() throws Exception { + } + + + @Test + public void testDecomposedMNVReturnsCorrectCodonChange() throws Exception { + QueryOptions queryOptions = (new QueryOptions("normalize", true)); + queryOptions.put("skipDecompose", true); + queryOptions.put("include", "consequenceType,hgvs"); + Variant variant = new Variant("18", 30517979, "CC", "AA"); + String transcriptID = "ENST00000581852"; + // Negative strand with no decompose + QueryResult queryResult = variantAnnotationCalculator + .getAnnotationByVariant(variant, queryOptions); + List consequenceTypeList = queryResult.getResult().get(0).getConsequenceTypes(); + assertFalse(consequenceTypeList.isEmpty()); + ConsequenceType consequenceType = getConsequenceType(consequenceTypeList,transcriptID); + assertEquals("-", consequenceType.getStrand()); + assertEquals("GGT/TTT", consequenceType.getCodon()); + assertEquals("GLY", consequenceType.getProteinVariantAnnotation().getReference()); + assertEquals("PHE", consequenceType.getProteinVariantAnnotation().getAlternate()); + assertEquals(262, consequenceType.getCdnaPosition().intValue()); + assertEquals(214, consequenceType.getCdsPosition().intValue()); + // For negative strand with decompose, amino acid change should be similar to the non-decomposed one + queryOptions.put("skipDecompose", false); + queryResult = variantAnnotationCalculator + .getAnnotationByVariant(variant, queryOptions); + // First variant + consequenceTypeList = queryResult.getResult().get(0).getConsequenceTypes(); + consequenceType = getConsequenceType(consequenceTypeList,transcriptID); + assertEquals("-", consequenceType.getStrand()); + assertEquals("GGt/TTt", consequenceType.getCodon()); + assertEquals("GLY", consequenceType.getProteinVariantAnnotation().getReference()); + assertEquals("PHE", consequenceType.getProteinVariantAnnotation().getAlternate()); + assertEquals(30517979, queryResult.getResult().get(0).getStart().intValue()); + assertEquals(263, consequenceType.getCdnaPosition().intValue()); + assertEquals(215, consequenceType.getCdsPosition().intValue()); + // Second variant + consequenceTypeList = queryResult.getResult().get(1).getConsequenceTypes(); + consequenceType = getConsequenceType(consequenceTypeList,transcriptID); + assertEquals("-", consequenceType.getStrand()); + assertEquals("GGt/TTt", consequenceType.getCodon()); + assertEquals("GLY", consequenceType.getProteinVariantAnnotation().getReference()); + assertEquals("PHE", consequenceType.getProteinVariantAnnotation().getAlternate()); + assertEquals(30517980, queryResult.getResult().get(1).getStart().intValue()); + assertEquals(262, consequenceType.getCdnaPosition().intValue()); + assertEquals(214, consequenceType.getCdsPosition().intValue()); + + // Test for negative strand decomposed mnv made of 3 changes in the same codon + variant = new Variant("18", 30517978, "ACC", "GGG"); + queryResult = variantAnnotationCalculator + .getAnnotationByVariant(variant, queryOptions); + consequenceTypeList = queryResult.getResult().get(0).getConsequenceTypes(); + consequenceType = getConsequenceType(consequenceTypeList,transcriptID); + assertEquals("-", consequenceType.getStrand()); + assertEquals("GGT/CCC", consequenceType.getCodon()); + assertEquals("GLY", consequenceType.getProteinVariantAnnotation().getReference()); + assertEquals("PRO", consequenceType.getProteinVariantAnnotation().getAlternate()); + assertEquals(30517978, queryResult.getResult().get(0).getStart().intValue()); + assertEquals(264, consequenceType.getCdnaPosition().intValue()); + assertEquals(216, consequenceType.getCdsPosition().intValue()); + + // Positive strand, no decompose + variant = new Variant("19", 33167329, "AC", "TT"); + transcriptID = "ENST00000334176"; + queryOptions.put("skipDecompose", true); + queryResult = variantAnnotationCalculator + .getAnnotationByVariant(variant, queryOptions); + consequenceTypeList = queryResult.getResult().get(0).getConsequenceTypes(); + consequenceType = getConsequenceType(consequenceTypeList,transcriptID); + assertEquals("+", consequenceType.getStrand()); + assertEquals("ACC/TTC", consequenceType.getCodon()); + assertEquals("THR", consequenceType.getProteinVariantAnnotation().getReference()); + assertEquals("PHE", consequenceType.getProteinVariantAnnotation().getAlternate()); + assertEquals(33167329, queryResult.getResult().get(0).getStart().intValue()); + assertEquals(1017, consequenceType.getCdnaPosition().intValue()); + assertEquals(160, consequenceType.getCdsPosition().intValue()); + // Positive strand with decompose + queryOptions.put("skipDecompose", false); + queryResult = variantAnnotationCalculator + .getAnnotationByVariant(variant, queryOptions); + // First variant + consequenceTypeList = queryResult.getResult().get(0).getConsequenceTypes(); + consequenceType = getConsequenceType(consequenceTypeList,transcriptID); + assertEquals("+", consequenceType.getStrand()); + assertEquals("ACc/TTc", consequenceType.getCodon()); + assertEquals("THR", consequenceType.getProteinVariantAnnotation().getReference()); + assertEquals("PHE", consequenceType.getProteinVariantAnnotation().getAlternate()); + assertEquals(33167329, queryResult.getResult().get(0).getStart().intValue()); + assertEquals(1017, consequenceType.getCdnaPosition().intValue()); + assertEquals(160, consequenceType.getCdsPosition().intValue()); + // Second variant + consequenceTypeList = queryResult.getResult().get(1).getConsequenceTypes(); + consequenceType = getConsequenceType(consequenceTypeList,transcriptID); + assertEquals("+", consequenceType.getStrand()); + assertEquals("ACc/TTc", consequenceType.getCodon()); + assertEquals("THR", consequenceType.getProteinVariantAnnotation().getReference()); + assertEquals("PHE", consequenceType.getProteinVariantAnnotation().getAlternate()); + assertEquals(33167330, queryResult.getResult().get(1).getStart().intValue()); + assertEquals(1018, consequenceType.getCdnaPosition().intValue()); + assertEquals(161, consequenceType.getCdsPosition().intValue()); } @Test diff --git a/cellbase-server/pom.xml b/cellbase-server/pom.xml index aaa3ecf52..e1ff880c0 100644 --- a/cellbase-server/pom.xml +++ b/cellbase-server/pom.xml @@ -6,7 +6,7 @@ org.opencb.cellbase cellbase - 4.12.5 + 4.12.6 ../pom.xml diff --git a/cellbase-test/pom.xml b/cellbase-test/pom.xml index 69183b824..b5e38dcf3 100644 --- a/cellbase-test/pom.xml +++ b/cellbase-test/pom.xml @@ -22,7 +22,7 @@ org.opencb.cellbase cellbase-test - 4.12.5 + 4.12.6 pom diff --git a/pom.xml b/pom.xml index 77a905767..81d0bfa40 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ org.opencb.cellbase cellbase - 4.12.5 + 4.12.6 pom CellBase project @@ -22,7 +22,7 @@ - 4.12.5 + 4.12.6 1.8 3.7.5 1.5.7