-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: Add testing CI and mention paper (#40)
* docs: Add new citation * chore: Remove unnecessary todo * test: Add local test cases for subwfs * ci: Add unit test workflow * ci: Remove tap * ci: Fix regex
- Loading branch information
Showing
17 changed files
with
317 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name: nf-test CI | ||
# This workflow runs the nf-test test suite | ||
on: | ||
pull_request: | ||
release: | ||
types: [published] | ||
|
||
env: | ||
NXF_ANSI_LOG: false | ||
|
||
jobs: | ||
test: | ||
name: Run ${{ matrix.profile }} pipeline test | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
NXF_VER: | ||
- "latest-stable" | ||
profile: ["docker"] # TODO , "singularity", "conda"] | ||
steps: | ||
- name: Check out pipeline code | ||
uses: actions/checkout@v2 | ||
|
||
- uses: actions/cache@v2 | ||
with: | ||
path: /usr/local/bin/nextflow | ||
key: ${{ runner.os }} | ||
restore-keys: | | ||
${{ runner.os }}-nextflow- | ||
- name: Install Nextflow | ||
uses: nf-core/setup-nextflow@v1 | ||
with: | ||
version: "${{ matrix.NXF_VER }}" | ||
|
||
- name: Install nf-test | ||
run: | | ||
wget -qO- https://code.askimed.com/install/nf-test | bash | ||
sudo mv nf-test /usr/local/bin/ | ||
- name: Run nf-test | ||
run: nf-test test --profile=${{ matrix.profile }} tests/*nf.test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,3 +8,8 @@ testing/ | |
testing* | ||
*.pyc | ||
test_data/kraken_viral_db/ | ||
.nf-test | ||
nf-test | ||
.nf-test.log | ||
test.nf | ||
site |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
config { | ||
testsDir "tests" | ||
workDir ".nf-test" | ||
profile "test,docker" | ||
} |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
nextflow_workflow { | ||
|
||
name "Test ALIGNMENT workflow" | ||
script "subworkflows/local/alignment.nf" | ||
workflow "ALIGNMENT" | ||
tag "ALIGNMENT" | ||
tag "subworkflows" | ||
|
||
test("Should run alignment with DIAMOND_MAKEDB and DIAMOND_BLASTX") { | ||
|
||
when { | ||
workflow { | ||
""" | ||
input[0] = [[id:'MEGAHIT-test_minigut'], "$baseDir/test_data/MEGAHIT-test_minigut.contigs.fa.gz"] | ||
input[1] = Channel.fromPath("$baseDir/test_data/protein.faa.gz") | ||
input[2] = [] | ||
""" | ||
} | ||
} | ||
|
||
then { | ||
assertAll( | ||
{ assert workflow.success }, | ||
{ assert workflow.trace.succeeded().size() == 2 }, | ||
{ assert workflow.out.alignments }, | ||
{ assert workflow.out.multiqc_files }, | ||
{ assert workflow.out.versions }, | ||
{ assert path(workflow.out.alignments[0][1]).exists() }, | ||
) | ||
|
||
} | ||
} | ||
|
||
test("Should run alignment with pre-built DIAMOND database") { | ||
|
||
when { | ||
workflow { | ||
""" | ||
input[0] = [[id:'minigut'], '$baseDir/test_data/MEGAHIT-test_minigut.contigs.fa.gz'] | ||
input[1] = Channel.fromPath("$baseDir/test_data/protein.faa.gz") | ||
input[2] = Channel.fromPath("$baseDir/test_data/protein.faa.gz.dmnd") | ||
""" | ||
} | ||
} | ||
|
||
then { | ||
assertAll( | ||
{ assert workflow.success }, | ||
{ assert workflow.trace.succeeded().size() == 1 }, | ||
{ assert workflow.out.alignments }, | ||
{ assert workflow.out.multiqc_files }, | ||
{ assert workflow.out.versions }, | ||
{ assert path(workflow.out.alignments[0][1]).exists() }, | ||
) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
nextflow_workflow { | ||
|
||
name "Test FUNCTIONAL workflow" | ||
script "subworkflows/local/functional.nf" | ||
workflow "FUNCTIONAL" | ||
tag "FUNCTIONAL" | ||
tag "subworkflows" | ||
|
||
test("Should run functional annotation workflow") { | ||
|
||
when { | ||
workflow { | ||
""" | ||
input[0] = [ | ||
[ id:'test_sample' ], | ||
file("$baseDir/test_data/test_minigut_sample2.txt.gz") | ||
] | ||
input[1] = file("$baseDir/test_data/idmapping_selected.tab.example.gz") | ||
""" | ||
} | ||
params { | ||
minimum_bitscore = 50 | ||
minimum_pident = 90 | ||
minimum_alen = 100 | ||
maximum_evalue = 1e-5 | ||
} | ||
} | ||
|
||
then { | ||
assertAll( | ||
{ assert workflow.success }, | ||
{ assert workflow.out.annotated }, | ||
) | ||
|
||
// Check GUNZIP output | ||
with(workflow.out.annotated) { | ||
assert size() == 1 | ||
with(get(0)) { | ||
assert get(0).id == "test_sample" | ||
} | ||
} | ||
|
||
// Check ANNOTATE output | ||
with(workflow.out.annotated) { | ||
assert size() == 1 | ||
with(get(0)) { | ||
assert get(0).id == "test_sample" | ||
assert get(1).readLines().size() > 0 | ||
// You might want to add more specific checks on the content of the annotated file | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* | ||
======================================================================================== | ||
Nextflow config file for running tests | ||
======================================================================================== | ||
*/ | ||
|
||
params { | ||
// Limit resources so that this can run on GitHub Actions | ||
cpus = 2 | ||
memory = 4.GB | ||
time = 4.h | ||
} | ||
|
||
process { | ||
withLabel:process_single { | ||
cpus = 1 | ||
memory = 6.GB | ||
time = 4.h | ||
} | ||
withLabel:process_low { | ||
cpus = 2 | ||
memory = 4.GB | ||
time = 4.h | ||
} | ||
withLabel:process_medium { | ||
cpus = 2 | ||
memory = 4.GB | ||
time = 4.h | ||
} | ||
withLabel:process_high { | ||
cpus = 2 | ||
memory = 4.GB | ||
time = 4.h | ||
} | ||
withLabel:process_high_memory { | ||
memory = 4.GB | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
nextflow_workflow { | ||
|
||
name "Test PREPROCESS workflow" | ||
script "subworkflows/local/preprocess.nf" | ||
workflow "PREPROCESS" | ||
tag "PREPROCESS" | ||
tag "subworkflows" | ||
|
||
test("Should run preprocessing with paired-end reads") { | ||
|
||
when { | ||
workflow { | ||
""" | ||
input[0] = [ | ||
[ id:'test_sample', single_end:false ], // meta map | ||
[ | ||
"https://raw.githubusercontent.com/nf-core/test-datasets/mag/test_data/test_minigut_R1.fastq.gz", | ||
"https://raw.githubusercontent.com/nf-core/test-datasets/mag/test_data/test_minigut_R2.fastq.gz" | ||
] | ||
] | ||
""" | ||
} | ||
} | ||
|
||
then { | ||
assertAll( | ||
{ assert workflow.success }, | ||
{ assert workflow.out.reads }, | ||
{ assert workflow.out.merged_reads }, | ||
{ assert workflow.out.multiqc_files }, | ||
{ assert workflow.out.versions } | ||
) | ||
|
||
// Check FASTP output | ||
with(workflow.out.reads) { | ||
assert size() == 1 | ||
with(get(0)) { | ||
assert get(0).id == "test_sample" | ||
assert get(0).single_end == false | ||
assert get(1).size() == 2 // Two fastq files for paired-end | ||
} | ||
} | ||
|
||
// Check merged reads | ||
with(workflow.out.merged_reads) { | ||
assert size() == 1 | ||
with(get(0)) { | ||
assert get(0).id == "test_sample" | ||
assert get(0).single_end == true | ||
} | ||
} | ||
|
||
// Check versions | ||
with(workflow.out.versions) { | ||
assert size() == 3 | ||
assert path(get(0)).text.contains("FASTP") | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
nextflow_workflow { | ||
|
||
name "Test TAXONOMY workflow" | ||
script "subworkflows/local/taxonomy.nf" | ||
workflow "TAXONOMY" | ||
tag "TAXONOMY" | ||
tag "subworkflows" | ||
|
||
test("Should run taxonomy workflow with Kraken2") { | ||
|
||
when { | ||
workflow { | ||
""" | ||
input[0] = [ | ||
[ id:'test_sample', single_end:false ], // meta map | ||
[ | ||
"https://raw.githubusercontent.com/nf-core/test-datasets/mag/test_data/test_minigut_R1.fastq.gz", | ||
"https://raw.githubusercontent.com/nf-core/test-datasets/mag/test_data/test_minigut_R2.fastq.gz" | ||
] | ||
] | ||
input[1] = [] | ||
input[2] = file("$baseDir/test_data/testdb-kraken2") | ||
""" | ||
} | ||
params { | ||
run_kaiju = false | ||
run_kraken2 = true | ||
skip_microview = true | ||
} | ||
} | ||
|
||
then { | ||
assertAll( | ||
{ assert workflow.success }, | ||
{ assert workflow.out.tax_report }, | ||
{ assert workflow.out.krona_report }, | ||
{ assert workflow.out.versions } | ||
) | ||
|
||
// Check Krona output | ||
with(workflow.out.krona_report) { | ||
assert size() == 1 | ||
} | ||
} | ||
} | ||
} |