From b5338efb7dfd306aeedda2b34ed79cfa27e51b59 Mon Sep 17 00:00:00 2001 From: drpatelh Date: Fri, 7 Aug 2020 13:24:24 +0100 Subject: [PATCH] Add tests for BWA mem --- .github/workflows/bwa_mem.yml | 30 ++++++++ software/bwa/mem/meta.yml | 100 ++++++++++++++++---------- software/bwa/mem/test/main.nf | 48 ++++++++++--- software/bwa/mem/test/nextflow.config | 22 +++++- 4 files changed, 153 insertions(+), 47 deletions(-) create mode 100644 .github/workflows/bwa_mem.yml mode change 100644 => 100755 software/bwa/mem/test/main.nf diff --git a/.github/workflows/bwa_mem.yml b/.github/workflows/bwa_mem.yml new file mode 100644 index 00000000..7f463471 --- /dev/null +++ b/.github/workflows/bwa_mem.yml @@ -0,0 +1,30 @@ +name: bwa_mem +on: + push: + paths: + - software/bwa/mem/** + - .github/workflows/bwa_mem.yml + - tests + pull_request: + paths: + - software/bwa/mem/** + - .github/workflows/bwa_mem.yml + - tests + +jobs: + ci_test: + runs-on: ubuntu-latest + env: + NXF_ANSI_LOG: false + steps: + + - uses: actions/checkout@v2 + + - name: Install Nextflow + run: | + export NXF_VER="20.07.1" + wget -qO- get.nextflow.io | bash + sudo mv nextflow /usr/local/bin/ + + # Test the module + - run: nextflow run ./software/bwa/mem/test/ -profile docker diff --git a/software/bwa/mem/meta.yml b/software/bwa/mem/meta.yml index d8ae9a7d..1f570167 100644 --- a/software/bwa/mem/meta.yml +++ b/software/bwa/mem/meta.yml @@ -1,42 +1,68 @@ -name: bwa mem -description: Performs fastq alignment to a fasta reference using the burrows-wheeler aligner +name: bwa_mem +description: Performs fastq alignment to a fasta reference using BWA keywords: - - mem - - bwa - - alignment + - mem + - bwa + - alignment + - map tools: - - bwa: - description: | - BWA is a software package for mapping DNA sequences against a large reference genome, such as the human genome. - homepage: http://bio-bwa.sourceforge.net/ - documentation: http://www.htslib.org/doc/samtools.html - arxiv: arXiv:1303.3997 + - bwa: + description: | + BWA is a software package for mapping DNA sequences against + a large reference genome, such as the human genome. + homepage: http://bio-bwa.sourceforge.net/ + documentation: http://www.htslib.org/doc/samtools.html + arxiv: arXiv:1303.3997 +params: + - outdir: + type: string + description: | + The pipeline's output directory. By default, the module will + output files into `$params.outdir/` + - publish_dir_mode: + type: string + description: | + Value for the Nextflow `publishDir` mode parameter. + Available: symlink, rellink, link, copy, copyNoFollow, move. + - conda: + type: boolean + description: | + Run the module with Conda using the software specified + via the `conda` directive input: - - - - id: - type: val - description: read/read pair id - - reads: - type: file - description: Input fastq file - pattern: "*.{fastq,fq}" - - index: - type: file - description: bwa indexes file - pattern: "*.{amb,ann,bwt,pac,sa}" - - prefix: - type: val - description: bwa index prefix, equivalent to index file names without extensions. Usually the reference genome file name unless otherwise specified. + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - reads: + type: file + description: | + List of input FastQ files of size 1 and 2 for single-end and paired-end data, + respectively. + - index: + type: file + description: | + BWA genome index files + pattern: "*.{amb,ann,bwt,pac,sa}" + - fasta: + type: file + description: | + Input genome fasta file + - options: + type: map + description: | + Groovy Map containing module options for passing command-line arguments and + output file paths. output: - - - - bam: - type: file - description: Output bam file - pattern: "*.bam" - - bamindex: - type: file - description: Output bam index file - pattern: "*.bai" - + - bam: + type: file + description: Output BAM file containing read alignments + pattern: "*.bam" + - version: + type: file + description: File containing software version + pattern: "*.version.txt" authors: - - "@jeremy1805" + - "@drpatelh" + - "@jeremy1805" diff --git a/software/bwa/mem/test/main.nf b/software/bwa/mem/test/main.nf old mode 100644 new mode 100755 index 3a609477..f37dbd5b --- a/software/bwa/mem/test/main.nf +++ b/software/bwa/mem/test/main.nf @@ -1,13 +1,45 @@ #!/usr/bin/env nextflow -nextflow.preview.dsl = 2 -include '../../../../tests/functions/check_process_outputs.nf' params(params) -include '../main.nf' params(params) -reads = '../../../../test-datasets/tools/bwa/mem/reads/*_R{1,2}_001.fastq.gz' -index = '../../../../test-datasets/tools/bwa/mem/index/H3N2.{amb,ann,bwt,pac,sa}' -prefix = 'H3N2' +nextflow.enable.dsl = 2 + +include { BWA_MEM } from '../main.nf' + +/* + * Test with single-end data + */ +workflow test_single_end { + + def input = [] + input = [ [ id:'test', single_end:true ], // meta map + [ file("${baseDir}/input/Ecoli_DNA_R1.fastq.gz", checkIfExists: true) ] ] + + BWA_MEM ( + input, + file("${baseDir}/input/index/NC_010473.fa.{amb,ann,bwt,pac,sa}", checkIfExists: true), + file("${baseDir}/input/NC_010473.fa", checkIfExists: true), + [ publish_dir:'test_paired_end' ] + ) +} + +/* + * Test with paired-end data + */ +workflow test_paired_end { + + def input = [] + input = [ [ id:'test', single_end:false ], // meta map + [ file("${baseDir}/input/Ecoli_DNA_R1.fastq.gz", checkIfExists: true), + file("${baseDir}/input/Ecoli_DNA_R2.fastq.gz", checkIfExists: true) ] ] + + BWA_MEM ( + input, + file("${baseDir}/input/index/NC_010473.fa.{amb,ann,bwt,pac,sa}", checkIfExists: true), + file("${baseDir}/input/NC_010473.fa", checkIfExists: true), + [ publish_dir:'test_paired_end' ] + ) +} workflow { - read_input=Channel.fromFilePairs(reads) - bwa_mem(read_input,file(index),prefix) + test_single_end() + test_paired_end() } diff --git a/software/bwa/mem/test/nextflow.config b/software/bwa/mem/test/nextflow.config index c137a138..ddb59275 100644 --- a/software/bwa/mem/test/nextflow.config +++ b/software/bwa/mem/test/nextflow.config @@ -1,2 +1,20 @@ -docker.enabled = true -params.outdir = './results' + +params { + outdir = "output/" + publish_dir_mode = "copy" + conda = false +} + +profiles { + conda { + params.conda = true + } + docker { + docker.enabled = true + docker.runOptions = '-u \$(id -u):\$(id -g)' + } + singularity { + singularity.enabled = true + singularity.autoMounts = true + } +}