Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add stability analysis #48

Merged
merged 19 commits into from
May 24, 2024
Merged
Prev Previous commit
Next Next commit
update wf
  • Loading branch information
rcannood committed May 23, 2024
commit 34913a624f90265e2e19acf8bc0ceab28f628247
13 changes: 12 additions & 1 deletion src/task/workflows/run_benchmark/config.vsh.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,22 @@ functionality:
required: true
direction: output
default: task_info.yaml
- name: Methods
- name: Arguments
arguments:
- name: "--method_ids"
type: string
multiple: true
description: A list of method ids to run. If not specified, all methods will be run.
- name: --bootstrap_num_replicates
type: integer
required: true
example: 10
description: Number of bootstraps to generate.
- name: --bootstrap_sample_fraction
type: double
required: true
example: 0.95
description: Fraction of the dataset to include in each bootstrap.
resources:
- type: nextflow_script
path: main.nf
Expand All @@ -82,6 +92,7 @@ functionality:
- name: metrics/mean_rowwise_error
- name: metrics/mean_cosine_sim
- name: metrics/mean_correlation
- name: process_dataset/bootstrap
repositories:
- name: openproblemsv2
type: github
Expand Down
31 changes: 31 additions & 0 deletions src/task/workflows/run_benchmark/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,37 @@ workflow run_wf {
***************************/
score_ch = dataset_ch

// Bootstrap the dataset (if necessary)
| bootstrap.run(
runIf: { id, state -> state.bootstrap_fraction },

fromState: [
input_parquet: "de_train",
input_h5ad: "de_train_h5ad",
bootstrap_num_replicates: "bootstrap_num_replicates",
bootstrap_sample_fraction: "bootstrap_sample_fraction"
],

toState: [
de_train: "output_parquet",
de_train_h5ad: "output_h5ad"
]
)

// flatten bootstraps (if necessary)
| flatMap { id, state ->
if (!state.bootstrap_fraction) {
return [[id, state]]
}

[state.de_train, state.de_train_h5ad]
.transpose()
.withIndex()
.collect{ el, idx ->
[id + "_bootstrap" + idx, state + [de_train: el[0], de_train_h5ad: el[1]]]
}
}

// run all methods
| runEach(
components: methods,
Expand Down