mirror of
https://github.com/MillironX/nf-core_modules.git
synced 2024-11-10 20:23:10 +00:00
Add abacas module (#431)
* Add abacas module * Add test for abacas module * Add Harshil to authorship * Updating test with the data uploaded to nf-core/datasets * Apply suggestions from code review Co-authored-by: Harshil Patel <drpatelh@users.noreply.github.com>
This commit is contained in:
parent
0b402ffda8
commit
3ac21ff0dc
7 changed files with 213 additions and 4 deletions
70
software/abacas/functions.nf
Normal file
70
software/abacas/functions.nf
Normal file
|
@ -0,0 +1,70 @@
|
||||||
|
/*
|
||||||
|
* -----------------------------------------------------
|
||||||
|
* 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"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
45
software/abacas/main.nf
Normal file
45
software/abacas/main.nf
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
// Import generic module functions
|
||||||
|
include { initOptions; saveFiles; getSoftwareName } from './functions'
|
||||||
|
|
||||||
|
params.options = [:]
|
||||||
|
options = initOptions(params.options)
|
||||||
|
|
||||||
|
process ABACAS {
|
||||||
|
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), meta:meta, publish_by_meta:['id']) }
|
||||||
|
|
||||||
|
conda (params.enable_conda ? "bioconda::abacas=1.3.1" : null)
|
||||||
|
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
|
||||||
|
container "https://depot.galaxyproject.org/singularity/abacas:1.3.1--pl526_0"
|
||||||
|
} else {
|
||||||
|
container "quay.io/biocontainers/abacas:1.3.1--pl526_0"
|
||||||
|
}
|
||||||
|
|
||||||
|
input:
|
||||||
|
tuple val(meta), path(scaffold)
|
||||||
|
path fasta
|
||||||
|
|
||||||
|
output:
|
||||||
|
tuple val(meta), path('*.abacas*'), emit: results
|
||||||
|
path '*.version.txt' , emit: version
|
||||||
|
|
||||||
|
script:
|
||||||
|
def software = getSoftwareName(task.process)
|
||||||
|
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
||||||
|
"""
|
||||||
|
abacas.pl \\
|
||||||
|
-r $fasta \\
|
||||||
|
-q $scaffold \\
|
||||||
|
$options.args \\
|
||||||
|
-o ${prefix}.abacas
|
||||||
|
|
||||||
|
mv nucmer.delta ${prefix}.abacas.nucmer.delta
|
||||||
|
mv nucmer.filtered.delta ${prefix}.abacas.nucmer.filtered.delta
|
||||||
|
mv nucmer.tiling ${prefix}.abacas.nucmer.tiling
|
||||||
|
mv unused_contigs.out ${prefix}.abacas.unused.contigs.out
|
||||||
|
echo \$(abacas.pl -v 2>&1) | sed 's/^.*ABACAS.//; s/ .*\$//' > ${software}.version.txt
|
||||||
|
"""
|
||||||
|
}
|
48
software/abacas/meta.yml
Normal file
48
software/abacas/meta.yml
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
name: abacas
|
||||||
|
description: contiguate draft genome assembly
|
||||||
|
keywords:
|
||||||
|
- genome
|
||||||
|
- assembly
|
||||||
|
- contiguate
|
||||||
|
tools:
|
||||||
|
- abacas:
|
||||||
|
description: ABACAS is intended to rapidly contiguate (align, order, orientate), visualize and design primers to close gaps on shotgun assembled contigs based on a reference sequence.
|
||||||
|
homepage: http://abacas.sourceforge.net/documentation.html
|
||||||
|
documentation: http://abacas.sourceforge.net/documentation.html
|
||||||
|
tool_dev_url: None
|
||||||
|
doi: "10.1093/bioinformatics/btp347"
|
||||||
|
licence: ['GPL v2-or-later']
|
||||||
|
|
||||||
|
input:
|
||||||
|
- meta:
|
||||||
|
type: map
|
||||||
|
description: |
|
||||||
|
Groovy Map containing sample information
|
||||||
|
e.g. [ id:'test', single_end:false ]
|
||||||
|
- scaffold:
|
||||||
|
type: file
|
||||||
|
description: Fasta file containing scaffold
|
||||||
|
pattern: "*.{fasta,fa}"
|
||||||
|
- fasta:
|
||||||
|
type: file
|
||||||
|
description: FASTA reference file
|
||||||
|
pattern: "*.{fasta,fa}"
|
||||||
|
|
||||||
|
output:
|
||||||
|
- meta:
|
||||||
|
type: map
|
||||||
|
description: |
|
||||||
|
Groovy Map containing sample information
|
||||||
|
e.g. [ id:'test', single_end:false ]
|
||||||
|
- results:
|
||||||
|
type: file
|
||||||
|
description: Sorted BAM/CRAM/SAM file
|
||||||
|
pattern: "*.{bam,cram,sam}"
|
||||||
|
- version:
|
||||||
|
type: file
|
||||||
|
description: File containing software version
|
||||||
|
pattern: "*.{version.txt}"
|
||||||
|
|
||||||
|
authors:
|
||||||
|
- "@joseespinosa"
|
||||||
|
- "@drpatelh"
|
|
@ -1,3 +1,7 @@
|
||||||
|
abacas:
|
||||||
|
- software/abacas/**
|
||||||
|
- tests/software/abacas/**
|
||||||
|
|
||||||
adapterremoval:
|
adapterremoval:
|
||||||
- software/adapterremoval/**
|
- software/adapterremoval/**
|
||||||
- tests/software/adapterremoval/**
|
- tests/software/adapterremoval/**
|
||||||
|
@ -542,10 +546,10 @@ vcftools:
|
||||||
- software/vcftools/**
|
- software/vcftools/**
|
||||||
- tests/software/vcftools/**
|
- tests/software/vcftools/**
|
||||||
|
|
||||||
yara/mapper:
|
|
||||||
- software/yara/mapper/**
|
|
||||||
- tests/software/yara/mapper/**
|
|
||||||
|
|
||||||
yara/index:
|
yara/index:
|
||||||
- software/yara/index/**
|
- software/yara/index/**
|
||||||
- tests/software/yara/index/**
|
- tests/software/yara/index/**
|
||||||
|
|
||||||
|
yara/mapper:
|
||||||
|
- software/yara/mapper/**
|
||||||
|
- tests/software/yara/mapper/**
|
||||||
|
|
|
@ -30,6 +30,8 @@ params {
|
||||||
informative_sites_fas = "${test_data_dir}/genomics/sarscov2/genome/alignment/informative_sites.fas"
|
informative_sites_fas = "${test_data_dir}/genomics/sarscov2/genome/alignment/informative_sites.fas"
|
||||||
|
|
||||||
contigs_fasta = "${test_data_dir}/genomics/sarscov2/genome/contigs.fasta"
|
contigs_fasta = "${test_data_dir}/genomics/sarscov2/genome/contigs.fasta"
|
||||||
|
scaffolds_fasta = "${test_data_dir}/genomics/sarscov2/genome/scaffolds.fasta"
|
||||||
|
assembly_gfa = "${test_data_dir}/genomics/sarscov2/genome/assembly.gfa"
|
||||||
}
|
}
|
||||||
'illumina' {
|
'illumina' {
|
||||||
test_single_end_bam = "${test_data_dir}/genomics/sarscov2/illumina/bam/test_single_end.bam"
|
test_single_end_bam = "${test_data_dir}/genomics/sarscov2/illumina/bam/test_single_end.bam"
|
||||||
|
|
16
tests/software/abacas/main.nf
Normal file
16
tests/software/abacas/main.nf
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
#!/usr/bin/env nextflow
|
||||||
|
|
||||||
|
nextflow.enable.dsl = 2
|
||||||
|
|
||||||
|
include { ABACAS } from '../../../software/abacas/main.nf' addParams ( options: ['args' : '-m -p nucmer'] )
|
||||||
|
|
||||||
|
workflow test_abacas {
|
||||||
|
|
||||||
|
input = [ [ id:'test', single_end:false ], // meta map
|
||||||
|
file(params.test_data['sarscov2']['genome']['scaffolds_fasta'], checkIfExists: true)
|
||||||
|
]
|
||||||
|
|
||||||
|
fasta = file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true)
|
||||||
|
|
||||||
|
ABACAS ( input, fasta )
|
||||||
|
}
|
24
tests/software/abacas/test.yml
Normal file
24
tests/software/abacas/test.yml
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
- name: abacas
|
||||||
|
command: nextflow run ./tests/software/abacas -entry test_abacas -c tests/config/nextflow.config
|
||||||
|
tags:
|
||||||
|
- abacas
|
||||||
|
files:
|
||||||
|
- path: output/abacas/test.abacas.bin
|
||||||
|
- path: output/abacas/test.abacas.crunch
|
||||||
|
md5sum: 9a95358a9bd8ee97d1f2253d95623a17
|
||||||
|
- path: output/abacas/test.abacas.fasta
|
||||||
|
md5sum: 5e6c403d3850d52f6bde956fa2403b13
|
||||||
|
- path: output/abacas/test.abacas.gaps
|
||||||
|
md5sum: 5361af445b8d18a85c3af6527a97c89a
|
||||||
|
- path: output/abacas/test.abacas.gaps.tab
|
||||||
|
md5sum: 193024ec9e5a553573519b218eb06e29
|
||||||
|
- path: output/abacas/test.abacas.nucmer.delta
|
||||||
|
- path: output/abacas/test.abacas.nucmer.filtered.delta
|
||||||
|
- path: output/abacas/test.abacas.nucmer.tiling
|
||||||
|
md5sum: 0adaa0ce800d92c149a523d447148d95
|
||||||
|
- path: output/abacas/test.abacas.tab
|
||||||
|
md5sum: a5b9b452516f519a4201ff809655ef69
|
||||||
|
- path: output/abacas/test.abacas.unused.contigs.out
|
||||||
|
md5sum: d41d8cd98f00b204e9800998ecf8427e
|
||||||
|
- path: output/abacas/test.abacas.MULTIFASTA.fa
|
||||||
|
md5sum: 46c899ad70dcef8d14b5829fd8fbab82
|
Loading…
Reference in a new issue