Update busco module

This commit is contained in:
Mahesh Binzer-Panchal 2022-05-03 08:42:56 +00:00
parent 3e6be50600
commit 9a72548ee1
4 changed files with 60 additions and 36 deletions

View file

@ -1,31 +1,31 @@
process BUSCO { process BUSCO {
tag "$meta.id" tag "$meta.id"
label 'process_medium' label 'process_medium'
conda (params.enable_conda ? "bioconda::busco=5.2.2" : null) conda (params.enable_conda ? "bioconda::busco=5.3.2" : null)
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/busco:5.2.2--pyhdfd78af_0': 'https://depot.galaxyproject.org/singularity/busco:5.3.2--pyhdfd78af_0':
'quay.io/biocontainers/busco:5.2.2--pyhdfd78af_0' }" 'quay.io/biocontainers/busco:5.3.2--pyhdfd78af_0' }"
input: input:
tuple val(meta), path(fasta) tuple val(meta), path(fasta) // Required: meta map, and fasta sequence file
val(mode) each lineage // Required: lineage to check against
path(augustus_config) path busco_lineages_path // Recommended: path to busco lineages - downloads if not set
val(lineage) path config_file // Optional: busco configuration file
output: output:
tuple val(meta), path("${meta.id}/run_*/full_table.tsv"), emit: tsv tuple val(meta), path("*-busco"), emit: busco_dir
tuple val(meta), path("${meta.id}/run_*/short_summary.txt"), emit: txt path "versions.yml" , emit: versions
path "versions.yml" , emit: versions
when:
task.ext.when == null || task.ext.when
script: script:
def args = task.ext.args ?: '' def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}" def prefix = task.ext.prefix ?: "${meta.id}-${lineage}"
if (lineage) args += " --lineage_dataset $lineage" def busco_config = config_file ? "--config $config_file" : ''
def busco_lineage_dir = busco_lineages_path ? "--download_path ${busco_lineages_path}" : ''
""" """
# Ensure the input is uncompressed
gzip -cdf $fasta > __UNCOMPRESSED_FASTA_FILE__
# Nextflow changes the container --entrypoint to /bin/bash (container default entrypoint: /usr/local/env-execute) # Nextflow changes the container --entrypoint to /bin/bash (container default entrypoint: /usr/local/env-execute)
# Check for container variable initialisation script and source it. # Check for container variable initialisation script and source it.
if [ -f "/usr/local/env-activate.sh" ]; then if [ -f "/usr/local/env-activate.sh" ]; then
@ -39,12 +39,30 @@ process BUSCO {
. "/usr/local/etc/conda/activate.d/augustus.sh" . "/usr/local/etc/conda/activate.d/augustus.sh"
. "/usr/local/etc/conda/activate.d/openjdk_activate.sh" . "/usr/local/etc/conda/activate.d/openjdk_activate.sh"
fi fi
# Copy the image's AUGUSTUS config directory if it was not provided to the module # If the augustus config directory is not writable, then copy to writeable area
[ ! -e augustus_config ] && cp -a /usr/local/config augustus_config if [ ! -w "\${AUGUSTUS_CONFIG_PATH}" ]; then
# Create writable tmp directory for augustus
# Busco command AUG_CONF_DIR=\$( mktemp -d -p \$PWD )
AUGUSTUS_CONFIG_PATH=augustus_config busco $args --augustus --mode $mode --cpu $task.cpus --in __UNCOMPRESSED_FASTA_FILE__ --out $meta.id cp -r \$AUGUSTUS_CONFIG_PATH/* \$AUG_CONF_DIR
export AUGUSTUS_CONFIG_PATH=\$AUG_CONF_DIR
echo "New AUGUSTUS_CONFIG_PATH=\${AUGUSTUS_CONFIG_PATH}"
fi
# Ensure the input is uncompressed
gzip -cdf $fasta > ${prefix}_uncompressed.fasta
busco \\
--cpu $task.cpus \\
--in ${prefix}_uncompressed.fasta \\
--out ${prefix}-busco \\
--lineage_dataset $lineage \\
$busco_lineage_dir \\
$busco_config \\
$args
# clean up
rm ${prefix}_uncompressed.fasta
cat <<-END_VERSIONS > versions.yml cat <<-END_VERSIONS > versions.yml
"${task.process}": "${task.process}":

View file

@ -2,14 +2,22 @@
nextflow.enable.dsl = 2 nextflow.enable.dsl = 2
include { BUSCO as BUSCO_BACTE } from '../../../modules/busco/main.nf' include { BUSCO } from '../../../modules/busco/main.nf'
// This tests genome decompression, empty input channels and data download // This tests genome decompression, empty input channels and data download
workflow test_busco { workflow test_busco {
input = [ [ id:'test' ], file(params.test_data['bacteroides_fragilis']['genome']['genome_fna_gz'], checkIfExists: true) ]
BUSCO_BACTE ( input, input = [
"genome", [ id:'test', single_end:false ], // meta map
[], file( params.test_data['bacteroides_fragilis']['genome']['genome_fna_gz'], checkIfExists: true)
[] ) ]
BUSCO (
input,
'bacteria_odb10',
[], // Download busco lineage
[], // No config
)
} }

View file

@ -1,5 +1,6 @@
process { process {
publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" }
ext.args = '--mode genome'
}
}

View file

@ -1,10 +1,7 @@
- name: busco test_busco - name: busco test_busco
command: nextflow run ./tests/modules/busco -entry test_busco -c ./tests/config/nextflow.config -c ./tests/modules/busco/nextflow.config command: nextflow run tests/modules/busco -entry test_busco -c tests/config/nextflow.config
tags: tags:
- busco - busco
files: files:
- path: output/busco/test/run_bacteroidales_odb10/full_table.tsv - path: output/busco/versions.yml
md5sum: 8d7b401d875ecd9291b01bf4485bf080 md5sum: 921e2abe85bf73e63a8b494453dc83cf
- path: output/busco/test/run_bacteroidales_odb10/short_summary.txt
contains: ['Complete BUSCOs (C)']