test(bwa): Refactor to use pytest-workflow

This commit is contained in:
Edmund Miller 2020-11-24 18:16:56 -06:00
parent dfc8528df9
commit 016d8684f3
No known key found for this signature in database
GPG key ID: BD387FF7BC10AA9D
21 changed files with 106 additions and 124 deletions

View file

@ -17,7 +17,6 @@ jobs:
env:
NXF_ANSI_LOG: false
steps:
- uses: actions/checkout@v2
- name: Install Nextflow
@ -26,5 +25,12 @@ jobs:
wget -qO- get.nextflow.io | bash
sudo mv nextflow /usr/local/bin/
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.x"
- name: Install dependencies
run: python -m pip install --upgrade pip pytest-workflow
# Test the module
- run: nextflow run ./software/bwa/index/test/ -profile docker
- run: pytest --tag bwa_index --symlink --wt 2

View file

@ -17,7 +17,6 @@ jobs:
env:
NXF_ANSI_LOG: false
steps:
- uses: actions/checkout@v2
- name: Install Nextflow
@ -26,5 +25,12 @@ jobs:
wget -qO- get.nextflow.io | bash
sudo mv nextflow /usr/local/bin/
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.x"
- name: Install dependencies
run: python -m pip install --upgrade pip pytest-workflow
# Test the module
- run: nextflow run ./software/bwa/mem/test/ -profile docker
- run: pytest --tag bwa_index --symlink --wt 2

View file

@ -1 +0,0 @@
../../../../../tests/data/fasta/E_coli/NC_010473.fa

View file

@ -1,13 +0,0 @@
#!/usr/bin/env nextflow
nextflow.enable.dsl = 2
include { BWA_INDEX } from '../main.nf' addParams( options: [:] )
workflow test {
BWA_INDEX ( file("${baseDir}/input/NC_010473.fa", checkIfExists: true) )
}
workflow {
test()
}

View file

@ -1,20 +0,0 @@
params {
outdir = "output/"
publish_dir_mode = "copy"
enable_conda = false
}
profiles {
conda {
params.enable_conda = true
}
docker {
docker.enabled = true
docker.runOptions = '-u \$(id -u):\$(id -g)'
}
singularity {
singularity.enabled = true
singularity.autoMounts = true
}
}

View file

@ -1,3 +0,0 @@
4686137 1 2
20895 1 Y
142347 1 R

View file

@ -1,3 +0,0 @@
4686137 1 11
0 gi|170079663|ref|NC_010473.1| Escherichia coli str. K-12 substr. DH10B, complete genome
0 4686137 2

View file

@ -1 +0,0 @@
../../../../../tests/data/fastq/dna/Ecoli_DNA_R1.fastq.gz

View file

@ -1 +0,0 @@
../../../../../tests/data/fastq/dna/Ecoli_DNA_R2.fastq.gz

View file

@ -1 +0,0 @@
../../../../../tests/data/fasta/E_coli/NC_010473.fa

View file

@ -1 +0,0 @@
../../../../../tests/data/index/E_coli/bwa/

View file

