Skip to content

Commit

Permalink
Merge pull request #317 from EGA-archive/develop
Browse files Browse the repository at this point in the history
filtering terms scopes fixed
  • Loading branch information
costero-e authored Apr 15, 2024
2 parents 369a0f5 + 75f3c61 commit 04ebcd7
Show file tree
Hide file tree
Showing 12 changed files with 23 additions and 20 deletions.
2 changes: 1 addition & 1 deletion beacon/db/analyses.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def get_variants_of_analysis(entry_id: Optional[str], qparams: RequestParams, da
return schema, count, dataset_count, docs

def get_filtering_terms_of_analyse(entry_id: Optional[str], qparams: RequestParams):
query = {'scope': 'analyses'}
query = {'scopes': 'analysis'}
schema = DefaultSchemas.FILTERINGTERMS
count = get_count(client.beacon.filtering_terms, query)
remove_id={'_id':0}
Expand Down
2 changes: 1 addition & 1 deletion beacon/db/biosamples.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def get_runs_of_biosample(entry_id: Optional[str], qparams: RequestParams, datas
return schema, count, dataset_count, docs

def get_filtering_terms_of_biosample(entry_id: Optional[str], qparams: RequestParams):
query = {'scope': 'biosamples'}
query = {'scopes': 'biosample'}
schema = DefaultSchemas.FILTERINGTERMS
count = get_count(client.beacon.filtering_terms, query)
remove_id={'_id':0}
Expand Down
2 changes: 1 addition & 1 deletion beacon/db/cohorts.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ def get_biosamples_of_cohort(entry_id: Optional[str], qparams: RequestParams, da


def get_filtering_terms_of_cohort(entry_id: Optional[str], qparams: RequestParams):
query = {'scope': 'cohorts'}
query = {'scopes': 'cohort'}
schema = DefaultSchemas.FILTERINGTERMS
count = get_count(client.beacon.filtering_terms, query)
remove_id={'_id':0}
Expand Down
2 changes: 1 addition & 1 deletion beacon/db/datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ def filter_public_datasets(requested_datasets_ids):


def get_filtering_terms_of_dataset(entry_id: Optional[str], qparams: RequestParams):
query = {'scope': 'datasets'}
query = {'scopes': 'dataset'}
schema = DefaultSchemas.FILTERINGTERMS
count = get_count(client.beacon.filtering_terms, query)
docs = get_documents(
Expand Down
16 changes: 8 additions & 8 deletions beacon/db/extract_filtering_terms.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,30 +283,30 @@ def get_filtering_object(terms_ids: list, collection_name: str):
'label': ontology_label,
# TODO: Use conf.py -> beaconGranularity to not disclouse counts in the filtering terms
#'count': get_ontology_term_count(collection_name, onto),
'scope': [collection_name[0:-1]]
'scopes': [collection_name[0:-1]]
})

terms.append({
'type': 'alphanumeric',
'id': field,
# TODO: Use conf.py -> beaconGranularity to not disclouse counts in the filtering terms
#'count': get_ontology_term_count(collection_name, onto),
'scope': [collection_name[0:-1]]
'scopes': [collection_name[0:-1]]
})
terms.append({
'type': 'custom',
'id': '{}:{}'.format(field,label),
# TODO: Use conf.py -> beaconGranularity to not disclouse counts in the filtering terms
#'count': get_ontology_term_count(collection_name, onto),
'scope': [collection_name[0:-1]]
'scopes': [collection_name[0:-1]]
})
if value_id is not None:
terms.append({
'type': 'alphanumeric',
'id': value_id,
# TODO: Use conf.py -> beaconGranularity to not disclouse counts in the filtering terms
#'count': get_ontology_term_count(collection_name, onto),
'scope': [collection_name[0:-1]]
'scopes': [collection_name[0:-1]]
})

print(terms)
Expand Down Expand Up @@ -369,17 +369,17 @@ def merge_terms():
#print(repeated_term)
id=repeated_term["id"]
label=repeated_term["label"]
if repeated_term['scope'] != []:
if repeated_term['scope'][0] not in array_of_scopes:
array_of_scopes.append(repeated_term['scope'][0])
if repeated_term['scopes'] != []:
if repeated_term['scopes'][0] not in array_of_scopes:
array_of_scopes.append(repeated_term['scopes'][0])
if array_of_scopes != []:
new_terms.append({
'type': 'ontology',
'id': id,
'label': label,
# TODO: Use conf.py -> beaconGranularity to not disclouse counts in the filtering terms
#'count': get_ontology_term_count(collection_name, onto),
'scope': array_of_scopes
'scopes': array_of_scopes
})
client.beacon.filtering_terms.delete_many({"id": repeated_id})
client.beacon.filtering_terms.insert_many(new_terms)
Expand Down
8 changes: 4 additions & 4 deletions beacon/db/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ def apply_ontology_filter(query: dict, filter: OntologyFilter, collection: str,
final_term_list.append(filter.id)
query_filtering={}
query_filtering['$and']=[]
dict_scope['scope']=scope
dict_scope['scopes']=scope
query_filtering['$and'].append(dict_scope)
dict_id={}
dict_id['id']=filter.id
Expand Down Expand Up @@ -514,7 +514,7 @@ def apply_ontology_filter(query: dict, filter: OntologyFilter, collection: str,
query_filtering['$and']=[]
dict_scope={}

dict_scope['scope']=scope
dict_scope['scopes']=scope
dict_id={}
dict_id['id']=filter.id
query_filtering['$and'].append(dict_id)
Expand All @@ -540,7 +540,7 @@ def apply_ontology_filter(query: dict, filter: OntologyFilter, collection: str,
dict_id={}
dict_id['id']=dict_regex
dict_scope={}
dict_scope['scope']=scope
dict_scope['scopes']=scope
query_filtering['$and'].append(dict_id)
query_filtering['$and'].append(dict_scope)
docs_2 = get_documents(
Expand Down Expand Up @@ -573,7 +573,7 @@ def apply_ontology_filter(query: dict, filter: OntologyFilter, collection: str,
query_filtering={}
query_filtering['$and']=[]
dict_scope={}
dict_scope['scope']=scope
dict_scope['scopes']=scope
query_filtering['$and'].append(dict_scope)
dict_id={}
dict_id['id']=filter.id
Expand Down
2 changes: 1 addition & 1 deletion beacon/db/g_variants.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ def get_analyses_of_variant(entry_id: Optional[str], qparams: RequestParams, dat
return schema, count, dataset_count, docs

def get_filtering_terms_of_genomicvariation(entry_id: Optional[str], qparams: RequestParams):
query = {'scope': 'genomicVariations'}
query = {'scopes': 'genomicVariation'}
schema = DefaultSchemas.FILTERINGTERMS
count = get_count(client.beacon.filtering_terms, query)
remove_id={'_id':0}
Expand Down
2 changes: 1 addition & 1 deletion beacon/db/individuals.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ def get_biosamples_of_individual(entry_id: Optional[str], qparams: RequestParams


def get_filtering_terms_of_individual(entry_id: Optional[str], qparams: RequestParams):
query = {'scope': 'individuals'}
query = {'scopes': 'individual'}
schema = DefaultSchemas.FILTERINGTERMS
count = get_count(client.beacon.filtering_terms, query)
remove_id={'_id':0}
Expand Down
2 changes: 1 addition & 1 deletion beacon/db/runs.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ def get_analyses_of_run(entry_id: Optional[str], qparams: RequestParams, dataset
return schema, count, dataset_count, docs

def get_filtering_terms_of_run(entry_id: Optional[str], qparams: RequestParams):
query = {'scope': 'runs'}
query = {'scopes': 'run'}
schema = DefaultSchemas.FILTERINGTERMS
count = get_count(client.beacon.filtering_terms, query)
remove_id={'_id':0}
Expand Down
1 change: 1 addition & 0 deletions beacon/request/cohorts.yml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions beacon/request/datasets.yml

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion permissions/public_datasets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ public_datasets:
- CINECA_dataset
- AV_Dataset
- rd-connect_dataset
- coadread_tcga_pan_can_atlas_2018
- coadread_tcga_pan_can_atlas_2018
- B1MG-COADREAD

0 comments on commit 04ebcd7

Please sign in to comment.