From 735da9f5ecfee847951754d719365ab50dc1a713 Mon Sep 17 00:00:00 2001 From: Robrecht Cannoodt Date: Wed, 4 Sep 2024 13:01:11 +0200 Subject: [PATCH] fix pipeline and scripts --- .../create_component/create_python_method.sh | 0 .../create_component/create_python_metric.sh | 0 scripts/create_component/create_r_method.sh | 0 scripts/create_component/create_r_metric.sh | 0 scripts/run_benchmark/run_full_local.sh | 36 +++++++++++++++++++ scripts/run_benchmark/run_full_seqeracloud.sh | 32 +++++++++++++++++ scripts/run_benchmark/run_test_local.sh | 33 +++++++++++++++++ scripts/run_benchmark/run_test_seqeracloud.sh | 36 +++++++++++++++++++ src/workflows/run_benchmark/main.nf | 2 +- src/workflows/run_benchmark/test.sh | 2 +- 10 files changed, 139 insertions(+), 2 deletions(-) mode change 100644 => 100755 scripts/create_component/create_python_method.sh mode change 100644 => 100755 scripts/create_component/create_python_metric.sh mode change 100644 => 100755 scripts/create_component/create_r_method.sh mode change 100644 => 100755 scripts/create_component/create_r_metric.sh create mode 100755 scripts/run_benchmark/run_full_local.sh create mode 100755 scripts/run_benchmark/run_full_seqeracloud.sh create mode 100755 scripts/run_benchmark/run_test_local.sh create mode 100755 scripts/run_benchmark/run_test_seqeracloud.sh diff --git a/scripts/create_component/create_python_method.sh b/scripts/create_component/create_python_method.sh old mode 100644 new mode 100755 diff --git a/scripts/create_component/create_python_metric.sh b/scripts/create_component/create_python_metric.sh old mode 100644 new mode 100755 diff --git a/scripts/create_component/create_r_method.sh b/scripts/create_component/create_r_method.sh old mode 100644 new mode 100755 diff --git a/scripts/create_component/create_r_metric.sh b/scripts/create_component/create_r_metric.sh old mode 100644 new mode 100755 diff --git a/scripts/run_benchmark/run_full_local.sh b/scripts/run_benchmark/run_full_local.sh new file mode 100755 index 0000000..851cd62 --- /dev/null +++ b/scripts/run_benchmark/run_full_local.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +# get the root of the directory +REPO_ROOT=$(git rev-parse --show-toplevel) + +# ensure that the command below is run from the root of the repository +cd "$REPO_ROOT" + +# NOTE: depending on the the datasets and components, you may need to launch this workflow +# on a different compute platform (e.g. a HPC, AWS Cloud, Azure Cloud, Google Cloud). +# please refer to the nextflow information for more details: +# https://www.nextflow.io/docs/latest/ + +set -e + +# generate a unique id +RUN_ID="run_$(date +%Y-%m-%d_%H-%M-%S)" +publish_dir="resources/results/${RUN_ID}" + +# write the parameters to file +cat > /tmp/params.yaml << HERE +input_states: resources/datasets/**/state.yaml +rename_keys: 'input_singlecell_dataset:output_sc;input_spatial_dataset:output_sp' +output_state: "state.yaml" +publish_dir: "$publish_dir" +HERE + +# run the benchmark +nextflow run openproblems-bio/task_spatial_simulators \ + --revision build/main \ + -main-script target/nextflow/workflows/run_benchmark/main.nf \ + -profile docker \ + -resume \ + -entry auto \ + -c common/nextflow_helpers/labels.config \ + -params-file /tmp/params.yaml diff --git a/scripts/run_benchmark/run_full_seqeracloud.sh b/scripts/run_benchmark/run_full_seqeracloud.sh new file mode 100755 index 0000000..137600b --- /dev/null +++ b/scripts/run_benchmark/run_full_seqeracloud.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +# get the root of the directory +REPO_ROOT=$(git rev-parse --show-toplevel) + +# ensure that the command below is run from the root of the repository +cd "$REPO_ROOT" + +set -e + +# generate a unique id +RUN_ID="run_$(date +%Y-%m-%d_%H-%M-%S)" +publish_dir="s3://openproblems-data/resources/task_spatial_simulators/results/${RUN_ID}" + +# write the parameters to file +cat > /tmp/params.yaml << HERE +input_states: s3://openproblems-data/resources/task_spatial_simulators/datasets/**/state.yaml +rename_keys: 'input_singlecell_dataset:output_sc;input_spatial_dataset:output_sp' +output_state: "state.yaml" +publish_dir: "$publish_dir" +HERE + +tw launch https://github.com/openproblems-bio/task_spatial_simulators.git \ + --revision build/main \ + --pull-latest \ + --main-script target/nextflow/workflows/run_benchmark/main.nf \ + --workspace 53907369739130 \ + --compute-env 6TeIFgV5OY4pJCk8I0bfOh \ + --params-file /tmp/params.yaml \ + --entry-name auto \ + --config common/nextflow_helpers/labels_tw.config \ + --labels task_spatial_simulators,full diff --git a/scripts/run_benchmark/run_test_local.sh b/scripts/run_benchmark/run_test_local.sh new file mode 100755 index 0000000..e16b46d --- /dev/null +++ b/scripts/run_benchmark/run_test_local.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +# get the root of the directory +REPO_ROOT=$(git rev-parse --show-toplevel) + +# ensure that the command below is run from the root of the repository +cd "$REPO_ROOT" + +# remove this when you have implemented the script +echo "TODO: once the 'run_benchmark' workflow has been implemented, update this script to use it." +echo " Step 1: replace 'task_spatial_simulators' with the name of the task in the following command." +echo " Step 2: replace the rename keys parameters to fit your run_benchmark inputs" +echo " Step 3: replace the settings parameter to fit your run_benchmark outputs" +echo " Step 4: remove this message" +exit 1 + +set -e + +# write the parameters to file +cat > /tmp/params.yaml << 'HERE' +input_states: s3://openproblems-data/resources_test/task_spatial_simulators/**/state.yaml +rename_keys: 'input_singlecell_dataset:output_sc;input_spatial_dataset:output_sp' +output_state: "state.yaml" +publish_dir: s3://openproblems-nextflow/temp/task_spatial_simulators/ +HERE + +nextflow run . \ + -main-script target/nextflow/workflows/run_benchmark/main.nf \ + -profile docker \ + -resume \ + -entry auto \ + -c common/nextflow_helpers/labels.config \ + -params-file /tmp/params.yaml diff --git a/scripts/run_benchmark/run_test_seqeracloud.sh b/scripts/run_benchmark/run_test_seqeracloud.sh new file mode 100755 index 0000000..81ee24a --- /dev/null +++ b/scripts/run_benchmark/run_test_seqeracloud.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +# get the root of the directory +REPO_ROOT=$(git rev-parse --show-toplevel) + +# ensure that the command below is run from the root of the repository +cd "$REPO_ROOT" + +# remove this when you have implemented the script +echo "TODO: once the 'run_benchmark' workflow has been implemented, update this script to use it." +echo " Step 1: replace 'task_spatial_simulators' with the name of the task in the following command." +echo " Step 2: replace the rename keys parameters to fit your run_benchmark inputs" +echo " Step 3: replace the settings parameter to fit your run_benchmark outputs" +echo " Step 4: remove this message" +exit 1 + +set -e + +# write the parameters to file +cat > /tmp/params.yaml << 'HERE' +input_states: s3://openproblems-data/resources_test/task_spatial_simulators/**/state.yaml +rename_keys: 'input_singlecell_dataset:output_sc;input_spatial_dataset:output_sp' +output_state: "state.yaml" +publish_dir: s3://openproblems-nextflow/temp/task_spatial_simulators/ +HERE + +tw launch https://github.com/openproblems-bio/task_spatial_simulators.git \ + --revision build/main \ + --pull-latest \ + --main-script target/nextflow/workflows/run_benchmark/main.nf \ + --workspace 53907369739130 \ + --compute-env 6TeIFgV5OY4pJCk8I0bfOh \ + --params-file /tmp/params.yaml \ + --entry-name auto \ + --config common/nextflow_helpers/labels_tw.config \ + --labels task_spatial_simulators,test diff --git a/src/workflows/run_benchmark/main.nf b/src/workflows/run_benchmark/main.nf index 01e0658..fea480c 100644 --- a/src/workflows/run_benchmark/main.nf +++ b/src/workflows/run_benchmark/main.nf @@ -128,7 +128,7 @@ workflow run_wf { output_ch = score_ch // extract the scores - | extract_metadata.run( + | extract_uns_metadata.run( key: "extract_scores", fromState: [input: "metric_output"], toState: { id, output, state -> diff --git a/src/workflows/run_benchmark/test.sh b/src/workflows/run_benchmark/test.sh index 6fd0d36..51d361d 100755 --- a/src/workflows/run_benchmark/test.sh +++ b/src/workflows/run_benchmark/test.sh @@ -23,7 +23,7 @@ nextflow run . \ -entry auto \ -c common/nextflow_helpers/labels_ci.config \ --input_states "$DATASETS_DIR/spatialsimbench_mobnew/state.yaml" \ - --rename_keys 'input_sc:output_sc;input_sp:output_sp' \ + --rename_keys 'input_singlecell_dataset:output_sc;input_spatial_dataset:output_sp' \ --settings '{"output_scores": "scores.yaml", "output_dataset_info": "dataset_info.yaml", "output_method_configs": "method_configs.yaml", "output_metric_configs": "metric_configs.yaml", "output_task_info": "task_info.yaml"}' \ --publish_dir "$OUTPUT_DIR" \ --output_state "state.yaml"