Skip to content

Commit

Permalink
update test resources
Browse files Browse the repository at this point in the history
  • Loading branch information
rcannood committed Sep 3, 2024
1 parent da30b86 commit 75cedc8
Show file tree
Hide file tree
Showing 46 changed files with 268 additions and 134 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# task_template x.y.z
# task_predict_modality x.y.z

## BREAKING CHANGES

Expand Down
14 changes: 8 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ data shows that this is not trivial.
| Kaiwen Deng | contributor |
| Louise Deconinck | author |
| Robrecht Cannoodt | author, maintainer |
| Xueer Chen | contributor |
| Jiwei Liu | contributor |

## API

Expand Down Expand Up @@ -161,7 +163,7 @@ Arguments:
The mod1 expression values of the test cells.

Example file:
`resources_test/predict_modality/openproblems_neurips2021/bmmc_cite/swap/test_mod1.h5ad`
`resources_test/task_predict_modality/openproblems_neurips2021/bmmc_cite/swap/test_mod1.h5ad`

Format:

Expand Down Expand Up @@ -208,7 +210,7 @@ Data structure:
The mod2 expression values of the test cells.

Example file:
`resources_test/predict_modality/openproblems_neurips2021/bmmc_cite/swap/test_mod2.h5ad`
`resources_test/task_predict_modality/openproblems_neurips2021/bmmc_cite/swap/test_mod2.h5ad`

Format:

Expand Down Expand Up @@ -254,7 +256,7 @@ Data structure:
The mod1 expression values of the train cells.

Example file:
`resources_test/predict_modality/openproblems_neurips2021/bmmc_cite/swap/train_mod1.h5ad`
`resources_test/task_predict_modality/openproblems_neurips2021/bmmc_cite/swap/train_mod1.h5ad`

Format:

Expand Down Expand Up @@ -296,7 +298,7 @@ Data structure:
The mod2 expression values of the train cells.

Example file:
`resources_test/predict_modality/openproblems_neurips2021/bmmc_cite/swap/train_mod2.h5ad`
`resources_test/task_predict_modality/openproblems_neurips2021/bmmc_cite/swap/train_mod2.h5ad`

Format:

Expand Down Expand Up @@ -424,7 +426,7 @@ Arguments:
A prediction of the mod2 expression values of the test cells

Example file:
`resources_test/predict_modality/openproblems_neurips2021/bmmc_cite/swap/prediction.h5ad`
`resources_test/task_predict_modality/openproblems_neurips2021/bmmc_cite/swap/prediction.h5ad`

Format:

Expand Down Expand Up @@ -458,7 +460,7 @@ another.
Metric score file

Example file:
`resources_test/predict_modality/openproblems_neurips2021/bmmc_cite/swap/score.h5ad`
`resources_test/task_predict_modality/openproblems_neurips2021/bmmc_cite/swap/score.h5ad`

Format:

Expand Down
10 changes: 8 additions & 2 deletions _viash.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,20 @@ info:
path: s3://openproblems-data/resources_test/common/
dest: resources_test/common
- type: s3
path: s3://openproblems-data/resources_test/predict_modality/
dest: resources_test/predict_modality
path: s3://openproblems-data/resources_test/task_predict_modality/
dest: resources_test/task_predict_modality

repositories:
- name: openproblems_v2
type: github
repo: openproblems-bio/openproblems-v2
tag: main_build
- name: core
type: github
repo: openproblems-bio/core
# tag: build/main
tag: build/add_common_components
path: viash/core

config_mods: |
.runners[.type == "nextflow"].config.labels := { lowmem : "memory = 20.Gb", midmem : "memory = 50.Gb", highmem : "memory = 100.Gb", lowcpu : "cpus = 5", midcpu : "cpus = 15", highcpu : "cpus = 30", lowtime : "time = 1.h", midtime : "time = 4.h", hightime : "time = 8.h", veryhightime : "time = 24.h" }
2 changes: 1 addition & 1 deletion common
3 changes: 0 additions & 3 deletions scripts/.gitignore

This file was deleted.

8 changes: 8 additions & 0 deletions scripts/create_component/create_python_method.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

set -e

