Skip to content

Commit 1b59fef

Browse files
Update module: sparsesignatures (#8950)
minor module updates Co-authored-by: Simon Pearce <24893913+SPPearce@users.noreply.github.com>
1 parent d935734 commit 1b59fef

File tree

4 files changed

+24
-9
lines changed

4 files changed

+24
-9
lines changed

modules/nf-core/sparsesignatures/main.nf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ process SPARSE_SIGNATURES {
99

1010
input:
1111
tuple val(meta), path(tsv_join, stageAs: '*.tsv')
12-
12+
val(genome) // genome version
13+
1314
output:
1415
tuple val(meta), path("*_mut_counts.rds"), emit: signatures_mutCounts_rds
1516
tuple val(meta), path("*_cv_means_mse.rds"), emit: signatures_cv_rds

modules/nf-core/sparsesignatures/meta.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ input:
3838
pattern: "*.{tsv}"
3939
ontologies:
4040
- edam: http://edamontology.org/format_3475 # TSV
41+
- genome:
42+
type: string
43+
description: Reference genome name to use with SparseSignatures (e.g. "GRCh37", "GRCh38")
44+
ontologies: []
4145
output:
4246
signatures_mutCounts_rds:
4347
- - meta:
@@ -115,8 +119,8 @@ output:
115119
ontologies:
116120
- edam: http://edamontology.org/format_3750 # YAML
117121
authors:
118-
- "@Katerina10-cloud"
122+
- "@kdavydzenka"
119123
- "@elena-buscaroli"
120124
maintainers:
121-
- "@Katerina10-cloud"
125+
- "@kdavydzenka"
122126
- "@elena-buscaroli"

modules/nf-core/sparsesignatures/templates/main_script.R

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ parse_args <- function(x) {
2121

2222
opt = list(
2323
prefix = ifelse('$task.ext.prefix' == 'null', '$meta.id', '$task.ext.prefix'),
24-
genome = "NULL",
24+
genome = "${genome}",
2525
K = "2:10",
2626
nmf_runs = "10",
2727
iterations = "30",
@@ -75,13 +75,19 @@ load_genome = function(genome, input_data) {
7575
if (genome == "GRCh37") {
7676
library(BSgenome.Hsapiens.1000genomes.hs37d5)
7777
bsg = BSgenome.Hsapiens.1000genomes.hs37d5::hs37d5
78-
input_data <- input_data %>% mutate(chrom = str_remove(chrom,"^chr"))
78+
79+
if (any(grepl("^chr", input_data[["chrom"]]))) {
80+
input_data <- input_data %>% mutate(chrom = str_remove(chrom, "^chr"))
81+
}
7982

8083
} else if (genome == "GRCh38") {
8184
library(BSgenome.Hsapiens.UCSC.hg38)
8285
bsg = BSgenome.Hsapiens.UCSC.hg38
83-
84-
# Leave 'chrom' unchanged for GRCh38
86+
87+
if (all(!grepl("^chr", input_data[["chrom"]]))) {
88+
input_data <- input_data %>% mutate(chrom = paste0("chr", chrom))
89+
}
90+
8591
}
8692
return(list(bsg = bsg, input_data = input_data))
8793
}

modules/nf-core/sparsesignatures/tests/main.nf.test

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ nextflow_process {
1515
when {
1616

1717
params {
18-
module_args = '[genome:GRCh37, K:2:3, nmf_runs:3, iterations:5, max_iterations_lasso:80, cross_validation_repetitions:3, cross_validation_iterations:3, cross_validation_entries:0.01, lambda_values_alpha:c(0.00, 0.01), lambda_values_beta:c(0.01, 0.05), lambda_rate_alpha:0, num_processes:all, seed:42]'
18+
module_args = '[K:2:3, nmf_runs:3, iterations:5, max_iterations_lasso:80, cross_validation_repetitions:3, cross_validation_iterations:3, cross_validation_entries:0.01, lambda_values_alpha:c(0.00, 0.01), lambda_values_beta:c(0.01, 0.05), lambda_rate_alpha:0, num_processes:all, seed:42]'
1919
}
2020

2121
process {
@@ -24,6 +24,7 @@ nextflow_process {
2424
[ id:'test_grch37'],
2525
file(params.modules_testdata_base_path + 'delete_me/sparsesignatures/test_GRCh37/MSeq_Set06_joint_table.tsv', checkIfExists: true)
2626
]
27+
input[1] = "GRCh37"
2728
"""
2829
}
2930
}
@@ -59,6 +60,7 @@ nextflow_process {
5960
[ id:'test_grch37'], // meta map
6061
file(params.modules_testdata_base_path + 'delete_me/sparsesignatures/test_GRCh37/MSeq_Set06_joint_table.tsv', checkIfExists: true)
6162
]
63+
input[1] = "GRCh37"
6264
"""
6365
}
6466
}
@@ -79,7 +81,7 @@ nextflow_process {
7981

8082
when {
8183
params {
82-
module_args = '[genome:GRCh38, K:2:3, nmf_runs:3, iterations:5, max_iterations_lasso:80, cross_validation_repetitions:3, cross_validation_iterations:3, cross_validation_entries:0.01, lambda_values_alpha:c(0.00, 0.01), lambda_values_beta:c(0.01, 0.05), lambda_rate_alpha:0, num_processes:all, seed:42]'
84+
module_args = '[K:2:3, nmf_runs:3, iterations:5, max_iterations_lasso:80, cross_validation_repetitions:3, cross_validation_iterations:3, cross_validation_entries:0.01, lambda_values_alpha:c(0.00, 0.01), lambda_values_beta:c(0.01, 0.05), lambda_rate_alpha:0, num_processes:all, seed:42]'
8385
}
8486

8587
process {
@@ -88,6 +90,7 @@ nextflow_process {
8890
[ id:'test_grch38' ], // meta map
8991
file(params.modules_testdata_base_path + 'delete_me/sparsesignatures/test_GRCh38/HCC1395_WXS_HCC1395_joint_table.tsv', checkIfExists: true)
9092
]
93+
input[1] = "GRCh38"
9194
"""
9295
}
9396
}
@@ -120,6 +123,7 @@ nextflow_process {
120123
[ id:'test_grch38' ],
121124
file(params.modules_testdata_base_path + 'delete_me/sparsesignatures/test_GRCh38/HCC1395_WXS_HCC1395_joint_table.tsv', checkIfExists: true)
122125
]
126+
input[1] = "GRCh38"
123127
"""
124128
}
125129
}

0 commit comments

Comments
 (0)