Repository: opencb/opencga (language: python)

Issue:
TASK-6789 - Variant query fails with large skip values



Discussion / hints:

Fix patch:
diff --git a/opencga-app/src/main/java/org/opencb/opencga/app/migrations/v3_2_0/VariantSetupMigration.java b/opencga-app/src/main/java/org/opencb/opencga/app/migrations/v3/v3_2_0/VariantSetupMigration.java
similarity index 87%
rename from opencga-app/src/main/java/org/opencb/opencga/app/migrations/v3_2_0/VariantSetupMigration.java
rename to opencga-app/src/main/java/org/opencb/opencga/app/migrations/v3/v3_2_0/VariantSetupMigration.java
index 9d02073d099..f7d6c03be9d 100644
--- a/opencga-app/src/main/java/org/opencb/opencga/app/migrations/v3_2_0/VariantSetupMigration.java
+++ b/opencga-app/src/main/java/org/opencb/opencga/app/migrations/v3/v3_2_0/VariantSetupMigration.java
@@ -1,4 +1,4 @@
-package org.opencb.opencga.app.migrations.v3_2_0;
+package org.opencb.opencga.app.migrations.v3.v3_2_0;
 
 import org.opencb.commons.datastore.core.ObjectMap;
 import org.opencb.opencga.analysis.variant.manager.VariantStorageManager;
@@ -9,6 +9,7 @@
 import org.opencb.opencga.storage.core.metadata.VariantStorageMetadataManager;
 
 import java.util.LinkedHashSet;
+import java.util.List;
 
 @Migration(id = "variant_setup", description = "Add a dummy variant setup for studies with data", version = "3.2.0",
         domain = Migration.MigrationDomain.STORAGE, date = 20240516)
