mirror of
https://github.com/MillironX/nf-core_modules.git
synced 2024-11-10 20:23:10 +00:00
0a7368aa6f
* Refactor genrich to avoid params in main * Missed to commit test.yml file
72 lines
2.8 KiB
Text
72 lines
2.8 KiB
Text
// Import generic module functions
|
|
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
|
|
|
|
params.options = [:]
|
|
options = initOptions(params.options)
|
|
|
|
process GENRICH {
|
|
tag "$meta.id"
|
|
label 'process_high'
|
|
publishDir "${params.outdir}",
|
|
mode: params.publish_dir_mode,
|
|
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
|
|
|
|
conda (params.enable_conda ? "bioconda::genrich=0.6.1" : null)
|
|
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
|
|
container "https://depot.galaxyproject.org/singularity/genrich:0.6.1--h5bf99c6_1"
|
|
} else {
|
|
container "quay.io/biocontainers/genrich:0.6.1--h5bf99c6_1"
|
|
}
|
|
|
|
input:
|
|
tuple val(meta), path(treatment_bam)
|
|
path control_bam
|
|
path blacklist_bed
|
|
val save_pvalues
|
|
val save_pileup
|
|
val save_bed
|
|
val save_duplicates
|
|
|
|
output:
|
|
tuple val(meta), path("*narrowPeak") , emit: peaks
|
|
tuple val(meta), path("*pvalues.bedGraph"), optional:true, emit: bedgraph_pvalues
|
|
tuple val(meta), path("*pileup.bedGraph") , optional:true, emit: bedgraph_pileup
|
|
tuple val(meta), path("*intervals.bed") , optional:true, emit: bed_intervals
|
|
tuple val(meta), path("*duplicates.txt") , optional:true, emit: duplicates
|
|
path "versions.yml" , emit: versions
|
|
|
|
script:
|
|
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
|
def control = control_bam ? "-c $control_bam" : ''
|
|
def blacklist = blacklist_bed ? "-E $blacklist_bed" : ""
|
|
def pvalues = save_pvalues ? "-f ${prefix}.pvalues.bedGraph" : ""
|
|
def pileup = save_pileup ? "-k ${prefix}.pileup.bedGraph" : ""
|
|
def bed = save_bed ? "-b ${prefix}.intervals.bed" : ""
|
|
def duplicates = ""
|
|
if (save_duplicates) {
|
|
if (options.args.contains('-r')) {
|
|
duplicates = "-R ${prefix}.duplicates.txt"
|
|
} else {
|
|
log.info '[Genrich] Duplicates can only be saved if they are filtered, defaulting to -r option (Remove PCR duplicates).'
|
|
duplicates = "-r -R ${prefix}.duplicates.txt"
|
|
}
|
|
}
|
|
"""
|
|
Genrich \\
|
|
-t $treatment_bam \\
|
|
$options.args \\
|
|
$control \\
|
|
$blacklist \\
|
|
-o ${prefix}.narrowPeak \\
|
|
$pvalues \\
|
|
$pileup \\
|
|
$bed \\
|
|
$duplicates \\
|
|
$control
|
|
|
|
cat <<-END_VERSIONS > versions.yml
|
|
${getProcessName(task.process)}:
|
|
${getSoftwareName(task.process)}: \$(echo \$(Genrich --version 2>&1) | sed 's/^Genrich, version //; s/ .*\$//')
|
|
END_VERSIONS
|
|
"""
|
|
}
|