From ec182d28952446c81610e953a8550eb06c8f4821 Mon Sep 17 00:00:00 2001 From: Michael Baudis Date: Wed, 13 Nov 2024 11:17:14 +0900 Subject: [PATCH] more doc --- bycon/byconServiceLibs/datatable_utils.py | 8 ++++---- bycon/byconServiceLibs/export_file_generation.py | 2 +- docs/API.md | 2 +- housekeepers/mongodbIndexer.py | 2 +- importers/importTablesGenerator.py | 2 +- rsrc/templates/analyses.tsv | 1 + rsrc/templates/biosamples.tsv | 1 + rsrc/templates/individuals.tsv | 1 + rsrc/templates/metadata.tsv | 1 + rsrc/templates/metadata_all.tsv | 1 + rsrc/templates/variants.tsv | 1 + rsrc/templates/variants_all.tsv | 1 + 12 files changed, 15 insertions(+), 8 deletions(-) create mode 100644 rsrc/templates/analyses.tsv create mode 100644 rsrc/templates/biosamples.tsv create mode 100644 rsrc/templates/individuals.tsv create mode 100644 rsrc/templates/metadata.tsv create mode 100644 rsrc/templates/metadata_all.tsv create mode 100644 rsrc/templates/variants.tsv create mode 100644 rsrc/templates/variants_all.tsv diff --git a/bycon/byconServiceLibs/datatable_utils.py b/bycon/byconServiceLibs/datatable_utils.py index 23d2cebb8..a9ace98d6 100644 --- a/bycon/byconServiceLibs/datatable_utils.py +++ b/bycon/byconServiceLibs/datatable_utils.py @@ -9,10 +9,10 @@ def export_datatable_download(flattened_data): dt_m = BYC["datatable_mappings"] r_t = BYC.get("response_entity_id", "___none___") - if not r_t in dt_m["definitions"]: + if not r_t in dt_m["$defs"]: return sel_pars = BYC_PARS.get("delivery_keys", []) - io_params = dt_m["definitions"][ r_t ]["parameters"] + io_params = dt_m["$defs"][ r_t ]["parameters"] if len(sel_pars) > 0: io_params = { k: v for k, v in io_params.items() if k in sel_pars } prdlhead(f'{r_t}.tsv') @@ -39,9 +39,9 @@ def export_datatable_download(flattened_data): def import_datatable_dict_line(parent, fieldnames, lineobj, primary_scope="biosample"): dt_m = BYC["datatable_mappings"] - if not primary_scope in dt_m["definitions"]: + if not primary_scope in dt_m["$defs"]: return - io_params = dt_m["definitions"][ primary_scope ]["parameters"] + io_params = dt_m["$defs"][ primary_scope ]["parameters"] def_params = create_table_header(io_params) for f_n in fieldnames: if "#"in f_n: diff --git a/bycon/byconServiceLibs/export_file_generation.py b/bycon/byconServiceLibs/export_file_generation.py index 7e4b842c6..38cd0ff13 100644 --- a/bycon/byconServiceLibs/export_file_generation.py +++ b/bycon/byconServiceLibs/export_file_generation.py @@ -55,7 +55,7 @@ def stream_pgx_meta_header(ds_id, ds_results): def pgxseg_biosample_meta_line(biosample, group_id_key="histological_diagnosis_id"): dt_m = BYC["datatable_mappings"] - io_params = dt_m["definitions"][ "biosample" ]["parameters"] + io_params = dt_m["$defs"][ "biosample" ]["parameters"] g_id_k = group_id_key g_lab_k = re.sub("_id", "_label", g_id_k) diff --git a/docs/API.md b/docs/API.md index 20576cfa4..819c61da5 100644 --- a/docs/API.md +++ b/docs/API.md @@ -12,7 +12,7 @@ are indicated by the `@` symbol.\n\n #### Schemas **{S}**, Tests **{T}** and Examples **{E}** Tests, examples and schemas are run from the server defined in this site's build instructions -(see the `reference_server_url` entry in `mkdocs.yaml` file in the repository's root). +(see the current _{{config.reference_server_url}}_ entry for `reference_server_url` entry in `mkdocs.yaml` file in the [{{config.repo_url}}](repository's root). {% include-markdown "generated/beacon-responses.md" diff --git a/housekeepers/mongodbIndexer.py b/housekeepers/mongodbIndexer.py index 5da8ef98e..14972f99e 100755 --- a/housekeepers/mongodbIndexer.py +++ b/housekeepers/mongodbIndexer.py @@ -33,7 +33,7 @@ def mongodb_indexer(): print(f"¡¡¡ Collection {collname} does not exist in {ds_id} !!!") continue i_coll = data_db[ collname ] - io_params = dt_m["definitions"][ r_t ]["parameters"] + io_params = dt_m["$defs"][ r_t ]["parameters"] for p_k, p_v in io_params.items(): if (i_t := p_v.get("indexed", False)) is False: diff --git a/importers/importTablesGenerator.py b/importers/importTablesGenerator.py index 004195125..1273c7bd3 100755 --- a/importers/importTablesGenerator.py +++ b/importers/importTablesGenerator.py @@ -16,7 +16,7 @@ ################################################################################ def main(): - dt_m = BYC["datatable_mappings"].get("definitions", {}) + dt_m = BYC["datatable_mappings"].get("$defs", {}) ordered_mcs = BYC["datatable_mappings"].get("ordered_metadata_core", []) ordered_vcs = BYC["datatable_mappings"].get("ordered_variants_core", []) rsrc_p = path.join(pkg_path, "rsrc", "templates") diff --git a/rsrc/templates/analyses.tsv b/rsrc/templates/analyses.tsv new file mode 100644 index 000000000..5e50b8c69 --- /dev/null +++ b/rsrc/templates/analyses.tsv @@ -0,0 +1 @@ +analysis_id biosample_id individual_id platform_id platform_label pipeline_name pipeline_ref analysis_operation_id analysis_operation_label experiment_id series_id experiment_title data_provenance diff --git a/rsrc/templates/biosamples.tsv b/rsrc/templates/biosamples.tsv new file mode 100644 index 000000000..47366cb78 --- /dev/null +++ b/rsrc/templates/biosamples.tsv @@ -0,0 +1 @@ +biosample_id individual_id biosample_name notes histological_diagnosis_id histological_diagnosis_label pathological_stage_id pathological_stage_label biosample_status_id biosample_status_label sample_origin_type_id sample_origin_type_label sampled_tissue_id sampled_tissue_label tnm tumor_grade_id tumor_grade_label age_iso icdo_morphology_id icdo_morphology_label icdo_topography_id icdo_topography_label pubmed_id pubmed_label cellosaurus_id cellosaurus_label cbioportal_id cbioportal_label tcgaproject_id tcgaproject_label cohorts geoprov_id geoprov_city geoprov_country geoprov_iso_alpha3 geoprov_long_lat group_id group_label diff --git a/rsrc/templates/individuals.tsv b/rsrc/templates/individuals.tsv new file mode 100644 index 000000000..e413d4e96 --- /dev/null +++ b/rsrc/templates/individuals.tsv @@ -0,0 +1 @@ +individual_id individual_name sex_id sex_label age_iso age_days external_references data_use_conditions_id data_use_conditions_label histological_diagnosis_id histological_diagnosis_label notes index_disease_followup_time index_disease_followup_state_id index_disease_followup_state_label auxiliary_disease_id auxiliary_disease_label auxiliary_disease_notes ethnicity_id ethnicity_label diff --git a/rsrc/templates/metadata.tsv b/rsrc/templates/metadata.tsv new file mode 100644 index 000000000..99362fa5f --- /dev/null +++ b/rsrc/templates/metadata.tsv @@ -0,0 +1 @@ +analysis_id biosample_id individual_id experiment_title biosample_name notes histological_diagnosis_id histological_diagnosis_label experiment_id series_id pubmed_id sex_id sex_label age_iso icdo_morphology_id icdo_morphology_label icdo_topography_id icdo_topography_label sampled_tissue_id sampled_tissue_label biosample_status_id biosample_status_label sample_origin_type_id sample_origin_type_label tnm pathological_stage_id pathological_stage_label tumor_grade_id tumor_grade_label ethnicity_id ethnicity_label index_disease_followup_time index_disease_followup_state_id index_disease_followup_state_label platform_id platform_label pipeline_name pipeline_ref analysis_operation_id analysis_operation_label geoprov_id diff --git a/rsrc/templates/metadata_all.tsv b/rsrc/templates/metadata_all.tsv new file mode 100644 index 000000000..65aa2b28f --- /dev/null +++ b/rsrc/templates/metadata_all.tsv @@ -0,0 +1 @@ +analysis_id biosample_id individual_id experiment_title biosample_name notes histological_diagnosis_id histological_diagnosis_label experiment_id series_id pubmed_id sex_id sex_label age_iso icdo_morphology_id icdo_morphology_label icdo_topography_id icdo_topography_label sampled_tissue_id sampled_tissue_label biosample_status_id biosample_status_label sample_origin_type_id sample_origin_type_label tnm pathological_stage_id pathological_stage_label tumor_grade_id tumor_grade_label ethnicity_id ethnicity_label index_disease_followup_time index_disease_followup_state_id index_disease_followup_state_label platform_id platform_label pipeline_name pipeline_ref analysis_operation_id analysis_operation_label geoprov_id data_provenance pubmed_label cellosaurus_id cellosaurus_label cbioportal_id cbioportal_label tcgaproject_id tcgaproject_label cohorts geoprov_city geoprov_country geoprov_iso_alpha3 geoprov_long_lat group_id group_label individual_name age_days external_references data_use_conditions_id data_use_conditions_label auxiliary_disease_id auxiliary_disease_label auxiliary_disease_notes diff --git a/rsrc/templates/variants.tsv b/rsrc/templates/variants.tsv new file mode 100644 index 000000000..92078c587 --- /dev/null +++ b/rsrc/templates/variants.tsv @@ -0,0 +1 @@ +analysis_id biosample_id individual_id reference_name start end variant_state_id variant_state_label reference_sequence sequence diff --git a/rsrc/templates/variants_all.tsv b/rsrc/templates/variants_all.tsv new file mode 100644 index 000000000..ec47eb3cc --- /dev/null +++ b/rsrc/templates/variants_all.tsv @@ -0,0 +1 @@ +variant_id variant_internal_id analysis_id biosample_id individual_id sequence_id reference_name start end adjoined_sequences variant_state_id variant_state_label reference_sequence sequence annotation_derived aminoacid_changes genomic_hgvs_id var_length variant_fusion_id updated log2 variant_type