Skip to content

Commit

Permalink
1.6.5
Browse files Browse the repository at this point in the history
first multi-variant match etc.; see http://bycon.progenetix.org/changes/
  • Loading branch information
mbaudis committed Apr 3, 2024
1 parent 8095c4b commit 3acd204
Show file tree
Hide file tree
Showing 18 changed files with 689 additions and 64 deletions.
1 change: 1 addition & 0 deletions bycon/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from beacon_response_generation import *
from bycon_helpers import *
from cgi_parsing import *
from cytoband_parsing import *
from dataset_parsing import *
from genome_utils import *
from handover_generation import *
Expand Down
65 changes: 49 additions & 16 deletions bycon/definitions/argument_definitions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,17 @@ include_resultset_responses:

dataset_ids:
type: array
items: string
items:
type: string
cmdFlags:
- -d
- --datasetIds
description: dataset ids

filters:
type: array
items: string
items:
type: string
cmdFlags:
- --filters
description: prefixed filter values, comma concatenated
Expand Down Expand Up @@ -202,9 +204,11 @@ variant_max_length:
description: 'variantMaxLength: The maximum variant length in bases for e.g. CNV queries.'

gene_id:
type: string
type: array
items:
type: string
pattern: '^\w+?(\w+?(\-\w+?)?)?$'
db_key: Null
pattern: '^\w+?(\w+?(\-\w+?)?)?$'
cmdFlags:
- --geneId
description: gene id
Expand Down Expand Up @@ -235,6 +239,18 @@ genomic_allele_short_form:
# variant parameters - non-standard
# ------------------------------------------------------------------------------

variant_query_digests:
type: array
db_key: Null
items:
type: string
pattern: '^(?:chro?)?([12]?[\dXY]):(\d+?(?:-\d+?)?)(?:--(\d+?(?:-\d+?)?))?(?::([\w\:\>]+?))?$'
cmdFlags:
- --variantQueryDigests
examples:
- "9:9000001-21975098--21967753-24000000:DEL"
description: 'Variant query digest-style short form'

variant_internal_id:
type: string
db_key: variant_internal_id
Expand Down Expand Up @@ -281,38 +297,48 @@ id:

ids:
type: array
items: string
items:
type: string
pattern: '^\w[\w:-]+\w$'
cmdFlags:
- --ids
description: 'One or more ids; this parameter only makes sense for specific REST entry types'

biosample_ids:
type: array
items: string
items:
type: string
pattern: '^\w[\w:-]+\w$'
byc_entity: biosample
cmdFlags:
- --biosampleIds
description: biosample ids

analysis_ids:
type: array
items: string
items:
type: string
pattern: '^\w[\w:-]+\w$'
byc_entity: analysis
cmdFlags:
- --analysisIds
description: callset / analysis ids

individual_ids:
type: array
items: string
items:
type: string
pattern: '^\w[\w:-]+\w$'
byc_entity: individual
cmdFlags:
- --individualIds
description: subject ids

variant_ids:
type: array
items: string
items:
type: string
pattern: '^\w[\w:-]+\w$'
byc_entity: genomicVariant
cmdFlags:
- --variantIds
Expand Down Expand Up @@ -465,14 +491,16 @@ source:

delivery_keys:
type: array
items: string
items:
type: string
cmdFlags:
- --deliveryKeys
description: delivery keys

collation_types:
type: array
items: string
items:
type: string
cmdFlags:
- --collationTypes
description: selected collation types, e.g. "EFO"
Expand All @@ -485,7 +513,8 @@ with_samples:

selected_beacons:
type: array
items: string
items:
type: string

# ------------------------------------------------------------------------------
# genomic parameters
Expand All @@ -499,17 +528,21 @@ genome_binning:
description: "one of the predefined genome binning keys - default 1Mb"

cyto_bands:
type: string
type: array
db_key: Null
pattern: ^(?:chro?)?([12]?[\dXY])([pq](?:(?:ter)|(?:cen)|(?:[1-4](?:\d(?:\.\d\d*?)?)?)?))?\-?([pq](?:(?:cen)|(?:ter)|(?:[1-4](?:\d(?:\.\d\d*?)?)?)?))?$
items:
type: string
pattern: ^(?:chro?)?([12]?[\dXY])([pq](?:(?:ter)|(?:cen)|(?:[1-4](?:\d(?:\.\d\d*?)?)?)?))?\-?([pq](?:(?:cen)|(?:ter)|(?:[1-4](?:\d(?:\.\d\d*?)?)?)?))?$
cmdFlags:
- --cytoBands
description: cytobands, e.g. 8q21q24.1

chro_bases:
type: string
type: array
items:
type: string
pattern: ^(chro?)?([12]?[\dXY])\:(\d+?)(\-(\d+?))?$
db_key: Null
pattern: ^(chro?)?([12]?[\dXY])\:(\d+?)(\-(\d+?))?$
cmdFlags:
- --chroBases
description: only for the cytoband converter ... e.g. 8:0-120000000
Expand Down
11 changes: 11 additions & 0 deletions bycon/definitions/datatable_mappings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,17 @@ definitions:
db_key: references.cbioportal.label
beacon_key: False
compact: True
tcgaproject_id:
type: string
db_key: references.tcgaproject.id
indexed: True
beacon_key: False
compact: True
tcgaproject_label:
type: string
db_key: references.tcgaproject.label
beacon_key: False
compact: True
external_references:
type: array
beacon_key: biosamples.externalReferences
Expand Down
32 changes: 23 additions & 9 deletions bycon/definitions/variant_request_definitions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,26 @@ request_pars:
- gene_id
- aminoacid_change
- genomic_allele_short_form
- cyto_bands
- variant_query_digests

