Add tests for BWA mem

This commit is contained in:
drpatelh 2020-08-07 13:24:24 +01:00
parent cff81ef875
commit b5338efb7d
4 changed files with 153 additions and 47 deletions

30
.github/workflows/bwa_mem.yml vendored Normal file
View file

@ -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

View file

@ -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/<SOFTWARE>`
- 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"

48
software/bwa/mem/test/main.nf Normal file → Executable file
View file

@ -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()
}

View file

@ -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
}
}