nf-core_modules/modules/pbccs/functions.nf

79 lines
2.6 KiB
Text
Raw Normal View History

new module: pbccs (#688) * 📦 NEW: First commit of pbccs module * 👌 IMPROVE: Remove option from command + rename output (ccs -> bam) * 👌 IMPROVE: Move .pbi output into report channel * 🐛FIX: Correct code after --rq option removal from command line module - module main.nf: Remove ramaining rq input channel - Test main.nf: Transfert rq into addParams - Test test.yml: Update md5sums * 🐛FIX: Repair additionnal option usage * 👌 IMPROVE: Add some pacbio test files * 🐛 FIX: Add Pacbio index to test_data.config * 👌 IMPROVE: CCS is run in parallel with --chunk option * 👌 IMPROVE: Add Pbindex in bam ouput channel * 👌 IMPROVE: Change label to process_low * 👌 IMPROVE: Define reports files names + add json version of txt report * 🐛 FIX: Add missing backslashes * 🐛 FIX: Add missing gz extension * 🐛 FIX: update ouput channel * 🐛 FIX: output file name * 👌 IMPROVE: .gitignore * 👌 IMPROVE: Update function.nf to last version * 👌 IMPROVE: Update saveAs in main.nf * 👌 IMPROVE: Add pbccs module * 🐛 FIX: Fix Broken test * 👌 IMPROVE: Update test_data.config * 🐛 FIX: Fix test * 👌 IMPROVE: Update path of test dataset files * 👌 IMPROVE: Remove useless index + Fix Typos * 📦 NEW: First commit of pbccs module * 👌 IMPROVE: Remove option from command + rename output (ccs -> bam) * 👌 IMPROVE: Move .pbi output into report channel * 🐛FIX: Correct code after --rq option removal from command line module - module main.nf: Remove ramaining rq input channel - Test main.nf: Transfert rq into addParams - Test test.yml: Update md5sums * 🐛FIX: Repair additionnal option usage * 👌 IMPROVE: Add some pacbio test files * 🐛 FIX: Add Pacbio index to test_data.config * 👌 IMPROVE: CCS is run in parallel with --chunk option * 👌 IMPROVE: Add Pbindex in bam ouput channel * 👌 IMPROVE: Change label to process_low * 👌 IMPROVE: Define reports files names + add json version of txt report * 🐛 FIX: Add missing backslashes * 🐛 FIX: Add missing gz extension * 🐛 FIX: update ouput channel * 🐛 FIX: output file name * 👌 IMPROVE: .gitignore * 👌 IMPROVE: Update function.nf to last version * 👌 IMPROVE: Update saveAs in main.nf * 👌 IMPROVE: Add pbccs module * 🐛 FIX: Fix Broken test * 👌 IMPROVE: Update test_data.config * 🐛 FIX: Fix test * 👌 IMPROVE: Update path of test dataset files * 👌 IMPROVE: Remove useless index + Fix Typos * 🐛 FIX: fill contains args * 👌 IMPROVE: One output => One Channel * 👌 IMPROVE: One input => One channel * 🐛 FIX: Update tests * 🐛 FIX: Remove TODOs from test.yaml * 👌 IMPROVE: Revert and keep bam and pbi together * 🐛 FIX: Remove old rq input from meta.yml * 👌 IMPROVE: Update test to match input channels Co-authored-by: James A. Fellows Yates <jfy133@gmail.com>
2021-09-16 10:48:18 +00:00
//
// Utility functions used in nf-core DSL2 module files
//
//
// Extract name of software tool from process name using $task.process
//
def getSoftwareName(task_process) {
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()
}
//
// Extract name of module from process name using $task.process
//
def getProcessName(task_process) {
return task_process.tokenize(':')[-1]
}
new module: pbccs (#688) * 📦 NEW: First commit of pbccs module * 👌 IMPROVE: Remove option from command + rename output (ccs -> bam) * 👌 IMPROVE: Move .pbi output into report channel * 🐛FIX: Correct code after --rq option removal from command line module - module main.nf: Remove ramaining rq input channel - Test main.nf: Transfert rq into addParams - Test test.yml: Update md5sums * 🐛FIX: Repair additionnal option usage * 👌 IMPROVE: Add some pacbio test files * 🐛 FIX: Add Pacbio index to test_data.config * 👌 IMPROVE: CCS is run in parallel with --chunk option * 👌 IMPROVE: Add Pbindex in bam ouput channel * 👌 IMPROVE: Change label to process_low * 👌 IMPROVE: Define reports files names + add json version of txt report * 🐛 FIX: Add missing backslashes * 🐛 FIX: Add missing gz extension * 🐛 FIX: update ouput channel * 🐛 FIX: output file name * 👌 IMPROVE: .gitignore * 👌 IMPROVE: Update function.nf to last version * 👌 IMPROVE: Update saveAs in main.nf * 👌 IMPROVE: Add pbccs module * 🐛 FIX: Fix Broken test * 👌 IMPROVE: Update test_data.config * 🐛 FIX: Fix test * 👌 IMPROVE: Update path of test dataset files * 👌 IMPROVE: Remove useless index + Fix Typos * 📦 NEW: First commit of pbccs module * 👌 IMPROVE: Remove option from command + rename output (ccs -> bam) * 👌 IMPROVE: Move .pbi output into report channel * 🐛FIX: Correct code after --rq option removal from command line module - module main.nf: Remove ramaining rq input channel - Test main.nf: Transfert rq into addParams - Test test.yml: Update md5sums * 🐛FIX: Repair additionnal option usage * 👌 IMPROVE: Add some pacbio test files * 🐛 FIX: Add Pacbio index to test_data.config * 👌 IMPROVE: CCS is run in parallel with --chunk option * 👌 IMPROVE: Add Pbindex in bam ouput channel * 👌 IMPROVE: Change label to process_low * 👌 IMPROVE: Define reports files names + add json version of txt report * 🐛 FIX: Add missing backslashes * 🐛 FIX: Add missing gz extension * 🐛 FIX: update ouput channel * 🐛 FIX: output file name * 👌 IMPROVE: .gitignore * 👌 IMPROVE: Update function.nf to last version * 👌 IMPROVE: Update saveAs in main.nf * 👌 IMPROVE: Add pbccs module * 🐛 FIX: Fix Broken test * 👌 IMPROVE: Update test_data.config * 🐛 FIX: Fix test * 👌 IMPROVE: Update path of test dataset files * 👌 IMPROVE: Remove useless index + Fix Typos * 🐛 FIX: fill contains args * 👌 IMPROVE: One output => One Channel * 👌 IMPROVE: One input => One channel * 🐛 FIX: Update tests * 🐛 FIX: Remove TODOs from test.yaml * 👌 IMPROVE: Revert and keep bam and pbi together * 🐛 FIX: Remove old rq input from meta.yml * 👌 IMPROVE: Update test to match input channels Co-authored-by: James A. Fellows Yates <jfy133@gmail.com>
2021-09-16 10:48:18 +00:00
//
// Function to initialise default values and to generate a Groovy Map of available options for nf-core modules
//
def initOptions(Map args) {
def Map options = [:]
options.args = args.args ?: ''
options.args2 = args.args2 ?: ''
options.args3 = args.args3 ?: ''
options.publish_by_meta = args.publish_by_meta ?: []
options.publish_dir = args.publish_dir ?: ''
options.publish_files = args.publish_files
options.suffix = args.suffix ?: ''
return options
}
//
// Tidy up and join elements of a list to return a path string
//
def getPathFromList(path_list) {
def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries
paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes
return paths.join('/')
}
//
// Function to save/publish module results
//
def saveFiles(Map args) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
// Do not publish versions.yml unless running from pytest workflow
if (args.filename.equals('versions.yml') && !System.getenv("NF_CORE_MODULES_TEST")) {
return null
}
if (ioptions.publish_by_meta) {
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
for (key in key_list) {
if (args.meta && key instanceof String) {
def path = key
if (args.meta.containsKey(key)) {
path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key]
new module: pbccs (#688) * 📦 NEW: First commit of pbccs module * 👌 IMPROVE: Remove option from command + rename output (ccs -> bam) * 👌 IMPROVE: Move .pbi output into report channel * 🐛FIX: Correct code after --rq option removal from command line module - module main.nf: Remove ramaining rq input channel - Test main.nf: Transfert rq into addParams - Test test.yml: Update md5sums * 🐛FIX: Repair additionnal option usage * 👌 IMPROVE: Add some pacbio test files * 🐛 FIX: Add Pacbio index to test_data.config * 👌 IMPROVE: CCS is run in parallel with --chunk option * 👌 IMPROVE: Add Pbindex in bam ouput channel * 👌 IMPROVE: Change label to process_low * 👌 IMPROVE: Define reports files names + add json version of txt report * 🐛 FIX: Add missing backslashes * 🐛 FIX: Add missing gz extension * 🐛 FIX: update ouput channel * 🐛 FIX: output file name * 👌 IMPROVE: .gitignore * 👌 IMPROVE: Update function.nf to last version * 👌 IMPROVE: Update saveAs in main.nf * 👌 IMPROVE: Add pbccs module * 🐛 FIX: Fix Broken test * 👌 IMPROVE: Update test_data.config * 🐛 FIX: Fix test * 👌 IMPROVE: Update path of test dataset files * 👌 IMPROVE: Remove useless index + Fix Typos * 📦 NEW: First commit of pbccs module * 👌 IMPROVE: Remove option from command + rename output (ccs -> bam) * 👌 IMPROVE: Move .pbi output into report channel * 🐛FIX: Correct code after --rq option removal from command line module - module main.nf: Remove ramaining rq input channel - Test main.nf: Transfert rq into addParams - Test test.yml: Update md5sums * 🐛FIX: Repair additionnal option usage * 👌 IMPROVE: Add some pacbio test files * 🐛 FIX: Add Pacbio index to test_data.config * 👌 IMPROVE: CCS is run in parallel with --chunk option * 👌 IMPROVE: Add Pbindex in bam ouput channel * 👌 IMPROVE: Change label to process_low * 👌 IMPROVE: Define reports files names + add json version of txt report * 🐛 FIX: Add missing backslashes * 🐛 FIX: Add missing gz extension * 🐛 FIX: update ouput channel * 🐛 FIX: output file name * 👌 IMPROVE: .gitignore * 👌 IMPROVE: Update function.nf to last version * 👌 IMPROVE: Update saveAs in main.nf * 👌 IMPROVE: Add pbccs module * 🐛 FIX: Fix Broken test * 👌 IMPROVE: Update test_data.config * 🐛 FIX: Fix test * 👌 IMPROVE: Update path of test dataset files * 👌 IMPROVE: Remove useless index + Fix Typos * 🐛 FIX: fill contains args * 👌 IMPROVE: One output => One Channel * 👌 IMPROVE: One input => One channel * 🐛 FIX: Update tests * 🐛 FIX: Remove TODOs from test.yaml * 👌 IMPROVE: Revert and keep bam and pbi together * 🐛 FIX: Remove old rq input from meta.yml * 👌 IMPROVE: Update test to match input channels Co-authored-by: James A. Fellows Yates <jfy133@gmail.com>
2021-09-16 10:48:18 +00:00
}
path = path instanceof String ? path : ''
path_list.add(path)
new module: pbccs (#688) * 📦 NEW: First commit of pbccs module * 👌 IMPROVE: Remove option from command + rename output (ccs -> bam) * 👌 IMPROVE: Move .pbi output into report channel * 🐛FIX: Correct code after --rq option removal from command line module - module main.nf: Remove ramaining rq input channel - Test main.nf: Transfert rq into addParams - Test test.yml: Update md5sums * 🐛FIX: Repair additionnal option usage * 👌 IMPROVE: Add some pacbio test files * 🐛 FIX: Add Pacbio index to test_data.config * 👌 IMPROVE: CCS is run in parallel with --chunk option * 👌 IMPROVE: Add Pbindex in bam ouput channel * 👌 IMPROVE: Change label to process_low * 👌 IMPROVE: Define reports files names + add json version of txt report * 🐛 FIX: Add missing backslashes * 🐛 FIX: Add missing gz extension * 🐛 FIX: update ouput channel * 🐛 FIX: output file name * 👌 IMPROVE: .gitignore * 👌 IMPROVE: Update function.nf to last version * 👌 IMPROVE: Update saveAs in main.nf * 👌 IMPROVE: Add pbccs module * 🐛 FIX: Fix Broken test * 👌 IMPROVE: Update test_data.config * 🐛 FIX: Fix test * 👌 IMPROVE: Update path of test dataset files * 👌 IMPROVE: Remove useless index + Fix Typos * 📦 NEW: First commit of pbccs module * 👌 IMPROVE: Remove option from command + rename output (ccs -> bam) * 👌 IMPROVE: Move .pbi output into report channel * 🐛FIX: Correct code after --rq option removal from command line module - module main.nf: Remove ramaining rq input channel - Test main.nf: Transfert rq into addParams - Test test.yml: Update md5sums * 🐛FIX: Repair additionnal option usage * 👌 IMPROVE: Add some pacbio test files * 🐛 FIX: Add Pacbio index to test_data.config * 👌 IMPROVE: CCS is run in parallel with --chunk option * 👌 IMPROVE: Add Pbindex in bam ouput channel * 👌 IMPROVE: Change label to process_low * 👌 IMPROVE: Define reports files names + add json version of txt report * 🐛 FIX: Add missing backslashes * 🐛 FIX: Add missing gz extension * 🐛 FIX: update ouput channel * 🐛 FIX: output file name * 👌 IMPROVE: .gitignore * 👌 IMPROVE: Update function.nf to last version * 👌 IMPROVE: Update saveAs in main.nf * 👌 IMPROVE: Add pbccs module * 🐛 FIX: Fix Broken test * 👌 IMPROVE: Update test_data.config * 🐛 FIX: Fix test * 👌 IMPROVE: Update path of test dataset files * 👌 IMPROVE: Remove useless index + Fix Typos * 🐛 FIX: fill contains args * 👌 IMPROVE: One output => One Channel * 👌 IMPROVE: One input => One channel * 🐛 FIX: Update tests * 🐛 FIX: Remove TODOs from test.yaml * 👌 IMPROVE: Revert and keep bam and pbi together * 🐛 FIX: Remove old rq input from meta.yml * 👌 IMPROVE: Update test to match input channels Co-authored-by: James A. Fellows Yates <jfy133@gmail.com>
2021-09-16 10:48:18 +00:00
}
}
}
if (ioptions.publish_files instanceof Map) {
for (ext in ioptions.publish_files) {
if (args.filename.endsWith(ext.key)) {
def ext_list = path_list.collect()
ext_list.add(ext.value)
return "${getPathFromList(ext_list)}/$args.filename"
new module: pbccs (#688) * 📦 NEW: First commit of pbccs module * 👌 IMPROVE: Remove option from command + rename output (ccs -> bam) * 👌 IMPROVE: Move .pbi output into report channel * 🐛FIX: Correct code after --rq option removal from command line module - module main.nf: Remove ramaining rq input channel - Test main.nf: Transfert rq into addParams - Test test.yml: Update md5sums * 🐛FIX: Repair additionnal option usage * 👌 IMPROVE: Add some pacbio test files * 🐛 FIX: Add Pacbio index to test_data.config * 👌 IMPROVE: CCS is run in parallel with --chunk option * 👌 IMPROVE: Add Pbindex in bam ouput channel * 👌 IMPROVE: Change label to process_low * 👌 IMPROVE: Define reports files names + add json version of txt report * 🐛 FIX: Add missing backslashes * 🐛 FIX: Add missing gz extension * 🐛 FIX: update ouput channel * 🐛 FIX: output file name * 👌 IMPROVE: .gitignore * 👌 IMPROVE: Update function.nf to last version * 👌 IMPROVE: Update saveAs in main.nf * 👌 IMPROVE: Add pbccs module * 🐛 FIX: Fix Broken test * 👌 IMPROVE: Update test_data.config * 🐛 FIX: Fix test * 👌 IMPROVE: Update path of test dataset files * 👌 IMPROVE: Remove useless index + Fix Typos * 📦 NEW: First commit of pbccs module * 👌 IMPROVE: Remove option from command + rename output (ccs -> bam) * 👌 IMPROVE: Move .pbi output into report channel * 🐛FIX: Correct code after --rq option removal from command line module - module main.nf: Remove ramaining rq input channel - Test main.nf: Transfert rq into addParams - Test test.yml: Update md5sums * 🐛FIX: Repair additionnal option usage * 👌 IMPROVE: Add some pacbio test files * 🐛 FIX: Add Pacbio index to test_data.config * 👌 IMPROVE: CCS is run in parallel with --chunk option * 👌 IMPROVE: Add Pbindex in bam ouput channel * 👌 IMPROVE: Change label to process_low * 👌 IMPROVE: Define reports files names + add json version of txt report * 🐛 FIX: Add missing backslashes * 🐛 FIX: Add missing gz extension * 🐛 FIX: update ouput channel * 🐛 FIX: output file name * 👌 IMPROVE: .gitignore * 👌 IMPROVE: Update function.nf to last version * 👌 IMPROVE: Update saveAs in main.nf * 👌 IMPROVE: Add pbccs module * 🐛 FIX: Fix Broken test * 👌 IMPROVE: Update test_data.config * 🐛 FIX: Fix test * 👌 IMPROVE: Update path of test dataset files * 👌 IMPROVE: Remove useless index + Fix Typos * 🐛 FIX: fill contains args * 👌 IMPROVE: One output => One Channel * 👌 IMPROVE: One input => One channel * 🐛 FIX: Update tests * 🐛 FIX: Remove TODOs from test.yaml * 👌 IMPROVE: Revert and keep bam and pbi together * 🐛 FIX: Remove old rq input from meta.yml * 👌 IMPROVE: Update test to match input channels Co-authored-by: James A. Fellows Yates <jfy133@gmail.com>
2021-09-16 10:48:18 +00:00
}
}
} else if (ioptions.publish_files == null) {
return "${getPathFromList(path_list)}/$args.filename"
new module: pbccs (#688) * 📦 NEW: First commit of pbccs module * 👌 IMPROVE: Remove option from command + rename output (ccs -> bam) * 👌 IMPROVE: Move .pbi output into report channel * 🐛FIX: Correct code after --rq option removal from command line module - module main.nf: Remove ramaining rq input channel - Test main.nf: Transfert rq into addParams - Test test.yml: Update md5sums * 🐛FIX: Repair additionnal option usage * 👌 IMPROVE: Add some pacbio test files * 🐛 FIX: Add Pacbio index to test_data.config * 👌 IMPROVE: CCS is run in parallel with --chunk option * 👌 IMPROVE: Add Pbindex in bam ouput channel * 👌 IMPROVE: Change label to process_low * 👌 IMPROVE: Define reports files names + add json version of txt report * 🐛 FIX: Add missing backslashes * 🐛 FIX: Add missing gz extension * 🐛 FIX: update ouput channel * 🐛 FIX: output file name * 👌 IMPROVE: .gitignore * 👌 IMPROVE: Update function.nf to last version * 👌 IMPROVE: Update saveAs in main.nf * 👌 IMPROVE: Add pbccs module * 🐛 FIX: Fix Broken test * 👌 IMPROVE: Update test_data.config * 🐛 FIX: Fix test * 👌 IMPROVE: Update path of test dataset files * 👌 IMPROVE: Remove useless index + Fix Typos * 📦 NEW: First commit of pbccs module * 👌 IMPROVE: Remove option from command + rename output (ccs -> bam) * 👌 IMPROVE: Move .pbi output into report channel * 🐛FIX: Correct code after --rq option removal from command line module - module main.nf: Remove ramaining rq input channel - Test main.nf: Transfert rq into addParams - Test test.yml: Update md5sums * 🐛FIX: Repair additionnal option usage * 👌 IMPROVE: Add some pacbio test files * 🐛 FIX: Add Pacbio index to test_data.config * 👌 IMPROVE: CCS is run in parallel with --chunk option * 👌 IMPROVE: Add Pbindex in bam ouput channel * 👌 IMPROVE: Change label to process_low * 👌 IMPROVE: Define reports files names + add json version of txt report * 🐛 FIX: Add missing backslashes * 🐛 FIX: Add missing gz extension * 🐛 FIX: update ouput channel * 🐛 FIX: output file name * 👌 IMPROVE: .gitignore * 👌 IMPROVE: Update function.nf to last version * 👌 IMPROVE: Update saveAs in main.nf * 👌 IMPROVE: Add pbccs module * 🐛 FIX: Fix Broken test * 👌 IMPROVE: Update test_data.config * 🐛 FIX: Fix test * 👌 IMPROVE: Update path of test dataset files * 👌 IMPROVE: Remove useless index + Fix Typos * 🐛 FIX: fill contains args * 👌 IMPROVE: One output => One Channel * 👌 IMPROVE: One input => One channel * 🐛 FIX: Update tests * 🐛 FIX: Remove TODOs from test.yaml * 👌 IMPROVE: Revert and keep bam and pbi together * 🐛 FIX: Remove old rq input from meta.yml * 👌 IMPROVE: Update test to match input channels Co-authored-by: James A. Fellows Yates <jfy133@gmail.com>
2021-09-16 10:48:18 +00:00
}
}