Skip to content

Commit

Permalink
making filters work for entry types with biosamples and variants
Browse files Browse the repository at this point in the history
  • Loading branch information
costero-e committed Nov 21, 2024
1 parent 4aadcdf commit 61702a4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@ logs.log
beacon/connections/mongo/data/datasets
beacon/connections/mongo/data/rarediseases
beacon/connections/mongo/data/rd-connect
*.vcf.gz
*.vcf.gz
beacon/connections/mongo/data/db/*
!beacon/connections/mongo/data/db/dir.txt
14 changes: 7 additions & 7 deletions beacon/connections/mongo/g_variants.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,16 @@ def get_biosamples_of_variant(self, entry_id: Optional[str], qparams: RequestPar
query = {"$and": [{"variantInternalId": entry_id}]}
query_parameters, parameters_as_filters = apply_request_parameters(self, query, qparams, dataset)
if parameters_as_filters == True:
query, parameters_as_filters = apply_request_parameters(self, {}, qparams, dataset)# pragma: no cover
query, parameters_as_filters = apply_request_parameters(self, query, qparams, dataset)# pragma: no cover
query_parameters={}# pragma: no cover
else:
query=query_parameters
query = apply_filters(self, query, qparams.query.filters, collection,query_parameters, dataset)
collection='biosamples'
HGVSIds = client.beacon.genomicVariations \
.find(query, {"identifiers.genomicHGVSId": 1, "datasetId": 1, "_id": 0})
HGVSDataset=HGVSIds[0]["datasetId"]
if dataset != HGVSDataset:
schema = DefaultSchemas.INDIVIDUALS
schema = DefaultSchemas.BIOSAMPLES
return schema, 0, 0, [], dataset
HGVSIds=list(HGVSIds)
HGVSId=HGVSIds[0]["identifiers"]["genomicHGVSId"]
Expand Down Expand Up @@ -116,11 +116,11 @@ def get_runs_of_variant(self, entry_id: Optional[str], qparams: RequestParams, d
query = {"$and": [{"variantInternalId": entry_id}]}
query_parameters, parameters_as_filters = apply_request_parameters(self, query, qparams, dataset)
if parameters_as_filters == True:
query, parameters_as_filters = apply_request_parameters(self, {}, qparams, dataset)# pragma: no cover
query, parameters_as_filters = apply_request_parameters(self, query, qparams, dataset)# pragma: no cover
query_parameters={}# pragma: no cover
else:
query=query_parameters
query = apply_filters(self, query, qparams.query.filters, collection,query_parameters, dataset)
collection='runs'
HGVSIds = client.beacon.genomicVariations \
.find(query, {"identifiers.genomicHGVSId": 1, "datasetId": 1, "_id": 0})
HGVSDataset=HGVSIds[0]["datasetId"]
Expand Down Expand Up @@ -166,11 +166,11 @@ def get_analyses_of_variant(self, entry_id: Optional[str], qparams: RequestParam
query = {"$and": [{"variantInternalId": entry_id}]}
query_parameters, parameters_as_filters = apply_request_parameters(self, query, qparams, dataset)
if parameters_as_filters == True:
query, parameters_as_filters = apply_request_parameters(self, {}, qparams, dataset)# pragma: no cover
query, parameters_as_filters = apply_request_parameters(self, query, qparams, dataset)# pragma: no cover
query_parameters={}# pragma: no cover
else:
query=query_parameters
query = apply_filters(self, query, qparams.query.filters, collection,query_parameters, dataset)
collection='analyses'
HGVSIds = client.beacon.genomicVariations \
.find(query, {"identifiers.genomicHGVSId": 1, "datasetId": 1, "_id": 0})
HGVSDataset=HGVSIds[0]["datasetId"]
Expand Down

0 comments on commit 61702a4

Please sign in to comment.