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

New Module: NACHO_NORMALISE #7100

Merged
merged 23 commits into from
Nov 29, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
51c8563
Create module
alanmmobbs93 Nov 26, 2024
3c5386e
parse arguments on module R script
alanmmobbs93 Nov 26, 2024
713eb78
update meta info
alanmmobbs93 Nov 26, 2024
290b53f
update nf-test
alanmmobbs93 Nov 26, 2024
0a488ae
Merge remote-tracking branch 'origin' into newmodule_nacho_normalise
alanmmobbs93 Nov 26, 2024
69373fd
update snaps after upgrading versions file
alanmmobbs93 Nov 26, 2024
ec020a1
update snaps after upgrading versions file
alanmmobbs93 Nov 26, 2024
2e306bb
add stub test, meta components and update names
alanmmobbs93 Nov 27, 2024
32b8b2b
remove comments from ymls
alanmmobbs93 Nov 27, 2024
b7ba0c5
change output
alanmmobbs93 Nov 27, 2024
4f40e2f
Merge branch 'master' into newmodule_nacho_normalise
atrigila Nov 27, 2024
b577694
add meta to output channels
alanmmobbs93 Nov 27, 2024
a3dd7fc
fix environment.yml linting
alanmmobbs93 Nov 27, 2024
566aec6
Merge branch 'newmodule_nacho_normalise' of https://github.com/alanmm…
alanmmobbs93 Nov 27, 2024
109954c
Merge branch 'master' into newmodule_nacho_normalise
alanmmobbs93 Nov 27, 2024
8fea3b7
update snaps
alanmmobbs93 Nov 27, 2024
162b616
Merge branch 'newmodule_nacho_normalise' of https://github.com/alanmm…
alanmmobbs93 Nov 27, 2024
01828c2
replace Stub with stub to pass linting
alanmmobbs93 Nov 27, 2024
380c3b0
Update main.nf.test
alanmmobbs93 Nov 27, 2024
f195ac7
change normalise by normalize
alanmmobbs93 Nov 28, 2024
e4e779b
move moduleBinaries to test nextflow config
alanmmobbs93 Nov 28, 2024
6061702
Merge branch 'master' into newmodule_nacho_normalise
alanmmobbs93 Nov 28, 2024
aa2faad
update snapshot after renaming
alanmmobbs93 Nov 28, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion modules/nf-core/nacho/normalise/environment.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
channels:
- conda-forge
dependencies:
Expand Down
11 changes: 7 additions & 4 deletions modules/nf-core/nacho/normalise/main.nf
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
nextflow.enable.moduleBinaries = true

process NACHO_NORMALISE {
tag "$sample_sheet"
tag "${meta.id}"
label 'process_single'

conda "${moduleDir}/environment.yml"
container 'community.wave.seqera.io/library/r-dplyr_r-fs_r-ggplot2_r-nacho_pruned:033bc017f5f36b6d'

input:
path rcc_files, stageAs: "input/*"
path sample_sheet
tuple val(meta) , path(rcc_files, stageAs: "input/*")
tuple val(meta2), path(sample_sheet)
atrigila marked this conversation as resolved.
Show resolved Hide resolved

output:
path "*normalized_counts.tsv" , emit: normalized_counts
alanmmobbs93 marked this conversation as resolved.
Show resolved Hide resolved
Expand All @@ -22,7 +22,10 @@ process NACHO_NORMALISE {
script:
def args = task.ext.args ?: ''
"""
nacho_norm.R --input_rcc_path input --input_samplesheet ${sample_sheet} $args
nacho_norm.R \\
--input_rcc_path input \\
$args \\
--input_samplesheet ${sample_sheet}

cat <<-END_VERSIONS > versions.yml
"${task.process}":
Expand Down
9 changes: 4 additions & 5 deletions modules/nf-core/nacho/normalise/meta.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json
name: nacho_normalise
description: |
NACHO (NAnostring quality Control dasHbOard) is developed for NanoString nCounter data.
Expand All @@ -22,8 +21,8 @@ tools:
homepage: https://github.com/mcanouil/NACHO
documentation: https://cran.r-project.org/web/packages/NACHO/vignettes/NACHO.html
doi: "doi:10.1093/bioinformatics/btz647"
licence: GPL-3.0 license
identifier: biotools:nacho
licence: [ "GPL-3.0" ]
identifier: ""

input:
- - rcc_files:
Expand Down Expand Up @@ -59,6 +58,6 @@ output:
pattern: "versions.yml"

authors:
- Mickaël Canouil, Gerard A. Bouland, Amélie Bonnefond, Philippe Froguel, Leen Hart, and Roderick Slieker.
- "@alanmobbs93"
maintainers:
-
- "@alanmobbs93"
alanmmobbs93 marked this conversation as resolved.
Show resolved Hide resolved
10 changes: 6 additions & 4 deletions modules/nf-core/nacho/normalise/resources/usr/bin/nacho_norm.R
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,13 @@ input_rcc_path <- opt$input_rcc_path
input_samplesheet <- opt$input_samplesheet
norm_method <- opt$norm_method

#Create filelist for NachoQC
# Create filelist for NachoQC

list_of_rccs <- dir_ls(path = input_rcc_path, glob = "*.RCC")
print(list_of_rccs)

####RealCode####
# Core Code
## Read data
nacho_data <- load_rcc(data_directory = input_rcc_path,
ssheet_csv = input_samplesheet,
id_colname = "RCC_FILE_NAME",
Expand All @@ -75,16 +76,17 @@ get_counts <- function(
tidyr::pivot_wider(names_from = "RCC_FILE_NAME", values_from = "Count_Norm")
}

#Write out normalized counts
## Write out normalized counts
norm_counts <- as.data.frame(get_counts(nacho_data))
write_tsv(norm_counts, file = "normalized_counts.tsv")

#Write out non-hk normalized counts too
## Create non-hk normalized counts too
nacho_data_no_hk <- load_rcc(data_directory = input_rcc_path,
ssheet_csv = input_samplesheet,
id_colname = "RCC_FILE_NAME",
normalisation_method = norm_method,
housekeeping_norm = FALSE)

## Export non-hk tables
norm_counts_without_hks <- as.data.frame(get_counts(nacho_data_no_hk))
write_tsv(norm_counts_without_hks, file = "normalized_counts_wo_HKnorm.tsv")
59 changes: 51 additions & 8 deletions modules/nf-core/nacho/normalise/tests/main.nf.test
alanmmobbs93 marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// TODO nf-core: Once you have added the required tests, please run the following command to build this file:
// nf-core modules test nacho/normalise
nextflow_process {

name "Test Process NACHO_NORMALISE"
Expand All @@ -12,7 +10,7 @@ nextflow_process {
tag "nacho"
tag "nacho/normalise"

test("Should run without failures") {
test("Salmon - RCC files") {

when {
params {
Expand All @@ -21,13 +19,58 @@ nextflow_process {
process {
"""
// RCC Files: Collect from sample sheet
input[0] = Channel.fromPath('https://raw.githubusercontent.com/nf-core/test-datasets/nanostring/samplesheets/samplesheet_test.csv', checkIfExists: true)
.splitCsv(header: true)
.map { row -> row.RCC_FILE } // Select first column: path to file
.collect()
input[0] =
Channel.fromPath('https://raw.githubusercontent.com/nf-core/test-datasets/nanostring/samplesheets/samplesheet_test.csv', checkIfExists: true)
.splitCsv( header: true )
.map { row -> return file(row.RCC_FILE, checkIfExists: true) } // Select first column: path to file // Select first column: path to file
.collect()
alanmmobbs93 marked this conversation as resolved.
Show resolved Hide resolved
.map{ files ->
tuple( [id: 'test'], files ) // Add meta component
}


// Sample sheet
input[1] = Channel.of( [
[ id: 'test_samplesheet'],
[ file('https://raw.githubusercontent.com/nf-core/test-datasets/nanostring/samplesheets/samplesheet_test.csv', checkIfExists: true) ]
] )
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match() }
)
}
}

