Skip to content

Commit

Permalink
storage: Fix compilation issues #TASK-6765
Browse files Browse the repository at this point in the history
  • Loading branch information
j-coll committed Sep 20, 2024
1 parent 7529652 commit 1f92650
Show file tree
Hide file tree
Showing 13 changed files with 43 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import java.util.List;

@Migration(id = "ensure_sample_index_configuration_is_defined",
description = "Ensure that the SampleIndexConfiguration object is correctly defined. #TASK-6765", version = "3.4.0",
description = "Ensure that the SampleIndexConfiguration object is correctly defined. #TASK-6765", version = "4.0.0",
language = Migration.MigrationLanguage.JAVA,
domain = Migration.MigrationDomain.STORAGE,
patch = 1,
Expand Down
2 changes: 0 additions & 2 deletions opencga-client/src/main/R/R/Clinical-methods.R
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@
#' | queryRgaVariant | /{apiVersion}/analysis/clinical/rga/variant/query | include, exclude, limit, skip, count, includeIndividual, skipIndividual, limitIndividual, sampleId, individualId, sex, phenotypes, disorders, numParents, geneId, geneName, chromosome, start, end, transcriptId, variants, dbSnps, knockoutType, filter, type, clinicalSignificance, populationFrequency, consequenceType, study |
#' | summaryRgaVariant | /{apiVersion}/analysis/clinical/rga/variant/summary | limit, skip, count, sampleId, individualId, sex, phenotypes, disorders, numParents, geneId, geneName, chromosome, start, end, transcriptId, variants, dbSnps, knockoutType, filter, type, clinicalSignificance, populationFrequency, consequenceType, study |
#' | search | /{apiVersion}/analysis/clinical/search | include, exclude, limit, skip, count, flattenAnnotations, study, id, uuid, type, disorder, files, sample, individual, proband, probandSamples, family, familyMembers, familyMemberSamples, panels, locked, analystId, priority, flags, creationDate, modificationDate, dueDate, qualityControlSummary, release, status, internalStatus, annotation, deleted |
#' | queryVariant | /{apiVersion}/analysis/clinical/variant/query | include, exclude, limit, skip, count, approximateCount, approximateCountSamplingSize, savedFilter, includeInterpretation, id, region, type, study, file, filter, qual, fileData, sample, sampleData, sampleAnnotation, cohort, cohortStatsRef, cohortStatsAlt, cohortStatsMaf, cohortStatsMgf, cohortStatsPass, missingAlleles, missingGenotypes, score, family, familyDisorder, familySegregation, familyMembers, familyProband, gene, ct, xref, biotype, proteinSubstitution, conservation, populationFrequencyAlt, populationFrequencyRef, populationFrequencyMaf, transcriptFlag, geneTraitId, go, expression, proteinKeyword, drug, functionalScore, clinical, clinicalSignificance, clinicalConfirmedStatus, customAnnotation, panel, panelModeOfInheritance, panelConfidence, panelRoleInCancer, panelFeatureType, panelIntersection, trait |
#' | search | /{apiVersion}/analysis/clinical/search | include, exclude, limit, skip, count, flattenAnnotations, study, id, uuid, type, disorder, files, sample, individual, proband, probandSamples, family, familyMembers, familyMemberSamples, panels, locked, analystId, priority, flags, creationDate, modificationDate, dueDate, qualityControlSummary, release, snapshot, status, internalStatus, annotation, deleted |
#' | queryVariant | /{apiVersion}/analysis/clinical/variant/query | include, exclude, limit, skip, count, approximateCount, approximateCountSamplingSize, savedFilter, includeInterpretation, id, region, type, study, file, filter, qual, fileData, sample, sampleData, sampleAnnotation, cohort, cohortStatsRef, cohortStatsAlt, cohortStatsMaf, cohortStatsMgf, cohortStatsPass, missingAlleles, missingGenotypes, score, family, familyDisorder, familySegregation, familyMembers, familyProband, gene, ct, xref, biotype, proteinSubstitution, conservation, populationFrequencyAlt, populationFrequencyRef, populationFrequencyMaf, transcriptFlag, geneTraitId, go, expression, proteinKeyword, drug, functionalScore, clinical, clinicalSignificance, clinicalConfirmedStatus, customAnnotation, panel, panelModeOfInheritance, panelConfidence, panelRoleInCancer, panelFeatureType, panelIntersection, source, trait |
#' | acl | /{apiVersion}/analysis/clinical/{clinicalAnalyses}/acl | clinicalAnalyses[*], study, member, silent |
#' | delete | /{apiVersion}/analysis/clinical/{clinicalAnalyses}/delete | study, force, clinicalAnalyses[*] |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import org.opencb.commons.datastore.core.QueryParam;
import org.opencb.opencga.storage.core.exceptions.StorageEngineException;
import org.opencb.opencga.storage.core.variant.adaptors.VariantDBAdaptor;
import org.opencb.opencga.storage.core.variant.adaptors.VariantQuery;
import org.opencb.opencga.storage.core.variant.adaptors.VariantQueryException;
import org.opencb.opencga.storage.core.variant.adaptors.VariantQueryParam;
import org.opencb.opencga.storage.core.variant.adaptors.iterators.VariantDBIterator;
Expand All @@ -40,7 +41,8 @@ public BreakendVariantQueryExecutor(String storageEngineId, ObjectMap options,
}

@Override
public boolean canUseThisExecutor(Query query, QueryOptions options) throws StorageEngineException {
public boolean canUseThisExecutor(ParsedVariantQuery variantQuery, QueryOptions options) throws StorageEngineException {
VariantQuery query = variantQuery.getQuery();
return query.getString(VariantQueryParam.TYPE.key()).equals(VariantType.BREAKEND.name())
&& VariantQueryUtils.isValidParam(query, VariantQueryParam.GENOTYPE);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@
import org.opencb.opencga.storage.core.metadata.models.SampleMetadata;
import org.opencb.opencga.storage.core.metadata.models.Trio;
import org.opencb.opencga.storage.core.variant.VariantStorageOptions;
import org.opencb.opencga.storage.core.variant.adaptors.VariantField;
import org.opencb.opencga.storage.core.variant.adaptors.VariantIterable;
import org.opencb.opencga.storage.core.variant.adaptors.VariantQueryException;
import org.opencb.opencga.storage.core.variant.adaptors.VariantQueryParam;
import org.opencb.opencga.storage.core.variant.adaptors.*;
import org.opencb.opencga.storage.core.variant.adaptors.iterators.UnionMultiVariantKeyIterator;
import org.opencb.opencga.storage.core.variant.adaptors.iterators.VariantDBIterator;
import org.opencb.opencga.storage.core.variant.adaptors.iterators.VariantDBIteratorWithCounts;
Expand Down Expand Up @@ -64,8 +61,8 @@ public CompoundHeterozygousQueryExecutor(VariantStorageMetadataManager metadataM
}

@Override
public boolean canUseThisExecutor(Query query, QueryOptions options) throws StorageEngineException {
return isValidParam(query, VariantQueryUtils.SAMPLE_COMPOUND_HETEROZYGOUS);
public boolean canUseThisExecutor(ParsedVariantQuery variantQuery, QueryOptions options) throws StorageEngineException {
return isValidParam(variantQuery.getQuery(), VariantQueryUtils.SAMPLE_COMPOUND_HETEROZYGOUS);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
package org.opencb.opencga.storage.core.variant.query.executors;

import org.opencb.biodata.models.variant.Variant;
import org.opencb.commons.datastore.core.*;
import org.opencb.commons.datastore.core.ObjectMap;
import org.opencb.commons.datastore.core.QueryOptions;
import org.opencb.commons.datastore.core.QueryParam;
import org.opencb.opencga.storage.core.exceptions.StorageEngineException;
import org.opencb.opencga.storage.core.variant.query.ParsedVariantQuery;
import org.opencb.opencga.storage.core.variant.query.VariantQueryResult;
import org.opencb.opencga.storage.core.variant.adaptors.VariantDBAdaptor;
import org.opencb.opencga.storage.core.variant.adaptors.VariantQueryParam;
import org.opencb.opencga.storage.core.variant.query.ParsedVariantQuery;
import org.opencb.opencga.storage.core.variant.query.VariantQueryResult;
import org.opencb.opencga.storage.core.variant.query.VariantQueryUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -52,9 +54,9 @@ protected Object getOrIterator(ParsedVariantQuery variantQuery, boolean iterator
}

@Override
public boolean canUseThisExecutor(Query query, QueryOptions options) {
public boolean canUseThisExecutor(ParsedVariantQuery variantQuery, QueryOptions options) throws StorageEngineException {
for (QueryParam unsupportedParam : UNSUPPORTED_PARAMS) {
if (VariantQueryUtils.isValidParam(query, unsupportedParam)) {
if (VariantQueryUtils.isValidParam(variantQuery.getQuery(), unsupportedParam)) {
logger.warn("Unsupported variant query param {} in {}",
unsupportedParam.key(),
DBAdaptorVariantQueryExecutor.class.getSimpleName());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import org.opencb.opencga.storage.core.metadata.models.CohortMetadata;
import org.opencb.opencga.storage.core.metadata.models.StudyMetadata;
import org.opencb.opencga.storage.core.variant.adaptors.GenotypeClass;
import org.opencb.opencga.storage.core.variant.adaptors.VariantQuery;
import org.opencb.opencga.storage.core.variant.adaptors.VariantQueryParam;
import org.opencb.opencga.storage.core.variant.adaptors.iterators.VariantDBIterator;
import org.opencb.opencga.storage.core.variant.query.*;
Expand All @@ -34,7 +35,8 @@ public NoOpVariantQueryExecutor(VariantStorageMetadataManager metadataManager, S
}

@Override
public boolean canUseThisExecutor(Query query, QueryOptions options) throws StorageEngineException {
public boolean canUseThisExecutor(ParsedVariantQuery variantQuery, QueryOptions options) throws StorageEngineException {
VariantQuery query = variantQuery.getQuery();
boolean sampleQuery = false;
String sample = null;
if (VariantQueryUtils.isValidParam(query, VariantQueryParam.GENOTYPE)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ public static void setDefaultTimeout(QueryOptions queryOptions, ObjectMap config
queryOptions.put(QueryOptions.TIMEOUT, timeout);
}

/**
* Determine if this VariantQueryExecutor can run the given query.
* @param variantQuery Query to execute
* @return True if this variant query executor is valid for the query
* @throws StorageEngineException if there is an error
*/
public final boolean canUseThisExecutor(ParsedVariantQuery variantQuery) throws StorageEngineException {
boolean canUseThisExecutor = canUseThisExecutor(variantQuery, variantQuery.getInputOptions());
if (canUseThisExecutor) {
Expand All @@ -77,7 +83,7 @@ public final boolean canUseThisExecutor(ParsedVariantQuery variantQuery) throws
}

/**
* Determine if this VariantQueryExecutor can run the given query.
* Internal method to determine if this VariantQueryExecutor can run the given query.
* @param variantQuery Query to execute
* @param options Options for the query
* @return True if this variant query executor is valid for the query
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import org.opencb.opencga.storage.core.exceptions.StorageEngineException;
import org.opencb.opencga.storage.core.exceptions.VariantSearchException;
import org.opencb.opencga.storage.core.variant.adaptors.VariantDBAdaptor;
import org.opencb.opencga.storage.core.variant.adaptors.VariantQuery;
import org.opencb.opencga.storage.core.variant.adaptors.VariantQueryException;
import org.opencb.opencga.storage.core.variant.query.ParsedVariantQuery;
import org.opencb.opencga.storage.core.variant.search.solr.VariantSearchManager;
Expand All @@ -28,7 +29,8 @@ public SamplesSearchIndexVariantQueryExecutor(VariantDBAdaptor dbAdaptor, Varian
}

@Override
public boolean canUseThisExecutor(Query query, QueryOptions options) throws StorageEngineException {
public boolean canUseThisExecutor(ParsedVariantQuery variantQuery, QueryOptions options) throws StorageEngineException {
VariantQuery query = variantQuery.getQuery();
String samplesCollection = inferSpecificSearchIndexSamplesCollection(query, options, getMetadataManager(), dbName);
return samplesCollection != null && searchActiveAndAlive(samplesCollection);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@
import org.opencb.opencga.storage.core.exceptions.StorageEngineException;
import org.opencb.opencga.storage.core.exceptions.VariantSearchException;
import org.opencb.opencga.storage.core.variant.VariantStorageEngine;
import org.opencb.opencga.storage.core.variant.adaptors.VariantDBAdaptor;
import org.opencb.opencga.storage.core.variant.adaptors.VariantField;
import org.opencb.opencga.storage.core.variant.adaptors.VariantQueryException;
import org.opencb.opencga.storage.core.variant.adaptors.VariantQueryParam;
import org.opencb.opencga.storage.core.variant.adaptors.*;
import org.opencb.opencga.storage.core.variant.query.ParsedVariantQuery;
import org.opencb.opencga.storage.core.variant.query.VariantQueryResult;
import org.opencb.opencga.storage.core.variant.query.VariantQueryUtils;
Expand Down Expand Up @@ -76,7 +73,8 @@ public SearchIndexVariantQueryExecutor setIntersectParamsThreshold(int intersect
}

@Override
public boolean canUseThisExecutor(Query query, QueryOptions options) throws StorageEngineException {
public boolean canUseThisExecutor(ParsedVariantQuery variantQuery, QueryOptions options) throws StorageEngineException {
VariantQuery query = variantQuery.getQuery();
return doQuerySearchManager(query, options) || doIntersectWithSearch(query, options);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,15 +213,15 @@ public VariantQueryResult<Variant> testQuery(Query query, QueryOptions options,
logger.info("########## TEST QUERY :" + query.toJson());
logger.info("####################################################");
logger.info("## Allowed VariantQueryExecutors:");
ParsedVariantQuery variantQuery = variantStorageEngine.parseQuery(query, options);
for (VariantQueryExecutor variantQueryExecutor : variantQueryExecutors) {
if (variantQueryExecutor.canUseThisExecutor(query, options)) {
if (variantQueryExecutor.canUseThisExecutor(variantQuery, options)) {
logger.info("## - " + variantQueryExecutor.getClass().getSimpleName());
}
}
logger.info("## Using DBAdaptorVariantQueryExecutor for expected results");
Assert.assertTrue(dbQueryExecutor.canUseThisExecutor(query, options));
Assert.assertTrue(dbQueryExecutor.canUseThisExecutor(variantQuery, options));

ParsedVariantQuery variantQuery = variantStorageEngine.parseQuery(query, options);
VariantQueryResult<Variant> expected = dbQueryExecutor.get(variantQuery);

VariantQueryResult<Variant> unfilteredResult = null;
Expand Down Expand Up @@ -265,7 +265,7 @@ public VariantQueryResult<Variant> testQuery(Query query, QueryOptions options,
}

for (VariantQueryExecutor variantQueryExecutor : variantQueryExecutors) {
if (variantQueryExecutor.canUseThisExecutor(query, options)) {
if (variantQueryExecutor.canUseThisExecutor(variantQuery, options)) {
logger.info("");
logger.info("###################");
logger.info("### Testing " + variantQueryExecutor.getClass().getSimpleName());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import org.opencb.commons.datastore.core.QueryOptions;
import org.opencb.opencga.storage.core.variant.VariantStorageOptions;
import org.opencb.opencga.storage.core.variant.adaptors.VariantDBAdaptor;
import org.opencb.opencga.storage.core.variant.adaptors.VariantQuery;
import org.opencb.opencga.storage.core.variant.query.ParsedQuery;
import org.opencb.opencga.storage.core.variant.query.ParsedVariantQuery;
import org.opencb.opencga.storage.core.variant.query.VariantQueryResult;
Expand Down Expand Up @@ -43,8 +44,8 @@ public HBaseColumnIntersectVariantQueryExecutor(VariantDBAdaptor dbAdaptor, Stri
}

@Override
public boolean canUseThisExecutor(Query query, QueryOptions options) {

public boolean canUseThisExecutor(ParsedVariantQuery variantQuery, QueryOptions options) {
VariantQuery query = variantQuery.getQuery();
if (!options.getBoolean(HBASE_COLUMN_INTERSECT, ACTIVE_BY_DEFAULT)) {
// HBase column intersect not active
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import org.opencb.biodata.tools.pedigree.MendelianError;
import org.opencb.commons.datastore.core.DataResult;
import org.opencb.commons.datastore.core.ObjectMap;
import org.opencb.commons.datastore.core.Query;
import org.opencb.commons.datastore.core.QueryOptions;
import org.opencb.opencga.storage.core.metadata.models.SampleMetadata;
import org.opencb.opencga.storage.core.metadata.models.Trio;
Expand All @@ -33,10 +32,10 @@ public SampleIndexMendelianErrorQueryExecutor(VariantHadoopDBAdaptor dbAdaptor,
}

@Override
public boolean canUseThisExecutor(Query query, QueryOptions options) {
if (VariantQueryUtils.isValidParam(query, VariantQueryUtils.SAMPLE_MENDELIAN_ERROR)
|| VariantQueryUtils.isValidParam(query, VariantQueryUtils.SAMPLE_DE_NOVO)
|| VariantQueryUtils.isValidParam(query, VariantQueryUtils.SAMPLE_DE_NOVO_STRICT)) {
public boolean canUseThisExecutor(ParsedVariantQuery query, QueryOptions options) {
if (VariantQueryUtils.isValidParam(query.getQuery(), VariantQueryUtils.SAMPLE_MENDELIAN_ERROR)
|| VariantQueryUtils.isValidParam(query.getQuery(), VariantQueryUtils.SAMPLE_DE_NOVO)
|| VariantQueryUtils.isValidParam(query.getQuery(), VariantQueryUtils.SAMPLE_DE_NOVO_STRICT)) {
return super.canUseThisExecutor(query, options);
} else {
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ public SampleIndexVariantQueryExecutor(VariantHadoopDBAdaptor dbAdaptor, SampleI
}

@Override
public boolean canUseThisExecutor(Query query, QueryOptions options) {
public boolean canUseThisExecutor(ParsedVariantQuery query, QueryOptions options) {
if (options.getBoolean(SAMPLE_INDEX_INTERSECT, true)) {
return SampleIndexQueryParser.validSampleIndexQuery(query);
return SampleIndexQueryParser.validSampleIndexQuery(query.getQuery());
}
return false;
}
Expand Down

0 comments on commit 1f92650

Please sign in to comment.