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

TASK-6703 - Fix junit tests #2493

Merged
merged 4 commits into from
Aug 8, 2024
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
import org.opencb.opencga.core.response.OpenCGAResult;
import org.opencb.opencga.core.testclassification.duration.MediumTests;
import org.opencb.opencga.core.tools.result.ExecutionResult;
import org.opencb.opencga.storage.core.variant.adaptors.VariantQuery;
import org.opencb.opencga.storage.core.variant.adaptors.VariantQueryParam;

import java.io.File;
Expand Down Expand Up @@ -140,8 +141,11 @@ public void customAnalysisFromClinicalAnalysisTest() throws Exception {
.setConfig(config);

ExecutionResult result = customAnalysis.start();

checkInterpretation(238, result);
int expected = opencga.getVariantStorageManager().get(new VariantQuery(query),
new QueryOptions(QueryOptions.LIMIT, 500), clinicalTest.token)
.getResults().size();
assertNotEquals(0, expected);
checkInterpretation(expected, result);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -515,13 +515,20 @@ public void testCellbaseConfigure() throws Exception {
assertEquals("GRCh38", cellBaseUtils.getAssembly());

String newCellbase = "https://uk.ws.zettagenomics.com/cellbase/";
String newCellbaseVersion = "v5.8";
String newCellbaseVersion = "v5.2";
String newCellbaseDataRelease = "1";

assertNotEquals(newCellbase, cellBaseUtils.getURL());
assertNotEquals(newCellbaseVersion, cellBaseUtils.getVersion());
assertNotEquals(newCellbaseDataRelease, cellBaseUtils.getDataRelease());

variantStorageManager.setCellbaseConfiguration(project, new CellBaseConfiguration(newCellbase, newCellbaseVersion, "1", ""), false, null, token);
variantStorageManager.setCellbaseConfiguration(project, new CellBaseConfiguration(newCellbase, newCellbaseVersion, newCellbaseDataRelease, ""), false, null, token);
CellBaseConfiguration cellbaseConfiguration = catalogManager.getProjectManager().get(project, new QueryOptions(), token).first().getCellbase();

assertEquals(newCellbase, cellbaseConfiguration.getUrl());
assertEquals(newCellbaseVersion, cellbaseConfiguration.getVersion());
assertEquals(newCellbaseDataRelease, cellbaseConfiguration.getDataRelease());

// assertTrue(family.getPedigreeGraph() != null);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -319,9 +319,13 @@ private void validateProjectForCreation(Project project, User user) throws Catal
throw new CatalogParameterException("Missing mandatory organism information");
}
try {
//TODO: Should the datarelease be undefined? When undefined, it'd be read from cellbase meta endpoints.
String defaultDataRelease = project.getOrganism().getAssembly().equalsIgnoreCase("grch38")
? ParamConstants.CELLBASE_DATA_RELEASE_GRCH38
: null;
CellBaseConfiguration cellBaseConfiguration = ParamUtils.defaultObject(project.getCellbase(),
new CellBaseConfiguration(ParamConstants.CELLBASE_URL, ParamConstants.CELLBASE_VERSION,
ParamConstants.CELLBASE_DATA_RELEASE, ParamConstants.CELLBASE_APIKEY));
defaultDataRelease, ParamConstants.CELLBASE_APIKEY));
cellBaseConfiguration = CellBaseValidator.validate(cellBaseConfiguration,
project.getOrganism().getScientificName(),
project.getOrganism().getAssembly(), true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,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 = "7";
public static final String CELLBASE_DATA_RELEASE_GRCH38 = "7";
public static final String CELLBASE_APIKEY = null;

public static final String POP_FREQ_1000G_CB_V4 = "1kG_phase3";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ private CellBaseConfiguration validate(boolean autoComplete) throws IOException
logger.warn("DataRelease not supported on version '" + serverVersion + ".x'");
} else {
String dataRelease = getDataRelease();
if (dataRelease == null) {
if (StringUtils.isEmpty(dataRelease)) {
if (autoComplete) {
cellBaseConfiguration.setDataRelease(getDefaultDataRelease());
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public class CellBaseConfiguration {
private String apiKey;

public CellBaseConfiguration() {
this(ParamConstants.CELLBASE_URL, ParamConstants.CELLBASE_VERSION, ParamConstants.CELLBASE_DATA_RELEASE,
this(ParamConstants.CELLBASE_URL, ParamConstants.CELLBASE_VERSION, ParamConstants.CELLBASE_DATA_RELEASE_GRCH38,
ParamConstants.CELLBASE_APIKEY);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public abstract class VariantStorageEngineBNDTest extends VariantStorageBaseTest
public void before() throws Exception {
variantStorageEngine.getConfiguration().getCellbase().setUrl(ParamConstants.CELLBASE_URL);
variantStorageEngine.getConfiguration().getCellbase().setVersion(ParamConstants.CELLBASE_VERSION);
variantStorageEngine.getConfiguration().getCellbase().setDataRelease(ParamConstants.CELLBASE_DATA_RELEASE);
variantStorageEngine.getConfiguration().getCellbase().setDataRelease(ParamConstants.CELLBASE_DATA_RELEASE_GRCH38);
if (!loaded) {
clearDB(DB_NAME);
loadFiles();
Expand All @@ -58,7 +58,7 @@ public void before() throws Exception {
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);
variantStorageEngine.getConfiguration().getCellbase().setDataRelease(ParamConstants.CELLBASE_DATA_RELEASE_GRCH38);
studyMetadata = new StudyMetadata(1, "s1");
// variantStorageEngine.getOptions().append(VariantStorageOptions.ANNOTATOR_CELLBASE_EXCLUDE.key(), "expression,clinical");
input1 = getResourceUri("variant-test-bnd.vcf");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public void before() throws Exception {
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);
variantStorageEngine.getConfiguration().getCellbase().setDataRelease(ParamConstants.CELLBASE_DATA_RELEASE_GRCH38);
variantStorageEngine.getOptions().put(VariantStorageOptions.ASSEMBLY.key(), "grch38");
variantStorageEngine.reloadCellbaseConfiguration();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public void before() throws Exception {
VariantStorageEngine variantStorageEngine = getVariantStorageEngine();
variantStorageEngine.getConfiguration().getCellbase().setUrl(ParamConstants.CELLBASE_URL);
variantStorageEngine.getConfiguration().getCellbase().setVersion(ParamConstants.CELLBASE_VERSION);
variantStorageEngine.getConfiguration().getCellbase().setDataRelease(ParamConstants.CELLBASE_DATA_RELEASE);
variantStorageEngine.getConfiguration().getCellbase().setDataRelease(ParamConstants.CELLBASE_DATA_RELEASE_GRCH38);
dbAdaptor = variantStorageEngine.getDBAdaptor();
if (!loaded) {
loadFile();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,8 @@ public void testXRefRs() throws StorageEngineException {
with("ConsequenceType", VariantAnnotation::getConsequenceTypes, hasItem(
with("GeneName", ConsequenceType::getGeneName,
is("TEX13B"))))));
matchers.put("COSV60260399", hasAnnotation(with("TraitAssociation", VariantAnnotation::getTraitAssociation, hasItem(
with("Cosmic", EvidenceEntry::getId, is("COSV60260399"))))));
matchers.put("RCV000155534", hasAnnotation(with("TraitAssociation", VariantAnnotation::getTraitAssociation, hasItem(
with("Clinvar", EvidenceEntry::getId, is("RCV000155534"))))));
matchers.put("ENST00000341832.11(ENSG00000248333):c.356-1170A>G", hasAnnotation(with("HGVS", VariantAnnotation::getHgvs, hasItem(
is("ENST00000341832.11(ENSG00000248333):c.356-1170A>G")))));
matchers.put("ENST00000341832.11:c.356-1170A>G", hasAnnotation(with("HGVS", VariantAnnotation::getHgvs, hasItem(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");


Expand Down
Loading