mirror of
https://github.com/MillironX/nf-core_modules.git
synced 2024-11-10 20:23:10 +00:00
new module: gubbins (#377)
* new gubbins module * new gubbins module * new gubbins module * Update software/gubbins/main.nf Co-authored-by: Harshil Patel <drpatelh@users.noreply.github.com> * Update software/gubbins/main.nf Co-authored-by: Harshil Patel <drpatelh@users.noreply.github.com> * Update software/gubbins/main.nf Co-authored-by: Harshil Patel <drpatelh@users.noreply.github.com> * Update software/gubbins/meta.yml Co-authored-by: Harshil Patel <drpatelh@users.noreply.github.com> * new gubbins module * new gubbins module * new gubbins module * new gubbins module * new gubbins module * new gubbins module * new gubbins module * Update tests/config/test_data.config Co-authored-by: Harshil Patel <drpatelh@users.noreply.github.com> * Update tests/software/gubbins/main.nf Co-authored-by: Harshil Patel <drpatelh@users.noreply.github.com> * new gubbins module * new gubbins module Co-authored-by: Harshil Patel <drpatelh@users.noreply.github.com>
This commit is contained in:
parent
7c2f10f591
commit
710ab76b90
8 changed files with 213 additions and 0 deletions
60
software/gubbins/functions.nf
Normal file
60
software/gubbins/functions.nf
Normal 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"
|
||||
}
|
||||
}
|
||||
}
|
44
software/gubbins/main.nf
Normal file
44
software/gubbins/main.nf
Normal file
|
@ -0,0 +1,44 @@
|
|||
// Import generic module functions
|
||||
include { initOptions; saveFiles; getSoftwareName } from './functions'
|
||||
|
||||
params.options = [:]
|
||||
options = initOptions(params.options)
|
||||
|
||||
process GUBBINS {
|
||||
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:'') }
|
||||
|
||||
conda (params.enable_conda ? "bioconda::gubbins=2.4.1" : null)
|
||||
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
|
||||
container "https://depot.galaxyproject.org/singularity/gubbins:2.4.1--py38h197edbe_1"
|
||||
} else {
|
||||
container "quay.io/biocontainers/gubbins:2.4.1--py38h197edbe_1"
|
||||
}
|
||||
|
||||
input:
|
||||
path alignment
|
||||
|
||||
output:
|
||||
path "*.fasta" , emit: fasta
|
||||
path "*.gff" , emit: gff
|
||||
path "*.vcf" , emit: vcf
|
||||
path "*.csv" , emit: stats
|
||||
path "*.phylip" , emit: phylip
|
||||
path "*.recombination_predictions.embl" , emit: embl_predicted
|
||||
path "*.branch_base_reconstruction.embl", emit: embl_branch
|
||||
path "*.final_tree.tre" , emit: tree
|
||||
path "*.node_labelled.final_tree.tre" , emit: tree_labelled
|
||||
path "*.version.txt" , emit: version
|
||||
|
||||
script:
|
||||
def software = getSoftwareName(task.process)
|
||||
"""
|
||||
run_gubbins.py \\
|
||||
--threads $task.cpus \\
|
||||
$options.args \\
|
||||
$alignment
|
||||
echo \$(run_gubbins.py --version 2>&1) > ${software}.version.txt
|
||||
"""
|
||||
}
|
61
software/gubbins/meta.yml
Normal file
61
software/gubbins/meta.yml
Normal file
|
@ -0,0 +1,61 @@
|
|||
name: gubbins
|
||||
description: Gubbins (Genealogies Unbiased By recomBinations In Nucleotide Sequences) is an algorithm that iteratively identifies
|
||||
loci containing elevated densities of base substitutions while concurrently constructing a phylogeny based on the
|
||||
putative point mutations outside of these regions.
|
||||
keywords:
|
||||
- recombination
|
||||
- alignment
|
||||
tools:
|
||||
- gubbins:
|
||||
description: Rapid phylogenetic analysis of large samples of recombinant bacterial whole genome sequences using Gubbins.
|
||||
homepage: https://sanger-pathogens.github.io/gubbins/
|
||||
documentation: https://sanger-pathogens.github.io/gubbins/
|
||||
input:
|
||||
- alignment:
|
||||
type: file
|
||||
description: fasta alignment file
|
||||
pattern: "*.{fasta,fas,fa,aln}"
|
||||
output:
|
||||
- version:
|
||||
type: file
|
||||
description: File containing software version
|
||||
pattern: "*.{version.txt}"
|
||||
- fasta:
|
||||
type: file
|
||||
description: Filtered variant alignment in fasta format
|
||||
pattern: "*.{fasta}"
|
||||
- embl_predicted:
|
||||
type: file
|
||||
description: Recombination predictions in embl format
|
||||
pattern: "*.{recombination_predictions.embl}"
|
||||
- gff:
|
||||
type: file
|
||||
description: Recombination predictions in gff format
|
||||
pattern: "*.{gff}"
|
||||
- embl_branch:
|
||||
type: file
|
||||
description: Branch base reconstruction
|
||||
pattern: "*.{branch_base_reconstruction.embl}"
|
||||
- vcf:
|
||||
type: file
|
||||
description: SNP distribution
|
||||
pattern: "*.{vcf}"
|
||||
- stats:
|
||||
type: file
|
||||
description: Per branch statistics
|
||||
pattern: "*.{csv}"
|
||||
- phylip:
|
||||
type: file
|
||||
description: Filtered variant alignment in phylip format
|
||||
pattern: "*.{phylip}"
|
||||
- tree:
|
||||
type: file
|
||||
description: Recombination removed RAxML phylogenetic tree
|
||||
pattern: "*.{final_tree.tre}"
|
||||
- tree_labelled:
|
||||
type: file
|
||||
description: Recombination removed RAxML phylogenetic tree (nodes labelled)
|
||||
pattern: "*.{node_labelled.final_tree.tre}"
|
||||
authors:
|
||||
- "@avantonder"
|
||||
|
|
@ -246,6 +246,10 @@ gffread:
|
|||
- software/gffread/**
|
||||
- tests/software/gffread/**
|
||||
|
||||
gubbins:
|
||||
- software/gubbins/**
|
||||
- tests/software/gubbins/**
|
||||
|
||||
gunzip:
|
||||
- software/gunzip/**
|
||||
- tests/software/gunzip/**
|
||||
|
|
|
@ -25,6 +25,8 @@ params {
|
|||
kraken2_tar_gz = "${test_data_dir}/genomics/sarscov2/genome/db/kraken2.tar.gz"
|
||||
|
||||
test_wig_gz = "${test_data_dir}/genomics/sarscov2/genome/gcwiggle/test.wig.gz"
|
||||
|
||||
test_fas = "${test_data_dir}/genomics/sarscov2/genome/alignment/test.fas"
|
||||
}
|
||||
'illumina' {
|
||||
test_single_end_bam = "${test_data_dir}/genomics/sarscov2/illumina/bam/test_single_end.bam"
|
||||
|
|
8
tests/data/genomics/sarscov2/genome/alignment/test.fas
Normal file
8
tests/data/genomics/sarscov2/genome/alignment/test.fas
Normal file
File diff suppressed because one or more lines are too long
11
tests/software/gubbins/main.nf
Normal file
11
tests/software/gubbins/main.nf
Normal file
|
@ -0,0 +1,11 @@
|
|||
#!/usr/bin/env nextflow
|
||||
|
||||
nextflow.enable.dsl = 2
|
||||
|
||||
include { GUBBINS } from '../../../software/gubbins/main.nf' addParams( options: [:] )
|
||||
|
||||
workflow test_gubbins {
|
||||
input = file(params.test_data['sarscov2']['genome']['test_fas'], checkIfExists: true)
|
||||
|
||||
GUBBINS ( input )
|
||||
}
|
23
tests/software/gubbins/test.yml
Normal file
23
tests/software/gubbins/test.yml
Normal file
|
@ -0,0 +1,23 @@
|
|||
- name: gubbins
|
||||
command: nextflow run ./tests/software/gubbins -entry test_gubbins -c tests/config/nextflow.config
|
||||
tags:
|
||||
- gubbins
|
||||
files:
|
||||
- path: output/gubbins/test.filtered_polymorphic_sites.fasta
|
||||
md5sum: c9dff2294307eb2200a6e19efce47796
|
||||
- path: output/gubbins/test.recombination_predictions.embl
|
||||
md5sum: d41d8cd98f00b204e9800998ecf8427e
|
||||
- path: output/gubbins/test.recombination_predictions.gff
|
||||
md5sum: a2ca9c119674f4d121a8f78e4078fe05
|
||||
- path: output/gubbins/test.branch_base_reconstruction.embl
|
||||
md5sum: d41d8cd98f00b204e9800998ecf8427e
|
||||
- path: output/gubbins/test.summary_of_snp_distribution.vcf
|
||||
md5sum: afee50e92fb919a5df487fbda0b9dbb5
|
||||
- path: output/gubbins/test.per_branch_statistics.csv
|
||||
md5sum: 0f364b5e0b01a6be9b6a4407658ab25f
|
||||
- path: output/gubbins/test.filtered_polymorphic_sites.phylip
|
||||
md5sum: 85db9d0896cfec34a73641496b7498bb
|
||||
- path: output/gubbins/test.final_tree.tre
|
||||
md5sum: dce7164a0c69bb3d642a419907364aa3
|
||||
- path: output/gubbins/test.node_labelled.final_tree.tre
|
||||
md5sum: beef5ce05aca4598bb3f42caf126e045
|
Loading…
Reference in a new issue