@ -1,44 +0,0 @@
#!/usr/bin/env nextflow
nextflow.enable.dsl = 2
include { BWA_MEM as BWA_MEM_SE } from '../main.nf' addParams( options: [ publish_dir:'test_single_end' ] )
include { BWA_MEM as BWA_MEM_PE } from '../main.nf' addParams( options: [ publish_dir:'test_paired_end' ] )
/*
* 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_SE (
input,
file("${baseDir}/input/index/NC_010473.fa.{amb,ann,bwt,pac,sa}", checkIfExists: true),
file("${baseDir}/input/NC_010473.fa", checkIfExists: true)
)
}
/*
* 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_PE (
input,
file("${baseDir}/input/index/NC_010473.fa.{amb,ann,bwt,pac,sa}", checkIfExists: true),
file("${baseDir}/input/NC_010473.fa", checkIfExists: true)
)
}
workflow {
test_single_end()
test_paired_end()
}

View file

@ -1,20 +0,0 @@
params {
outdir = "output/"
publish_dir_mode = "copy"
enable_conda = false
}
profiles {
conda {
params.enable_conda = true
}
docker {
docker.enabled = true
docker.runOptions = '-u \$(id -u):\$(id -g)'
}
singularity {
singularity.enabled = true
singularity.autoMounts = true
}
}

View file

@ -0,0 +1,44 @@
#!/usr/bin/env nextflow
nextflow.enable.dsl = 2
include { BWA_INDEX } from '../../../software/bwa/index/main.nf' addParams( options: [:] )
include { BWA_MEM as BWA_MEM_SE } from '../../../software/bwa/mem/main.nf' addParams( options: [ publish_dir:'test_single_end' ] )
include { BWA_MEM as BWA_MEM_PE } from '../../../software/bwa/mem/main.nf' addParams( options: [ publish_dir:'test_paired_end' ] )
workflow test_bwa_index {
BWA_INDEX ( file("${launchDir}/tests/data/fasta/E_coli/NC_010473.fa", checkIfExists: true) )
}
/*
* Test with single-end data
*/
workflow test_bwa_mem_single_end {
def input = []
input = [ [ id:'test', single_end:true ], // meta map
[ file("${launchDir}/tests/data/fastq/dna/Ecoli_DNA_R1.fastq.gz", checkIfExists: true) ] ]
BWA_MEM_SE (
input,
file("${launchDir}/tests/data/index/E_coli/bwa/NC_010473.fa.{amb,ann,bwt,pac,sa}", checkIfExists: true),
file("${launchDir}/tests/data/fasta/E_coli/NC_010473.fa", checkIfExists: true)
)
}
/*
* Test with paired-end data
*/
workflow test_bwa_mem_paired_end {
def input = []
input = [ [ id:'test', single_end:false ], // meta map
[ file("${launchDir}/tests/data/fastq/dna/Ecoli_DNA_R1.fastq.gz", checkIfExists: true),
file("${launchDir}/tests/data/fastq/dna/Ecoli_DNA_R2.fastq.gz", checkIfExists: true) ] ]
BWA_MEM_PE (
input,
file("${launchDir}/tests/data/index/E_coli/bwa/NC_010473.fa.{amb,ann,bwt,pac,sa}", checkIfExists: true),
file("${launchDir}/tests/data/fasta/E_coli/NC_010473.fa", checkIfExists: true)
)
}

View file

@ -0,0 +1,32 @@
- name: Run bwa index
command: nextflow run ./tests/software/bwa -profile docker -entry test_bwa_index -c tests/config/nextflow.config
tags:
- bwa
- bwa_index
files:
- path: output/bwa/NC_010473.fa.amb
md5sum: 942a990ae872f1c0b8d72dda2db405d5
- path: output/bwa/NC_010473.fa.bwt
md5sum: 7301b52e2ecb893d429a49fa692447ae
- path: output/bwa/NC_010473.fa.pac
md5sum: 4d5e6fc45bbc968f7f859e9ca2cc89ad
- path: output/bwa/NC_010473.fa.sa
md5sum: a47dcc92e750e2f16fbd979b8ff9538e
- name: Run bwa mem single-end
command: nextflow run ./tests/software/bwa -profile docker -entry test_bwa_mem_single_end -c tests/config/nextflow.config
tags:
- bwa
- bwa_mem
files:
- path: output/test_single_end/test.bam
md5sum: 3ee21210bac387e0335008146e4728bc
- name: Run bwa mem paired-end
command: nextflow run ./tests/software/bwa -profile docker -entry test_bwa_mem_paired_end -c tests/config/nextflow.config
tags:
- bwa
- bwa_mem
files:
- path: output/test_paired_end/test.bam
md5sum: 510d8acc6448c07cdacce8e64ec0904c

View file

@ -29,3 +29,5 @@ workflow test_paired_end {
FASTQC_PE ( input )
}
// TODO Test e2e