2021-10-30 08:52:13 +00:00
|
|
|
process IDR {
|
|
|
|
tag "$prefix"
|
|
|
|
label 'process_low'
|
|
|
|
|
|
|
|
conda (params.enable_conda ? "bioconda::idr=2.0.4.2" : null)
|
2021-11-26 07:58:40 +00:00
|
|
|
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
|
|
|
|
'https://depot.galaxyproject.org/singularity/idr:2.0.4.2--py39hcbe4a3b_5' :
|
2022-01-03 18:00:46 +00:00
|
|
|
'quay.io/biocontainers/idr:2.0.4.2--py39hcbe4a3b_5' }"
|
2021-10-30 08:52:13 +00:00
|
|
|
|
|
|
|
input:
|
|
|
|
path peaks
|
|
|
|
val peak_type
|
|
|
|
val prefix
|
|
|
|
|
|
|
|
output:
|
|
|
|
path "*idrValues.txt", emit: idr
|
|
|
|
path "*log.txt" , emit: log
|
|
|
|
path "*.png" , emit: png
|
|
|
|
path "versions.yml" , emit: versions
|
|
|
|
|
2022-02-04 08:53:32 +00:00
|
|
|
when:
|
|
|
|
task.ext.when == null || task.ext.when
|
|
|
|
|
2021-10-30 08:52:13 +00:00
|
|
|
script:
|
2021-11-26 07:58:40 +00:00
|
|
|
def args = task.ext.args ?: ''
|
2021-10-30 08:52:13 +00:00
|
|
|
if (peaks.toList().size < 2) {
|
|
|
|
log.error "[ERROR] idr needs at least two replicates only one provided."
|
|
|
|
}
|
|
|
|
def peak_types = ['narrowPeak', 'broadPeak', 'bed']
|
|
|
|
if (!peak_types.contains(peak_type)) {
|
|
|
|
log.error "[ERROR] Invalid option: '${peak_type}'. Valid options for 'peak_type': ${peak_types.join(', ')}."
|
|
|
|
}
|
|
|
|
def idr_vals = prefix ? "${prefix}.idrValues.txt" : "idrValues.txt"
|
|
|
|
def log_file = prefix ? "${prefix}.log.txt" : "log.txt"
|
|
|
|
"""
|
|
|
|
idr \\
|
|
|
|
--samples $peaks \\
|
|
|
|
--input-file-type $peak_type \\
|
|
|
|
--output-file $idr_vals \\
|
|
|
|
--log-output-file $log_file \\
|
|
|
|
--plot \\
|
2021-11-26 07:58:40 +00:00
|
|
|
$args
|
2021-10-30 08:52:13 +00:00
|
|
|
|
|
|
|
cat <<-END_VERSIONS > versions.yml
|
2021-11-26 07:58:40 +00:00
|
|
|
"${task.process}":
|
|
|
|
idr: \$(echo \$(idr --version 2>&1) | sed 's/^.*IDR //; s/ .*\$//')
|
2021-10-30 08:52:13 +00:00
|
|
|
END_VERSIONS
|
|
|
|
"""
|
|
|
|
}
|