common/scripts/create_component \
--name my_python_method \
--language python \
--type method
8 changes: 8 additions & 0 deletions scripts/create_component/create_python_metric.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

set -e

common/scripts/create_component \
--name my_python_metric \
--language python \
--type metric
8 changes: 8 additions & 0 deletions scripts/create_component/create_r_method.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

set -e

common/scripts/create_component \
--name my_r_method \
--language r \
--type method
8 changes: 8 additions & 0 deletions scripts/create_component/create_r_metric.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

set -e

common/scripts/create_component \
--name my_r_metric \
--language r \
--type metric
Original file line number Diff line number Diff line change
@@ -1,22 +1,26 @@
#!/bin/bash

# only process the 'log_cp10k' datasets
# 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"

cat > /tmp/params.yaml << 'HERE'
id: predict_modality_process_datasets
input_states: s3://openproblems-data/resources/datasets/**/log_cp10k/state.yaml
settings: '{"output_train_mod1": "$id/train_mod1.h5ad", "output_train_mod2": "$id/train_mod2.h5ad", "output_test_mod1": "$id/test_mod1.h5ad", "output_test_mod2": "$id/test_mod2.h5ad"}'
input_states: s3://openproblems-data/resources/datasets/**/state.yaml
rename_keys: 'input_mod1:output_mod1;input_mod2:output_mod2'
output_state: "$id/state.yaml"
publish_dir: s3://openproblems-data/resources/predict_modality/datasets
settings: '{"output_train_mod1": "$id/train_mod1.h5ad", "output_train_mod2": "$id/train_mod2.h5ad", "output_test_mod1": "$id/test_mod1.h5ad", "output_test_mod2": "$id/test_mod2.h5ad"}'
publish_dir: s3://openproblems-data/resources/task_predict_modality/datasets/
HERE

tw launch https://github.com/openproblems-bio/task_predict_modality.git \
--revision "build/main" \
--revision build/main \
--pull-latest \
--main-script target/nextflow/workflows/process_datasets/main.nf \
--workspace 53907369739130 \
--compute-env 6TeIFgV5OY4pJCk8I0bfOh \
--params-file /tmp/params.yaml \
--entry-name auto \
--config common/nextflow_helpers/labels_tw.config \
--labels predict_modality,process_datasets
--labels task_predict_modality,process_datasets
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ cd "$REPO_ROOT"

set -e

DATASETS_DIR="resources_test/common"
OUTPUT_DIR="resources_test/predict_modality"
RAW_DATA=resources_test/common
OUTPUT_DIR=resources_test/task_predict_modality

mkdir -p $OUTPUT_DIR

export NXF_VER=22.04.5

Expand Down Expand Up @@ -49,4 +51,9 @@ viash run src/methods/knnr_py/config.vsh.yaml -- \
--input_train_mod1 $OUTPUT_DIR/openproblems_neurips2021/bmmc_multiome/swap/train_mod1.h5ad \
--input_train_mod2 $OUTPUT_DIR/openproblems_neurips2021/bmmc_multiome/swap/train_mod2.h5ad \
--input_test_mod1 $OUTPUT_DIR/openproblems_neurips2021/bmmc_multiome/swap/test_mod1.h5ad \
--output $OUTPUT_DIR/openproblems_neurips2021/bmmc_multiome/swap/prediction.h5ad
--output $OUTPUT_DIR/openproblems_neurips2021/bmmc_multiome/swap/prediction.h5ad

# only run this if you have access to the openproblems-data bucket
aws s3 sync --profile op \
"$DATASET_DIR" s3://openproblems-data/resources_test/task_predict_modality \
--delete --dryrun
6 changes: 3 additions & 3 deletions scripts/create_readme.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash

common/create_task_readme/create_task_readme \
--task_dir src \
--output README.md
set -e

common/scripts/create_task_readme
16 changes: 0 additions & 16 deletions scripts/download_resources.sh

This file was deleted.

6 changes: 6 additions & 0 deletions scripts/project/build_all_components.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

set -e

# Build all components in a namespace (refer https://viash.io/reference/cli/ns_build.html)
viash ns test --parallel
7 changes: 7 additions & 0 deletions scripts/project/build_all_docker_containers.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

set -e

