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 // Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './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 = [:] params.options = [:]
options = initOptions(params.options) options = initOptions(params.options)
process CIRCULARMAPPER_GENERATOR { process CIRCULARMAPPER_GENERATOR {
tag '$bam' tag "$fasta"
label 'process_medium' label 'process_medium'
publishDir "${params.outdir}", publishDir "${params.outdir}",
mode: params.publish_dir_mode, 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). conda (params.enable_conda ? "bioconda::circularmapper=1.93.5 bioconda::bwa=0.7.17" : null)
// 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)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { 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 { } else {
container "quay.io/biocontainers/circularmapper:1.93.5--h4a94de4_1" container "quay.io/biocontainers/mulled-v2-9955aa4caccd101358f742fbf51faa7f9105f099:a7be1c066de246d48c344a53c13b18da1f80cb4c-0"
} }
input: input:
// TODO nf-core: Where applicable all sample-specific information e.g. "id", "single_end", "read_group" path fasta
// 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
output: output:
// TODO nf-core: Named file extensions MUST be emitted for ALL output channels path "circularmapper", emit: index
path "*.bam", emit: bam path "versions.yml", emit: versions
// TODO nf-core: List additional required output channels/values here
path "*.version.txt" , emit: version
script: script:
def software = getSoftwareName(task.process) 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 \\ mkdir circularmapper
sort \\ circulargenerator \\
$options.args \\ -i $fasta \\
-@ $task.cpus \\ $options.args
$bam
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 name: circularmapper_generator
## TODO nf-core: Add a description of the module and list keywords description: CircularMapper Generator Module
description: write your description here
keywords: keywords:
- sort - index
- genome
- fasta
- reference
tools: tools:
- circularmapper: - 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. description: A method to improve mappings on circular genomes, using the BWA mapper.
homepage: None homepage: https://github.com/apeltzer/Circularmapper
documentation: None documentation: https://circularmapper.readthedocs.io/en/latest/
tool_dev_url: None doi: "10.1186/s13059-016-0918-z"
doi: ""
licence: ['GPL v3'] licence: ['GPL v3']
## TODO nf-core: Add a description of all of the variables used as input
input: input:
## TODO nf-core: Delete / customise this example input - fasta:
- bam:
type: file type: file
description: BAM/CRAM/SAM file description: Input genome fasta file
pattern: "*.{bam,cram,sam}" pattern: "*.{fasta}"
## TODO nf-core: Add a description of all of the variables used as output
output: output:
- version: - index:
type: file type: file
description: File containing software version description: BWA genome index files
pattern: "*.{version.txt}" pattern: "*.{amb,ann,bwt,pac,sa}"
## TODO nf-core: Delete / customise this example output - versions:
- bam:
type: file type: file
description: Sorted BAM/CRAM/SAM file description: File containing software versions
pattern: "*.{bam,cram,sam}" pattern: "versions.yml"
authors: authors:
- "@apeltzer" - "@apeltzer"

View file

@ -2,11 +2,11 @@
nextflow.enable.dsl = 2 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 { 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 ) 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 - name: circularmapper generator
command: nextflow run ./tests/modules/circularmapper/generator -entry test_circularmapper_generator -c tests/config/nextflow.config command: nextflow run ./tests/modules/circularmapper/generator -entry test_circularmapper_generator -c tests/config/nextflow.config
tags: tags: