nf-core_modules/software/cnvkit/functions.nf

71 lines
2.6 KiB
Text
Raw Normal View History

cnvkit module (#173) * Normal bam file added * Normal bam.bai file added * Tumour bam bai files added * human dir added * annotation dir added * cnvkit dir added * cnvkit dir added * Update software/cnvkit/main.nf Co-authored-by: Maxime Garcia <maxime.garcia@scilifelab.se> * Update software/cnvkit/main.nf Co-authored-by: Maxime Garcia <maxime.garcia@scilifelab.se> * Update software/cnvkit/main.nf Co-authored-by: Maxime Garcia <maxime.garcia@scilifelab.se> * changed input filenames * edited main.nf * edited main.nf * edited meta.nf * edited test.yml * filters.yml * edited main * edited main * edited meta * edited meta * edited main * removed unwanted lines * edited the path to the main.nf * removed function.nf * added functions.nf * deleted 2 workflows and craeted a common workflow * deleted paths for 2 workflows and created paths for a common workflow * Deleted annotation dir * deleted params.modules * Edited meta.with_normal * deleted normal_280_sub_chr21.bam * deleted normal_280_sub_chr21.bam.bai * deleted tumour_278_sub_chr21.bam * deleted tumour_278_sub_chr21.bam.bai * Edited input and script parts * Edited input part * Added * Edited args * Edited script * Edited input * Changed annotation to annotationfile * Changed description of the tool * edited singularuty container * edited input * line 44 removed trailing whitespace * Edited addParams * Deleted pdf output * Deleted pdf output * edited the path to main.nf * edited path to the main.nf * Added docker image version * Removed extra ../ * added md5sums * added md5sums * Update software/cnvkit/main.nf Co-authored-by: Harshil Patel <drpatelh@users.noreply.github.com> * Update software/cnvkit/main.nf Co-authored-by: Harshil Patel <drpatelh@users.noreply.github.com> * Edited the script * Edited the input * Edited main.nf * Edited main.nf * edited md5sum for reference.cnn * removed human fasta * removed human fasta.fai * added GRCh38 fasta * added GRCh38 fasta.fai * added hg19 fasta.fai * added hg19 fasta * Edited fasta file name * Edited bed file names and md5sums * Edited md5sums * edited the input and script section * edited input section * added targetfile * changed the files * changed the output files * added bam files * added bam files * remove files * added md5sums * replace file * added files * edited tests/software/cnvkit files * edited tests/software/cnvkit files * edited authors list * removed files * added files * added files * added files * added files * added file * added file * added file * added file * edited files * edited files * edited files * edited files * edited files * edited files * added new module * added new module * edited files * edited file * edited file * edited file * removed files Co-authored-by: kaurravneet4123 <kaurravneet4123@yahoo.com@users.noreply.github.com> Co-authored-by: Maxime Garcia <maxime.garcia@scilifelab.se> Co-authored-by: Harshil Patel <drpatelh@users.noreply.github.com>
2021-03-22 22:27:30 +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()
}
/*
* 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 ?: ''
cnvkit module (#173) * Normal bam file added * Normal bam.bai file added * Tumour bam bai files added * human dir added * annotation dir added * cnvkit dir added * cnvkit dir added * Update software/cnvkit/main.nf Co-authored-by: Maxime Garcia <maxime.garcia@scilifelab.se> * Update software/cnvkit/main.nf Co-authored-by: Maxime Garcia <maxime.garcia@scilifelab.se> * Update software/cnvkit/main.nf Co-authored-by: Maxime Garcia <maxime.garcia@scilifelab.se> * changed input filenames * edited main.nf * edited main.nf * edited meta.nf * edited test.yml * filters.yml * edited main * edited main * edited meta * edited meta * edited main * removed unwanted lines * edited the path to the main.nf * removed function.nf * added functions.nf * deleted 2 workflows and craeted a common workflow * deleted paths for 2 workflows and created paths for a common workflow * Deleted annotation dir * deleted params.modules * Edited meta.with_normal * deleted normal_280_sub_chr21.bam * deleted normal_280_sub_chr21.bam.bai * deleted tumour_278_sub_chr21.bam * deleted tumour_278_sub_chr21.bam.bai * Edited input and script parts * Edited input part * Added * Edited args * Edited script * Edited input * Changed annotation to annotationfile * Changed description of the tool * edited singularuty container * edited input * line 44 removed trailing whitespace * Edited addParams * Deleted pdf output * Deleted pdf output * edited the path to main.nf * edited path to the main.nf * Added docker image version * Removed extra ../ * added md5sums * added md5sums * Update software/cnvkit/main.nf Co-authored-by: Harshil Patel <drpatelh@users.noreply.github.com> * Update software/cnvkit/main.nf Co-authored-by: Harshil Patel <drpatelh@users.noreply.github.com> * Edited the script * Edited the input * Edited main.nf * Edited main.nf * edited md5sum for reference.cnn * removed human fasta * removed human fasta.fai * added GRCh38 fasta * added GRCh38 fasta.fai * added hg19 fasta.fai * added hg19 fasta * Edited fasta file name * Edited bed file names and md5sums * Edited md5sums * edited the input and script section * edited input section * added targetfile * changed the files * changed the output files * added bam files * added bam files * remove files * added md5sums * replace file * added files * edited tests/software/cnvkit files * edited tests/software/cnvkit files * edited authors list * removed files * added files * added files * added files * added files * added file * added file * added file * added file * edited files * edited files * edited files * edited files * edited files * edited files * added new module * added new module * edited files * edited file * edited file * edited file * removed files Co-authored-by: kaurravneet4123 <kaurravneet4123@yahoo.com@users.noreply.github.com> Co-authored-by: Maxime Garcia <maxime.garcia@scilifelab.se> Co-authored-by: Harshil Patel <drpatelh@users.noreply.github.com>
2021-03-22 22:27:30 +00:00
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
cnvkit module (#173) * Normal bam file added * Normal bam.bai file added * Tumour bam bai files added * human dir added * annotation dir added * cnvkit dir added * cnvkit dir added * Update software/cnvkit/main.nf Co-authored-by: Maxime Garcia <maxime.garcia@scilifelab.se> * Update software/cnvkit/main.nf Co-authored-by: Maxime Garcia <maxime.garcia@scilifelab.se> * Update software/cnvkit/main.nf Co-authored-by: Maxime Garcia <maxime.garcia@scilifelab.se> * changed input filenames * edited main.nf * edited main.nf * edited meta.nf * edited test.yml * filters.yml * edited main * edited main * edited meta * edited meta * edited main * removed unwanted lines * edited the path to the main.nf * removed function.nf * added functions.nf * deleted 2 workflows and craeted a common workflow * deleted paths for 2 workflows and created paths for a common workflow * Deleted annotation dir * deleted params.modules * Edited meta.with_normal * deleted normal_280_sub_chr21.bam * deleted normal_280_sub_chr21.bam.bai * deleted tumour_278_sub_chr21.bam * deleted tumour_278_sub_chr21.bam.bai * Edited input and script parts * Edited input part * Added * Edited args * Edited script * Edited input * Changed annotation to annotationfile * Changed description of the tool * edited singularuty container * edited input * line 44 removed trailing whitespace * Edited addParams * Deleted pdf output * Deleted pdf output * edited the path to main.nf * edited path to the main.nf * Added docker image version * Removed extra ../ * added md5sums * added md5sums * Update software/cnvkit/main.nf Co-authored-by: Harshil Patel <drpatelh@users.noreply.github.com> * Update software/cnvkit/main.nf Co-authored-by: Harshil Patel <drpatelh@users.noreply.github.com> * Edited the script * Edited the input * Edited main.nf * Edited main.nf * edited md5sum for reference.cnn * removed human fasta * removed human fasta.fai * added GRCh38 fasta * added GRCh38 fasta.fai * added hg19 fasta.fai * added hg19 fasta * Edited fasta file name * Edited bed file names and md5sums * Edited md5sums * edited the input and script section * edited input section * added targetfile * changed the files * changed the output files * added bam files * added bam files * remove files * added md5sums * replace file * added files * edited tests/software/cnvkit files * edited tests/software/cnvkit files * edited authors list * removed files * added files * added files * added files * added files * added file * added file * added file * added file * edited files * edited files * edited files * edited files * edited files * edited files * added new module * added new module * edited files * edited file * edited file * edited file * removed files Co-authored-by: kaurravneet4123 <kaurravneet4123@yahoo.com@users.noreply.github.com> Co-authored-by: Maxime Garcia <maxime.garcia@scilifelab.se> Co-authored-by: Harshil Patel <drpatelh@users.noreply.github.com>
2021-03-22 22:27:30 +00:00
return paths.join('/')
}
/*
* Function to save/publish module results
*/
def saveFiles(Map args) {
if (!args.filename.endsWith('.version.txt')) {
def ioptions = initOptions(args.options)
cnvkit module (#173) * Normal bam file added * Normal bam.bai file added * Tumour bam bai files added * human dir added * annotation dir added * cnvkit dir added * cnvkit dir added * Update software/cnvkit/main.nf Co-authored-by: Maxime Garcia <maxime.garcia@scilifelab.se> * Update software/cnvkit/main.nf Co-authored-by: Maxime Garcia <maxime.garcia@scilifelab.se> * Update software/cnvkit/main.nf Co-authored-by: Maxime Garcia <maxime.garcia@scilifelab.se> * changed input filenames * edited main.nf * edited main.nf * edited meta.nf * edited test.yml * filters.yml * edited main * edited main * edited meta * edited meta * edited main * removed unwanted lines * edited the path to the main.nf * removed function.nf * added functions.nf * deleted 2 workflows and craeted a common workflow * deleted paths for 2 workflows and created paths for a common workflow * Deleted annotation dir * deleted params.modules * Edited meta.with_normal * deleted normal_280_sub_chr21.bam * deleted normal_280_sub_chr21.bam.bai * deleted tumour_278_sub_chr21.bam * deleted tumour_278_sub_chr21.bam.bai * Edited input and script parts * Edited input part * Added * Edited args * Edited script * Edited input * Changed annotation to annotationfile * Changed description of the tool * edited singularuty container * edited input * line 44 removed trailing whitespace * Edited addParams * Deleted pdf output * Deleted pdf output * edited the path to main.nf * edited path to the main.nf * Added docker image version * Removed extra ../ * added md5sums * added md5sums * Update software/cnvkit/main.nf Co-authored-by: Harshil Patel <drpatelh@users.noreply.github.com> * Update software/cnvkit/main.nf Co-authored-by: Harshil Patel <drpatelh@users.noreply.github.com> * Edited the script * Edited the input * Edited main.nf * Edited main.nf * edited md5sum for reference.cnn * removed human fasta * removed human fasta.fai * added GRCh38 fasta * added GRCh38 fasta.fai * added hg19 fasta.fai * added hg19 fasta * Edited fasta file name * Edited bed file names and md5sums * Edited md5sums * edited the input and script section * edited input section * added targetfile * changed the files * changed the output files * added bam files * added bam files * remove files * added md5sums * replace file * added files * edited tests/software/cnvkit files * edited tests/software/cnvkit files * edited authors list * removed files * added files * added files * added files * added files * added file * added file * added file * added file * edited files * edited files * edited files * edited files * edited files * edited files * added new module * added new module * edited files * edited file * edited file * edited file * removed files Co-authored-by: kaurravneet4123 <kaurravneet4123@yahoo.com@users.noreply.github.com> Co-authored-by: Maxime Garcia <maxime.garcia@scilifelab.se> Co-authored-by: Harshil Patel <drpatelh@users.noreply.github.com>
2021-03-22 22:27:30 +00:00
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)
}
}
cnvkit module (#173) * Normal bam file added * Normal bam.bai file added * Tumour bam bai files added * human dir added * annotation dir added * cnvkit dir added * cnvkit dir added * Update software/cnvkit/main.nf Co-authored-by: Maxime Garcia <maxime.garcia@scilifelab.se> * Update software/cnvkit/main.nf Co-authored-by: Maxime Garcia <maxime.garcia@scilifelab.se> * Update software/cnvkit/main.nf Co-authored-by: Maxime Garcia <maxime.garcia@scilifelab.se> * changed input filenames * edited main.nf * edited main.nf * edited meta.nf * edited test.yml * filters.yml * edited main * edited main * edited meta * edited meta * edited main * removed unwanted lines * edited the path to the main.nf * removed function.nf * added functions.nf * deleted 2 workflows and craeted a common workflow * deleted paths for 2 workflows and created paths for a common workflow * Deleted annotation dir * deleted params.modules * Edited meta.with_normal * deleted normal_280_sub_chr21.bam * deleted normal_280_sub_chr21.bam.bai * deleted tumour_278_sub_chr21.bam * deleted tumour_278_sub_chr21.bam.bai * Edited input and script parts * Edited input part * Added * Edited args * Edited script * Edited input * Changed annotation to annotationfile * Changed description of the tool * edited singularuty container * edited input * line 44 removed trailing whitespace * Edited addParams * Deleted pdf output * Deleted pdf output * edited the path to main.nf * edited path to the main.nf * Added docker image version * Removed extra ../ * added md5sums * added md5sums * Update software/cnvkit/main.nf Co-authored-by: Harshil Patel <drpatelh@users.noreply.github.com> * Update software/cnvkit/main.nf Co-authored-by: Harshil Patel <drpatelh@users.noreply.github.com> * Edited the script * Edited the input * Edited main.nf * Edited main.nf * edited md5sum for reference.cnn * removed human fasta * removed human fasta.fai * added GRCh38 fasta * added GRCh38 fasta.fai * added hg19 fasta.fai * added hg19 fasta * Edited fasta file name * Edited bed file names and md5sums * Edited md5sums * edited the input and script section * edited input section * added targetfile * changed the files * changed the output files * added bam files * added bam files * remove files * added md5sums * replace file * added files * edited tests/software/cnvkit files * edited tests/software/cnvkit files * edited authors list * removed files * added files * added files * added files * added files * added file * added file * added file * added file * edited files * edited files * edited files * edited files * edited files * edited files * added new module * added new module * edited files * edited file * edited file * edited file * removed files Co-authored-by: kaurravneet4123 <kaurravneet4123@yahoo.com@users.noreply.github.com> Co-authored-by: Maxime Garcia <maxime.garcia@scilifelab.se> Co-authored-by: Harshil Patel <drpatelh@users.noreply.github.com>
2021-03-22 22:27:30 +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"
}
}
} else if (ioptions.publish_files == null) {
return "${getPathFromList(path_list)}/$args.filename"
}
}
}