Skip to content

Commit

Permalink
Merge pull request #626 from julie-sullivan/cnvpadding
Browse files Browse the repository at this point in the history
CellBase v4 - fix cnvPadding bug
  • Loading branch information
julie-sullivan authored Nov 14, 2022
2 parents b96d74b + 4a4af00 commit d01e2ab
Show file tree
Hide file tree
Showing 11 changed files with 54 additions and 16 deletions.
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.11.1</version>
<version>4.12.0-SNAPSHOT</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.11.1</version>
<version>4.12.0-SNAPSHOT</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.11.1</version>
<version>4.12.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import org.opencb.biodata.models.variant.avro.ConsequenceType;
import org.opencb.biodata.models.variant.avro.ProteinVariantAnnotation;
import org.opencb.biodata.models.variant.avro.SequenceOntologyTerm;
import org.opencb.biodata.models.variant.avro.VariantType;
import org.opencb.cellbase.core.api.GenomeDBAdaptor;
import org.opencb.commons.datastore.core.Query;
import org.opencb.commons.datastore.core.QueryOptions;
Expand Down Expand Up @@ -53,7 +54,9 @@ protected void parseQueryParam(QueryOptions queryOptions) {
}

protected int getStart(int extraPadding) {
if (imprecise && variant.getSv() != null) {
if (imprecise && VariantType.CNV.equals(variant.getType())) {
return variant.getStart() - extraPadding;
} else if (imprecise && variant.getSv() != null) {
return variant.getSv().getCiStartLeft() != null ? variant.getSv().getCiStartLeft() - extraPadding
: variant.getStart();
} else {
Expand All @@ -63,7 +66,9 @@ protected int getStart(int extraPadding) {
}

protected int getEnd(int extraPadding) {
if (imprecise && variant.getSv() != null) {
if (imprecise && VariantType.CNV.equals(variant.getType())) {
return variant.getEnd() + extraPadding;
} else if (imprecise && variant.getSv() != null) {
return variant.getSv().getCiEndRight() != null ? variant.getSv().getCiEndRight() + extraPadding
: variant.getEnd();
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import org.opencb.biodata.models.variant.Variant;
import org.opencb.biodata.models.variant.avro.ConsequenceType;
import org.opencb.biodata.models.variant.avro.ExonOverlap;
import org.opencb.biodata.models.variant.avro.VariantType;
import org.opencb.commons.datastore.core.QueryOptions;

import java.util.ArrayList;
Expand All @@ -24,8 +25,9 @@ public List<ConsequenceType> run(Variant inputVariant, List<Gene> geneList, bool
parseQueryParam(queryOptions);
List<ConsequenceType> consequenceTypeList = new ArrayList<>();
variant = inputVariant;
variantEnd = getEnd(svExtraPadding);
variantStart = getStart(svExtraPadding);
int extraPadding = VariantType.CNV.equals(variant.getType()) ? cnvExtraPadding : svExtraPadding;
variantEnd = getEnd(extraPadding);
variantStart = getStart(extraPadding);
// isBigDeletion = ((variantEnd - variantStart) > BIG_VARIANT_SIZE_THRESHOLD);
boolean isIntergenic = true;
for (Gene currentGene : geneList) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,8 @@ private List<VariantAnnotation> runAnnotationProcess(List<Variant> normalizedVar
if (annotatorSet.contains("consequenceType")) {
try {
List<ConsequenceType> consequenceTypeList = getConsequenceTypeList(normalizedVariantList.get(i),
variantGeneList, true, QueryOptions.empty());
variantGeneList, true, new QueryOptions().append("imprecise", imprecise)
.append("cnvExtraPadding", cnvExtraPadding));
variantAnnotation.setConsequenceTypes(consequenceTypeList);
if (phased) {
checkAndAdjustPhasedConsequenceTypes(normalizedVariantList.get(i), variantBuffer);
Expand Down
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.11.1</version>
<version>4.12.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1983,9 +1983,6 @@ public void testMissingClinVar() throws Exception {
queryOptions.put("imprecise", true);
queryOptions.put("phased", false);

QueryResult<VariantAnnotation> queryResult = variantAnnotationCalculator.getAnnotationByVariant(variant1, queryOptions);

assertEquals(14,new HashSet<String>(queryResult.getResult().get(0).getHgvs()).size());

}

Expand Down Expand Up @@ -2020,6 +2017,39 @@ public void testClinicalVariantsGrch38() throws Exception {

}

@Test
// long variant should have same annotations as short variant + cnvPadding
public void testCNVExtraPadding() throws Exception {

initGrch38();

// short variant
Variant shortVariant = new Variant("chr17:43087248-43087249:<CNV>");
// long variant
Variant longVariant = new Variant("chr17:43087248-43098506:<CNV>");

QueryOptions queryOptions = new QueryOptions("useCache", false);
queryOptions.put("include", "consequenceType, reference, alternate ,clinical");
queryOptions.put("normalize", true);
queryOptions.put("skipDecompose", false);
queryOptions.put("checkAminoAcidChange", true);
queryOptions.put("imprecise", true);
queryOptions.put("phased", false);

// long variant
QueryResult<VariantAnnotation> queryResult = variantAnnotationCalculator.getAnnotationByVariant(longVariant, queryOptions);
assertEquals(27, queryResult.getResult().get(0).getConsequenceTypes().size());

// short variant
queryResult = variantAnnotationCalculator.getAnnotationByVariant(shortVariant, queryOptions);
assertEquals(17, queryResult.getResult().get(0).getConsequenceTypes().size());

queryOptions.put("cnvExtraPadding", 10000);

// short variant with padding
queryResult = variantAnnotationCalculator.getAnnotationByVariant(shortVariant, queryOptions);
assertEquals(27, queryResult.getResult().get(0).getConsequenceTypes().size());
}

// threw an exception
@Test
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.11.1</version>
<version>4.12.0-SNAPSHOT</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.11.1</version>
<version>4.12.0-SNAPSHOT</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.11.1</version>
<version>4.12.0-SNAPSHOT</version>
<packaging>pom</packaging>

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

<properties>
<cellbase.version>4.11.1</cellbase.version>
<cellbase.version>4.12.0-SNAPSHOT</cellbase.version>
<compileSource>1.8</compileSource>
<java-common-libs.version>3.7.5</java-common-libs.version>
<biodata.version>1.5.6</biodata.version>
Expand Down

0 comments on commit d01e2ab

Please sign in to comment.