Very preliminary implementation of passing optional params to bedtools/intersect modules

This commit is contained in:
JoseEspinosa 2020-07-16 16:37:33 +02:00
parent 759dd85c92
commit d30089f12d
2 changed files with 15 additions and 5 deletions

View file

@ -20,12 +20,18 @@ process INTERSECT_BED {
path (input_file_2) path (input_file_2)
val (intersectbed_args) val (intersectbed_args)
output: //output:
stdout() //path "${input_file_1.baseName}_i_${input_file_2.baseName}.bed", emit: intersect
//path "*.version.txt", emit: version
script: script:
def params_string = intersectbed_args.collect {
/-$it.key $it.value/
} join " "
""" """
bedtools intersect -a ${input_file_1} -b ${input_file_2} ${intersectbed_args} 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
""" """
} }

View file

@ -1,7 +1,6 @@
#!/usr/bin/env nextflow #!/usr/bin/env nextflow
nextflow.preview.dsl = 2 nextflow.preview.dsl = 2
params.out_dir = "test_output" params.out_dir = "test_output"
params.fastqc_args = '' params.fastqc_args = ''
params.publish_dir_mode = "copy" params.publish_dir_mode = "copy"
@ -14,7 +13,12 @@ include INTERSECT_BED from '../main.nf' params(params)
ch_input_1 = Channel.fromPath('./input_data/A.bed') ch_input_1 = Channel.fromPath('./input_data/A.bed')
ch_input_2 = Channel.fromPath('./input_data/B.bed') ch_input_2 = Channel.fromPath('./input_data/B.bed')
def additional_params_map = [:]
additional_params_map = [ s: "",
f: 0.9 ]
// Run the workflow // Run the workflow
workflow { workflow {
INTERSECT_BED(ch_input_1, ch_input_2, params.intersect_args) INTERSECT_BED(ch_input_1, ch_input_2, additional_params_map)
} }