mirror of
https://github.com/MillironX/nf-core_modules.git
synced 2024-12-22 02:58:17 +00:00
Editing the CAT/CAT module to handle single files (#1196)
* Removed if-statement to only run on more than 1 file, now it will run on single files as well. * Added a test for running the cat_cat module on a single file. * Created a new test.yml with nf-core modules create-test-yml -t cat/cat * Edited test.yml to not include paths and md5sums for versions.yml, and also removed sometimes variable md5sums
This commit is contained in:
parent
2d4b0f7787
commit
c4549c0ecd
3 changed files with 38 additions and 23 deletions
|
@ -18,30 +18,28 @@ process CAT_CAT {
|
|||
def args = task.ext.args ?: ''
|
||||
def args2 = task.ext.args2 ?: ''
|
||||
def file_list = files_in.collect { it.toString() }
|
||||
if (file_list.size > 1) {
|
||||
|
||||
// | input | output | command1 | command2 |
|
||||
// |-----------|------------|----------|----------|
|
||||
// | gzipped | gzipped | cat | |
|
||||
// | ungzipped | ungzipped | cat | |
|
||||
// | gzipped | ungzipped | zcat | |
|
||||
// | ungzipped | gzipped | cat | pigz |
|
||||
// | input | output | command1 | command2 |
|
||||
// |-----------|------------|----------|----------|
|
||||
// | gzipped | gzipped | cat | |
|
||||
// | ungzipped | ungzipped | cat | |
|
||||
// | gzipped | ungzipped | zcat | |
|
||||
// | ungzipped | gzipped | cat | pigz |
|
||||
|
||||
def in_zip = file_list[0].endsWith('.gz')
|
||||
def out_zip = file_out.endsWith('.gz')
|
||||
def command1 = (in_zip && !out_zip) ? 'zcat' : 'cat'
|
||||
def command2 = (!in_zip && out_zip) ? "| pigz -c -p $task.cpus $args2" : ''
|
||||
"""
|
||||
$command1 \\
|
||||
$args \\
|
||||
${file_list.join(' ')} \\
|
||||
$command2 \\
|
||||
> $file_out
|
||||
def in_zip = file_list[0].endsWith('.gz')
|
||||
def out_zip = file_out.endsWith('.gz')
|
||||
def command1 = (in_zip && !out_zip) ? 'zcat' : 'cat'
|
||||
def command2 = (!in_zip && out_zip) ? "| pigz -c -p $task.cpus $args2" : ''
|
||||
"""
|
||||
$command1 \\
|
||||
$args \\
|
||||
${file_list.join(' ')} \\
|
||||
$command2 \\
|
||||
> $file_out
|
||||
|
||||
cat <<-END_VERSIONS > versions.yml
|
||||
"${task.process}":
|
||||
pigz: \$( pigz --version 2>&1 | sed 's/pigz //g' )
|
||||
END_VERSIONS
|
||||
"""
|
||||
}
|
||||
cat <<-END_VERSIONS > versions.yml
|
||||
"${task.process}":
|
||||
pigz: \$( pigz --version 2>&1 | sed 's/pigz //g' )
|
||||
END_VERSIONS
|
||||
"""
|
||||
}
|
||||
|
|
|
@ -43,3 +43,12 @@ workflow test_cat_unzipped_zipped {
|
|||
|
||||
CAT_CAT ( input, 'cat.txt.gz' )
|
||||
}
|
||||
|
||||
workflow test_cat_one_file_unzipped_zipped {
|
||||
|
||||
input = [
|
||||
file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true),
|
||||
]
|
||||
|
||||
CAT_CAT ( input, 'cat.txt.gz' )
|
||||
}
|
||||
|
|
|
@ -31,3 +31,11 @@
|
|||
- cat/cat
|
||||
files:
|
||||
- path: output/cat/cat.txt.gz
|
||||
|
||||
- name: cat one file unzipped zipped
|
||||
command: nextflow run ./tests/modules/cat/cat -entry test_cat_one_file_unzipped_zipped -c ./tests/config/nextflow.config -c ./tests/modules/cat/cat/nextflow.config
|
||||
tags:
|
||||
- cat
|
||||
- cat/cat
|
||||
files:
|
||||
- path: output/cat/cat.txt.gz
|
||||
|
|
Loading…
Reference in a new issue