Skip to content

Commit

Permalink
Add arguments for filtering methods in benchmark workflow (#4)
Browse files Browse the repository at this point in the history
* Add arguments to filtering methods in benchmark WF

* Apply suggestions from code review

Co-authored-by: Robrecht Cannoodt <[email protected]>

* Tidy method argument definitions

* Move checkMethodAllowed Nexflow helper to common

* Move checkMethodAllowed Nexflow helper to common

---------

Co-authored-by: Robrecht Cannoodt <[email protected]>
  • Loading branch information
lazappi and rcannood authored Oct 22, 2024
1 parent 0149793 commit 4cb77a4
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 5 deletions.
2 changes: 1 addition & 1 deletion common
19 changes: 16 additions & 3 deletions src/workflows/run_benchmark/config.vsh.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,32 @@ argument_groups:
required: true
direction: output
default: task_info.yaml
- name: Methods
- name: Method filtering
description: |
Use these arguments to filter methods by name. By default, all methods are
run. If `--methods_include` is defined, only those methods are run. If
`--methods_exclude` is defined, all methods except those specified are run.
These arguments are mutually exclusive, so only `--methods_include` OR
`--methods_exclude` can set but not both.
arguments:
- name: "--method_ids"
- name: "--methods_include"
type: string
multiple: true
description: A list of method ids to run. If not specified, all methods will be run.
description: |
A list of method ids to include. If specified, only these methods will be run.
- name: "--methods_exclude"
type: string
multiple: true
description: |
A list of method ids to exclude. If specified, all methods except the ones listed will be run.
resources:
- type: nextflow_script
path: main.nf
entrypoint: run_wf
- type: file
path: /_viash.yaml
- path: /common/nextflow_helpers/helper.nf

dependencies:
- name: h5ad/extract_uns_metadata
Expand Down
11 changes: 10 additions & 1 deletion src/workflows/run_benchmark/main.nf
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
include { checkItemAllowed } from "${meta.resources_dir}/helper.nf"

workflow auto {
findStates(params, meta.config)
| meta.workflow.run(
Expand Down Expand Up @@ -75,6 +77,7 @@ workflow run_wf {
/***************************
* RUN METHODS AND METRICS *
***************************/

score_ch = dataset_ch

// run all methods
Expand All @@ -88,7 +91,13 @@ workflow run_wf {
// if the preferred normalisation is none at all,
// we can pass whichever dataset we want
def norm_check = (norm == "log_cp10k" && pref == "counts") || norm == pref
def method_check = !state.method_ids || state.method_ids.contains(comp.config.name)
def method_check = checkItemAllowed(
comp.config.name,
state.methods_include,
state.methods_exclude,
"methods_include",
"methods_exclude"
)

method_check && norm_check
},
Expand Down

0 comments on commit 4cb77a4

Please sign in to comment.