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

Fix insertion with n consequence type #672

Open
wants to merge 3 commits into
base: release-4.12.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion cellbase-app/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.opencb.cellbase</groupId>
<artifactId>cellbase</artifactId>
<version>4.12.6</version>
<version>4.12.7</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion cellbase-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.opencb.cellbase</groupId>
<artifactId>cellbase</artifactId>
<version>4.12.6</version>
<version>4.12.7</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion cellbase-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.opencb.cellbase</groupId>
<artifactId>cellbase</artifactId>
<version>4.12.6</version>
<version>4.12.7</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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());
Expand Down
Original file line number Diff line number Diff line change
@@ -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<Object[]> 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}
});
}
}
}
2 changes: 1 addition & 1 deletion cellbase-lib/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.opencb.cellbase</groupId>
<artifactId>cellbase</artifactId>
<version>4.12.6</version>
<version>4.12.7</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion cellbase-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.opencb.cellbase</groupId>
<artifactId>cellbase</artifactId>
<version>4.12.6</version>
<version>4.12.7</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion cellbase-test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

<groupId>org.opencb.cellbase</groupId>
<artifactId>cellbase-test</artifactId>
<version>4.12.6</version>
<version>4.12.7</version>
<packaging>pom</packaging>

<dependencies>
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>org.opencb.cellbase</groupId>
<artifactId>cellbase</artifactId>
<version>4.12.6</version>
<version>4.12.7</version>
<packaging>pom</packaging>

<name>CellBase project</name>
Expand All @@ -22,7 +22,7 @@
</modules>

<properties>
<cellbase.version>4.12.6</cellbase.version>
<cellbase.version>4.12.7</cellbase.version>
<compileSource>1.8</compileSource>
<java-common-libs.version>3.7.5</java-common-libs.version>
<biodata.version>1.5.7</biodata.version>
Expand Down