Skip to content

Commit 6f93ddc

Browse files
feat: handle boolean parameters from groovy to R
1 parent e59ae7b commit 6f93ddc

4 files changed

Lines changed: 42 additions & 2 deletions

File tree

main.nf

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ counts : ${params.counts}
1818
.stripIndent()
1919

2020
include { create_multiOmicDataSet_from_files } from './modules/local/mosuite/create_multiOmicDataSet_from_files/'
21+
include { clean_raw_counts } from './modules/local/mosuite/clean_raw_counts/'
2122

2223
// workflow.onComplete {
2324
// if (!workflow.stubRun && !workflow.commandLine.contains('-preview')) {
@@ -32,5 +33,7 @@ workflow {
3233
ch_input = Channel.fromPath(file(params.samplesheet, checkIfExists: true))
3334
.combine(Channel.fromPath(file(params.counts, checkIfExists: true)))
3435

35-
ch_input | create_multiOmicDataSet_from_files
36+
ch_moo = ch_input |
37+
create_multiOmicDataSet_from_files
38+
clean_raw_counts(ch_moo, [ params.aggregate_rows_with_duplicate_gene_names, params.cleanup_column_names, params.split_gene_name ])
3639
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
process clean_raw_counts {
2+
container "${params.container}"
3+
4+
input:
5+
path(moo)
6+
tuple val(aggregate_rows_with_duplicate_gene_names), val(cleanup_column_names), val(split_gene_name)
7+
8+
output:
9+
path("moo_clean.rds"), emit: 'moo'
10+
path("figures/"), emit: figures
11+
12+
script:
13+
"""
14+
#!/usr/bin/env Rscript
15+
16+
options(MOO_SAVE_PLOTS = TRUE)
17+
library(MOSuite)
18+
19+
true <- TRUE
20+
false <- FALSE
21+
null <- NULL
22+
23+
moo <- readr::read_rds("$moo") |>
24+
clean_raw_counts(
25+
aggregate_rows_with_duplicate_gene_names = $aggregate_rows_with_duplicate_gene_names,
26+
cleanup_column_names = $cleanup_column_names,
27+
split_gene_name = $split_gene_name
28+
)
29+
30+
readr::write_rds(moo, "moo_clean.rds")
31+
"""
32+
}

modules/local/mosuite/create_multiOmicDataSet_from_files/main.nf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ process create_multiOmicDataSet_from_files {
55
tuple path(samplesheet), path(counts)
66

77
output:
8-
path("moo*.rds")
8+
path("moo*.rds"), emit: moo
99

1010
script:
1111
"""

nextflow.config

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ params {
55
samplesheet = null
66
counts = null
77

8+
// clean_raw_counts
9+
aggregate_rows_with_duplicate_gene_names = true
10+
cleanup_column_names = true
11+
split_gene_name = true
12+
813
// Boilerplate options
914
outputDir = 'results'
1015
tracedir = "${params.outputDir}/pipeline_info"

0 commit comments

Comments
 (0)