test("Salmon - RCC files - Stub") {

options "-stub"
when {
params {
module_args = '--norm_method "GEO"'
}
process {
"""
// RCC Files: Collect from sample sheet
input[0] =
Channel.fromPath('https://raw.githubusercontent.com/nf-core/test-datasets/nanostring/samplesheets/samplesheet_test.csv', checkIfExists: true)
.splitCsv( header: true )
.map { row -> return file(row.RCC_FILE, checkIfExists: true) } // Select first column: path to file // Select first column: path to file
.collect()
.map{ files ->
tuple( [id: 'test'], files ) // Add meta component
}

// Sample sheet
input[1] = file('https://raw.githubusercontent.com/nf-core/test-datasets/nanostring/samplesheets/samplesheet_test.csv', checkIfExists: true)
input[1] =
Channel.of( [
[id: 'test_samplesheet'],
[ file('https://raw.githubusercontent.com/nf-core/test-datasets/nanostring/samplesheets/samplesheet_test.csv', checkIfExists: true) ]
] )
"""
}
}
Expand Down
33 changes: 31 additions & 2 deletions modules/nf-core/nacho/normalise/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -1,5 +1,34 @@
{
"Should run without failures": {
"Salmon - RCC files - Stub": {
atrigila marked this conversation as resolved.
Show resolved Hide resolved
"content": [
{
"0": [
"normalized_counts.tsv:md5,d41d8cd98f00b204e9800998ecf8427e"
],
"1": [
"normalized_counts_wo_HKnorm.tsv:md5,d41d8cd98f00b204e9800998ecf8427e"
],
"2": [
"versions.yml:md5,a67e277a3788bf01023f086295e6fab1"
],
"normalized_counts": [
"normalized_counts.tsv:md5,d41d8cd98f00b204e9800998ecf8427e"
],
"normalized_counts_wo_HK": [
"normalized_counts_wo_HKnorm.tsv:md5,d41d8cd98f00b204e9800998ecf8427e"
],
"versions": [
"versions.yml:md5,a67e277a3788bf01023f086295e6fab1"
]
}
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.10.1"
},
"timestamp": "2024-11-27T15:13:12.044326701"
},
"Salmon - RCC files": {
"content": [
{
"0": [
Expand All @@ -26,6 +55,6 @@
"nf-test": "0.9.2",
"nextflow": "24.10.1"
},
"timestamp": "2024-11-26T20:12:23.648098726"
"timestamp": "2024-11-27T15:12:49.870804363"
}
}
2 changes: 0 additions & 2 deletions modules/nf-core/nacho/normalise/tests/test.tap
alanmmobbs93 marked this conversation as resolved.
Outdated
Show resolved Hide resolved

This file was deleted.

Loading