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 name: bwa_mem
description: Performs fastq alignment to a fasta reference using the burrows-wheeler aligner description: Performs fastq alignment to a fasta reference using BWA
keywords: keywords:
- mem - mem
- bwa - bwa
- alignment - alignment
- map
tools: tools:
- bwa: - bwa:
description: | description: |
BWA is a software package for mapping DNA sequences against a large reference genome, such as the human genome. BWA is a software package for mapping DNA sequences against
homepage: http://bio-bwa.sourceforge.net/ a large reference genome, such as the human genome.
documentation: http://www.htslib.org/doc/samtools.html homepage: http://bio-bwa.sourceforge.net/
arxiv: arXiv:1303.3997 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: input:
- - meta:
- id: type: map
type: val description: |
description: read/read pair id Groovy Map containing sample information
- reads: e.g. [ id:'test', single_end:false ]
type: file - reads:
description: Input fastq file type: file
pattern: "*.{fastq,fq}" description: |
- index: List of input FastQ files of size 1 and 2 for single-end and paired-end data,
type: file respectively.
description: bwa indexes file - index:
pattern: "*.{amb,ann,bwt,pac,sa}" type: file
- prefix: description: |
type: val BWA genome index files
description: bwa index prefix, equivalent to index file names without extensions. Usually the reference genome file name unless otherwise specified. 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: output:
- - bam:
- bam: type: file
type: file description: Output BAM file containing read alignments
description: Output bam file pattern: "*.bam"
pattern: "*.bam" - version:
- bamindex: type: file
type: file description: File containing software version
description: Output bam index file pattern: "*.version.txt"
pattern: "*.bai"
authors: 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 #!/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' nextflow.enable.dsl = 2
index = '../../../../test-datasets/tools/bwa/mem/index/H3N2.{amb,ann,bwt,pac,sa}'
prefix = 'H3N2' 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 { workflow {
read_input=Channel.fromFilePairs(reads) test_single_end()
bwa_mem(read_input,file(index),prefix) 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
}
}