mirror of
https://github.com/MillironX/nf-core_modules.git
synced 2024-12-22 11:08:17 +00:00
refactor(pytest-workflow): Move fastqc tests to tests/
This commit is contained in:
parent
f235732a58
commit
ba681c6f27
10 changed files with 34 additions and 112 deletions
|
@ -1 +0,0 @@
|
|||
../../../lib/
|
|
@ -1,76 +0,0 @@
|
|||
#!/usr/bin/env nextflow
|
||||
import checksum
|
||||
nextflow.preview.dsl = 2
|
||||
|
||||
params.out_dir = "test_output"
|
||||
params.fastqc_args = ''
|
||||
params.publish_dir_mode = "copy"
|
||||
|
||||
include { FASTQC } from '../main.nf'
|
||||
|
||||
/**
|
||||
* Test if FASTQC runs with single-end data
|
||||
*/
|
||||
workflow test_single_end {
|
||||
input_files = Channel.fromPath("${baseDir}/input/test_single_end.fastq.gz")
|
||||
.map {f -> [f.name.replace(".fastq.gz", ""), true, f]}
|
||||
FASTQC(input_files)
|
||||
|
||||
// test that the output looks as expected
|
||||
FASTQC.out.html.map { name, is_single_end, html_file ->
|
||||
html_hash = checksum.getMD5(new File("${html_file}"));
|
||||
|
||||
assert name == "test_single_end"
|
||||
assert is_single_end == true
|
||||
assert html_file.getName() == "test_single_end_fastqc.html"
|
||||
// Hash seems to vary between local runs and GitHub Actions
|
||||
// TODO: Might be solved when using Docker for tests?
|
||||
// assert html_hash == "8ed68442ebb5b9706bf79b4f66701e15"
|
||||
}
|
||||
FASTQC.out.zip.map { name, is_single_end, zip_file ->
|
||||
// NOTE: output zip files do not have a consistent hash
|
||||
assert name == "test_single_end"
|
||||
assert is_single_end == true
|
||||
assert zip_file.getName() == "test_single_end_fastqc.zip"
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test if FASTQC runs with paired end data
|
||||
*/
|
||||
workflow test_paired_end {
|
||||
input_files = Channel.fromFilePairs("input/test_R{1,2}.fastq.gz")
|
||||
.map {f -> [f[0], false, f[1]]}
|
||||
FASTQC(input_files)
|
||||
|
||||
// test that the output looks as expected
|
||||
FASTQC.out.html.map { name, is_single_end, html_files ->
|
||||
html_r1 = html_files[0]
|
||||
html_r2 = html_files[1]
|
||||
|
||||
html_r1_hash = checksum.getMD5(new File("${html_r1}"));
|
||||
html_r2_hash = checksum.getMD5(new File("${html_r2}"));
|
||||
|
||||
assert name == "test_R"
|
||||
assert is_single_end == false
|
||||
assert html_r1.getName() == "test_R_1_fastqc.html"
|
||||
assert html_r2.getName() == "test_R_2_fastqc.html"
|
||||
assert html_r1_hash == "082c13ce7163ea0f52a66b83cb57b0f0"
|
||||
assert html_r2_hash == "4ff04ec8da77e3af512f03b8c09a9e04"
|
||||
}
|
||||
FASTQC.out.zip.map { name, is_single_end, zip_files ->
|
||||
zip_r1 = zip_files[0]
|
||||
zip_r2 = zip_files[1]
|
||||
// NOTE: output zip files do not have a consistent hash
|
||||
|
||||
assert name == "test_R"
|
||||
assert is_single_end == false
|
||||
assert zip_r1.getName() == "test_R_1_fastqc.zip"
|
||||
assert zip_r2.getName() == "test_R_2_fastqc.zip"
|
||||
}
|
||||
}
|
||||
|
||||
workflow {
|
||||
test_single_end()
|
||||
test_paired_end()
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
../../../../tests/data/fastq/rna/test_single_end.fastq.gz
|
|
@ -1,31 +0,0 @@
|
|||
#!/usr/bin/env nextflow
|
||||
|
||||
nextflow.enable.dsl = 2
|
||||
|
||||
include { FASTQC as FASTQC_SE } from '../main.nf' addParams( options: [ publish_dir:'test_single_end' ] )
|
||||
include { FASTQC as FASTQC_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/test_single_end.fastq.gz", checkIfExists: true) ] ]
|
||||
|
||||
FASTQC_SE ( input )
|
||||
}
|
||||
|
||||
/*
|
||||
* Test with paired-end data
|
||||
*/
|
||||
workflow test_paired_end {
|
||||
|
||||
def input = []
|
||||
input = [ [ id:'test', single_end:false ], // meta map
|
||||
[ file("${baseDir}/input/test_R1.fastq.gz", checkIfExists: true),
|
||||
file("${baseDir}/input/test_R2.fastq.gz", checkIfExists: true) ] ]
|
||||
|
||||
FASTQC_PE ( input )
|
||||
}
|
1
tests/fastqc/input/test_single_end.fastq.gz
Symbolic link
1
tests/fastqc/input/test_single_end.fastq.gz
Symbolic link
|
@ -0,0 +1 @@
|
|||
../../data/fastq/rna/test_single_end.fastq.gz
|
31
tests/fastqc/main.nf
Normal file
31
tests/fastqc/main.nf
Normal file
|
@ -0,0 +1,31 @@
|
|||
#!/usr/bin/env nextflow
|
||||
|
||||
nextflow.enable.dsl = 2
|
||||
|
||||
include { FASTQC as FASTQC_SE } from '../../software/fastqc/main.nf' addParams( options: [ publish_dir:'test_single_end' ] )
|
||||
include { FASTQC as FASTQC_PE } from '../../software/fastqc/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("${projectDir}/input/test_single_end.fastq.gz", checkIfExists: true) ] ]
|
||||
|
||||
FASTQC_SE ( input )
|
||||
}
|
||||
|
||||
/*
|
||||
* Test with paired-end data
|
||||
*/
|
||||
workflow test_paired_end {
|
||||
|
||||
def input = []
|
||||
input = [ [ id:'test', single_end:false ], // meta map
|
||||
[ file("${launchDir}/tests/data/fastq/rna/test_R1.fastq.gz", checkIfExists: true),
|
||||
file("${projectDir}/../data/fastq/rna/test_R2.fastq.gz", checkIfExists: true) ] ]
|
||||
|
||||
FASTQC_PE ( input )
|
||||
}
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
params {
|
||||
outdir = "output/"
|
||||
publish_dir_mode = "copy"
|
|
@ -1,5 +1,5 @@
|
|||
- name: Run fastqc single-end test workflow
|
||||
command: nextflow run ./software/fastqc/test/ -profile docker -entry test_single_end
|
||||
command: nextflow run ./tests/fastqc/ -profile docker -entry test_single_end
|
||||
tags:
|
||||
- fastqc
|
||||
files:
|
||||
|
@ -8,7 +8,7 @@
|
|||
- path: output/test_single_end/test_fastqc.zip
|
||||
|
||||
- name: Run fastqc paired-end test workflow
|
||||
command: nextflow run ./software/fastqc/test/ -profile docker -entry test_paired_end
|
||||
command: nextflow run ./tests/fastqc/ -profile docker -entry test_paired_end
|
||||
tags:
|
||||
- fastqc
|
||||
files:
|
Loading…
Reference in a new issue