mirror of
https://github.com/MillironX/nf-core_modules.git
synced 2024-12-23 11:38:17 +00:00
01dc6a289d
* hifiasm copied from fastqc * hifiasm tests init from fastqc * meta.yml init; test.yml and main.nf for printing version * Add hifiasm version printing * Removed spaced on an empty line * Reverted hifiasm from main * hifiasm copied from fastqc * hifiasm tests init from fastqc * meta.yml init; test.yml and main.nf for printing version * Add hifiasm version printing * Removed spaced on an empty line * Reverted hifiasm from main * Added seqtk/subseq and checking for seed in seqtk/sample * Separate authors in software/seqtk/sample/meta.yml Co-authored-by: Harshil Patel <drpatelh@users.noreply.github.com> * Align commans in output channesl software/seqtk/subseq/main.nf Co-authored-by: Harshil Patel <drpatelh@users.noreply.github.com> * Define prefix in software/seqtk/subseq/main.nf Co-authored-by: Harshil Patel <drpatelh@users.noreply.github.com> * Use prefix in output file name software/seqtk/subseq/main.nf Co-authored-by: Harshil Patel <drpatelh@users.noreply.github.com> * Define suffix in options in tests/software/seqtk/subseq/main.nf Co-authored-by: Harshil Patel <drpatelh@users.noreply.github.com> * Change output file name in tests/software/seqtk/subseq/test.yml Co-authored-by: Harshil Patel <drpatelh@users.noreply.github.com> * Remove a to-do point from tests/software/seqtk/subseq/test.yml Co-authored-by: Harshil Patel <drpatelh@users.noreply.github.com> * Added --no-name into gzip commands * Update samtools from 1.10 to 1.12 (#530) * feat: remove social preview image to use GitHub OpenGraph * feat: update samtools from 1.10 to 1.12 * fix: CI tests * fix: add meta.yml file for samtools/merge * Update software/samtools/merge/meta.yml Co-authored-by: Jose Espinosa-Carrasco <kadomu@gmail.com> * Update software/samtools/merge/meta.yml Co-authored-by: Jose Espinosa-Carrasco <kadomu@gmail.com> * hifiasm copied from fastqc * hifiasm tests init from fastqc * meta.yml init; test.yml and main.nf for printing version * Add hifiasm version printing * Removed spaced on an empty line * Reverted hifiasm from main * Added seqtk/subseq and checking for seed in seqtk/sample * hifiasm copied from fastqc * hifiasm tests init from fastqc * meta.yml init; test.yml and main.nf for printing version * Add hifiasm version printing * Removed spaced on an empty line * Reverted hifiasm from main * Separate authors in software/seqtk/sample/meta.yml Co-authored-by: Harshil Patel <drpatelh@users.noreply.github.com> * Align commans in output channesl software/seqtk/subseq/main.nf Co-authored-by: Harshil Patel <drpatelh@users.noreply.github.com> * Define prefix in software/seqtk/subseq/main.nf Co-authored-by: Harshil Patel <drpatelh@users.noreply.github.com> * Use prefix in output file name software/seqtk/subseq/main.nf Co-authored-by: Harshil Patel <drpatelh@users.noreply.github.com> * Define suffix in options in tests/software/seqtk/subseq/main.nf Co-authored-by: Harshil Patel <drpatelh@users.noreply.github.com> * Change output file name in tests/software/seqtk/subseq/test.yml Co-authored-by: Harshil Patel <drpatelh@users.noreply.github.com> * Remove a to-do point from tests/software/seqtk/subseq/test.yml Co-authored-by: Harshil Patel <drpatelh@users.noreply.github.com> * Added --no-name into gzip commands * Replaced functions.nf in seqtk/subseq * Refreshed tests for sample and subseq * Corrected paired-end test and YAML description for sample Co-authored-by: Sviatoslav Sidorov <sviatoslav.sidorov@crick.ac.uk> Co-authored-by: Harshil Patel <drpatelh@users.noreply.github.com> Co-authored-by: Maxime U. Garcia <max.u.garcia@gmail.com> Co-authored-by: Jose Espinosa-Carrasco <kadomu@gmail.com>
68 lines
2.5 KiB
Text
68 lines
2.5 KiB
Text
//
|
|
// 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()
|
|
}
|
|
|
|
//
|
|
// 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) {
|
|
if (!args.filename.endsWith('.version.txt')) {
|
|
def ioptions = initOptions(args.options)
|
|
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
|
|
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]
|
|
}
|
|
path = path instanceof String ? path : ''
|
|
path_list.add(path)
|
|
}
|
|
}
|
|
}
|
|
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"
|
|
}
|
|
}
|
|
} else if (ioptions.publish_files == null) {
|
|
return "${getPathFromList(path_list)}/$args.filename"
|
|
}
|
|
}
|
|
}
|