2020-07-15 16:15:49 +00:00
|
|
|
def MODULE = "bedtools_intersect"
|
|
|
|
params.publish_dir = MODULE
|
|
|
|
params.publish_results = "default"
|
|
|
|
|
2020-07-14 14:17:23 +00:00
|
|
|
process INTERSECT_BED {
|
|
|
|
tag "$input_file_1-$input_file_2"
|
|
|
|
|
2020-07-15 16:15:49 +00:00
|
|
|
publishDir "${params.out_dir}/${params.publish_dir}",
|
|
|
|
mode: params.publish_dir_mode,
|
|
|
|
saveAs: { filename ->
|
|
|
|
if (params.publish_results == "none") null
|
|
|
|
else filename }
|
|
|
|
|
2020-07-16 08:22:09 +00:00
|
|
|
container "docker.pkg.github.com/nf-core/$MODULE"
|
2020-07-14 14:17:23 +00:00
|
|
|
|
2020-07-15 16:15:49 +00:00
|
|
|
conda "${moduleDir}/environment.yml"
|
|
|
|
|
2020-07-14 14:17:23 +00:00
|
|
|
input:
|
|
|
|
path (input_file_1)
|
|
|
|
path (input_file_2)
|
|
|
|
val (intersectbed_args)
|
|
|
|
|
2020-07-16 14:38:37 +00:00
|
|
|
output:
|
|
|
|
path "${input_file_1.baseName}_i_${input_file_2.baseName}.bed", emit: intersect
|
|
|
|
path "*.version.txt", emit: version
|
2020-07-14 14:17:23 +00:00
|
|
|
|
|
|
|
script:
|
2020-07-16 14:37:33 +00:00
|
|
|
def params_string = intersectbed_args.collect {
|
|
|
|
/-$it.key $it.value/
|
|
|
|
} join " "
|
|
|
|
|
2020-07-14 14:17:23 +00:00
|
|
|
"""
|
2020-07-16 14:37:33 +00:00
|
|
|
bedtools intersect -a ${input_file_1} -b ${input_file_2} ${params_string} > ${input_file_1.baseName}_i_${input_file_2.baseName}.bed
|
|
|
|
bedtools --version | sed -n "s/.*\\(v.*\$\\)/\\1/p" > bedtools.version.txt
|
2020-07-14 14:17:23 +00:00
|
|
|
"""
|
|
|
|
}
|