PR for sequenzautils/gcwiggle (#345)

* added files

* edited files

* edited files

* edited file

* test(sequenzautils): Remove md5sum

Co-authored-by: kaurravneet4123 <kaurravneet4123@yahoo.com@users.noreply.github.com>
Co-authored-by: Edmund Miller <edmund.a.miller@protonmail.com>
This commit is contained in:
Ravneet Bhuller 2021-03-24 05:03:03 +00:00 committed by GitHub
parent 3f14b1fabe
commit a70abc236b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 169 additions and 0 deletions

View file

@ -0,0 +1,60 @@
/*
* -----------------------------------------------------
* 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_id = args.publish_by_id ?: false
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_id) {
path_list.add(args.publish_id)
}
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"
}
}
}

View file

@ -0,0 +1,40 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions'
params.options = [:]
options = initOptions(params.options)
process SEQUENZAUTILS_GCWIGGLE {
tag "$meta.id"
label 'process_medium'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) }
conda (params.enable_conda ? "bioconda::sequenza-utils=3.0.0" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
container "https://depot.galaxyproject.org/singularity/sequenza-utils:3.0.0--py38h6ed170a_2"
} else {
container "quay.io/biocontainers/sequenza-utils:3.0.0--py38h6ed170a_2"
}
input:
tuple val(meta), path(fasta)
output:
tuple val(meta), path("*.wig.gz"), emit: wig
path "*.version.txt" , emit: version
script:
def software = getSoftwareName(task.process)
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
"""
sequenza-utils \\
gc_wiggle \\
$options.args \\
--fasta $fasta \\
-o ${prefix}.wig.gz
echo \$(sequenzautils --version 2>&1) | sed 's/^.*sequenzautils //; s/Using.*\$//' > ${software}.version.txt
"""
}

View file

@ -0,0 +1,38 @@
name: sequenzautils_gcwiggle
description: Sequenza-utils gc_wiggle computes the GC percentage across the sequences, and returns a file in the UCSC wiggle format, given a fasta file and a window size.
keywords:
- gc_wiggle
tools:
- sequenzautils:
description: Sequenza-utils provides 3 main command line programs to transform common NGS file format - such as FASTA, BAM - to input files for the Sequenza R package. The program -gc_wiggle- takes fasta file as an input, computes GC percentage across the sequences and returns a file in the UCSC wiggle format.
homepage: https://sequenza-utils.readthedocs.io/en/latest/index.html
documentation: https://sequenza-utils.readthedocs.io/en/latest/index.html
doi: 10.1093/annonc/mdu479
input:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- fasta:
type: file
description: FASTA file
pattern: "*.{fasta}"
output:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- version:
type: file
description: File containing software version
pattern: "*.{version.txt}"
- wig:
type: file
description: GC Wiggle track file
pattern: "*.{wig.gz}"
authors:
- "@kaurravneet4123"

View file

@ -375,10 +375,18 @@ seqkit_split2:
- software/seqkit/split2/**
- tests/software/seqkit/split2/**
sequenza_bam2seqz:
- software/sequenza/bam2seqz/**
- tests/software/sequenza/bam2seqz/**
sequenza_wiggle:
- software/sequenza/wiggle/**
- tests/software/sequenza/wiggle/**
sequenzautils_gcwiggle:
- software/sequenzautils/gcwiggle/**
- tests/software/sequenzautils/gcwiggle/**
seqwish_induce:
- software/seqwish/induce/**
- tests/software/seqwish/induce/**

View file

@ -0,0 +1,14 @@
#!/usr/bin/env nextflow
nextflow.enable.dsl = 2
include { SEQUENZAUTILS_GCWIGGLE } from '../../../../software/sequenzautils/gcwiggle/main.nf' addParams( options: [ 'args': '-w 50' ] )
workflow test_sequenzautils_gcwiggle {
def input = []
input = [ [ id:'test' ], // meta map
file("${launchDir}/tests/data/genomics/sarscov2/fasta/test_genome.fasta", checkIfExists: true) ]
SEQUENZAUTILS_GCWIGGLE ( input )
}

View file

@ -0,0 +1,9 @@
## TODO nf-core: Please run the following command to build this file:
# nf-core modules create-test-yml sequenzautils/gcwiggle
- name: sequenzautils gcwiggle
command: nextflow run ./tests/software/sequenzautils/gcwiggle -entry test_sequenzautils_gcwiggle -c tests/config/nextflow.config
tags:
- sequenzautils
- sequenzautils_gcwiggle
files:
- path: output/sequenzautils/test.wig.gz