Skip to content

Commit

Permalink
update UniverSC module
Browse files Browse the repository at this point in the history
  add inputs, outputs and example calls for UniverSC and Cell Ranger v3.0.2
  calls versions for UniverSC and Cell Ranger
  • Loading branch information
TomKellyGenetics committed Sep 12, 2022
1 parent a711a45 commit 74c4908
Showing 1 changed file with 89 additions and 14 deletions.
103 changes: 89 additions & 14 deletions modules/universc/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ process UNIVERSC {
// Software MUST be pinned to channel (i.e. "bioconda"), version (i.e. "1.10").
// For Conda, the build (i.e. "h9402c20_2") must be EXCLUDED to support installation on different operating systems.
// TODO nf-core: See section in main README for further information regarding finding and adding container addresses to the section below.
conda (params.enable_conda ? "YOUR-TOOL-HERE" : null)
conda (params.enable_conda ? "UniverSC" : null)
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/YOUR-TOOL-HERE':
'quay.io/biocontainers/YOUR-TOOL-HERE' }"
'https://hub.docker.com/layers/tomkellygenetics/universc':
'docker.io/tomkellygenetics/universc:latest' }"

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

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

when:
task.ext.when == null || task.ext.when

script:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
def sample_arg = meta.samples.unique().join(",")
def reference_name = reference.name
def input_reads = meta.single_end ? "--file $reads" : "-R1 ${reads[0]} -R2 ${reads[1]}"
// TODO nf-core: Where possible, a command MUST be provided to obtain the version number of the software e.g. 1.10
// If the software is unable to output a version number on the command-line then it can be manually specified
// e.g. https://github.com/nf-core/modules/blob/master/modules/homer/annotatepeaks/main.nf
Expand All @@ -59,17 +64,87 @@ process UNIVERSC {
// TODO nf-core: Please replace the example samtools command below with your module's command
// TODO nf-core: Please indent the command appropriately (4 spaces!!) to help with readability ;)
"""
samtools \\
sort \\
$args \\
-@ $task.cpus \\
-o ${prefix}.bam \\
-T $prefix \\
$bam
bash /universc/launch_universc.sh \\
--technology '${meta.technology}' \\
--id 'sample-${meta.id}' \\
$input_reads \\
--reference ${reference_name} \\
--sample ${sample_arg} \\
--jobmode "local" \\
--localcores ${task.cpus} \\
--localmem ${task.memory.toGiga()} \\
--per-cell-data \\
$args
cat <<-END_VERSIONS > versions.yml
"${task.process}":
cellranger: cellranger count --version 2>&1 | head -n 2 | tail -n 1 | sed 's/^.* \(\(\d*\)\)/\1/'| sed 's/[)(]//g'
universc: bash /universc/launch_universc.sh --version | grep version | grep universc | sed 's/^.* \(\(\d*\)\)/\1/'
END_VERSIONS
"""


stub:
"""
mkdir -p "sample-${meta.id}/outs/"
touch sample-${meta.id}/outs/fake_file.txt
cat <<-END_VERSIONS > versions.yml
"${task.process}":
cellranger: cellranger count --version 2>&1 | head -n 2 | tail -n 1 | sed 's/^.* \(\(\d*\)\)/\1/'| sed 's/[)(]//g'
universc: bash /universc/launch_universc.sh --version | grep version | grep universc | sed 's/^.* \(\(\d*\)\)/\1/'
END_VERSIONS
}
process CELLRANGER_COUNT_OS {
tag "$meta.id"
label 'process_medium'
if (params.enable_conda) {
exit 1, "Conda environments cannot be used when using the Cell Ranger tool. Please use docker or singularity containers."
}
container "tomkellygenetics/cellranger_clean:3.0.2.9001"
input:
tuple val(meta), path(reads)
path reference
output:
path("sample-${meta.id}/outs/*"), emit: outs
path "versions.yml" , emit: versions
when:
task.ext.when == null || task.ext.when
script:
def args = task.ext.args ?: ''
def sample_arg = meta.samples.unique().join(",")
def reference_name = reference.name
"""
cellranger \\
count \\
--id='sample-${meta.id}' \\
--fastqs=. \\
--transcriptome=$reference_name \\
--sample=$sample_arg \\
--localcores=$task.cpus \\
--localmem=${task.memory.toGiga()} \\
$args

cat <<-END_VERSIONS > versions.yml
"${task.process}":
cellranger: cellranger count --version 2>&1 | head -n 2 | tail -n 1 | sed 's/^.* \(\(\d*\)\)/\1/'| sed 's/[)(]//g'
END_VERSIONS
"""
stub:
"""
mkdir -p "sample-${meta.id}/outs/"
touch sample-${meta.id}/outs/fake_file.txt

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

0 comments on commit 74c4908

Please sign in to comment.