Skip to content

Commit

Permalink
Merge pull request #18 from openproblems-bio/fixes
Browse files Browse the repository at this point in the history
Fixes to wf
  • Loading branch information
janursa authored Feb 6, 2025
2 parents 8428344 + 7564f51 commit 3ff38ca
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 37 deletions.
2 changes: 1 addition & 1 deletion _viash.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -107,4 +107,4 @@ repositories:
- name: openproblems
type: github
repo: openproblems-bio/openproblems
tag: build/main
tag: build/main
6 changes: 2 additions & 4 deletions src/workflows/run_grn_evaluation/config.vsh.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -111,16 +111,14 @@ resources:
- type: nextflow_script
path: main.nf
entrypoint: run_wf
- type: file
path: /_viash.yaml


dependencies:
- name: metrics/regression_2
- name: metrics/regression_1
- name: metrics/ws_distance


- name: utils/extract_uns_metadata
repository: openproblems

runners:
- type: executable
Expand Down
38 changes: 6 additions & 32 deletions src/workflows/run_grn_evaluation/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -22,41 +22,25 @@ workflow run_wf {
/***************************
* RUN METRICS *
***************************/
score_ch = input_ch
output_ch = input_ch
| map{ id, state ->
[id, state + ["_meta": [join_id: id]]]
}

// | positive_control.run(
// runIf: { id, state ->
// state.method_id == 'positive_control'
// },
// fromState: [
// perturbation_data: "perturbation_data",
// multiomics_rna: "multiomics_rna",
// layer: "layer",
// tf_all: "tf_all"
// ],
// toState: {id, output, state ->
// state + [
// prediction: output.prediction
// ]
// }
// )

// run all metrics
| runEach(
components: metrics,
filter: { id, state, comp ->
!state.metric_ids || state.metric_ids.contains(comp.config.functionality.name)
!state.metric_ids || state.metric_ids.contains(comp.config.name)
},
id: { id, state, comp ->
id + "." + comp.config.functionality.name
id + "." + comp.config.name
},
// use 'fromState' to fetch the arguments the component requires from the overall state
fromState: [
evaluation_data: "evaluation_data",
prediction: "prediction",
ws_distance_background: "ws_distance_background",
subsample: "subsample",
reg_type: "reg_type",
method_id: "method_id",
Expand All @@ -69,16 +53,14 @@ workflow run_wf {
// use 'toState' to publish that component's outputs to the overall state
toState: { id, output, state, comp ->
state + [
metric_id: comp.config.functionality.name,
metric_id: comp.config.name,
metric_output: output.score
]
}
)

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 ->
Expand All @@ -96,8 +78,6 @@ workflow run_wf {
def metric_configs_file = tempFile("metric_configs.yaml")
metric_configs_file.write(metric_configs_yaml_blob)

// def task_info_file = meta.resources_dir.resolve("task_info.yaml")

// store the scores in a file
def score_uns = states.collect{it.score_uns}
def score_uns_yaml_blob = toYamlBlob(score_uns)
Expand All @@ -113,12 +93,6 @@ workflow run_wf {
["output", new_state]
}

// merge all of the output data
| joinStates{ ids, states ->
def mergedStates = states.inject([:]) { acc, m -> acc + m }
[ids[0], mergedStates]
}

emit:
output_ch
}

0 comments on commit 3ff38ca

Please sign in to comment.