Skip to content

Commit

Permalink
generate test resources with wf
Browse files Browse the repository at this point in the history
  • Loading branch information
rcannood committed Aug 16, 2024
1 parent c09fea0 commit 0857e4d
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 5 deletions.
9 changes: 6 additions & 3 deletions scripts/generate_test_resource.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
#!/bin/bash

viash run src/process_datasets/convert/config.vsh.yaml -- \
nextflow run . \
-main-script target/nextflow/workflows/process_datasets/main.nf \
--input_sc resources_test/datasets_raw/MOBNEW/dataset_sc.rds \
--input_sp resources_test/datasets_raw/MOBNEW/dataset_sp.rds \
--output_sc resources_test/datasets/MOBNEW/dataset_sc.h5ad \
--output_sp resources_test/datasets/MOBNEW/dataset_sp.h5ad \
--output_sp resources_test/datasets/MOBNEW/temp_dataset_sp_part1.h5ad \
--id MOBNEW \
--dataset_id MOBNEW \
--dataset_name "MOBNEW" \
--dataset_description "MOBNEW" \
--dataset_summary "MOBNEW" \
--dataset_reference "..." \
--dataset_organism "mus_musculus"
--dataset_organism "mus_musculus" \
--publish_dir resources_test/datasets

viash run src/methods/scdesign3/config.vsh.yaml -- \
--input resources_test/datasets/MOBNEW/dataset_sp.h5ad \
Expand Down
4 changes: 3 additions & 1 deletion src/api/comp_process_datasets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,14 @@ argument_groups:
name: --output_sc
description: Processed single-cell dataset
direction: output
required: true
required: true
default: '$id/output_sc.h5ad'
- type: file
name: --output_sp
description: Processed spatial dataset
direction: output
required: true
default: '$id/output_sp.h5ad'

- name: Dataset metadata
description: Metadata about the dataset, used for documentation and provenance.
Expand Down
2 changes: 1 addition & 1 deletion src/process_datasets/sc_features/script.R
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@ cat("Output dataset:\n")
print(input_sp)

cat("Write output files\n")
output_sp$write_h5ad(par$output_sp, compression = "gzip")
input_sp$write_h5ad(par$output_sp, compression = "gzip")
18 changes: 18 additions & 0 deletions src/workflows/process_datasets/config.vsh.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
__merge__: /src/api/comp_process_datasets.yaml
name: "process_datasets"
namespace: "workflows"
resources:
- type: nextflow_script
path: main.nf
entrypoint: run_wf
- path: /common/nextflow_helpers/helper.nf
dependencies:
- name: common/check_dataset_schema
repository: openproblems_v2
- name: common/extract_metadata
repository: openproblems_v2
- name: process_datasets/convert
- name: process_datasets/sc_features
- name: process_datasets/precompute_downstream
runners:
- type: nextflow
54 changes: 54 additions & 0 deletions src/workflows/process_datasets/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
include { findArgumentSchema } from "${meta.resources_dir}/helper.nf"

workflow auto {
findStates(params, meta.config)
| meta.workflow.run(
auto: [publish: "state"]
)
}

workflow run_wf {
take:
input_ch

main:

output_ch = input_ch

| convert.run(
fromState: [
"input_sc",
"input_sp",
"dataset_id",
"dataset_name",
"dataset_url",
"dataset_reference",
"dataset_summary",
"dataset_description",
"dataset_organism"
],
toState: [
"output_sc",
"output_sp"
]
)

| sc_features.run(
fromState: ["input_sp": "output_sp"],
toState: ["output_sp"]
)

| precompute_downstream.run(
fromState: ["input_sp": "output_sp"],
toState: ["output_sp"]
)

| setState ([
"output_sc",
"output_sp",
"_meta"
])

emit:
output_ch
}

0 comments on commit 0857e4d

Please sign in to comment.