Adding more stuff to test generator

This commit is contained in:
Alexander Peltzer 2021-10-28 14:59:25 +02:00
parent db21925937
commit b3df0d311d
4 changed files with 39 additions and 76 deletions

View file

@ -1,77 +1,45 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions'
// TODO nf-core: If in doubt look at other nf-core/modules to see how we are doing things! :)
// https://github.com/nf-core/modules/tree/master/software
// You can also ask for help via your pull request or on the #modules channel on the nf-core Slack workspace:
// https://nf-co.re/join
// TODO nf-core: A module file SHOULD only define input and output files as command-line parameters.
// All other parameters MUST be provided as a string i.e. "options.args"
// where "params.options" is a Groovy Map that MUST be provided via the addParams section of the including workflow.
// Any parameters that need to be evaluated in the context of a particular sample
// e.g. single-end/paired-end data MUST also be defined and evaluated appropriately.
// TODO nf-core: Software that can be piped together SHOULD be added to separate module files
// unless there is a run-time, storage advantage in implementing in this way
// e.g. it's ok to have a single module for bwa to output BAM instead of SAM:
// bwa mem | samtools view -B -T ref.fasta
// TODO nf-core: Optional inputs are not currently supported by Nextflow. However, using an empty
// list (`[]`) instead of a file can be used to work around this issue.
params.options = [:]
options = initOptions(params.options)
process CIRCULARMAPPER_GENERATOR {
tag '$bam'
tag "$fasta"
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:[:], publish_by_meta:[]) }
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:'index', meta:[:], publish_by_meta:[]) }
// TODO nf-core: List required Conda package(s).
// Software MUST be pinned to channel (i.e. "bioconda"), version (i.e. "1.10").
// For Conda, the build (i.e. "h9402c20_2") must be EXCLUDED to support installation on different operating systems.
// TODO nf-core: See section in main README for further information regarding finding and adding container addresses to the section below.
conda (params.enable_conda ? "bioconda::circularmapper=1.93.5" : null)
conda (params.enable_conda ? "bioconda::circularmapper=1.93.5 bioconda::bwa=0.7.17" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
container "https://depot.galaxyproject.org/singularity/circularmapper:1.93.5--h4a94de4_1"
container "https://depot.galaxyproject.org/singularity/mulled-v2-9955aa4caccd101358f742fbf51faa7f9105f099:a7be1c066de246d48c344a53c13b18da1f80cb4c-0"
} else {
container "quay.io/biocontainers/circularmapper:1.93.5--h4a94de4_1"
container "quay.io/biocontainers/mulled-v2-9955aa4caccd101358f742fbf51faa7f9105f099:a7be1c066de246d48c344a53c13b18da1f80cb4c-0"
}
input:
// TODO nf-core: Where applicable all sample-specific information e.g. "id", "single_end", "read_group"
// MUST be provided as an input via a Groovy Map called "meta".
// This information may not be required in some instances e.g. indexing reference genome files:
// https://github.com/nf-core/modules/blob/master/software/bwa/index/main.nf
// TODO nf-core: Where applicable please provide/convert compressed files as input/output
// e.g. "*.fastq.gz" and NOT "*.fastq", "*.bam" and NOT "*.sam" etc.
path bam
path fasta
output:
// TODO nf-core: Named file extensions MUST be emitted for ALL output channels
path "*.bam", emit: bam
// TODO nf-core: List additional required output channels/values here
path "*.version.txt" , emit: version
path "circularmapper", emit: index
path "versions.yml", emit: versions
script:
def software = getSoftwareName(task.process)
// TODO nf-core: Where possible, a command MUST be provided to obtain the version number of the software e.g. 1.10
// If the software is unable to output a version number on the command-line then it can be manually specified
// e.g. https://github.com/nf-core/modules/blob/master/software/homer/annotatepeaks/main.nf
// TODO nf-core: It MUST be possible to pass additional parameters to the tool as a command-line string via the "$options.args" variable
// TODO nf-core: If the tool supports multi-threading then you MUST provide the appropriate parameter
// using the Nextflow "task" variable e.g. "--threads $task.cpus"
// TODO nf-core: Please replace the example samtools command below with your module's command
// TODO nf-core: Please indent the command appropriately (4 spaces!!) to help with readability ;)
"""
samtools \\
sort \\
$options.args \\
-@ $task.cpus \\
$bam
mkdir circularmapper
circulargenerator \\
-i $fasta \\
$options.args
echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//' > ${software}.version.txt
bwa index $fasta
cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}:
${getSoftwareName(task.process)}: \$(echo \$(circulargenerator --help 2>&1) | head -n 1')
bwa: \$(echo \$(bwa 2>&1) | sed 's/^.*Version: //; s/Contact:.*\$//')
END_VERSIONS
"""
}

View file

@ -1,37 +1,34 @@
name: circularmapper_generator
## TODO nf-core: Add a description of the module and list keywords
description: write your description here
description: CircularMapper Generator Module
keywords:
- sort
- index
- genome
- fasta
- reference
tools:
- circularmapper:
## TODO nf-core: Add a description and other details for the software below
description: A method to improve mappings on circular genomes, using the BWA mapper.
homepage: None
documentation: None
tool_dev_url: None
doi: ""
homepage: https://github.com/apeltzer/Circularmapper
documentation: https://circularmapper.readthedocs.io/en/latest/
doi: "10.1186/s13059-016-0918-z"
licence: ['GPL v3']
## TODO nf-core: Add a description of all of the variables used as input
input:
## TODO nf-core: Delete / customise this example input
- bam:
- fasta:
type: file
description: BAM/CRAM/SAM file
pattern: "*.{bam,cram,sam}"
description: Input genome fasta file
pattern: "*.{fasta}"
## TODO nf-core: Add a description of all of the variables used as output
output:
- version:
- index:
type: file
description: File containing software version
pattern: "*.{version.txt}"
## TODO nf-core: Delete / customise this example output
- bam:
description: BWA genome index files
pattern: "*.{amb,ann,bwt,pac,sa}"
- versions:
type: file
description: Sorted BAM/CRAM/SAM file
pattern: "*.{bam,cram,sam}"
description: File containing software versions
pattern: "versions.yml"
authors:
- "@apeltzer"

View file

@ -2,11 +2,11 @@
nextflow.enable.dsl = 2
include { CIRCULARMAPPER_GENERATOR } from '../../../../modules/circularmapper/generator/main.nf' addParams( options: [:] )
include { CIRCULARMAPPER_GENERATOR } from '../../../../modules/circularmapper/generator/main.nf' addParams( options: [publish_dir:'circularmapper'] )
workflow test_circularmapper_generator {
input = file(params.test_data['sarscov2']['illumina']['test_single_end_bam'], checkIfExists: true)
input = file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true)
CIRCULARMAPPER_GENERATOR ( input )
}

View file

@ -1,5 +1,3 @@
## TODO nf-core: Please run the following command to build this file:
# nf-core modules create-test-yml circularmapper/generator
- name: circularmapper generator
command: nextflow run ./tests/modules/circularmapper/generator -entry test_circularmapper_generator -c tests/config/nextflow.config
tags: