From f01fa8adebbc7042e9f09ee5939a5d85c7b94ffd Mon Sep 17 00:00:00 2001 From: thalassemia Date: Wed, 3 Jul 2024 12:28:58 -0700 Subject: [PATCH] More Jenkins tests --- ecoli/variants/condition.py | 35 +++++++++++++++++ ecoli/variants/new_gene_internal_shift.py | 8 ++-- .../jenkins/configs/ecoli-anaerobic.json | 26 +++++++++++++ .../jenkins/configs/ecoli-new-gene-gfp.json | 39 +++++++++++++++++++ .../configs/ecoli-no-growth-rate-control.json | 22 +++++++++++ .../jenkins/configs/ecoli-no-operons.json | 18 +++++++++ .../configs/ecoli-superhelical-density.json | 16 ++++++++ runscripts/jenkins/configs/ecoli-with-aa.json | 18 +++++++++ ..._generations.json => two-generations.json} | 0 runscripts/jenkins/reproducibility | 13 +++++++ runscripts/jenkins/two-generations | 13 +++++++ 11 files changed, 203 insertions(+), 5 deletions(-) create mode 100644 ecoli/variants/condition.py create mode 100644 runscripts/jenkins/configs/ecoli-anaerobic.json create mode 100644 runscripts/jenkins/configs/ecoli-new-gene-gfp.json create mode 100644 runscripts/jenkins/configs/ecoli-no-growth-rate-control.json create mode 100644 runscripts/jenkins/configs/ecoli-no-operons.json create mode 100644 runscripts/jenkins/configs/ecoli-superhelical-density.json create mode 100644 runscripts/jenkins/configs/ecoli-with-aa.json rename runscripts/jenkins/configs/{two_generations.json => two-generations.json} (100%) create mode 100644 runscripts/jenkins/reproducibility create mode 100644 runscripts/jenkins/two-generations diff --git a/ecoli/variants/condition.py b/ecoli/variants/condition.py new file mode 100644 index 000000000..e4e14e9a5 --- /dev/null +++ b/ecoli/variants/condition.py @@ -0,0 +1,35 @@ +from typing import Any, TYPE_CHECKING + +if TYPE_CHECKING: + from reconstruction.ecoli.simulation_data import SimulationDataEcoli + +def apply_variant( + sim_data: "SimulationDataEcoli", params: dict[str, Any] +) -> "SimulationDataEcoli": + """ + Modify sim_data to environmental condition from condition_defs.tsv. + + Args: + sim_data: Simulation data to modify + params: Parameter dictionary of the following format:: + + { + # Environmental condition: "basal", "with_aa", "acetate", + # "succinate", "no_oxygen" + "condition": str, + } + + Returns: + Simulation data with the following attributes modified:: + + sim_data.condition + sim_data.external_state.current_timeline_id + """ + # Set media condition + sim_data.condition = params["condition"] + sim_data.external_state.current_timeline_id = params["condition"] + sim_data.external_state.saved_timelines[params["condition"]] = [ + (0, sim_data.conditions[params["condition"]]["nutrients"]) + ] + + return sim_data diff --git a/ecoli/variants/new_gene_internal_shift.py b/ecoli/variants/new_gene_internal_shift.py index f7e365d8c..4cbeb23aa 100644 --- a/ecoli/variants/new_gene_internal_shift.py +++ b/ecoli/variants/new_gene_internal_shift.py @@ -1,5 +1,7 @@ from typing import Any, TYPE_CHECKING +from ecoli.variants.condition import apply_variant as condition_variant + if TYPE_CHECKING: from reconstruction.ecoli.simulation_data import SimulationDataEcoli @@ -125,11 +127,7 @@ def apply_variant( """ # Set media condition - sim_data.condition = params["condition"] - sim_data.external_state.current_timeline_id = params["condition"] - sim_data.external_state.saved_timelines[params["condition"]] = [ - (0, sim_data.conditions[params["condition"]]["nutrients"]) - ] + sim_data = condition_variant(sim_data, params) # Initialize internal shift dictionary sim_data.internal_shift_dict = {} # type: ignore[attr-defined] diff --git a/runscripts/jenkins/configs/ecoli-anaerobic.json b/runscripts/jenkins/configs/ecoli-anaerobic.json new file mode 100644 index 000000000..e49ca78e5 --- /dev/null +++ b/runscripts/jenkins/configs/ecoli-anaerobic.json @@ -0,0 +1,26 @@ +{ + "experiment_id": "Daily with AA", + "single_daughters": true, + "generations": 8, + "fail_at_total_time": true, + "trna_attenuation": false, + "ppgpp_regulation": false, + "mechanistic_translation_supply": false, + "mechanistic_aa_transport": false, + "aa_supply_in_charging": false, + "d_period_division": false, + "mechanistic_replisome": true, + "mass_distribution": false, + "emitter" : { + "type": "parquet", + "config": { + "out_dir": "/scratch/groups/mcovert/vecoli" + } + }, + "analysis_options": { + "single": {"mass_fraction_summary": {}} + }, + "variants": { + "condition": {"condition": "no_oxygen"} + } +} diff --git a/runscripts/jenkins/configs/ecoli-new-gene-gfp.json b/runscripts/jenkins/configs/ecoli-new-gene-gfp.json new file mode 100644 index 000000000..25c60d945 --- /dev/null +++ b/runscripts/jenkins/configs/ecoli-new-gene-gfp.json @@ -0,0 +1,39 @@ +{ + "experiment_id": "Daily new gene GFP", + "single_daughters": true, + "generations": 4, + "fail_at_total_time": true, + "emitter" : { + "type": "parquet", + "config": { + "out_dir": "/scratch/groups/mcovert/vecoli" + } + }, + "parca_options": { + "new_genes": "gfp" + }, + "analysis_options": { + "single": {"mass_fraction_summary": {}} + }, + "variants": { + "new_gene_internal_shift": { + "condition": {"value": ["basal"]}, + "induction_gen": {"value": [1]}, + "knockout_gen": {"value": [-1]}, + "exp_trl_eff": { + "nested": { + "exp": { + "logspace": { + "start": 7, + "stop": 8, + "num": 1 + } + }, + "trl_eff": {"value": [1.0]}, + "op": "zip" + } + }, + "op": "zip" + } + } +} diff --git a/runscripts/jenkins/configs/ecoli-no-growth-rate-control.json b/runscripts/jenkins/configs/ecoli-no-growth-rate-control.json new file mode 100644 index 000000000..8987bb20c --- /dev/null +++ b/runscripts/jenkins/configs/ecoli-no-growth-rate-control.json @@ -0,0 +1,22 @@ +{ + "experiment_id": "Daily no growth rate control", + "single_daughters": true, + "generations": 4, + "fail_at_total_time": true, + "trna_attenuation": false, + "ppgpp_regulation": false, + "mechanistic_translation_supply": false, + "mechanistic_aa_transport": false, + "aa_supply_in_charging": false, + "d_period_division": false, + "mechanistic_replisome": true, + "emitter" : { + "type": "parquet", + "config": { + "out_dir": "/scratch/groups/mcovert/vecoli" + } + }, + "analysis_options": { + "single": {"mass_fraction_summary": {}} + } +} diff --git a/runscripts/jenkins/configs/ecoli-no-operons.json b/runscripts/jenkins/configs/ecoli-no-operons.json new file mode 100644 index 000000000..2ecb4ac85 --- /dev/null +++ b/runscripts/jenkins/configs/ecoli-no-operons.json @@ -0,0 +1,18 @@ +{ + "experiment_id": "Daily no operons", + "single_daughters": true, + "generations": 4, + "fail_at_total_time": true, + "emitter" : { + "type": "parquet", + "config": { + "out_dir": "/scratch/groups/mcovert/vecoli" + } + }, + "parca_options": { + "operons": false + }, + "analysis_options": { + "single": {"mass_fraction_summary": {}} + } +} diff --git a/runscripts/jenkins/configs/ecoli-superhelical-density.json b/runscripts/jenkins/configs/ecoli-superhelical-density.json new file mode 100644 index 000000000..66f459ea7 --- /dev/null +++ b/runscripts/jenkins/configs/ecoli-superhelical-density.json @@ -0,0 +1,16 @@ +{ + "experiment_id": "Daily superhelical density", + "single_daughters": true, + "generations": 4, + "fail_at_total_time": true, + "superhelical_density": true, + "emitter" : { + "type": "parquet", + "config": { + "out_dir": "/scratch/groups/mcovert/vecoli" + } + }, + "analysis_options": { + "single": {"mass_fraction_summary": {}} + } +} diff --git a/runscripts/jenkins/configs/ecoli-with-aa.json b/runscripts/jenkins/configs/ecoli-with-aa.json new file mode 100644 index 000000000..4ccd53db0 --- /dev/null +++ b/runscripts/jenkins/configs/ecoli-with-aa.json @@ -0,0 +1,18 @@ +{ + "experiment_id": "Daily with AA", + "single_daughters": true, + "generations": 8, + "fail_at_total_time": true, + "emitter" : { + "type": "parquet", + "config": { + "out_dir": "/scratch/groups/mcovert/vecoli" + } + }, + "analysis_options": { + "single": {"mass_fraction_summary": {}} + }, + "variants": { + "condition": {"condition": "with_aa"} + } +} diff --git a/runscripts/jenkins/configs/two_generations.json b/runscripts/jenkins/configs/two-generations.json similarity index 100% rename from runscripts/jenkins/configs/two_generations.json rename to runscripts/jenkins/configs/two-generations.json diff --git a/runscripts/jenkins/reproducibility b/runscripts/jenkins/reproducibility new file mode 100644 index 000000000..52d7a8760 --- /dev/null +++ b/runscripts/jenkins/reproducibility @@ -0,0 +1,13 @@ +pipeline { + agent any + + stages { + stage('Test Reproducibility') { + steps { + script { + sh "bash runscripts/jenkins/check-reproducibility.sh" + } + } + } + } +} diff --git a/runscripts/jenkins/two-generations b/runscripts/jenkins/two-generations new file mode 100644 index 000000000..641c8d162 --- /dev/null +++ b/runscripts/jenkins/two-generations @@ -0,0 +1,13 @@ +pipeline { + agent any + + stages { + stage('Test 2 Generations') { + steps { + script { + sh "bash runscripts/jenkins/workflow.sh runscripts/jenkins/configs/two-generations.json" + } + } + } + } +}