@@ -17,7 +18,12 @@ public class VariantSetupMigration extends StorageMigrationTool {
     @Override
     protected void run() throws Exception {
         VariantStorageManager variantStorageManager = getVariantStorageManager();
-        for (String study : getVariantStorageStudies()) {
+        List<String> storageStudies = getVariantStorageStudies();
+        if (storageStudies.isEmpty()) {
+            logger.info("No studies with variant storage found on organization '{}'", organizationId);
+            return;
+        }
+        for (String study : storageStudies) {
             logger.info("--- Checking study '{}'", study);
             if (variantStorageManager.hasVariantSetup(study, token)) {
                 logger.info("Study '{}' already has a variant setup", study);
diff --git a/opencga-catalog/src/main/java/org/opencb/opencga/catalog/managers/ProjectManager.java b/opencga-catalog/src/main/java/org/opencb/opencga/catalog/managers/ProjectManager.java
index dcfecf341f6..92591852817 100644
--- a/opencga-catalog/src/main/java/org/opencb/opencga/catalog/managers/ProjectManager.java
+++ b/opencga-catalog/src/main/java/org/opencb/opencga/catalog/managers/ProjectManager.java
@@ -227,13 +227,13 @@ private void validateProjectForCreation(String organizationId, Project project)
             CellBaseConfiguration cellBaseConfiguration = ParamUtils.defaultObject(project.getCellbase(),
                     new CellBaseConfiguration(ParamConstants.CELLBASE_URL, ParamConstants.CELLBASE_VERSION,
                             defaultDataRelease, ParamConstants.CELLBASE_APIKEY));
-            cellBaseConfiguration = CellBaseValidator.validate(cellBaseConfiguration, project.getOrganism().getScientificName(),
+            cellBaseConfiguration = CellBaseValidator.validate(cellBaseConfiguration,
+                    project.getOrganism().getScientificName(),
                     project.getOrganism().getAssembly(), true);
             project.setCellbase(cellBaseConfiguration);
         } catch (IOException e) {
             throw new CatalogParameterException(e);
         }
-
         project.setUuid(UuidUtils.generateOpenCgaUuid(UuidUtils.Entity.PROJECT));
         if (project.getStudies() != null && !project.getStudies().isEmpty()) {
             throw new CatalogParameterException("Creating project and studies in a single transaction is forbidden");
diff --git a/opencga-catalog/src/main/java/org/opencb/opencga/catalog/migration/MigrationManager.java b/opencga-catalog/src/main/java/org/opencb/opencga/catalog/migration/MigrationManager.java
index fa8fd7b9ee0..aacf4949226 100644
--- a/opencga-catalog/src/main/java/org/opencb/opencga/catalog/migration/MigrationManager.java
+++ b/opencga-catalog/src/main/java/org/opencb/opencga/catalog/migration/MigrationManager.java
@@ -668,7 +668,8 @@ private MigrationRun run(String organizationId, Class<? extends MigrationTool> r
                 + "-" + RandomStringUtils.randomAlphanumeric(5);
         String logFile = startMigrationLogger(jobId, Paths.get(configuration.getJobDir()).resolve(path));
         logger.info("------------------------------------------------------");
-        logger.info("Executing migration '{}' for version '{}'", annotation.id(), annotation.version());
+        logger.info("Executing migration '{}' for version '{}' in organization '{}'", annotation.id(), annotation.version(),
+                organizationId);
         logger.info("    {}", annotation.description());
         logger.info("------------------------------------------------------");
 
@@ -707,6 +708,7 @@ private MigrationRun run(String organizationId, Class<? extends MigrationTool> r
                 logger.info("Migration '{}' finished with status {} : {}", annotation.id(), status, TimeUtils.durationToString(stopWatch));
             }
             logger.info("------------------------------------------------------");
+            logger.info("");
         } catch (Exception e) {
             migrationRun.setStatus(MigrationRun.MigrationStatus.ERROR);
             String message;
diff --git a/opencga-core/src/main/java/org/opencb/opencga/core/api/ParamConstants.java b/opencga-core/src/main/java/org/opencb/opencga/core/api/ParamConstants.java
index 4d02f049f2a..d3739f43ce5 100644
--- a/opencga-core/src/main/java/org/opencb/opencga/core/api/ParamConstants.java
+++ b/opencga-core/src/main/java/org/opencb/opencga/core/api/ParamConstants.java
@@ -82,7 +82,7 @@ public class ParamConstants {
     public static final String CELLBASE_URL = "https://ws.zettagenomics.com/cellbase";
     public static final String CELLBASE_VERSION = "v5.8";
     public static final String CELLBASE_DATA_RELEASE_GRCH38 = "7";
-    public static final String CELLBASE_APIKEY = "";
+    public static final String CELLBASE_APIKEY = null;
 
     public static final String POP_FREQ_1000G_CB_V4 = "1kG_phase3";
     public static final String POP_FREQ_1000G_CB_V5 = "1000G";
diff --git a/opencga-storage/opencga-storage-core/src/main/java/org/opencb/opencga/storage/core/variant/search/SearchIndexVariantQueryExecutor.java b/opencga-storage/opencga-storage-core/src/main/java/org/opencb/opencga/storage/core/variant/search/SearchIndexVariantQueryExecutor.java
index 899f71a9b72..ccaae7dbe39 100644
--- a/opencga-storage/opencga-storage-core/src/main/java/org/opencb/opencga/storage/core/variant/search/SearchIndexVariantQueryExecutor.java
+++ b/opencga-storage/opencga-storage-core/src/main/java/org/opencb/opencga/storage/core/variant/search/SearchIndexVariantQueryExecutor.java
@@ -264,6 +264,10 @@ public boolean doIntersectWithSearch(Query query, QueryOptions options) {
             intersect = true;
         } else {
             if (options.getBoolean(QueryOptions.COUNT)) {
+                // The SearchIndex is better than anyone in terms of counting
+                intersect = true;
+            } else if (options.getInt(QueryOptions.SKIP, 0) > 500) {
+                // Large "skip" queries should use SearchIndex when possible
                 intersect = true;
             } else {
                 // TODO: Improve this heuristic
diff --git a/opencga-storage/opencga-storage-hadoop/opencga-storage-hadoop-core/src/main/java/org/opencb/opencga/storage/hadoop/variant/adaptors/phoenix/VariantPhoenixKeyFactory.java b/opencga-storage/opencga-storage-hadoop/opencga-storage-hadoop-core/src/main/java/org/opencb/opencga/storage/hadoop/variant/adaptors/phoenix/VariantPhoenixKeyFactory.java
index 9e06ebc4b51..977e6fbbf93 100644
--- a/opencga-storage/opencga-storage-hadoop/opencga-storage-hadoop-core/src/main/java/org/opencb/opencga/storage/hadoop/variant/adaptors/phoenix/VariantPhoenixKeyFactory.java
+++ b/opencga-storage/opencga-storage-hadoop/opencga-storage-hadoop-core/src/main/java/org/opencb/opencga/storage/hadoop/variant/adaptors/phoenix/VariantPhoenixKeyFactory.java
@@ -146,7 +146,7 @@ public static boolean mightHashAlleles(Variant variant) {
      */
     public static byte[] generateVariantRowKey(String chrom, int start, Integer end, String ref, String alt, StructuralVariation sv) {
         chrom = Region.normalizeChromosome(chrom);
-        alt = buildSymbolicAlternate(ref, alt, end, sv);
+        alt = buildSymbolicAlternate(ref, alt, start, end, sv);
         int size = getSize(chrom, ref, alt);
 
         if (size > HConstants.MAX_ROW_LENGTH) {
@@ -201,11 +201,11 @@ public static String buildAlleles(Variant v) {
     }
 
     public static String buildSymbolicAlternate(Variant v) {
-        return buildSymbolicAlternate(v.getReference(), v.getAlternate(), v.getEnd(), v.getSv());
+        return buildSymbolicAlternate(v.getReference(), v.getAlternate(), v.getStart(), v.getEnd(), v.getSv());
     }
 
     // visible for test
-    public static String buildSymbolicAlternate(String reference, String alternate, Integer end, StructuralVariation sv) {
+    public static String buildSymbolicAlternate(String reference, String alternate, int start, Integer end, StructuralVariation sv) {
         if (sv != null) {
             byte[] alternateBytes = alternate.getBytes();
             if (!Allele.wouldBeSymbolicAllele(alternateBytes) && emptyCiStartEnd(sv)) {
@@ -216,14 +216,16 @@ public static String buildSymbolicAlternate(String reference, String alternate,
             if (StructuralVariantType.TANDEM_DUPLICATION.equals(sv.getType())) {
                 alternate = VariantBuilder.DUP_TANDEM_ALT;
             }
-            boolean bnd = Allele.wouldBeBreakpoint(alternateBytes);
+            // Ignore CIEND on variants without an actual END. This includes Breakends and INSERTIONS
+            // These variants are not expected to have CIEND. This is a redundant check, as the CIEND should be empty after normalization.
+            boolean ignoreCiend = Allele.wouldBeBreakpoint(alternateBytes) || end < start;
 
             alternate = alternate
                     + SV_ALTERNATE_SEPARATOR + end
                     + SV_ALTERNATE_SEPARATOR + (sv.getCiStartLeft() == null ? 0 : sv.getCiStartLeft())
                     + SV_ALTERNATE_SEPARATOR + (sv.getCiStartRight() == null ? 0 : sv.getCiStartRight())
-                    + SV_ALTERNATE_SEPARATOR + (bnd | sv.getCiEndLeft() == null ? 0 : sv.getCiEndLeft())
-                    + SV_ALTERNATE_SEPARATOR + (bnd | sv.getCiEndRight() == null ? 0 : sv.getCiEndRight());
+                    + SV_ALTERNATE_SEPARATOR + ((ignoreCiend || sv.getCiEndLeft() == null) ? 0 : sv.getCiEndLeft())
+                    + SV_ALTERNATE_SEPARATOR + ((ignoreCiend || sv.getCiEndRight() == null) ? 0 : sv.getCiEndRight());
 
             if (StringUtils.isNotEmpty(sv.getLeftSvInsSeq()) || StringUtils.isNotEmpty(sv.getRightSvInsSeq())) {
                 alternate = alternate
diff --git a/opencga-storage/opencga-storage-hadoop/opencga-storage-hadoop-core/src/main/java/org/opencb/opencga/storage/hadoop/variant/index/sample/SampleIndexVariantBiConverter.java b/opencga-storage/opencga-storage-hadoop/opencga-storage-hadoop-core/src/main/java/org/opencb/opencga/storage/hadoop/variant/index/sample/SampleIndexVariantBiConverter.java
index f1b167ae9c1..6edc5c9abf2 100644
--- a/opencga-storage/opencga-storage-hadoop/opencga-storage-hadoop-core/src/main/java/org/opencb/opencga/storage/hadoop/variant/index/sample/SampleIndexVariantBiConverter.java
+++ b/opencga-storage/opencga-storage-hadoop/opencga-storage-hadoop-core/src/main/java/org/opencb/opencga/storage/hadoop/variant/index/sample/SampleIndexVariantBiConverter.java
@@ -688,7 +688,7 @@ protected int getRelativeStart(Variant variant) {
     }
 
     protected String getAlternate(Variant v) {
-        return VariantPhoenixKeyFactory.buildSymbolicAlternate(v.getReference(), v.getAlternate(), v.getEnd(), v.getSv());
+        return VariantPhoenixKeyFactory.buildSymbolicAlternate(v);
     }
 
     /**
diff --git a/pom.xml b/pom.xml
index 5076fd8b8ec..95f54ac4a10 100644
--- a/pom.xml
+++ b/pom.xml
@@ -45,7 +45,7 @@
     <properties>
         <pyopencga.version>3.2.1_dev</pyopencga.version>
         <opencgar.version>3.2.1_dev</opencgar.version>
-        <cellbase.version>6.1.1-SNAPSHOT</cellbase.version>
+        <cellbase.version>6.2.1-SNAPSHOT</cellbase.version>
         <biodata.version>3.2.1-SNAPSHOT</biodata.version>
         <java-common-libs.version>5.2.1-SNAPSHOT</java-common-libs.version>
         <iva.version>3.2.1-SNAPSHOT</iva.version>


Test patch:
diff --git a/opencga-analysis/src/test/java/org/opencb/opencga/analysis/clinical/exomiser/ExomiserInterpretationAnalysisTest.java b/opencga-analysis/src/test/java/org/opencb/opencga/analysis/clinical/exomiser/ExomiserInterpretationAnalysisTest.java
index 46799bfab58..a6fd99aa3bc 100644
--- a/opencga-analysis/src/test/java/org/opencb/opencga/analysis/clinical/exomiser/ExomiserInterpretationAnalysisTest.java
+++ b/opencga-analysis/src/test/java/org/opencb/opencga/analysis/clinical/exomiser/ExomiserInterpretationAnalysisTest.java
@@ -81,6 +81,7 @@ public void singleExomiserAnalysis() throws IOException, CatalogException, ToolE
 //        String resourceVersion = "2109";
         String exomiserVersion = "14.0";
         String resourceVersion = "2402";
+        assertTrue(opencga.getOpencgaHome().resolve("analysis").resolve("exomiser").resolve(exomiserVersion).toFile().exists());
         assumeTrue(Paths.get("/opt/opencga/analysis/resources/exomiser/READY-" + resourceVersion).toFile().exists());
 
         prepareExomiserData();
@@ -131,6 +132,7 @@ public void familyExomiserAnalysis() throws IOException, CatalogException, ToolE
 //        String resourceVersion = "2109";
         String exomiserVersion = "14.0";
         String resourceVersion = "2402";
+        assertTrue(opencga.getOpencgaHome().resolve("analysis").resolve("exomiser").resolve(exomiserVersion).toFile().exists());
         assumeTrue(Paths.get("/opt/opencga/analysis/resources/exomiser/READY-" + resourceVersion).toFile().exists());
 
         prepareExomiserData();
@@ -180,6 +182,7 @@ public void trioSingleExomiserAnalysis() throws IOException, CatalogException, T
 //        String resourceVersion = "2109";
         String exomiserVersion = "14.0";
         String resourceVersion = "2402";
+        assertTrue(opencga.getOpencgaHome().resolve("analysis").resolve("exomiser").resolve(exomiserVersion).toFile().exists());
         assumeTrue(Paths.get("/opt/opencga/analysis/resources/exomiser/READY-" + resourceVersion).toFile().exists());
 
         prepareExomiserData();
diff --git a/opencga-analysis/src/test/java/org/opencb/opencga/analysis/variant/OpenCGATestExternalResource.java b/opencga-analysis/src/test/java/org/opencb/opencga/analysis/variant/OpenCGATestExternalResource.java
index 6fca2e7c2aa..e3b69751771 100644
--- a/opencga-analysis/src/test/java/org/opencb/opencga/analysis/variant/OpenCGATestExternalResource.java
+++ b/opencga-analysis/src/test/java/org/opencb/opencga/analysis/variant/OpenCGATestExternalResource.java
@@ -22,7 +22,6 @@
 import org.opencb.commons.datastore.mongodb.MongoDataStore;
 import org.opencb.commons.datastore.mongodb.MongoDataStoreManager;
 import org.opencb.opencga.analysis.StorageManager;
-import org.opencb.opencga.analysis.clinical.exomiser.ExomiserInterpretationAnalysisTest;
 import org.opencb.opencga.analysis.tools.ToolRunner;
 import org.opencb.opencga.analysis.variant.manager.VariantStorageManager;
 import org.opencb.opencga.catalog.db.mongodb.MongoBackupUtils;
@@ -220,9 +219,9 @@ public Path isolateOpenCGA() throws IOException {
 
         catalogManagerExternalResource.getConfiguration().serialize(
                 new FileOutputStream(conf.resolve("configuration.yml").toFile()));
-        InputStream inputStream = StorageManager.class.getClassLoader().getResourceAsStream("storage-configuration.yml");
-
-        storageConfiguration = StorageConfiguration.load(inputStream, "yml");
+        try (InputStream inputStream = StorageManager.class.getClassLoader().getResourceAsStream("storage-configuration.yml")) {
+            storageConfiguration = StorageConfiguration.load(inputStream, "yml");
+        }
 
         storageConfiguration.getVariant().setDefaultEngine(storageEngine);
         if (storageEngine.equals(HadoopVariantStorageEngine.STORAGE_ENGINE_ID)) {
@@ -259,20 +258,22 @@ public Path isolateOpenCGA() throws IOException {
 
         // Mutational signatue analysis
         Path analysisPath = Files.createDirectories(opencgaHome.resolve("analysis/mutational-signature")).toAbsolutePath();
-        inputStream = new FileInputStream("../opencga-app/app/analysis/mutational-signature/sv_clustering.R");
-        Files.copy(inputStream, analysisPath.resolve("sv_clustering.R"), StandardCopyOption.REPLACE_EXISTING);
+        try (FileInputStream inputStream = new FileInputStream("../opencga-app/app/analysis/mutational-signature/sv_clustering.R")) {
+            Files.copy(inputStream, analysisPath.resolve("sv_clustering.R"), StandardCopyOption.REPLACE_EXISTING);
+        }
 
         // Pedigree graph analysis
         analysisPath = Files.createDirectories(opencgaHome.resolve("analysis/pedigree-graph")).toAbsolutePath();
-        inputStream = new FileInputStream("../opencga-app/app/analysis/pedigree-graph/ped.R");
-        Files.copy(inputStream, analysisPath.resolve("ped.R"), StandardCopyOption.REPLACE_EXISTING);
+        try (FileInputStream inputStream = new FileInputStream("../opencga-app/app/analysis/pedigree-graph/ped.R")) {
+            Files.copy(inputStream, analysisPath.resolve("ped.R"), StandardCopyOption.REPLACE_EXISTING);
+        }
 
         // Exomiser analysis files
         List<String> exomiserVersions = Arrays.asList("13.1", "14.0");
         List<String> exomiserFiles = Arrays.asList("application.properties", "exomiser-analysis.yml", "output.yml");
         for (String exomiserVersion : exomiserVersions) {
             analysisPath = Files.createDirectories(opencgaHome.resolve("analysis/exomiser").resolve(exomiserVersion).toAbsolutePath());
-            Path exomiserPath = Paths.get(ExomiserInterpretationAnalysisTest.class.getClassLoader().getResource("exomiser").getPath());
+            Path exomiserPath = Paths.get("../opencga-app/app/analysis/exomiser");
             for (String exomiserFile : exomiserFiles) {
                 String resource = exomiserVersion + "/" + exomiserFile;
                 Files.copy(exomiserPath.resolve(resource).toAbsolutePath(), analysisPath.resolve(exomiserFile), StandardCopyOption.REPLACE_EXISTING);
diff --git a/opencga-analysis/src/test/java/org/opencb/opencga/analysis/variant/manager/operations/RemoveVariantsTest.java b/opencga-analysis/src/test/java/org/opencb/opencga/analysis/variant/manager/operations/RemoveVariantsTest.java
index e5e190328b5..56e79581e2f 100644
--- a/opencga-analysis/src/test/java/org/opencb/opencga/analysis/variant/manager/operations/RemoveVariantsTest.java
+++ b/opencga-analysis/src/test/java/org/opencb/opencga/analysis/variant/manager/operations/RemoveVariantsTest.java
@@ -32,6 +32,7 @@
 import org.opencb.opencga.core.models.sample.Sample;
 import org.opencb.opencga.core.models.study.Study;
 import org.opencb.opencga.core.testclassification.duration.MediumTests;
+import org.opencb.opencga.storage.core.variant.VariantStorageEngine;
 import org.opencb.opencga.storage.core.variant.VariantStorageOptions;
 
 import java.nio.file.Files;
@@ -46,7 +47,6 @@
 import static org.hamcrest.CoreMatchers.anyOf;
 import static org.hamcrest.CoreMatchers.is;
 import static org.junit.Assert.*;
-import static org.opencb.opencga.storage.core.variant.VariantStorageBaseTest.getResourceUri;
 
 /**
  * Created on 10/07/17.
@@ -140,7 +140,7 @@ public void testLoadAndRemoveDifferentChromosomes() throws Exception {
         List<File> files = new ArrayList<>();
         files.add(create("1k.chr1.phase3_shapeit2_mvncall_integrated_v5.20130502.genotypes.vcf.gz"));
         files.add(create("10k.chr22.phase3_shapeit2_mvncall_integrated_v5.20130502.genotypes.vcf.gz"));
-        indexFiles(files, new QueryOptions(), outputId);
+        indexFiles(files, new QueryOptions(VariantStorageOptions.LOAD_SPLIT_DATA.key(), VariantStorageEngine.SplitData.CHROMOSOME), outputId);
 
         removeFile(files.get(0), new QueryOptions());
     }
diff --git a/opencga-analysis/src/test/resources/exomiser/13.1/application.properties b/opencga-analysis/src/test/resources/exomiser/13.1/application.properties
deleted file mode 100644
index 1775e32d14c..00000000000
--- a/opencga-analysis/src/test/resources/exomiser/13.1/application.properties
+++ /dev/null
@@ -1,45 +0,0 @@
-#
-# The Exomiser - A tool to annotate and prioritize genomic variants
-#
-# Copyright (c) 2016-2021 Queen Mary University of London.
-# Copyright (c) 2012-2016 Charité Universitätsmedizin Berlin and Genome Research Ltd.
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-#
-
-## exomiser root data directory ##
-# root path where data is to be downloaded and worked on it is assumed that all the files required by exomiser listed
-# in this properties file will be found in the data directory, unless specifically overridden here.
-#exomiser.data-directory=/exomiser-data
-exomiser.data-directory=/data
-
-#remm.version=0.3.1.post1
-#cadd.version=1.4
-#exomiser.hg38.data-version=1811
-#exomiser.hg38.data-version=2109
-#exomiser.hg38.remm-path=${exomiser.data-directory}/remm/ReMM.v${remm.version}.hg38.tsv.gz
-#exomiser.hg38.variant-white-list-path=${exomiser.hg38.data-version}_hg38_clinvar_whitelist.tsv.gz
-#exomiser.phenotype.data-version=2109
-#logging.file.name=/exomiser-data/logs/exomiser.log
-
-
-#remm.version=0.3.1.post1
-#cadd.version=1.4
-#exomiser.hg19.data-version=1811
-exomiser.hg38.data-version=2109
-#exomiser.hg19.remm-path=${exomiser.data-directory}/remm/ReMM.v${remm.version}.hg19.tsv.gz
-#exomiser.hg19.variant-white-list-path=${exomiser.hg19.data-version}_hg19_clinvar_whitelist.tsv.gz
-exomiser.hg38.variant-white-list-path=2109_hg38_clinvar_whitelist.tsv.gz
-exomiser.phenotype.data-version=2109
-logging.file.name=/jobdir/exomiser.log
diff --git a/opencga-analysis/src/test/resources/exomiser/13.1/exomiser-analysis.yml b/opencga-analysis/src/test/resources/exomiser/13.1/exomiser-analysis.yml
deleted file mode 100644
index 5ec7d93d508..00000000000
--- a/opencga-analysis/src/test/resources/exomiser/13.1/exomiser-analysis.yml
+++ /dev/null
@@ -1,70 +0,0 @@
----
-analysisMode: PASS_ONLY
-inheritanceModes: {
-  AUTOSOMAL_DOMINANT: 0.1,
-  AUTOSOMAL_RECESSIVE_HOM_ALT: 0.1,
-  AUTOSOMAL_RECESSIVE_COMP_HET: 2.0,
-  X_DOMINANT: 0.1,
-  X_RECESSIVE_HOM_ALT: 0.1,
-  X_RECESSIVE_COMP_HET: 2.0,
-  MITOCHONDRIAL: 0.2
-}
-frequencySources: [
-    THOUSAND_GENOMES,
-    TOPMED,
-    UK10K,
-
-    ESP_AFRICAN_AMERICAN, ESP_EUROPEAN_AMERICAN, ESP_ALL,
-
-    EXAC_AFRICAN_INC_AFRICAN_AMERICAN, EXAC_AMERICAN,
-    EXAC_SOUTH_ASIAN, EXAC_EAST_ASIAN,
-    EXAC_FINNISH, EXAC_NON_FINNISH_EUROPEAN,
-    EXAC_OTHER,
-
-    GNOMAD_E_AFR,
-    GNOMAD_E_AMR,
-  #        GNOMAD_E_ASJ,
-    GNOMAD_E_EAS,
-    GNOMAD_E_FIN,
-    GNOMAD_E_NFE,
-    GNOMAD_E_OTH,
-    GNOMAD_E_SAS,
-
-    GNOMAD_G_AFR,
-    GNOMAD_G_AMR,
-  #        GNOMAD_G_ASJ,
-    GNOMAD_G_EAS,
-    GNOMAD_G_FIN,
-    GNOMAD_G_NFE,
-    GNOMAD_G_OTH,
-    GNOMAD_G_SAS
-]
-# Possible pathogenicitySources: (POLYPHEN, MUTATION_TASTER, SIFT), (REVEL, MVP), CADD, REMM
-# REMM is trained on non-coding regulatory regions
-# *WARNING* if you enable CADD or REMM ensure that you have downloaded and installed the CADD/REMM tabix files
-# and updated their location in the application.properties. Exomiser will not run without this.
-pathogenicitySources: [ REVEL, MVP ]
-#this is the standard exomiser order.
-steps: [
-    failedVariantFilter: { },
-    variantEffectFilter: {
-      remove: [
-          FIVE_PRIME_UTR_EXON_VARIANT,
-          FIVE_PRIME_UTR_INTRON_VARIANT,
-          THREE_PRIME_UTR_EXON_VARIANT,
-          THREE_PRIME_UTR_INTRON_VARIANT,
-          NON_CODING_TRANSCRIPT_EXON_VARIANT,
-          NON_CODING_TRANSCRIPT_INTRON_VARIANT,
-          CODING_TRANSCRIPT_INTRON_VARIANT,
-          UPSTREAM_GENE_VARIANT,
-          DOWNSTREAM_GENE_VARIANT,
-          INTERGENIC_VARIANT,
-          REGULATORY_REGION_VARIANT
-      ]
-    },
-    frequencyFilter: { maxFrequency: 2.0 },
-    pathogenicityFilter: { keepNonPathogenic: true },
-    inheritanceFilter: { },
-    omimPrioritiser: { },
-    hiPhivePrioritiser: { }
-]
diff --git a/opencga-analysis/src/test/resources/exomiser/13.1/output.yml b/opencga-analysis/src/test/resources/exomiser/13.1/output.yml
deleted file mode 100644
index 3203c545356..00000000000
--- a/opencga-analysis/src/test/resources/exomiser/13.1/output.yml
+++ /dev/null
@@ -1,13 +0,0 @@
----
-outputContributingVariantsOnly: true
-#numGenes options: 0 = all or specify a limit e.g. 500 for the first 500 results
-numGenes: 20
-minExomiserGeneScore: 0.0
-#outputPrefix options: specify the path/filename without an extension and this will be added
-# according to the outputFormats option. If unspecified this will default to the following:
-# {exomiserDir}/results/input-vcf-name-exomiser-results.html
-# alternatively, specify a fully qualifed path only. e.g. /users/jules/exomes/analysis
-outputPrefix: /jobdir/exomiser_output
-#out-format options: HTML, JSON, TSV_GENE, TSV_VARIANT, VCF (default: HTML)
-#outputFormats: [HTML, JSON, TSV_GENE, TSV_VARIANT, VCF]
-outputFormats: [TSV_VARIANT, JSON, HTML]
diff --git a/opencga-analysis/src/test/resources/exomiser/14.0/application.properties b/opencga-analysis/src/test/resources/exomiser/14.0/application.properties
deleted file mode 100644
index d1658370370..00000000000
--- a/opencga-analysis/src/test/resources/exomiser/14.0/application.properties
+++ /dev/null
@@ -1,47 +0,0 @@
-#
-# The Exomiser - A tool to annotate and prioritize genomic variants
-#
-# Copyright (c) 2016-2021 Queen Mary University of London.
-# Copyright (c) 2012-2016 Charité Universitätsmedizin Berlin and Genome Research Ltd.
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-#
-
-## exomiser root data directory ##
-# root path where data is to be downloaded and worked on it is assumed that all the files required by exomiser listed
-# in this properties file will be found in the data directory, unless specifically overridden here.
-#exomiser.data-directory=/exomiser-data
-exomiser.data-directory=/data
-
-#remm.version=0.3.1.post1
-#cadd.version=1.4
-#exomiser.hg38.data-version=1811
-#exomiser.hg38.data-version=2109
-#exomiser.hg38.remm-path=${exomiser.data-directory}/remm/ReMM.v${remm.version}.hg38.tsv.gz
-#exomiser.hg38.variant-white-list-path=${exomiser.hg38.data-version}_hg38_clinvar_whitelist.tsv.gz
-#exomiser.phenotype.data-version=2109
-#logging.file.name=/exomiser-data/logs/exomiser.log
-
-
-#remm.version=0.3.1.post1
-#cadd.version=1.4
-#exomiser.hg19.data-version=1811
-exomiser.hg38.data-version=2402
-#exomiser.hg19.remm-path=${exomiser.data-directory}/remm/ReMM.v${remm.version}.hg19.tsv.gz
-#exomiser.hg19.variant-white-list-path=${exomiser.hg19.data-version}_hg19_clinvar_whitelist.tsv.gz
-#exomiser.hg38.variant-white-list-path=${exomiser.hg38.data-version}_hg38_clinvar_whitelist.tsv.gz
-exomiser.phenotype.data-version=2402
-exomiser.hg38.clin-var-data-version=2402
-exomiser.hg38.use-clinvar-white-list=true
-logging.file.name=/jobdir/exomiser.log
diff --git a/opencga-analysis/src/test/resources/exomiser/14.0/exomiser-analysis.yml b/opencga-analysis/src/test/resources/exomiser/14.0/exomiser-analysis.yml
deleted file mode 100644
index e3d064ba07b..00000000000
--- a/opencga-analysis/src/test/resources/exomiser/14.0/exomiser-analysis.yml
+++ /dev/null
@@ -1,85 +0,0 @@
----
-analysisMode: PASS_ONLY
-inheritanceModes: {
-  AUTOSOMAL_DOMINANT: 0.1,
-  AUTOSOMAL_RECESSIVE_COMP_HET: 2.0,
-  AUTOSOMAL_RECESSIVE_HOM_ALT: 0.1,
-  X_DOMINANT: 0.1,
-  X_RECESSIVE_COMP_HET: 2.0,
-  X_RECESSIVE_HOM_ALT: 0.1,
-  MITOCHONDRIAL: 0.2
-}
-frequencySources: [
-  UK10K,
-
-  GNOMAD_E_AFR,
-  GNOMAD_E_AMR,
-  #        GNOMAD_E_ASJ,
-  GNOMAD_E_EAS,
-  #    GNOMAD_E_FIN,
-  GNOMAD_E_NFE,
-  #    GNOMAD_E_OTH,
-  GNOMAD_E_SAS,
-
-  GNOMAD_G_AFR,
-  GNOMAD_G_AMR,
-  #        GNOMAD_G_ASJ,
-  GNOMAD_G_EAS,
-  #    GNOMAD_G_FIN,
-  GNOMAD_G_NFE,
-  #    GNOMAD_G_OTH,
-  GNOMAD_G_SAS
-]
-# Possible pathogenicitySources: (POLYPHEN, MUTATION_TASTER, SIFT), (REVEL, MVP), CADD, REMM
-# REMM is trained on non-coding regulatory regions
-# *WARNING* if you enable CADD or REMM ensure that you have downloaded and installed the CADD/REMM tabix files
-# and updated their location in the application.properties. Exomiser will not run without this.
-pathogenicitySources: [ REVEL, MVP ]
-#this is the standard exomiser order.
-#all steps are optional
-steps: [
-  #hiPhivePrioritiser: {},
-  #priorityScoreFilter: {priorityType: HIPHIVE_PRIORITY, minPriorityScore: 0.500},
-  #intervalFilter: {interval: 'chr10:123256200-123256300'},
-  # or for multiple intervals:
-  #intervalFilter: {intervals: ['chr10:123256200-123256300', 'chr10:123256290-123256350']},
-  # or using a BED file - NOTE this should be 0-based, Exomiser otherwise uses 1-based coordinates in line with VCF
-  #intervalFilter: {bed: /full/path/to/bed_file.bed},
-  #genePanelFilter: {geneSymbols: ['FGFR1','FGFR2']},
-  #geneBlacklistFilter: { },
-    failedVariantFilter: { },
-  #qualityFilter: {minQuality: 50.0},
-    variantEffectFilter: {
-      remove: [
-          FIVE_PRIME_UTR_EXON_VARIANT,
-          FIVE_PRIME_UTR_INTRON_VARIANT,
-          THREE_PRIME_UTR_EXON_VARIANT,
-          THREE_PRIME_UTR_INTRON_VARIANT,
-          NON_CODING_TRANSCRIPT_EXON_VARIANT,
-          UPSTREAM_GENE_VARIANT,
-          INTERGENIC_VARIANT,
-      REGULATORY_REGION_VARIANT,
-      CODING_TRANSCRIPT_INTRON_VARIANT,
-      NON_CODING_TRANSCRIPT_INTRON_VARIANT,
-      DOWNSTREAM_GENE_VARIANT
-    ]
-  },
-  # removes variants represented in the database
-  #knownVariantFilter: {},
-  frequencyFilter: {maxFrequency: 2.0},
-  pathogenicityFilter: {keepNonPathogenic: true},
-  # inheritanceFilter and omimPrioritiser should always run AFTER all other filters have completed
-  # they will analyse genes according to the specified modeOfInheritance above- UNDEFINED will not be analysed.
-  inheritanceFilter: {},
-  # omimPrioritiser isn't mandatory.
-  omimPrioritiser: {},
-  #priorityScoreFilter: {minPriorityScore: 0.4},
-  # Other prioritisers: Only combine omimPrioritiser with one of these.
-  # Don't include any if you only want to filter the variants.
-  hiPhivePrioritiser: {},
-  # or run hiPhive in benchmarking mode:
-  #hiPhivePrioritiser: {runParams: 'mouse'},
-  #phivePrioritiser: {}
-  #phenixPrioritiser: {}
-  #exomeWalkerPrioritiser: {seedGeneIds: [11111, 22222, 33333]}
-]
diff --git a/opencga-analysis/src/test/resources/exomiser/14.0/output.yml b/opencga-analysis/src/test/resources/exomiser/14.0/output.yml
deleted file mode 100644
index 695255a573b..00000000000
--- a/opencga-analysis/src/test/resources/exomiser/14.0/output.yml
+++ /dev/null
@@ -1,11 +0,0 @@
----
-outputContributingVariantsOnly: true
-#numGenes options: 0 = all or specify a limit e.g. 500 for the first 500 results
-numGenes: 20
-minExomiserGeneScore: 0.0
-# Path to the desired output directory. Will default to the 'results' subdirectory of the exomiser install directory
-outputDirectory: /jobdir/
-# Filename for the output files. Will default to {input-vcf-filename}-exomiser
-outputFileName: exomiser_output
-#out-format options: HTML, JSON, TSV_GENE, TSV_VARIANT, VCF (default: HTML)
-outputFormats: [TSV_VARIANT, JSON, HTML]
diff --git a/opencga-app/src/test/java/org/opencb/opencga/app/migrations/MigrationsTest.java b/opencga-app/src/test/java/org/opencb/opencga/app/migrations/MigrationsTest.java
index 6d72b9149f5..57ee782a7cc 100644
--- a/opencga-app/src/test/java/org/opencb/opencga/app/migrations/MigrationsTest.java
+++ b/opencga-app/src/test/java/org/opencb/opencga/app/migrations/MigrationsTest.java
@@ -8,7 +8,7 @@
 import org.opencb.commons.datastore.core.Query;
 import org.opencb.commons.datastore.core.QueryOptions;
 import org.opencb.opencga.analysis.variant.OpenCGATestExternalResource;
-import org.opencb.opencga.app.migrations.v3_2_0.VariantSetupMigration;
+import org.opencb.opencga.app.migrations.v3.v3_2_0.VariantSetupMigration;
 import org.opencb.opencga.catalog.exceptions.CatalogException;
 import org.opencb.opencga.catalog.migration.Migration;
 import org.opencb.opencga.catalog.migration.MigrationTool;
@@ -32,6 +32,7 @@ public void testVariantSetupMigration() throws Exception {
         String studyName = "test@1000G:phase1";
 
         VariantStorageMetadataManager metadataManager = opencga.getVariantStorageEngineByProject("test@1000G").getMetadataManager();
+        metadataManager.getAndUpdateProjectMetadata(new ObjectMap());
         StudyMetadata studyMetadata = metadataManager.createStudy(studyName);
         int fileId = metadataManager.registerFile(studyMetadata.getId(), "folder/file.vcf", Arrays.asList("s1", "s2"));
         metadataManager.addIndexedFiles(studyMetadata.getId(), Collections.singletonList(fileId));
diff --git a/opencga-storage/opencga-storage-core/src/test/java/org/opencb/opencga/storage/core/variant/VariantStorageEngineBNDTest.java b/opencga-storage/opencga-storage-core/src/test/java/org/opencb/opencga/storage/core/variant/VariantStorageEngineBNDTest.java
index a675e5304b0..19c23958e47 100644
--- a/opencga-storage/opencga-storage-core/src/test/java/org/opencb/opencga/storage/core/variant/VariantStorageEngineBNDTest.java
+++ b/opencga-storage/opencga-storage-core/src/test/java/org/opencb/opencga/storage/core/variant/VariantStorageEngineBNDTest.java
@@ -61,7 +61,9 @@ protected void loadFiles() throws Exception {
         variantStorageEngine.getConfiguration().getCellbase().setUrl(ParamConstants.CELLBASE_URL);
         variantStorageEngine.getConfiguration().getCellbase().setVersion(ParamConstants.CELLBASE_VERSION);
         variantStorageEngine.getConfiguration().getCellbase().setDataRelease(ParamConstants.CELLBASE_DATA_RELEASE_GRCH38);
+        variantStorageEngine.getOptions().put(VariantStorageOptions.NORMALIZATION_EXTENSIONS.key(), ParamConstants.NONE);
         variantStorageEngine.getOptions().put(VariantStorageOptions.ASSEMBLY.key(), "grch38");
+
         studyMetadata = new StudyMetadata(1, "s1");
 //        variantStorageEngine.getOptions().append(VariantStorageOptions.ANNOTATOR_CELLBASE_EXCLUDE.key(), "expression,clinical");
         input1 = getResourceUri("variant-test-bnd.vcf");
diff --git a/opencga-storage/opencga-storage-core/src/test/java/org/opencb/opencga/storage/core/variant/VariantStorageEngineSVTest.java b/opencga-storage/opencga-storage-core/src/test/java/org/opencb/opencga/storage/core/variant/VariantStorageEngineSVTest.java
index 2523fad5ba2..404411d09ce 100644
--- a/opencga-storage/opencga-storage-core/src/test/java/org/opencb/opencga/storage/core/variant/VariantStorageEngineSVTest.java
+++ b/opencga-storage/opencga-storage-core/src/test/java/org/opencb/opencga/storage/core/variant/VariantStorageEngineSVTest.java
@@ -8,7 +8,6 @@
 import org.opencb.biodata.models.variant.StudyEntry;
 import org.opencb.biodata.models.variant.Variant;
 import org.opencb.biodata.models.variant.avro.SampleEntry;
-import org.opencb.biodata.models.variant.avro.VariantType;
 import org.opencb.biodata.models.variant.exceptions.NonStandardCompliantSampleField;
 import org.opencb.biodata.tools.variant.VariantNormalizer;
 import org.opencb.commons.datastore.core.Query;
@@ -63,6 +62,7 @@ public void before() throws Exception {
         variantStorageEngine.getConfiguration().getCellbase().setVersion(ParamConstants.CELLBASE_VERSION);
         variantStorageEngine.getConfiguration().getCellbase().setDataRelease(ParamConstants.CELLBASE_DATA_RELEASE_GRCH38);
         variantStorageEngine.getOptions().put(VariantStorageOptions.ASSEMBLY.key(), "grch38");
+        variantStorageEngine.getOptions().put(VariantStorageOptions.NORMALIZATION_EXTENSIONS.key(), ParamConstants.NONE);
         variantStorageEngine.reloadCellbaseConfiguration();
 
         if (!loaded) {
@@ -72,9 +72,9 @@ public void before() throws Exception {
     }
 
     protected void loadFiles() throws Exception {
+
         input1 = getResourceUri("variant-test-sv.vcf");
         studyMetadata = new StudyMetadata(1, "s1");
-        variantStorageEngine.getOptions().append(VariantStorageOptions.ANNOTATOR_CELLBASE_EXCLUDE.key(), "expression,clinical");
         pipelineResult1 = runDefaultETL(input1, variantStorageEngine, studyMetadata, new QueryOptions()
                 .append(VariantStorageOptions.ANNOTATE.key(), true)
                 .append(VariantStorageOptions.STATS_CALCULATE.key(), true)
@@ -169,12 +169,7 @@ protected void checkCorrectness(URI file) throws StorageEngineException, NonStan
             actualStudyEntry.getFiles().get(0).setFileId("");
             assertEquals(expectedStudyEntry.getFiles().get(0), actualStudyEntry.getFiles().get(0));
 
-
-            if (actual.getAlternate().equals("<DEL:ME:ALU>") || actual.getType().equals(VariantType.BREAKEND)) {
-                System.err.println("WARN: Variant " + actual + (actual.getAnnotation() == null ? " without annotation" : " with annotation"));
-            } else {
-                assertNotNull(actual.toString(), actual.getAnnotation());
-            }
+            assertNotNull(actual.toString(), actual.getAnnotation());
         }
     }
 
diff --git a/opencga-storage/opencga-storage-core/src/test/java/org/opencb/opencga/storage/core/variant/adaptors/VariantDBAdaptorMultiFileTest.java b/opencga-storage/opencga-storage-core/src/test/java/org/opencb/opencga/storage/core/variant/adaptors/VariantDBAdaptorMultiFileTest.java
index 8071b86a14e..ee382b95557 100644
--- a/opencga-storage/opencga-storage-core/src/test/java/org/opencb/opencga/storage/core/variant/adaptors/VariantDBAdaptorMultiFileTest.java
+++ b/opencga-storage/opencga-storage-core/src/test/java/org/opencb/opencga/storage/core/variant/adaptors/VariantDBAdaptorMultiFileTest.java
@@ -10,6 +10,7 @@
 import org.opencb.biodata.models.variant.avro.SampleEntry;
 import org.opencb.biodata.models.variant.stats.VariantStats;
 import org.opencb.commons.datastore.core.*;
+import org.opencb.opencga.core.api.ParamConstants;
 import org.opencb.opencga.storage.core.variant.query.ParsedVariantQuery;
 import org.opencb.opencga.storage.core.variant.query.VariantQueryResult;
 import org.opencb.opencga.storage.core.exceptions.StorageEngineException;
@@ -78,6 +79,7 @@ protected void load() throws Exception {
         VariantStorageEngine storageEngine = getVariantStorageEngine();
         ObjectMap options = getOptions();
         options.put(VariantStorageOptions.STATS_CALCULATE.key(), true);
+        options.put(VariantStorageOptions.NORMALIZATION_EXTENSIONS.key(), ParamConstants.NONE);
 
         int maxStudies = 2;
         int studyId = 1;
diff --git a/opencga-storage/opencga-storage-core/src/test/java/org/opencb/opencga/storage/core/variant/adaptors/VariantQueryUsingSearchIndexTest.java b/opencga-storage/opencga-storage-core/src/test/java/org/opencb/opencga/storage/core/variant/adaptors/VariantQueryUsingSearchIndexTest.java
index 6194d25c6d8..cdc96e15377 100644
--- a/opencga-storage/opencga-storage-core/src/test/java/org/opencb/opencga/storage/core/variant/adaptors/VariantQueryUsingSearchIndexTest.java
+++ b/opencga-storage/opencga-storage-core/src/test/java/org/opencb/opencga/storage/core/variant/adaptors/VariantQueryUsingSearchIndexTest.java
@@ -2,16 +2,22 @@
 
 import com.google.common.base.Throwables;
 import org.junit.ClassRule;
+import org.junit.Test;
 import org.opencb.biodata.models.variant.Variant;
 import org.opencb.commons.datastore.core.DataResult;
 import org.opencb.commons.datastore.core.Query;
 import org.opencb.commons.datastore.core.QueryOptions;
-import org.opencb.opencga.storage.core.variant.query.VariantQueryResult;
 import org.opencb.opencga.storage.core.variant.VariantStorageEngine;
 import org.opencb.opencga.storage.core.variant.adaptors.iterators.VariantDBIterator;
+import org.opencb.opencga.storage.core.variant.query.VariantQueryResult;
 import org.opencb.opencga.storage.core.variant.search.solr.VariantSearchManager;
 import org.opencb.opencga.storage.core.variant.solr.VariantSolrExternalResource;
 
+import static org.hamcrest.CoreMatchers.containsString;
+import static org.hamcrest.CoreMatchers.not;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.opencb.opencga.storage.core.variant.search.solr.VariantSearchManager.SEARCH_ENGINE_ID;
+
 /**
  * Created on 22/12/17.
  *
@@ -87,4 +93,32 @@ public DataResult rank(int limit, Query query, String field, boolean asc) {
             throw Throwables.propagate(e);
         }
     }
+
+    @Test
+    public void testQueryExecutor() {
+        assertThat(variantStorageEngine.get(new VariantQuery(), new QueryOptions()
+                        .append(QueryOptions.LIMIT, 10)
+                        .append(QueryOptions.COUNT, false)
+                        .append(QueryOptions.SKIP, 0)).getSource(),
+                not(containsString(SEARCH_ENGINE_ID)));
+
+        assertThat(variantStorageEngine.get(new VariantQuery(), new QueryOptions()
+                        .append(QueryOptions.LIMIT, 10)
+                        .append(QueryOptions.COUNT, true)
+                        .append(QueryOptions.SKIP, 0)).getSource(),
+                containsString(SEARCH_ENGINE_ID));
+
+        assertThat(variantStorageEngine.get(new VariantQuery(), new QueryOptions()
+                        .append(QueryOptions.LIMIT, 10)
+                        .append(QueryOptions.COUNT, false)
+                        .append(QueryOptions.SKIP, 100)).getSource(),
+                not(containsString(SEARCH_ENGINE_ID)));
+
+        assertThat(variantStorageEngine.get(new VariantQuery(), new QueryOptions()
+                        .append(QueryOptions.LIMIT, 10)
+                        .append(QueryOptions.COUNT, false)
+                        .append(QueryOptions.SKIP, 1000)).getSource(),
+                containsString(SEARCH_ENGINE_ID));
+
+    }
 }
diff --git a/opencga-storage/opencga-storage-core/src/test/resources/variant-test-sv.vcf b/opencga-storage/opencga-storage-core/src/test/resources/variant-test-sv.vcf
index 9fc4fe9c325..6c1d32cf79a 100644
--- a/opencga-storage/opencga-storage-core/src/test/resources/variant-test-sv.vcf
+++ b/opencga-storage/opencga-storage-core/src/test/resources/variant-test-sv.vcf
@@ -44,7 +44,7 @@
 1	600000	.	T	<DEL>	.	PASS	SVTYPE=DEL;END=600250;SVLEN=-205;CIPOS=-56,20;CIEND=-10,62	GT	0/1	0/1
 1	650000	.	C	<CN0>	.	PASS	SVTYPE=DEL;END=650100;CIEND=0,48;CIPOS=-49,0	GT	0/1	0/1
 1	700000	.	C	<DEL:ME:ALU>	.	PASS	SVTYPE=DEL;END=700297;SVLEN=-297;CIPOS=-22,18;CIEND=-12,32	GT	0/1	0/1
-1	800000	.	A	<INS>	.	PASS	SVTYPE=INS;END=800000;SVLEN=6027;CIPOS=-16,22;RIGHT_SVINSSEQ=ACCACACCCACACAACACACA;LEFT_SVINSSEQ=TGTGGTGTGTGTGGTGTG	GT	0/1	0/1
+1	800000	.	A	<INS>	.	PASS	SVTYPE=INS;END=800000;SVLEN=6027;CIPOS=-16,22;CIEND=-16,22;RIGHT_SVINSSEQ=ACCACACCCACACAACACACA;LEFT_SVINSSEQ=TGTGGTGTGTGTGGTGTG	GT	0/1	0/1
 1	850000	.	A	<INS>	.	PASS	SVTYPE=INS;END=850000;SVINSSEQ=ACCACACCCACACAACACACAACCACACCCACACAACACACAACCACACCCACACAACACACAACCACACCCACACAACACACAACCACACCCACACAACACACAACCACACCCACACAACACACAACCACACCCACACAACACACAACCACACCCACACAACACACAACCACACCCACACAACACACAACCACACCCACACAACACACAACCACACCCACACAACACACA	GT	0/1	0/1
 1	860000	.	A	<INV>	.	PASS	SVTYPE=INVERSION;END=870000	GT	0/1	0/1
 1	900000	.	G	<INS>	.	PASS	SVTYPE=INS;END=900000;SVLEN=6027;CIPOS=-16,22	GT	0/1	0/1
diff --git a/opencga-storage/opencga-storage-core/src/test/resources/variant-test-sv_2.vcf b/opencga-storage/opencga-storage-core/src/test/resources/variant-test-sv_2.vcf
index 32ad6f4c4f0..0cfa097d85f 100644
--- a/opencga-storage/opencga-storage-core/src/test/resources/variant-test-sv_2.vcf
+++ b/opencga-storage/opencga-storage-core/src/test/resources/variant-test-sv_2.vcf
@@ -56,4 +56,4 @@
 1	1500000	.	C	<CN4>,<CN5>,<CN7>	.	PASS	SVTYPE=CNV;CIEND=-150,150;CIPOS=-150,150;END=1504000	GT	0/1	2/3
 1	1600000	.	T	G	.	PASS	.	GT	0/1	0/1
 2	100001	BND_V	T	]chr13:300000]T	.	PASS	SVTYPE=BND	GT	0/1	0/1
-13	300000	BND_U	C	C[chr2:100001[	.	PASS	SVTYPE=BND;CIPOS=-150,0	GT	0/1	0/1
\ No newline at end of file
+13	300000	BND_U	C	C[chr2:100001[	.	PASS	SVTYPE=BND;CIPOS=-150,0;CIEND=-150,0	GT	0/1	0/1
\ No newline at end of file
diff --git a/opencga-storage/opencga-storage-hadoop/opencga-storage-hadoop-core/src/test/java/org/opencb/opencga/storage/hadoop/variant/adaptors/phoenix/VariantPhoenixKeyFactoryTest.java b/opencga-storage/opencga-storage-hadoop/opencga-storage-hadoop-core/src/test/java/org/opencb/opencga/storage/hadoop/variant/adaptors/phoenix/VariantPhoenixKeyFactoryTest.java
index 05b6d81a5b3..5f514f7483c 100644
--- a/opencga-storage/opencga-storage-hadoop/opencga-storage-hadoop-core/src/test/java/org/opencb/opencga/storage/hadoop/variant/adaptors/phoenix/VariantPhoenixKeyFactoryTest.java
+++ b/opencga-storage/opencga-storage-hadoop/opencga-storage-hadoop-core/src/test/java/org/opencb/opencga/storage/hadoop/variant/adaptors/phoenix/VariantPhoenixKeyFactoryTest.java
@@ -129,7 +129,7 @@ public byte[] generateVariantRowKeyPhoenix(Variant variant) {
 
         ImmutableBytesWritable key = new ImmutableBytesWritable();
         String reference = variant.getReference();
-        String alternate = VariantPhoenixKeyFactory.buildSymbolicAlternate(reference, variant.getAlternate(), variant.getEnd(), variant.getSv());
+        String alternate = VariantPhoenixKeyFactory.buildSymbolicAlternate(variant);
         table.newKey(key, new byte[][]{
                 Bytes.toBytes(variant.getChromosome()),
                 Bytes.toBytes(variant.getStart()),
diff --git a/opencga-storage/opencga-storage-hadoop/opencga-storage-hadoop-core/src/test/java/org/opencb/opencga/storage/hadoop/variant/archive/mr/VariantLocalConflictResolverTest.java b/opencga-storage/opencga-storage-hadoop/opencga-storage-hadoop-core/src/test/java/org/opencb/opencga/storage/hadoop/variant/archive/mr/VariantLocalConflictResolverTest.java
index f716adb0110..c1dc22a6bb4 100644
--- a/opencga-storage/opencga-storage-hadoop/opencga-storage-hadoop-core/src/test/java/org/opencb/opencga/storage/hadoop/variant/archive/mr/VariantLocalConflictResolverTest.java
+++ b/opencga-storage/opencga-storage-hadoop/opencga-storage-hadoop-core/src/test/java/org/opencb/opencga/storage/hadoop/variant/archive/mr/VariantLocalConflictResolverTest.java
@@ -169,7 +169,7 @@ public void resolveConflictIndelCase1() throws Exception {
         se.setSampleDataKeys(Arrays.asList(GENOTYPE_KEY, GENOTYPE_FILTER_KEY));
         se.setSamplesPosition(asMap("S1", 0));
         se.addSampleData("S1", Arrays.asList("1/2", "LowGQXHetDel"));
-        se.getSecondaryAlternates().add(new AlternateCoordinate(null, null, 328, "CTT", "CTTTC", INDEL));
+        se.getSecondaryAlternates().add(new AlternateCoordinate(null, 328, null, "CTT", "CTTTC", INDEL));
         addAttribute(v1, FILTER, "LowGQXHetDel");