From b2ce2b86c843460c85e5bdb1932ca20d5aa340a1 Mon Sep 17 00:00:00 2001 From: Loraine Gueguen <loraine.gueguen@sb-roscoff.fr> Date: Fri, 14 May 2021 22:02:34 +0200 Subject: [PATCH] Get input yml keys from constants --- examples/citrus_sinensis.yml | 4 +-- templates/organisms.yml.j2 | 48 ++++++++++++++++++------------------ utilities.py | 35 +++++++++++++++++++++++++- 3 files changed, 59 insertions(+), 28 deletions(-) diff --git a/examples/citrus_sinensis.yml b/examples/citrus_sinensis.yml index 14fe1dc..ce35202 100644 --- a/examples/citrus_sinensis.yml +++ b/examples/citrus_sinensis.yml @@ -33,6 +33,4 @@ services: # List the optional services to be deploy in the stack # By default, only tripal, tripaldb, galaxy, jbrowse and elasticsearch services will be deployed - blast: "False" - wiki: "False" - apollo: "False" \ No newline at end of file + blast: "False" \ No newline at end of file diff --git a/templates/organisms.yml.j2 b/templates/organisms.yml.j2 index 915bbed..4739153 100644 --- a/templates/organisms.yml.j2 +++ b/templates/organisms.yml.j2 @@ -1,25 +1,25 @@ -- name: {{ name }} - description: - genus: {{ genus }} - species: {{ species }} - sex: {{ sex }} - strain: {{ strain }} - common_name: {{ common_name }} - origin: {{ origin }} - {% if main_species is defined and main_species is sameas true %} - main_species: yes +- {{ org_param_name }}: {{ org_param_name_value }} + {{ org_param_desc }}: + {{ org_param_desc_genus }}: {{ org_param_desc_genus_value }} + {{ org_param_desc_species }}: {{ org_param_desc_species_value }} + {{ org_param_desc_sex }}: {{ org_param_desc_sex_value }} + {{ org_param_desc_strain }}: {{ org_param_desc_strain_value }} + {{ org_param_desc_common_name }}: {{ org_param_desc_common_name_value }} + {{ org_param_desc_origin }}: {{ org_param_desc_origin_value }} + {% if org_param_desc_main_species_value is defined and org_param_desc_main_species_value is same as true %} + {{ org_param_desc_main_species }}: yes {% endif %} - data: - genome_path: {{ genome_path }} - transcripts_path: {{ transcripts_path }} - proteins_path: {{ proteins_path }} - gff_path: {{ gff_path }} - interpro_path: {{ interpro_path }} - orthofinder_path: {{ orthofinder_path }} - blastp_path: {{ blastp_path }} - blastx_path: {{ blastx_path }} - genome_version: {{ genome_version }} - ogs_version: {{ ogs_version }} - performed_by: {{ performed_by }} - services: - blast: {{ blast }} \ No newline at end of file + {{ org_param_data }}: + {{ org_param_data_genome_path }}: {{ org_param_data_genome_path_value }} + {{ org_param_data_transcripts_path }}: {{ org_param_data_transcripts_path_value }} + {{ org_param_data_proteins_path }}: {{ org_param_data_proteins_path_value }} + {{ org_param_data_gff_path }}: {{ org_param_data_gff_path_value }} + {{ org_param_data_interpro_path }}: {{ org_param_data_interpro_path_value }} + {{ org_param_data_orthofinder_path }}: {{ org_param_data_orthofinder_path_value }} + {{ org_param_data_blastp_path }}: {{ org_param_data_blastp_path_value }} + {{ org_param_data_blastx_path }}: {{ org_param_data_blastx_path_value }} + {{ org_param_data_genome_version }}: {{ org_param_data_genome_version_value }} + {{ org_param_data_ogs_version }}: {{ org_param_data_ogs_version_value }} + {{ org_param_data_performed_by }}: {{ org_param_data_performed_by_value }} + {{ org_param_services }}: + {{ org_param_services_blast }}: {{ org_param_services_blast_value }} \ No newline at end of file diff --git a/utilities.py b/utilities.py index 139d083..b23ec21 100755 --- a/utilities.py +++ b/utilities.py @@ -187,4 +187,37 @@ def run_tool_and_get_single_output_dataset_id(instance, tool_id, history_id, too output_dict = run_tool(instance, tool_id, history_id, tool_inputs) single_output_dataset_id = output_dict["outputs"][0]["id"] - return single_output_dataset_id \ No newline at end of file + return single_output_dataset_id + +def create_org_param_dict_from_constants(): + """ + Create a dictionary of variables containing the keys needed to render the organisms.yml.j2 (NOT the values) + Created from the constants + """ + + org_param_dict={} + org_param_dict[constants.ORG_PARAM_NAME] = constants.ORG_PARAM_NAME + org_param_dict[constants.ORG_PARAM_DESC] = constants.ORG_PARAM_DESC + org_param_dict[constants.ORG_PARAM_DESC_GENUS] = constants.ORG_PARAM_DESC_GENUS + org_param_dict[constants.ORG_PARAM_DESC_SPECIES] = constants.ORG_PARAM_DESC_SPECIES + org_param_dict[constants.ORG_PARAM_DESC_SEX] = constants.ORG_PARAM_DESC_SEX + org_param_dict[constants.ORG_PARAM_DESC_STRAIN] = constants.ORG_PARAM_DESC_STRAIN + org_param_dict[constants.ORG_PARAM_DESC_COMMON_NAME] = constants.ORG_PARAM_DESC_COMMON_NAME + org_param_dict[constants.ORG_PARAM_DESC_ORIGIN] = constants.ORG_PARAM_DESC_ORIGIN + org_param_dict[constants.ORG_PARAM_DESC_MAIN_SPECIES] = constants.ORG_PARAM_DESC_MAIN_SPECIES + org_param_dict[constants.ORG_PARAM_DATA] = constants.ORG_PARAM_DATA + org_param_dict[constants.ORG_PARAM_DATA_GENOME_PATH] = constants.ORG_PARAM_DATA_GENOME_PATH + org_param_dict[constants.ORG_PARAM_DATA_TRANSCRIPTS_PATH] = constants.ORG_PARAM_DATA_TRANSCRIPTS_PATH + org_param_dict[constants.ORG_PARAM_DATA_PROTEINS_PATH] = constants.ORG_PARAM_DATA_PROTEINS_PATH + org_param_dict[constants.ORG_PARAM_DATA_GFF_PATH] = constants.ORG_PARAM_DATA_GFF_PATH + org_param_dict[constants.ORG_PARAM_DATA_INTERPRO_PATH] = constants.ORG_PARAM_DATA_INTERPRO_PATH + org_param_dict[constants.ORG_PARAM_DATA_ORTHOFINDER_PATH] = constants.ORG_PARAM_DATA_ORTHOFINDER_PATH + org_param_dict[constants.ORG_PARAM_DATA_BLASTP_PATH] = constants.ORG_PARAM_DATA_BLASTP_PATH + org_param_dict[constants.ORG_PARAM_DATA_BLASTX_PATH] = constants.ORG_PARAM_DATA_BLASTX_PATH + org_param_dict[constants.ORG_PARAM_DATA_GENOME_VERSION] = constants.ORG_PARAM_DATA_GENOME_VERSION + org_param_dict[constants.ORG_PARAM_DATA_OGS_VERSION] = constants.ORG_PARAM_DATA_GENOME_VERSION + org_param_dict[constants.ORG_PARAM_DATA_PERFORMED_BY] = constants.ORG_PARAM_DATA_PERFORMED_BY + org_param_dict[constants.ORG_PARAM_SERVICES] = constants.ORG_PARAM_SERVICES + org_param_dict[constants.ORG_PARAM_SERVICES_BLAST] = constants.ORG_PARAM_SERVICES_BLAST + + return org_param_dict \ No newline at end of file -- GitLab