Skip to content

Commit 8f26297

Browse files
update UniverSC module
add inputs, outputs and example calls for UniverSC and Cell Ranger v3.0.2 calls versions for UniverSC and Cell Ranger
1 parent b392506 commit 8f26297

File tree

1 file changed

+89
-14
lines changed

1 file changed

+89
-14
lines changed

modules/universc/main.nf

Lines changed: 89 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ process UNIVERSC {
2323
// Software MUST be pinned to channel (i.e. "bioconda"), version (i.e. "1.10").
2424
// For Conda, the build (i.e. "h9402c20_2") must be EXCLUDED to support installation on different operating systems.
2525
// TODO nf-core: See section in main README for further information regarding finding and adding container addresses to the section below.
26-
conda (params.enable_conda ? "YOUR-TOOL-HERE" : null)
26+
conda (params.enable_conda ? "UniverSC" : null)
2727
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
28-
'https://depot.galaxyproject.org/singularity/YOUR-TOOL-HERE':
29-
'quay.io/biocontainers/YOUR-TOOL-HERE' }"
28+
'https://hub.docker.com/layers/tomkellygenetics/universc':
29+
'docker.io/tomkellygenetics/universc:latest' }"
3030

3131
input:
3232
// TODO nf-core: Where applicable all sample-specific information e.g. "id", "single_end", "read_group"
@@ -35,20 +35,25 @@ process UNIVERSC {
3535
// https://github.com/nf-core/modules/blob/master/modules/bwa/index/main.nf
3636
// TODO nf-core: Where applicable please provide/convert compressed files as input/output
3737
// e.g. "*.fastq.gz" and NOT "*.fastq", "*.bam" and NOT "*.sam" etc.
38-
tuple val(meta), path(bam)
38+
tuple val(meta), path(reads)
39+
path reference
3940

4041
output:
4142
// TODO nf-core: Named file extensions MUST be emitted for ALL output channels
42-
tuple val(meta), path("*.bam"), emit: bam
43+
output:
44+
path("sample-${meta.id}/outs/*"), emit: outs
4345
// TODO nf-core: List additional required output channels/values here
44-
path "versions.yml" , emit: versions
46+
path "versions.yml" , emit: versions
4547

4648
when:
4749
task.ext.when == null || task.ext.when
4850

4951
script:
5052
def args = task.ext.args ?: ''
5153
def prefix = task.ext.prefix ?: "${meta.id}"
54+
def sample_arg = meta.samples.unique().join(",")
55+
def reference_name = reference.name
56+
def input_reads = meta.single_end ? "--file $reads" : "-R1 ${reads[0]} -R2 ${reads[1]}"
5257
// TODO nf-core: Where possible, a command MUST be provided to obtain the version number of the software e.g. 1.10
5358
// If the software is unable to output a version number on the command-line then it can be manually specified
5459
// e.g. https://github.com/nf-core/modules/blob/master/modules/homer/annotatepeaks/main.nf
@@ -59,17 +64,87 @@ process UNIVERSC {
5964
// TODO nf-core: Please replace the example samtools command below with your module's command
6065
// TODO nf-core: Please indent the command appropriately (4 spaces!!) to help with readability ;)
6166
"""
62-
samtools \\
63-
sort \\
64-
$args \\
65-
-@ $task.cpus \\
66-
-o ${prefix}.bam \\
67-
-T $prefix \\
68-
$bam
67+
bash /universc/launch_universc.sh \\
68+
--technology '${meta.technology}' \\
69+
--id 'sample-${meta.id}' \\
70+
$input_reads \\
71+
--reference ${reference_name} \\
72+
--sample ${sample_arg} \\
73+
--jobmode "local" \\
74+
--localcores ${task.cpus} \\
75+
--localmem ${task.memory.toGiga()} \\
76+
--per-cell-data \\
77+
$args
78+
79+
cat <<-END_VERSIONS > versions.yml
80+
"${task.process}":
81+
cellranger: cellranger count --version 2>&1 | head -n 2 | tail -n 1 | sed 's/^.* \(\(\d*\)\)/\1/'| sed 's/[)(]//g'
82+
universc: bash /universc/launch_universc.sh --version | grep version | grep universc | sed 's/^.* \(\(\d*\)\)/\1/'
83+
END_VERSIONS
84+
"""
85+
86+
87+
stub:
88+
"""
89+
mkdir -p "sample-${meta.id}/outs/"
90+
touch sample-${meta.id}/outs/fake_file.txt
91+
92+
cat <<-END_VERSIONS > versions.yml
93+
"${task.process}":
94+
cellranger: cellranger count --version 2>&1 | head -n 2 | tail -n 1 | sed 's/^.* \(\(\d*\)\)/\1/'| sed 's/[)(]//g'
95+
universc: bash /universc/launch_universc.sh --version | grep version | grep universc | sed 's/^.* \(\(\d*\)\)/\1/'
96+
END_VERSIONS
97+
}
98+
99+
process CELLRANGER_COUNT_OS {
100+
tag "$meta.id"
101+
label 'process_medium'
102+
103+
if (params.enable_conda) {
104+
exit 1, "Conda environments cannot be used when using the Cell Ranger tool. Please use docker or singularity containers."
105+
}
106+
container "tomkellygenetics/cellranger_clean:3.0.2.9001"
107+
108+
input:
109+
tuple val(meta), path(reads)
110+
path reference
111+
112+
output:
113+
path("sample-${meta.id}/outs/*"), emit: outs
114+
path "versions.yml" , emit: versions
115+
116+
when:
117+
task.ext.when == null || task.ext.when
118+
119+
script:
120+
def args = task.ext.args ?: ''
121+
def sample_arg = meta.samples.unique().join(",")
122+
def reference_name = reference.name
123+
"""
124+
cellranger \\
125+
count \\
126+
--id='sample-${meta.id}' \\
127+
--fastqs=. \\
128+
--transcriptome=$reference_name \\
129+
--sample=$sample_arg \\
130+
--localcores=$task.cpus \\
131+
--localmem=${task.memory.toGiga()} \\
132+
$args
133+
134+
cat <<-END_VERSIONS > versions.yml
135+
"${task.process}":
136+
cellranger: cellranger count --version 2>&1 | head -n 2 | tail -n 1 | sed 's/^.* \(\(\d*\)\)/\1/'| sed 's/[)(]//g'
137+
END_VERSIONS
138+
"""
139+
140+
stub:
141+
"""
142+
mkdir -p "sample-${meta.id}/outs/"
143+
touch sample-${meta.id}/outs/fake_file.txt
69144

70145
cat <<-END_VERSIONS > versions.yml
71146
"${task.process}":
72-
universc: \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//' ))
147+
cellranger: cellranger count --version 2>&1 | head -n 2 | tail -n 1 | sed 's/^.* \(\(\d*\)\)/\1/'| sed 's/[)(]//g'
73148
END_VERSIONS
74149
"""
75150
}

0 commit comments

Comments
 (0)