Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add nf-test #1063

Open
wants to merge 49 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
f7fceaf
Add general structure, and generate (not working!) snapshot for basic…
jfy133 Apr 26, 2024
0778e58
Try adding an ignore zip system, doesn't work atm though...
jfy133 Apr 26, 2024
eb73ae6
Merge branch 'dev' into nf-test-conversionMerge in from dev
jfy133 Jun 28, 2024
cc114f3
Continue customisation
jfy133 Jun 28, 2024
37994df
More debugging
jfy133 Jul 12, 2024
e07dc06
Get working function
jfy133 Jul 19, 2024
c0f93d9
Get working function properly, and start integrating into snapshot: p…
jfy133 Jul 19, 2024
de035ca
Extract names properly
jfy133 Jul 19, 2024
7890575
Remove unnecesary code
jfy133 Jul 19, 2024
b795b9e
Get working string check function!
jfy133 Jul 19, 2024
cac8152
TODO
jfy133 Jul 19, 2024
a8dcd64
Update MQC so works on gitpod, try to re-add original getAllFilesFrom…
jfy133 Jul 20, 2024
56cba0c
And get it back again
jfy133 Jul 20, 2024
0f12b21
Sort output to ensure consistency
jfy133 Jul 22, 2024
d41aad9
Sort file name only funciton
jfy133 Jul 22, 2024
61c4d24
Start testing preprocessing
jfy133 Jul 26, 2024
19db88c
Merge branch 'dev' into nf-test-conversion
jfy133 Jul 26, 2024
bcc3baf
Start adding preprocessing dir but diff not working so can't ser vari…
jfy133 Jul 26, 2024
0b58cf7
Backing up TODO notes
jfy133 Jul 26, 2024
eb4824e
Final snapshots, need to double check all files are covered but I thi…
jfy133 Aug 16, 2024
9ce930f
Finalise first test
jfy133 Sep 20, 2024
5598eec
Merge branch 'dev' into nf-test-conversion
jfy133 Sep 20, 2024
6362fa3
Update tests to latest dev
jfy133 Sep 20, 2024
61086b5
Merge branch 'dev' into nf-test-conversion
jfy133 Oct 4, 2024
9a56d48
Merge branch 'dev' into nf-test-conversion
jfy133 Oct 4, 2024
bb12ca1
Start refactoring to use nft-utils
jfy133 Oct 4, 2024
87fafc5
fix qualimap output dir typo
TCLamnidis Oct 11, 2024
ef71d3b
no sampleid in qualimap outdir
TCLamnidis Oct 11, 2024
a7fadc6
bump nft-utils version
TCLamnidis Oct 18, 2024
4baefaf
start refactoring to use nft-utils
TCLamnidis Oct 18, 2024
8b7e950
update snapshot. Not sure it works yet.
TCLamnidis Oct 18, 2024
2e5bf4f
add preprocessing
TCLamnidis Nov 8, 2024
c204fe9
fix preprocessing checks
TCLamnidis Nov 29, 2024
4efc86b
Merge remote-tracking branch 'origin/dev' into nf-test-conversion
TCLamnidis Nov 30, 2024
9f3611f
Merge remote-tracking branch 'origin/dev' into nf-test-conversion
TCLamnidis Dec 3, 2024
6893eb6
reorder and add todos
TCLamnidis Dec 3, 2024
13a640c
remove versions.ymls from snapshot
TCLamnidis Dec 3, 2024
5241ffc
check bam names instead of content
TCLamnidis Dec 4, 2024
0dab178
add ave_filtered_bam parameter to test profile
TCLamnidis Dec 4, 2024
01850ad
fix result pickup for bam filtering and deduplication
TCLamnidis Dec 4, 2024
42b3a47
add final_bams,mapstats. fix mapping. remove old code
TCLamnidis Dec 6, 2024
0c6c8e3
simplify bam_input_stats snapshot
TCLamnidis Dec 6, 2024
50ea5e1
update snapshot
TCLamnidis Dec 6, 2024
997fb5b
exclude unstable qualimap results.
TCLamnidis Dec 6, 2024
82cb639
Check existence of Multiqc output files. reorder tests to match alpha…
TCLamnidis Dec 11, 2024
61f6285
Merge branch 'dev' into nf-test-conversion
TCLamnidis Dec 15, 2024
c0cd1eb
remove leftover todo
TCLamnidis Dec 20, 2024
53d82b0
Merge branch 'nf-test-conversion' of github.com:nf-core/eager into nf…
TCLamnidis Dec 20, 2024
5ed2b0b
add command legend, and align a bit more
TCLamnidis Dec 20, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 21 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
name: nf-core CI
# This workflow runs the pipeline with the minimal test dataset to check that it completes without any syntax errors
name: nf-core CI
on:
push:
branches:
- dev
- "dev"
pull_request:
branches:
- "dev"
- "master"
release:
types: [published]
workflow_dispatch:
Expand All @@ -15,16 +18,31 @@ env:
NXF_SINGULARITY_LIBRARYDIR: ${{ github.workspace }}/.singularity

