Learn More →
Edmund Miller /
Learn More →
Learn More →
University of Texas at Dallas
Pytest-workflow aims to make testing as simple as possible so you can focus on debugging your pipeline.
git bisect
- name: Touch a file
command: touch test.file
files:
- path: test.file
test.yml
file- name: gunzip
command: nextflow run ./tests/software/gunzip -entry test_gunzip -c tests/config/nextflow.config
tags:
- gunzip
files:
- path: ./output/gunzip/test_1.fastq
md5sum: 4161df271f9bfcd25d5845a1e220dbec
nf-core modules create-test-yml
nf-core modules create-test-yml
Exampleinclude { STAR_GENOMEGENERATE } from '../../../../software/star/genomegenerate/main.nf' addParams( options: [args: '--genomeSAindexNbases 9'] )
include { STAR_ALIGN } from '../../../../software/star/align/main.nf' addParams( options: [args: '--readFilesCommand zcat'] )
workflow test_star_alignment_single_end {
input = [ [ id:'test', single_end:true ], // meta map
[ file("${launchDir}/tests/data/generic/fastq/test_single_end.fastq.gz", checkIfExists: true) ]
]
fasta = file("${launchDir}/tests/data/generic/fasta/GCF_000019425.1_ASM1942v1_genomic.fna", checkIfExists: true)
gtf = file("${launchDir}/tests/data/generic/gtf/GCF_000019425.1_ASM1942v1_genomic.gtf", checkIfExists: true)
STAR_GENOMEGENERATE ( fasta, gtf )
STAR_ALIGN ( input, STAR_GENOMEGENERATE.out.index, gtf )
}
$ nf-core modules create-test-yml
,--./,-.
___ __ __ __ ___ /,-._.--~\
|\ | |__ __ / ` / \ |__) |__ } {
| \| | \__, \__/ | \ |___ \`-._,-`-,
`._,._,'
nf-core/tools version 1.13
INFO Press enter to use default values (shown in brackets) or type your own responses
? Tool name: star/align
Test YAML output path (- for stdout) (tests/software/star/align/test.yml):
File exists! 'tests/software/star/align/test.yml' Overwrite? [y/n]: y
INFO Looking for test workflow entry points: 'tests/software/star/align/main.nf'
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
INFO Building test meta for entry point 'test_star_alignment_single_end'
Test name (star align test_star_alignment_single_end):
Test command (nextflow run tests/software/star/align -entry test_star_alignment_single_end -c tests/config/nextflow.config):
Test tags (comma separated) (star_alignment_single_end,star_align,star):
Test output folder with results (leave blank to run test):
? Choose software profile Docker
INFO Running 'star/align' test with command:
nextflow run tests/software/star/align -entry test_star_alignment_single_end -c tests/config/nextflow.config --outdir
/var/folders/bq/451scswn2dn4npxhf_28lyt40000gn/T/tmp_p22f8bg
INFO Test workflow finished!
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
INFO Building test meta for entry point 'test_star_alignment_paired_end'
...
...
- uses: dorny/paths-filter@v2 id: filter with: filters: "tests/config/pytest_software.yml"
star/align: - software/star/align/** - tests/software/star/align/**
matrix: nxf_version: ['21.04.0'] tags: ['${{ fromJson(needs.changes.outputs.modules) }}'] profile: ['docker', 'singularity', 'conda']
- name: Run pytest-workflow
# only use one thread for pytest-workflow to avoid race condition on conda cache.
run: TMPDIR=~ PROFILE=${{ matrix.profile }} pytest --tag ${{ matrix.tags }} --symlink --kwdof
- name: Upload logs on failure
if: failure()
uses: actions/upload-artifact@v2
with:
name: logs-${{ matrix.tags }}-${{ matrix.profile }}-${{ matrix.nxf_version }}
path: |
/home/runner/pytest_workflow_*/*/.nextflow.log
/home/runner/pytest_workflow_*/*/log.out
/home/runner/pytest_workflow_*/*/log.err
/home/runner/pytest_workflow_*/*/work
- name: Lint ${{ matrix.tags }}
run: nf-core modules lint . -t ${{ matrix.tags }}
nf-core/modules $ conda install pytest-workflow
nf-core/modules $ PROFILE=docker pytest --tag gunzip --symlink
nf-core/modules $ PROFILE=docker pytest --tag gunzip --symlink --basetemp ~/scratch/tmp/pytest
# NOTE For now these tests don't support any containers beside singularity - name: Run default pipeline with test data command: nextflow run main.nf -profile test,docker tags: - default files: # fastqc - path: results/fastqc/RAP1_IAA_30M_REP1_1_fastqc.html - path: results/fastqc/RAP1_IAA_30M_REP1_1_fastqc.zip ... # multiqc - path: results/multiqc/star_salmon/multiqc_report.html ...
include { MARKDUPLICATES } from '../../../../subworkflows/nf-core/markduplicates' addParams( markduplicates_options: modules['markduplicates'], markduplicatesspark_options: modules['markduplicatesspark'] ) workflow test_markduplicates { input = [[id: 'test'], [file(params.test_data['nf-core']['test_paired_end_sorted_bam'], checkIfExists: true)], [file(params.test_data['nf-core']['test_paired_end_sorted_bai'], checkIfExists: true)]] MARKDUPLICATES ( input, false, true ) }
- name: subworkflow markduplicates
command: nextflow run ./tests/subworkflows/nf-core/markduplicates/ -entry test_markduplicates -c tests/config/nextflow.config
tags:
- markduplicates
- gatk4
files:
- path: output/preprocessing/test/markduplicates/test.md.bam
- path: output/preprocessing/test/markduplicates/test.md.bam.bai
markduplicates:
- modules/nf-core/software/gatk4/markduplicates/main.nf
- subworkflow/local/markduplicates.nf
- tests/subworkflow/local/markduplicates/**
Repository: nf-core/modules
Tutorial: https://nf-co.re/usage/usage_tutorials
Chat: https://nf-co.re/join
#channel