# Build all components in a namespace (refer https://viash.io/reference/cli/ns_build.html)
# and set up the container via a cached build
viash ns test --parallel --setup cachedbuild
6 changes: 6 additions & 0 deletions scripts/project/test_all_components.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

set -e

# Test all components in a namespace (refer https://viash.io/reference/cli/ns_test.html)
viash ns test --parallel
24 changes: 0 additions & 24 deletions scripts/resources_scripts/run_benchmark.sh

This file was deleted.

40 changes: 40 additions & 0 deletions scripts/run_benchmark/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/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_predict_modality' 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

# generate a unique id
RUN_ID="run_$(date +%Y-%m-%d_%H-%M-%S)"
publish_dir="s3://openproblems-data/resources/task_predict_modality/results/${RUN_ID}"

# make sure only log_cp10k is used
cat > /tmp/params.yaml << HERE
input_states: s3://openproblems-data/resources/task_predict_modality/datasets/**/state.yaml
rename_keys: 'input_train:output_train;input_test:output_test'
output_state: "state.yaml"
publish_dir: "$publish_dir"
HERE

tw launch https://github.com/openproblems-bio/task_predict_modality.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_predict_modality,full
35 changes: 35 additions & 0 deletions scripts/run_benchmark/run_on_test_resources.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/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_predict_modality' 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

cat > /tmp/params.yaml << 'HERE'
input_states: s3://openproblems-data/resources_test/task_predict_modality/**/state.yaml
rename_keys: 'input_train:output_train;input_test:output_test;input_solution:output_solution'
output_state: "state.yaml"
publish_dir: s3://openproblems-nextflow/temp/task_predict_modality/
HERE

tw launch https://github.com/openproblems-bio/task_predict_modality.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_predict_modality,test
5 changes: 5 additions & 0 deletions scripts/sync_resources.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

set -e

common/scripts/sync_resources
4 changes: 2 additions & 2 deletions src/api/comp_control_method.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,5 @@ test_resources:
path: /common/component_tests/check_config.py
- type: python_script
path: /common/component_tests/run_and_check_output.py
- path: /resources_test/predict_modality/openproblems_neurips2021/bmmc_cite/swap
dest: resources_test/predict_modality/openproblems_neurips2021/bmmc_cite/swap
- path: /resources_test/task_predict_modality/openproblems_neurips2021/bmmc_cite/swap
dest: resources_test/task_predict_modality/openproblems_neurips2021/bmmc_cite/swap
6 changes: 2 additions & 4 deletions src/api/comp_method.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@ arguments:
direction: output
required: true
test_resources:
- type: python_script
path: /common/component_tests/check_config.py
- type: python_script
path: /common/component_tests/run_and_check_output.py
- path: /resources_test/predict_modality/openproblems_neurips2021/bmmc_cite/swap
dest: resources_test/predict_modality/openproblems_neurips2021/bmmc_cite/swap
- path: /resources_test/task_predict_modality/openproblems_neurips2021/bmmc_cite/swap
dest: resources_test/task_predict_modality/openproblems_neurips2021/bmmc_cite/swap
7 changes: 6 additions & 1 deletion src/api/comp_method_predict.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,9 @@ arguments:
- name: "--output"
__merge__: file_prediction.yaml
direction: output
required: true
required: true
test_resources:
- type: python_script
path: /common/component_tests/run_and_check_output.py
- path: /resources_test/task_predict_modality/openproblems_neurips2021/bmmc_cite/swap
dest: resources_test/task_predict_modality/openproblems_neurips2021/bmmc_cite/swap
6 changes: 2 additions & 4 deletions src/api/comp_method_train.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@ arguments:
direction: output
required: true
test_resources:
- type: python_script
path: /common/component_tests/check_config.py
- type: python_script
path: /common/component_tests/run_and_check_output.py
- path: /resources_test/predict_modality/openproblems_neurips2021/bmmc_cite/swap
dest: resources_test/predict_modality/openproblems_neurips2021/bmmc_cite/swap
- path: /resources_test/task_predict_modality/openproblems_neurips2021/bmmc_cite/swap
dest: resources_test/task_predict_modality/openproblems_neurips2021/bmmc_cite/swap
Loading

0 comments on commit 75cedc8

Please sign in to comment.