concurrency:
group: "${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}"
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
define_nxf_versions:
name: Choose nextflow versions to test against depending on target branch
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.nxf_versions.outputs.matrix }}
steps:
- id: nxf_versions
run: |
if [[ "${{ github.event_name }}" == "pull_request" && "${{ github.base_ref }}" == "dev" && "${{ matrix.NXF_VER }}" != "latest-everything" ]]; then
echo matrix='["latest-everything"]' | tee -a $GITHUB_OUTPUT
else
echo matrix='["latest-everything", "23.10.0"]' | tee -a $GITHUB_OUTPUT
fi

test:
name: "Run pipeline with test data (${{ matrix.NXF_VER }} | ${{ matrix.test_name }} | ${{ matrix.profile }})"
# Only run on push if this is the nf-core dev branch (merged PRs)
if: "${{ github.event_name != 'push' || (github.event_name == 'push' && github.repository == 'nf-core/eager') }}"
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
NXF_VER:
- "24.04.2"
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ testing*
*.pyc
null/
.nf-test*

1 change: 1 addition & 0 deletions conf/test.config
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ params {
run_bamfiltering = true
bamfiltering_minreadlength = 30
bamfiltering_mappingquality = 37
bamfiltering_savefilteredbams = true

// Map Stats
run_bedtools_coverage = true
Expand Down
14 changes: 14 additions & 0 deletions nf-test.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
config {

testsDir "tests"
workDir ".nf-test"
configFile "tests/nextflow.config"
profile ""

// load the necessary plugins
plugins {
load "[email protected]"
load "[email protected]"
}

}
5 changes: 5 additions & 0 deletions tests/nextflow.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/*
========================================================================================
Nextflow config file for running tests
========================================================================================
*/
95 changes: 95 additions & 0 deletions tests/test.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
nextflow_pipeline {

name "Test pipeline: NFCORE_EAGER"
script "main.nf"
tag "pipeline"
tag "nfcore_eager"
tag "test"

test("test_profile") {

when {
params {
outdir = "$outputDir"
}
}

then {

// Each top level results directory should be tested with individual snapshots/variables
// stable_name_<dir> is for files with variable md5sums (i.e. content) so only names will be compared
// stable_content_<dir> is for files with stable md5sums (i.e. content) so md5sums will be compared
// For both cases, use the third argument to specify globs to exclude certain files
// If a directory is fully stable, you can drop `stable_name_*`
// Generate with: nf-test test --tag test --profile docker,test --update-snapshot
// Test with: nf-test test --tag test --profile docker,test
// NOTE: BAMs are always only stable in name, because:
// a) sharding breaks header since the shard that was first is named in the header
// b) the order of the reads in the BAMs is not stable (sorted, but reads that share a start position can be in any order)
// point b) also causes BAIs to be unstable.

// Check that no files are missing/added
// Command legend: Result directory to index , include dirs?, exclude patterns , exclude pattern list, include patterns
def stable_name_all = getAllFilesFromDir("$outputDir/" , true , ['pipeline_info/*'] , null , ['*', '**/*'] )

// Bam filtering
def stable_content_bamfiltering = getAllFilesFromDir("$outputDir/bam_filtering" , true , ['*.{bam,bai}'] , null , ['*.flagstat'] )
def stable_name_bamfiltering = getAllFilesFromDir("$outputDir/bam_filtering" , true , ['*.flagstat'] , null , ['*.{bam,bai}'] )

// Bam input stats
def stable_content_baminputstats = getAllFilesFromDir("$outputDir/bam_input_stats" , true , null , null , ['*.flagstat'] )

// Damage estimation
def stable_content_damageestimation = getAllFilesFromDir("$outputDir/damage_estimation" , true , ['**/*.{svg,pdf,log}'] , null , ['**/*.{txt,json}'] )
def stable_name_damageestimation = getAllFilesFromDir("$outputDir/damage_estimation" , true , ['**/*.{txt,json}'] , null , ['**/*.{svg,pdf,log}'] )

// Deduplication
def stable_content_deduplication = getAllFilesFromDir("$outputDir/deduplication" , true , ['*.{bam,bai}'] , null , ['*.flagstat'] )
def stable_name_deduplication = getAllFilesFromDir("$outputDir/deduplication" , true , ['*.flagstat'] , null , ['*.{bam,bai}'] )

// Final_bams
def stable_content_final_bams = getAllFilesFromDir("$outputDir/final_bams" , true , null , null , ['**/*.flagstat'] )
def stable_name_final_bams = getAllFilesFromDir("$outputDir/final_bams" , true , null , null , ['**/*.{bam,bai}'] )

// Mapping
def stable_content_mapping = getAllFilesFromDir("$outputDir/mapping" , true , null , null , ['**/*.flagstat'] )
def stable_name_mapping = getAllFilesFromDir("$outputDir/mapping" , true , null , null , ['**/*.{bam,bai}'] )

// Mapstats
// NOTE: GC content data and plot has minor changes between runs. I suspect this is because of the order of reads that start at the same position being unstable, but I am not sure.
def stable_content_mapstats = getAllFilesFromDir("$outputDir/mapstats" , true , ['**/*.html', '**/mapped_reads_gc-content_distribution.txt', '**/genome_gc_content_per_window.png'], null , ['**/*.{bed,json,txt,log,css,png,js}'] )
def stable_name_mapstats = getAllFilesFromDir("$outputDir/mapstats" , true , null , null , ['**/*.html', '**/mapped_reads_gc-content_distribution.txt', '**/genome_gc_content_per_window.png'] )

// MultiQC
def stable_name_multiqc = getAllFilesFromDir("$outputDir/multiqc" , true , null , null , ['*', '**/*'] )

// Preprocessing
def stable_content_preprocessing = getAllFilesFromDir("$outputDir/preprocessing" , true , ['**/*.{zip,log}', '**/*fastp.html'], null , ['**/*'] )
def stable_name_preprocessing = getAllFilesFromDir("$outputDir/preprocessing" , true , null , null , ['**/*.{zip,log}', '**/*fastp.html'] )

assertAll(
{ assert workflow.success },
// This checks that there are no missing or additional output files.
// Also a good starting point to look at all the files in the output folder than need to be checked in subsequent sections.
{ assert snapshot( stable_name_all*.name ).match("all_files") },

// Checking changes to contents of each section
{ assert snapshot( stable_content_bamfiltering , stable_name_bamfiltering*.name ).match("bam_filtering") },
{ assert snapshot( stable_content_baminputstats ).match("bam_input_stats") },
{ assert snapshot( stable_content_damageestimation, stable_name_damageestimation*.name ).match("damage_estimation") },
{ assert snapshot( stable_content_deduplication , stable_name_deduplication*.name ).match("deduplication") },
{ assert snapshot( stable_content_final_bams , stable_name_final_bams*.name ).match("final_bams") },
// NOTE: The snapshot section for mapping cannot be named 'mapping'. See https://github.com/askimed/nf-test/issues/279
{ assert snapshot( stable_content_mapping , stable_name_mapping*.name ).match("mapping_output") },
{ assert snapshot( stable_content_mapstats , stable_name_mapstats*.name ).match("mapstats") },
{ assert snapshot( stable_name_multiqc*.name ).match("multiqc") },
{ assert snapshot( stable_content_preprocessing , stable_name_preprocessing*.name ).match("preprocessing") },

// Versions
{ assert new File("$outputDir/pipeline_info/nf_core_pipeline_software_mqc_versions.yml").exists() },


)
}
}
}
Loading
Loading