Merge pull request #92 from drpatelh/salmon

Update Salmon modules
This commit is contained in:
Harshil Patel 2020-12-09 23:01:06 +00:00 committed by GitHub
commit deb0a103db
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 31 additions and 11 deletions

View file

@ -5,7 +5,7 @@ params.options = [:]
def options = initOptions(params.options) def options = initOptions(params.options)
process SALMON_INDEX { process SALMON_INDEX {
tag "$fasta" tag "$transcript_fasta"
label "process_medium" label "process_medium"
publishDir "${params.outdir}", publishDir "${params.outdir}",
mode: params.publish_dir_mode, mode: params.publish_dir_mode,
@ -15,21 +15,33 @@ process SALMON_INDEX {
container "quay.io/biocontainers/salmon:1.3.0--hf69c8f4_0" container "quay.io/biocontainers/salmon:1.3.0--hf69c8f4_0"
input: input:
path fasta path genome_fasta
path transcript_fasta
output: output:
path "salmon" , emit: index path "salmon" , emit: index
path "*.version.txt", emit: version path "*.version.txt", emit: version
script: script:
def software = getSoftwareName(task.process) def software = getSoftwareName(task.process)
def get_decoy_ids = "grep '^>' $genome_fasta | cut -d ' ' -f 1 > decoys.txt"
def gentrome = "gentrome.fa"
if (genome_fasta.endsWith('.gz')) {
get_decoy_ids = "grep '^>' <(gunzip -c $genome_fasta) | cut -d ' ' -f 1 > decoys.txt"
gentrome = "gentrome.fa.gz"
}
""" """
$get_decoy_ids
sed -i.bak -e 's/>//g' decoys.txt
cat $transcript_fasta $genome_fasta > $gentrome
salmon \\ salmon \\
index \\ index \\
--threads $task.cpus \\ --threads $task.cpus \\
-t $fasta \\ -t gentrome.fa \\
-d decoys.txt \\
$options.args \\ $options.args \\
-i salmon -i salmon
salmon --version | sed -e "s/salmon //g" > ${software}.version.txt salmon --version | sed -e "s/salmon //g" > ${software}.version.txt
""" """
} }

View file

@ -18,16 +18,24 @@ process SALMON_QUANT {
tuple val(meta), path(reads) tuple val(meta), path(reads)
path index path index
path gtf path gtf
path transcript_fasta
val alignment_mode
output: output:
tuple val(meta), path("${prefix}"), emit: results tuple val(meta), path("${prefix}"), emit: results
path "*.version.txt" , emit: version path "*.version.txt" , emit: version
script: script:
def software = getSoftwareName(task.process) def software = getSoftwareName(task.process)
prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}" prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
def endedness = meta.single_end ? "-r $reads" : "-1 ${reads[0]} -2 ${reads[1]}"
def reference = "--index $index"
def input_reads = meta.single_end ? "-r $reads" : "-1 ${reads[0]} -2 ${reads[1]}"
if (alignment_mode) {
reference = "-t $transcript_fasta"
input_reads = "-a $reads"
}
def strandedness = meta.single_end ? 'U' : 'IU' def strandedness = meta.single_end ? 'U' : 'IU'
if (meta.strandedness == 'forward') { if (meta.strandedness == 'forward') {
strandedness = meta.single_end ? 'SF' : 'ISF' strandedness = meta.single_end ? 'SF' : 'ISF'
@ -39,8 +47,8 @@ process SALMON_QUANT {
--geneMap $gtf \\ --geneMap $gtf \\
--threads $task.cpus \\ --threads $task.cpus \\
--libType=$strandedness \\ --libType=$strandedness \\
--index $index \\ $reference \\
$endedness \\ $input_reads \\
$options.args \\ $options.args \\
-o $prefix -o $prefix

View file

@ -6,7 +6,7 @@ def options = initOptions(params.options)
def VERSION = '377' def VERSION = '377'
process UCSC_BEDRAPHTOBIGWIG { process UCSC_BEDGRAPHTOBIGWIG {
tag "$meta.id" tag "$meta.id"
label 'process_medium' label 'process_medium'
publishDir "${params.outdir}", publishDir "${params.outdir}",