# As long as there are no variant query schemas to define valid Beacon
# variant parameter combinations the `request_types` here provide sets
# of combinations valid at least for `bycon` Progenetix etc. data.
request_types:

variantQueryDigestsRequest:
all_of:
- variant_query_digests

cytoBandRequest:
all_of:
- cyto_bands
optional:
- variant_type
- variant_min_length
- variant_max_length

aminoacidChangeRequest:
all_of:
- aminoacid_change
Expand All @@ -34,14 +48,14 @@ request_types:
all_of:
- genomic_allele_short_form

variantTypeRequest:
description: >-
This dangerous query only uses a variant type, e.g. to limit an "all variants"
retrieval to SNVs or CNVs.
TODO: Add some private parameter to make this work on ly for special
circumstances... May be used w/ a combination of filter length >0 check.
all_of:
- variant_type
# variantTypeRequest:
# description: >-
# This dangerous query only uses a variant type, e.g. to limit an "all variants"
# retrieval to SNVs or CNVs.
# TODO: Add some private parameter to make this work only for special
# circumstances... May be used w/ a combination of filter length > 0 check.
# all_of:
# - variant_type

variantBracketRequest:
description: >-
Expand All @@ -60,8 +74,8 @@ request_types:
- start
- end
- reference_name
- variant_type
optional:
- variant_type
- variant_min_length
- variant_max_length

Expand Down
58 changes: 58 additions & 0 deletions bycon/definitions/variant_type_definitions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,27 @@ EFO:0030066:
- EFO:0030072
- EFO:0030073

SO:0001743:
description: >-
This is an alternative to `EFO:0030067`. The SO definitions for CNVs are
slightly misleading (type of `sequence_length_alteration`) and do not
include the more specific child terms from EFO or VRS.
variant_state:
id: SO:0001743
label: copy_number_loss
DUPDEL: DEL
variant_type_id: SO:0001743
variant_type: DEL
VRS_type: CopyNumberChange
VCF_symbolic_allele: <DEL>
cnv_dummy_value: -1
child_terms:
- EFO:0030067
- SO:0001743
- EFO:0030068
- EFO:0020073
- EFO:0030069

EFO:0030067:
variant_state:
id: EFO:0030067
Expand All @@ -77,6 +98,7 @@ EFO:0030067:
cnv_dummy_value: -1
child_terms:
- EFO:0030067
- SO:0001743
- EFO:0030068
- EFO:0020073
- EFO:0030069
Expand Down Expand Up @@ -133,6 +155,28 @@ EFO:0030070:
cnv_dummy_value: 0.58
child_terms:
- EFO:0030070
- SO:0001742
- EFO:0030071
- EFO:0030072
- EFO:0030073

SO:0001742:
description: >-
This is an alternative to `EFO:0030070`. The SO definitions for CNVs are
slightly misleading (type of `sequence_length_alteration`) and do not
include the more specific child terms from EFO or VRS.
variant_state:
id: SO:0001742
label: copy_number_gain
DUPDEL: DUP
variant_type_id: SO:0001742
variant_type: DUP
VRS_type: CopyNumberChange
VCF_symbolic_allele: <DUP>
cnv_dummy_value: 0.58
child_terms:
- EFO:0030070
- SO:0001742
- EFO:0030071
- EFO:0030072
- EFO:0030073
Expand Down Expand Up @@ -192,6 +236,7 @@ SO:0001059:
- SO:0001483
- SO:0002007
- SO:0000667
- SO:0001743

SO:0001483:
variant_state:
Expand Down Expand Up @@ -231,3 +276,16 @@ SO:0000667:
cnv_dummy_value: Null
child_terms:
- SO:0000667

SO:0001413:
variant_state:
id: SO:0001413
label: translocation breakpoint
DUPDEL: Null
variant_type_id: SO:0001413
variant_type: BND
VRS_type: Null
VCF_symbolic_allele: <BND>
cnv_dummy_value: Null
child_terms:
- SO:0001413
10 changes: 8 additions & 2 deletions bycon/lib/beacon_response_generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,9 @@ def __return_filtering_terms(self):

# TODO: This should be derived from some entity definitions
# TODO: whole query generation in separate function ...
scopes = ["biosamples", "individuals", "analyses", "genomicVariations"]
# now added globally to filters since Q aggregation and
# https://github.com/ga4gh-beacon/beacon-v2/pull/118
scopes = BYC.get("data_pipeline_entities", [])
query = {}
q_list = []

Expand Down Expand Up @@ -470,6 +472,8 @@ def __return_filtering_terms(self):
if ft_k and ft_s:
f_t.update({"target": f'{ft_s}.{ft_k}'})

f_t.update({"scopes": scopes})

lab = f_t.get("label")
if lab is None:
f_t.pop("label", None)
Expand Down Expand Up @@ -753,7 +757,9 @@ def __retrieve_variants_data(self):
r_s_res = []

if "variants._id" in ds_results:
for v_id in ds_results["variants._id"]["target_values"]:
q_v_s = ds_results["variants._id"]["target_values"]
q_v_s = return_paginated_list(q_v_s, self.skip, self.limit)
for v_id in q_v_s:
v = v_coll.find_one({"_id":v_id})
r_s_res.append(v)
self.datasets_data.update({ds_id: r_s_res})
Expand Down
3 changes: 2 additions & 1 deletion bycon/lib/bycon_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ def refactor_value_from_defined_type(parameter, values, definition):
return str(value)
else:
BYC["WARNINGS"].append(f"!!! Multiple values for {parameter} in request")
return '::'.join(values)
# re-joining ...
return ','.join(values)


################################################################################
Expand Down
Loading

0 comments on commit 3acd204

Please sign in to comment.