From 739fbb55578267c3260e307bb3b29a7fedd5822e Mon Sep 17 00:00:00 2001 From: Felipe Marques de Almeida Date: Fri, 19 Jan 2024 11:40:02 +0000 Subject: [PATCH 01/13] add nf-test for alevin aligner --- .gitignore | 1 + nf-test.config | 8 ++++ tests/main_pipeline_alevin.test | 68 ++++++++++++++++++++++++++++ tests/main_pipeline_alevin.test.snap | 32 +++++++++++++ tests/nextflow.config | 32 +++++++++++++ 5 files changed, 141 insertions(+) create mode 100644 nf-test.config create mode 100644 tests/main_pipeline_alevin.test create mode 100644 tests/main_pipeline_alevin.test.snap create mode 100644 tests/nextflow.config diff --git a/.gitignore b/.gitignore index 5d402163..a9ba2c52 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ testing* log/ reports/ testme.sh +.nf-test/ diff --git a/nf-test.config b/nf-test.config new file mode 100644 index 00000000..2fa82adf --- /dev/null +++ b/nf-test.config @@ -0,0 +1,8 @@ +config { + + testsDir "tests" + workDir ".nf-test" + configFile "tests/nextflow.config" + profile "docker" + +} diff --git a/tests/main_pipeline_alevin.test b/tests/main_pipeline_alevin.test new file mode 100644 index 00000000..c51a8ee9 --- /dev/null +++ b/tests/main_pipeline_alevin.test @@ -0,0 +1,68 @@ +nextflow_pipeline { + + name "Test Workflow main.nf" + script "main.nf" + + test("test-dataset_alevin_aligner") { + + when { + // the rest is taken from shared config + params { + aligner = 'alevin' + outdir = "${outputDir}/results_alevin" + + // Limit resources so that this can run on GitHub Actions -- for some reason it had not been taken from shared config + max_cpus = 2 + max_memory = '6.GB' + max_time = '6.h' + } + } + + then { + + // + // General assertions + // + + // Did it finish successfully? + assert workflow.success + + // How many tasks were executed? + assert workflow.trace.tasks().size() == 16 + + // How many results were produced? + assert path("${outputDir}/results_alevin").list().size() == 5 + assert path("${outputDir}/results_alevin/alevin").list().size() == 4 + assert path("${outputDir}/results_alevin/alevin/mtx_conversions").list().size() == 4 + assert path("${outputDir}/results_alevin/alevinqc").list().size() == 2 + assert path("${outputDir}/results_alevin/fastqc").list().size() == 12 + assert path("${outputDir}/results_alevin/multiqc").list().size() == 3 + + // + // Check if files were produced + // + assert new File( "${outputDir}/results_alevin/alevin/Sample_X_alevin_results/af_quant/alevin/quants_mat_cols.txt" ).exists() + assert new File( "${outputDir}/results_alevin/alevin/Sample_X_alevin_results/af_quant/alevin/quants_mat.mtx" ).exists() + assert new File( "${outputDir}/results_alevin/alevin/Sample_X_alevin_results/af_quant/alevin/quants_mat_rows.txt" ).exists() + + assert new File( "${outputDir}/results_alevin/alevin/Sample_Y_alevin_results/af_quant/alevin/quants_mat_cols.txt" ).exists() + assert new File( "${outputDir}/results_alevin/alevin/Sample_Y_alevin_results/af_quant/alevin/quants_mat.mtx" ).exists() + assert new File( "${outputDir}/results_alevin/alevin/Sample_Y_alevin_results/af_quant/alevin/quants_mat_rows.txt" ).exists() + + // + // Check if files are the same + // + assert snapshot( + workflow, + path( "${outputDir}/results_alevin/alevin/Sample_X_alevin_results/af_quant/alevin/quants_mat_cols.txt" ), + path( "${outputDir}/results_alevin/alevin/Sample_X_alevin_results/af_quant/alevin/quants_mat.mtx" ), + path( "${outputDir}/results_alevin/alevin/Sample_X_alevin_results/af_quant/alevin/quants_mat_rows.txt" ), + path( "${outputDir}/results_alevin/alevin/Sample_Y_alevin_results/af_quant/alevin/quants_mat_cols.txt" ), + path( "${outputDir}/results_alevin/alevin/Sample_Y_alevin_results/af_quant/alevin/quants_mat.mtx" ), + path( "${outputDir}/results_alevin/alevin/Sample_Y_alevin_results/af_quant/alevin/quants_mat_rows.txt" ) + ).match() + + } + } + +} diff --git a/tests/main_pipeline_alevin.test.snap b/tests/main_pipeline_alevin.test.snap new file mode 100644 index 00000000..9d194012 --- /dev/null +++ b/tests/main_pipeline_alevin.test.snap @@ -0,0 +1,32 @@ +{ + "test-dataset_alevin_aligner": { + "content": [ + { + "stderr": [ + + ], + "errorReport": "", + "exitStatus": 0, + "failed": false, + "stdout": [ + + ], + "errorMessage": "", + "trace": { + "tasksFailed": 0, + "tasksCount": 16, + "tasksSucceeded": 16 + }, + "name": "workflow", + "success": true + }, + "quants_mat_cols.txt:md5,e9868982c17a330392e38c2a5933cf97", + "quants_mat.mtx:md5,b8aa7b3c488fd8923de50a3621d4991f", + "quants_mat_rows.txt:md5,6227df5a13127b71c71fb18cd8574857", + "quants_mat_cols.txt:md5,e9868982c17a330392e38c2a5933cf97", + "quants_mat.mtx:md5,54cd12666016adce94c025b2e07f4b02", + "quants_mat_rows.txt:md5,6b458a7777260ba90eccbe7919df934b" + ], + "timestamp": "2024-01-19T10:28:35.652763852" + } +} \ No newline at end of file diff --git a/tests/nextflow.config b/tests/nextflow.config new file mode 100644 index 00000000..66e56d29 --- /dev/null +++ b/tests/nextflow.config @@ -0,0 +1,32 @@ +/* +======================================================================================== + Nextflow config file for running tests +======================================================================================== +*/ + +// Copy from test.config for standardization +params { + config_profile_name = 'Test profile' + config_profile_description = 'Minimal test dataset to check pipeline function' + + // Limit resources so that this can run on GitHub Actions + max_cpus = 2 + max_memory = '6.GB' + max_time = '6.h' + + // Input data + input = 'https://github.com/nf-core/test-datasets/raw/scrnaseq/samplesheet-2-0.csv' + + // Genome references + fasta = 'https://github.com/nf-core/test-datasets/raw/scrnaseq/reference/GRCm38.p6.genome.chr19.fa' + gtf = 'https://github.com/nf-core/test-datasets/raw/scrnaseq/reference/gencode.vM19.annotation.chr19.gtf' + protocol = '10XV2' + + validationSchemaIgnoreParams = 'genomes' +} + +process { + withName: '.*:CELLRANGER_COUNT' { + maxForks = 1 + } +} From 23072dc4271f7b4461426fbe0a226d3e190d2b4a Mon Sep 17 00:00:00 2001 From: Felipe Marques de Almeida Date: Fri, 19 Jan 2024 15:51:42 +0000 Subject: [PATCH 02/13] adding nf-test for star aligner --- tests/main_pipeline_star.test | 87 ++++++++++++++++++++++++++++++ tests/main_pipeline_star.test.snap | 38 +++++++++++++ 2 files changed, 125 insertions(+) create mode 100644 tests/main_pipeline_star.test create mode 100644 tests/main_pipeline_star.test.snap diff --git a/tests/main_pipeline_star.test b/tests/main_pipeline_star.test new file mode 100644 index 00000000..d20657f1 --- /dev/null +++ b/tests/main_pipeline_star.test @@ -0,0 +1,87 @@ +nextflow_pipeline { + + name "Test Workflow main.nf" + script "main.nf" + + test("test-dataset_star_aligner") { + + when { + // the rest is taken from shared config + params { + aligner = 'star' + outdir = "${outputDir}/results_star" + + // Limit resources so that this can run on GitHub Actions -- for some reason it had not been taken from shared config + max_cpus = 2 + max_memory = '6.GB' + max_time = '6.h' + } + } + + then { + + // + // General assertions + // + + // Did it finish successfully? + assert workflow.success + + // How many tasks were executed? + assert workflow.trace.tasks().size() == 14 + + // How many results were produced? + assert path("${outputDir}/results_star").list().size() == 4 + assert path("${outputDir}/results_star/star").list().size() == 3 + assert path("${outputDir}/results_star/star/mtx_conversions").list().size() == 4 + assert path("${outputDir}/results_star/fastqc").list().size() == 12 + assert path("${outputDir}/results_star/multiqc").list().size() == 3 + + // + // Check if files were produced + // + // + // Check if main files exist + // + + assert new File( "${outputDir}/results_star/star/Sample_X/Sample_X.SJ.out.tab" ).exists() + assert new File( "${outputDir}/results_star/star/Sample_X/Sample_X.Solo.out/Barcodes.stats" ).exists() + assert new File( "${outputDir}/results_star/star/Sample_X/Sample_X.Solo.out/Gene/filtered/matrix.mtx.gz" ).exists() + assert new File( "${outputDir}/results_star/star/Sample_X/Sample_X.Solo.out/Gene/filtered/features.tsv.gz" ).exists() + assert new File( "${outputDir}/results_star/star/Sample_X/Sample_X.Solo.out/Gene/filtered/barcodes.tsv.gz" ).exists() + assert new File( "${outputDir}/results_star/star/mtx_conversions/Sample_X/Sample_X_matrix.h5ad" ).exists() + assert new File( "${outputDir}/results_star/star/mtx_conversions/Sample_X/Sample_X_matrix.rds" ).exists() + + assert new File( "${outputDir}/results_star/star/Sample_Y/Sample_Y.SJ.out.tab" ).exists() + assert new File( "${outputDir}/results_star/star/Sample_Y/Sample_Y.Solo.out/Barcodes.stats" ).exists() + assert new File( "${outputDir}/results_star/star/Sample_Y/Sample_Y.Solo.out/Gene/filtered/matrix.mtx.gz" ).exists() + assert new File( "${outputDir}/results_star/star/Sample_Y/Sample_Y.Solo.out/Gene/filtered/features.tsv.gz" ).exists() + assert new File( "${outputDir}/results_star/star/Sample_Y/Sample_Y.Solo.out/Gene/filtered/barcodes.tsv.gz" ).exists() + assert new File( "${outputDir}/results_star/star/mtx_conversions/Sample_Y/Sample_Y_matrix.h5ad" ).exists() + assert new File( "${outputDir}/results_star/star/mtx_conversions/Sample_Y/Sample_Y_matrix.rds" ).exists() + + // + // Check if files are the same + // + assert snapshot( + workflow, + path( "${outputDir}/results_star/star/Sample_X/Sample_X.SJ.out.tab" ), + path( "${outputDir}/results_star/star/Sample_X/Sample_X.Solo.out/Barcodes.stats" ), + path( "${outputDir}/results_star/star/Sample_X/Sample_X.Solo.out/Gene/filtered/matrix.mtx.gz" ), + path( "${outputDir}/results_star/star/Sample_X/Sample_X.Solo.out/Gene/filtered/features.tsv.gz" ), + path( "${outputDir}/results_star/star/Sample_X/Sample_X.Solo.out/Gene/filtered/barcodes.tsv.gz" ), + // path( "${outputDir}/results_star/star/mtx_conversions/Sample_X/Sample_X_matrix.h5ad" ), // does not match + path( "${outputDir}/results_star/star/mtx_conversions/Sample_X/Sample_X_matrix.rds" ), + path( "${outputDir}/results_star/star/Sample_Y/Sample_Y.SJ.out.tab" ), + path( "${outputDir}/results_star/star/Sample_Y/Sample_Y.Solo.out/Barcodes.stats" ), + path( "${outputDir}/results_star/star/Sample_Y/Sample_Y.Solo.out/Gene/filtered/matrix.mtx.gz" ), + path( "${outputDir}/results_star/star/Sample_Y/Sample_Y.Solo.out/Gene/filtered/features.tsv.gz" ), + path( "${outputDir}/results_star/star/Sample_Y/Sample_Y.Solo.out/Gene/filtered/barcodes.tsv.gz" ), + // path( "${outputDir}/results_star/star/mtx_conversions/Sample_Y/Sample_Y_matrix.h5ad" ), // does not match + path( "${outputDir}/results_star/star/mtx_conversions/Sample_Y/Sample_Y_matrix.rds" ), + ).match() + + } + } + +} diff --git a/tests/main_pipeline_star.test.snap b/tests/main_pipeline_star.test.snap new file mode 100644 index 00000000..ef086f60 --- /dev/null +++ b/tests/main_pipeline_star.test.snap @@ -0,0 +1,38 @@ +{ + "test-dataset_star_aligner": { + "content": [ + { + "stderr": [ + + ], + "errorReport": "", + "exitStatus": 0, + "failed": false, + "stdout": [ + + ], + "errorMessage": "", + "trace": { + "tasksFailed": 0, + "tasksCount": 14, + "tasksSucceeded": 14 + }, + "name": "workflow", + "success": true + }, + "Sample_X.SJ.out.tab:md5,d2d7f0abe38029012571bdf6622fc6eb", + "Barcodes.stats:md5,7f99dc8aa5e074fbe5779ea7712c0886", + "matrix.mtx.gz:md5,6a923393343aa1a69b0cf1bd998c9285", + "features.tsv.gz:md5,99e453cb1443a3e43e99405184e51a5e", + "barcodes.tsv.gz:md5,9a7dacaa1779ea43c1507a947fe6992a", + "Sample_X_matrix.rds:md5,aa2d36dd8507aba864347c88e4ce0d27", + "Sample_Y.SJ.out.tab:md5,98bd31104a860cf80119dc30d938d163", + "Barcodes.stats:md5,2dbf1ae426c1afd97903ee001f0db5ce", + "matrix.mtx.gz:md5,0ae080bd0002e350531a5816e159345e", + "features.tsv.gz:md5,99e453cb1443a3e43e99405184e51a5e", + "barcodes.tsv.gz:md5,9b695b0b91bcb146ec9c4688ca10a690", + "Sample_Y_matrix.rds:md5,d459af8f99258bcc88b80b2f7c58e911" + ], + "timestamp": "2024-01-19T15:46:22.470527538" + } +} \ No newline at end of file From 4ae28e384a4e28fa2e4e5bc8bfe3536c4b1d407a Mon Sep 17 00:00:00 2001 From: Felipe Marques de Almeida Date: Tue, 23 Jan 2024 11:51:02 +0000 Subject: [PATCH 03/13] add nf-tests for cellranger aligner --- tests/main_pipeline_cellranger.test | 84 ++++++++++++++++++++++++ tests/main_pipeline_cellranger.test.snap | 40 +++++++++++ 2 files changed, 124 insertions(+) create mode 100644 tests/main_pipeline_cellranger.test create mode 100644 tests/main_pipeline_cellranger.test.snap diff --git a/tests/main_pipeline_cellranger.test b/tests/main_pipeline_cellranger.test new file mode 100644 index 00000000..c90436f6 --- /dev/null +++ b/tests/main_pipeline_cellranger.test @@ -0,0 +1,84 @@ +nextflow_pipeline { + + name "Test Workflow main.nf" + script "main.nf" + + test("test-dataset_cellranger_aligner") { + + when { + // the rest is taken from shared config + params { + aligner = 'cellranger' + outdir = "${outputDir}/results_cellranger" + + // Limit resources so that this can run on GitHub Actions -- for some reason it had not been taken from shared config + max_cpus = 2 + max_memory = '6.GB' + max_time = '6.h' + } + } + + then { + + // + // General assertions + // + + // Did it finish successfully? + assert workflow.success + + // How many tasks were executed? + assert workflow.trace.tasks().size() == 15 + + // How many results were produced? + assert path("${outputDir}/results_cellranger").list().size() == 4 + assert path("${outputDir}/results_cellranger/cellranger").list().size() == 4 + assert path("${outputDir}/results_cellranger/cellranger/mtx_conversions").list().size() == 4 + assert path("${outputDir}/results_cellranger/cellranger/count").list().size() == 3 + assert path("${outputDir}/results_cellranger/fastqc").list().size() == 12 + assert path("${outputDir}/results_cellranger/multiqc").list().size() == 3 + + // + // Check if files were produced + // + assert new File( "${outputDir}/results_cellranger/cellranger/count/Sample_X/outs/filtered_feature_bc_matrix/barcodes.tsv.gz" ).exists() + assert new File( "${outputDir}/results_cellranger/cellranger/count/Sample_X/outs/filtered_feature_bc_matrix/features.tsv.gz" ).exists() + assert new File( "${outputDir}/results_cellranger/cellranger/count/Sample_X/outs/filtered_feature_bc_matrix/matrix.mtx.gz" ).exists() + + assert new File( "${outputDir}/results_cellranger/cellranger/count/Sample_Y/outs/filtered_feature_bc_matrix/barcodes.tsv.gz" ).exists() + assert new File( "${outputDir}/results_cellranger/cellranger/count/Sample_Y/outs/filtered_feature_bc_matrix/features.tsv.gz" ).exists() + assert new File( "${outputDir}/results_cellranger/cellranger/count/Sample_Y/outs/filtered_feature_bc_matrix/matrix.mtx.gz" ).exists() + + assert new File( "${outputDir}/results_cellranger/cellranger/count/Sample_X/outs/raw_feature_bc_matrix/barcodes.tsv.gz" ).exists() + assert new File( "${outputDir}/results_cellranger/cellranger/count/Sample_X/outs/raw_feature_bc_matrix/features.tsv.gz" ).exists() + assert new File( "${outputDir}/results_cellranger/cellranger/count/Sample_X/outs/raw_feature_bc_matrix/matrix.mtx.gz" ).exists() + + assert new File( "${outputDir}/results_cellranger/cellranger/count/Sample_Y/outs/raw_feature_bc_matrix/barcodes.tsv.gz" ).exists() + assert new File( "${outputDir}/results_cellranger/cellranger/count/Sample_Y/outs/raw_feature_bc_matrix/features.tsv.gz" ).exists() + assert new File( "${outputDir}/results_cellranger/cellranger/count/Sample_Y/outs/raw_feature_bc_matrix/matrix.mtx.gz" ).exists() + + // + // Check if files are the same + // + assert snapshot( + workflow, + path( "${outputDir}/results_cellranger/cellranger/count/Sample_X/outs/filtered_feature_bc_matrix/barcodes.tsv.gz" ), + path( "${outputDir}/results_cellranger/cellranger/count/Sample_X/outs/filtered_feature_bc_matrix/features.tsv.gz" ), + path( "${outputDir}/results_cellranger/cellranger/count/Sample_X/outs/filtered_feature_bc_matrix/matrix.mtx.gz" ), + path( "${outputDir}/results_cellranger/cellranger/count/Sample_Y/outs/filtered_feature_bc_matrix/barcodes.tsv.gz" ), + path( "${outputDir}/results_cellranger/cellranger/count/Sample_Y/outs/filtered_feature_bc_matrix/features.tsv.gz" ), + path( "${outputDir}/results_cellranger/cellranger/count/Sample_Y/outs/filtered_feature_bc_matrix/matrix.mtx.gz" ), + path( "${outputDir}/results_cellranger/cellranger/count/Sample_X/outs/raw_feature_bc_matrix/barcodes.tsv.gz" ), + path( "${outputDir}/results_cellranger/cellranger/count/Sample_X/outs/raw_feature_bc_matrix/features.tsv.gz" ), + path( "${outputDir}/results_cellranger/cellranger/count/Sample_X/outs/raw_feature_bc_matrix/matrix.mtx.gz" ), + path( "${outputDir}/results_cellranger/cellranger/count/Sample_Y/outs/raw_feature_bc_matrix/barcodes.tsv.gz" ), + path( "${outputDir}/results_cellranger/cellranger/count/Sample_Y/outs/raw_feature_bc_matrix/features.tsv.gz" ), + path( "${outputDir}/results_cellranger/cellranger/count/Sample_Y/outs/raw_feature_bc_matrix/matrix.mtx.gz" ), + path( "${outputDir}/results_cellranger/cellranger/mtx_conversions/Sample_X/Sample_X_matrix.rds" ), + path( "${outputDir}/results_cellranger/cellranger/mtx_conversions/Sample_Y/Sample_Y_matrix.rds" ) + ).match() + + } + } + +} diff --git a/tests/main_pipeline_cellranger.test.snap b/tests/main_pipeline_cellranger.test.snap new file mode 100644 index 00000000..5f88b954 --- /dev/null +++ b/tests/main_pipeline_cellranger.test.snap @@ -0,0 +1,40 @@ +{ + "test-dataset_cellranger_aligner": { + "content": [ + { + "stderr": [ + + ], + "errorReport": "", + "exitStatus": 0, + "failed": false, + "stdout": [ + + ], + "errorMessage": "", + "trace": { + "tasksFailed": 0, + "tasksCount": 15, + "tasksSucceeded": 15 + }, + "name": "workflow", + "success": true + }, + "barcodes.tsv.gz:md5,fe6e51564b4405b37ca8604a844b1f2e", + "features.tsv.gz:md5,99e453cb1443a3e43e99405184e51a5e", + "matrix.mtx.gz:md5,79471f700ec5bab852a960f0d1537705", + "barcodes.tsv.gz:md5,77afe9a76631fc7b44236d3962a55aa5", + "features.tsv.gz:md5,99e453cb1443a3e43e99405184e51a5e", + "matrix.mtx.gz:md5,e224aa759250fa5730dc069bce9be253", + "barcodes.tsv.gz:md5,85da6b6e0c78dfe81af8c07c2017ab5e", + "features.tsv.gz:md5,99e453cb1443a3e43e99405184e51a5e", + "matrix.mtx.gz:md5,1bc71041a425bfcee38472bfec5997f8", + "barcodes.tsv.gz:md5,081f72b5252ccaf5ffd535ffbd235c4c", + "features.tsv.gz:md5,99e453cb1443a3e43e99405184e51a5e", + "matrix.mtx.gz:md5,a4db04e43e650accc96361a287126a6b", + "Sample_X_matrix.rds:md5,f9191ba575a3ab79ada4807715f18573", + "Sample_Y_matrix.rds:md5,7be3f7b29d668dcf7e951b9f4d371a5e" + ], + "timestamp": "2024-01-22T15:19:20.134275449" + } +} \ No newline at end of file From b56577ce413a2a93ecc950b85bd1a7e0e235e38f Mon Sep 17 00:00:00 2001 From: Felipe Marques de Almeida Date: Tue, 23 Jan 2024 12:25:46 +0000 Subject: [PATCH 04/13] add nf-test for kallisto aligner --- tests/main_pipeline_kallisto.test | 71 ++++++++++++++++++++++++++ tests/main_pipeline_kallisto.test.snap | 34 ++++++++++++ 2 files changed, 105 insertions(+) create mode 100644 tests/main_pipeline_kallisto.test create mode 100644 tests/main_pipeline_kallisto.test.snap diff --git a/tests/main_pipeline_kallisto.test b/tests/main_pipeline_kallisto.test new file mode 100644 index 00000000..3bae1f31 --- /dev/null +++ b/tests/main_pipeline_kallisto.test @@ -0,0 +1,71 @@ +nextflow_pipeline { + + name "Test Workflow main.nf" + script "main.nf" + + test("test-dataset_kallisto_aligner") { + + when { + // the rest is taken from shared config + params { + aligner = 'kallisto' + outdir = "${outputDir}/results_kallisto" + + // Limit resources so that this can run on GitHub Actions -- for some reason it had not been taken from shared config + max_cpus = 2 + max_memory = '6.GB' + max_time = '6.h' + } + } + + then { + + // + // General assertions + // + + // Did it finish successfully? + assert workflow.success + + // How many tasks were executed? + assert workflow.trace.tasks().size() == 14 + + // How many results were produced? + assert path("${outputDir}/results_kallisto").list().size() == 4 + assert path("${outputDir}/results_kallisto/kallisto").list().size() == 4 + assert path("${outputDir}/results_kallisto/kallisto/mtx_conversions").list().size() == 4 + assert path("${outputDir}/results_kallisto/kallisto/Sample_X.count").list().size() == 9 + assert path("${outputDir}/results_kallisto/kallisto/Sample_Y.count").list().size() == 9 + assert path("${outputDir}/results_kallisto/fastqc").list().size() == 12 + assert path("${outputDir}/results_kallisto/multiqc").list().size() == 3 + + // + // Check if files were produced + // + assert new File( "${outputDir}/results_kallisto/kallisto/Sample_X.count/counts_unfiltered/cells_x_genes.barcodes.txt" ).exists() + assert new File( "${outputDir}/results_kallisto/kallisto/Sample_X.count/counts_unfiltered/cells_x_genes.genes.txt" ).exists() + assert new File( "${outputDir}/results_kallisto/kallisto/Sample_X.count/counts_unfiltered/cells_x_genes.mtx" ).exists() + + assert new File( "${outputDir}/results_kallisto/kallisto/Sample_Y.count/counts_unfiltered/cells_x_genes.barcodes.txt" ).exists() + assert new File( "${outputDir}/results_kallisto/kallisto/Sample_Y.count/counts_unfiltered/cells_x_genes.genes.txt" ).exists() + assert new File( "${outputDir}/results_kallisto/kallisto/Sample_Y.count/counts_unfiltered/cells_x_genes.mtx" ).exists() + + // + // Check if files are the same + // + assert snapshot( + workflow, + path( "${outputDir}/results_kallisto/kallisto/Sample_X.count/counts_unfiltered/cells_x_genes.barcodes.txt" ), + path( "${outputDir}/results_kallisto/kallisto/Sample_X.count/counts_unfiltered/cells_x_genes.genes.txt" ), + path( "${outputDir}/results_kallisto/kallisto/Sample_X.count/counts_unfiltered/cells_x_genes.mtx" ), + path( "${outputDir}/results_kallisto/kallisto/Sample_Y.count/counts_unfiltered/cells_x_genes.barcodes.txt" ), + path( "${outputDir}/results_kallisto/kallisto/Sample_Y.count/counts_unfiltered/cells_x_genes.genes.txt" ), + path( "${outputDir}/results_kallisto/kallisto/Sample_Y.count/counts_unfiltered/cells_x_genes.mtx" ), + path( "${outputDir}/results_kallisto/kallisto/mtx_conversions/Sample_X/Sample_X_matrix.rds" ), + path( "${outputDir}/results_kallisto/kallisto/mtx_conversions/Sample_Y/Sample_Y_matrix.rds" ) + ).match() + + } + } + +} diff --git a/tests/main_pipeline_kallisto.test.snap b/tests/main_pipeline_kallisto.test.snap new file mode 100644 index 00000000..b0fb50bb --- /dev/null +++ b/tests/main_pipeline_kallisto.test.snap @@ -0,0 +1,34 @@ +{ + "test-dataset_kallisto_aligner": { + "content": [ + { + "stderr": [ + + ], + "errorReport": "", + "exitStatus": 0, + "failed": false, + "stdout": [ + + ], + "errorMessage": "", + "trace": { + "tasksFailed": 0, + "tasksCount": 14, + "tasksSucceeded": 14 + }, + "name": "workflow", + "success": true + }, + "cells_x_genes.barcodes.txt:md5,18be561873e435d4587f6b3f95a0e301", + "cells_x_genes.genes.txt:md5,acd9d00120f52031974b2add3e7521b6", + "cells_x_genes.mtx:md5,37d2cd8c712f9c70463e87485bf6cd36", + "cells_x_genes.barcodes.txt:md5,488437e1f5477243697efb93366e5676", + "cells_x_genes.genes.txt:md5,acd9d00120f52031974b2add3e7521b6", + "cells_x_genes.mtx:md5,af90e05b404490f6cb133ab7f62949f8", + "Sample_X_matrix.rds:md5,f0e43f69403f4b2e7704065421592ad0", + "Sample_Y_matrix.rds:md5,61809156e64dbdaf254cbc1c3456588e" + ], + "timestamp": "2024-01-23T12:19:47.921508953" + } +} \ No newline at end of file From 3a89373a5594d674e807e7936fb72ab76ecdb2ab Mon Sep 17 00:00:00 2001 From: Felipe Marques de Almeida Date: Tue, 13 Feb 2024 11:01:17 +0000 Subject: [PATCH 05/13] update tests --- tests/main_pipeline_alevin.test | 31 ++++++++++------------- tests/main_pipeline_cellranger.test | 39 ++++++++++------------------- tests/main_pipeline_kallisto.test | 33 +++++++++++------------- tests/main_pipeline_star.test | 37 ++++++++------------------- 4 files changed, 50 insertions(+), 90 deletions(-) diff --git a/tests/main_pipeline_alevin.test b/tests/main_pipeline_alevin.test index c51a8ee9..f2730699 100644 --- a/tests/main_pipeline_alevin.test +++ b/tests/main_pipeline_alevin.test @@ -24,30 +24,25 @@ nextflow_pipeline { // General assertions // - // Did it finish successfully? - assert workflow.success + // Did it finish successfully? + assert workflow.success - // How many tasks were executed? - assert workflow.trace.tasks().size() == 16 + // How many tasks were executed? + assert workflow.trace.tasks().size() == 16 - // How many results were produced? - assert path("${outputDir}/results_alevin").list().size() == 5 - assert path("${outputDir}/results_alevin/alevin").list().size() == 4 - assert path("${outputDir}/results_alevin/alevin/mtx_conversions").list().size() == 4 - assert path("${outputDir}/results_alevin/alevinqc").list().size() == 2 - assert path("${outputDir}/results_alevin/fastqc").list().size() == 12 - assert path("${outputDir}/results_alevin/multiqc").list().size() == 3 + // How many results were produced? + assert path("${outputDir}/results_alevin").list().size() == 5 + assert path("${outputDir}/results_alevin/alevin").list().size() == 4 + assert path("${outputDir}/results_alevin/alevin/mtx_conversions").list().size() == 4 + assert path("${outputDir}/results_alevin/alevinqc").list().size() == 2 + assert path("${outputDir}/results_alevin/fastqc").list().size() == 12 + assert path("${outputDir}/results_alevin/multiqc").list().size() == 3 // // Check if files were produced // - assert new File( "${outputDir}/results_alevin/alevin/Sample_X_alevin_results/af_quant/alevin/quants_mat_cols.txt" ).exists() - assert new File( "${outputDir}/results_alevin/alevin/Sample_X_alevin_results/af_quant/alevin/quants_mat.mtx" ).exists() - assert new File( "${outputDir}/results_alevin/alevin/Sample_X_alevin_results/af_quant/alevin/quants_mat_rows.txt" ).exists() - - assert new File( "${outputDir}/results_alevin/alevin/Sample_Y_alevin_results/af_quant/alevin/quants_mat_cols.txt" ).exists() - assert new File( "${outputDir}/results_alevin/alevin/Sample_Y_alevin_results/af_quant/alevin/quants_mat.mtx" ).exists() - assert new File( "${outputDir}/results_alevin/alevin/Sample_Y_alevin_results/af_quant/alevin/quants_mat_rows.txt" ).exists() + assert new File( "${outputDir}/results_alevin/alevin/mtx_conversions/Sample_X/Sample_X_matrix.h5ad" ).exists() + assert new File( "${outputDir}/results_alevin/alevin/mtx_conversions/Sample_Y/Sample_Y_matrix.h5ad" ).exists() // // Check if files are the same diff --git a/tests/main_pipeline_cellranger.test b/tests/main_pipeline_cellranger.test index c90436f6..314177e0 100644 --- a/tests/main_pipeline_cellranger.test +++ b/tests/main_pipeline_cellranger.test @@ -24,38 +24,25 @@ nextflow_pipeline { // General assertions // - // Did it finish successfully? - assert workflow.success + // Did it finish successfully? + assert workflow.success - // How many tasks were executed? - assert workflow.trace.tasks().size() == 15 + // How many tasks were executed? + assert workflow.trace.tasks().size() == 15 - // How many results were produced? - assert path("${outputDir}/results_cellranger").list().size() == 4 - assert path("${outputDir}/results_cellranger/cellranger").list().size() == 4 - assert path("${outputDir}/results_cellranger/cellranger/mtx_conversions").list().size() == 4 - assert path("${outputDir}/results_cellranger/cellranger/count").list().size() == 3 - assert path("${outputDir}/results_cellranger/fastqc").list().size() == 12 - assert path("${outputDir}/results_cellranger/multiqc").list().size() == 3 + // How many results were produced? + assert path("${outputDir}/results_cellranger").list().size() == 4 + assert path("${outputDir}/results_cellranger/cellranger").list().size() == 4 + assert path("${outputDir}/results_cellranger/cellranger/mtx_conversions").list().size() == 4 + assert path("${outputDir}/results_cellranger/cellranger/count").list().size() == 3 + assert path("${outputDir}/results_cellranger/fastqc").list().size() == 12 + assert path("${outputDir}/results_cellranger/multiqc").list().size() == 3 // // Check if files were produced // - assert new File( "${outputDir}/results_cellranger/cellranger/count/Sample_X/outs/filtered_feature_bc_matrix/barcodes.tsv.gz" ).exists() - assert new File( "${outputDir}/results_cellranger/cellranger/count/Sample_X/outs/filtered_feature_bc_matrix/features.tsv.gz" ).exists() - assert new File( "${outputDir}/results_cellranger/cellranger/count/Sample_X/outs/filtered_feature_bc_matrix/matrix.mtx.gz" ).exists() - - assert new File( "${outputDir}/results_cellranger/cellranger/count/Sample_Y/outs/filtered_feature_bc_matrix/barcodes.tsv.gz" ).exists() - assert new File( "${outputDir}/results_cellranger/cellranger/count/Sample_Y/outs/filtered_feature_bc_matrix/features.tsv.gz" ).exists() - assert new File( "${outputDir}/results_cellranger/cellranger/count/Sample_Y/outs/filtered_feature_bc_matrix/matrix.mtx.gz" ).exists() - - assert new File( "${outputDir}/results_cellranger/cellranger/count/Sample_X/outs/raw_feature_bc_matrix/barcodes.tsv.gz" ).exists() - assert new File( "${outputDir}/results_cellranger/cellranger/count/Sample_X/outs/raw_feature_bc_matrix/features.tsv.gz" ).exists() - assert new File( "${outputDir}/results_cellranger/cellranger/count/Sample_X/outs/raw_feature_bc_matrix/matrix.mtx.gz" ).exists() - - assert new File( "${outputDir}/results_cellranger/cellranger/count/Sample_Y/outs/raw_feature_bc_matrix/barcodes.tsv.gz" ).exists() - assert new File( "${outputDir}/results_cellranger/cellranger/count/Sample_Y/outs/raw_feature_bc_matrix/features.tsv.gz" ).exists() - assert new File( "${outputDir}/results_cellranger/cellranger/count/Sample_Y/outs/raw_feature_bc_matrix/matrix.mtx.gz" ).exists() + assert new File( "${outputDir}/results_cellranger/cellranger/mtx_conversions/Sample_X/Sample_X_matrix.h5ad" ).exists() + assert new File( "${outputDir}/results_cellranger/cellranger/mtx_conversions/Sample_Y/Sample_Y_matrix.h5ad" ).exists() // // Check if files are the same diff --git a/tests/main_pipeline_kallisto.test b/tests/main_pipeline_kallisto.test index 3bae1f31..1b06f249 100644 --- a/tests/main_pipeline_kallisto.test +++ b/tests/main_pipeline_kallisto.test @@ -24,31 +24,26 @@ nextflow_pipeline { // General assertions // - // Did it finish successfully? - assert workflow.success + // Did it finish successfully? + assert workflow.success - // How many tasks were executed? - assert workflow.trace.tasks().size() == 14 + // How many tasks were executed? + assert workflow.trace.tasks().size() == 14 - // How many results were produced? - assert path("${outputDir}/results_kallisto").list().size() == 4 - assert path("${outputDir}/results_kallisto/kallisto").list().size() == 4 - assert path("${outputDir}/results_kallisto/kallisto/mtx_conversions").list().size() == 4 - assert path("${outputDir}/results_kallisto/kallisto/Sample_X.count").list().size() == 9 - assert path("${outputDir}/results_kallisto/kallisto/Sample_Y.count").list().size() == 9 - assert path("${outputDir}/results_kallisto/fastqc").list().size() == 12 - assert path("${outputDir}/results_kallisto/multiqc").list().size() == 3 + // How many results were produced? + assert path("${outputDir}/results_kallisto").list().size() == 4 + assert path("${outputDir}/results_kallisto/kallisto").list().size() == 4 + assert path("${outputDir}/results_kallisto/kallisto/mtx_conversions").list().size() == 4 + assert path("${outputDir}/results_kallisto/kallisto/Sample_X.count").list().size() == 9 + assert path("${outputDir}/results_kallisto/kallisto/Sample_Y.count").list().size() == 9 + assert path("${outputDir}/results_kallisto/fastqc").list().size() == 12 + assert path("${outputDir}/results_kallisto/multiqc").list().size() == 3 // // Check if files were produced // - assert new File( "${outputDir}/results_kallisto/kallisto/Sample_X.count/counts_unfiltered/cells_x_genes.barcodes.txt" ).exists() - assert new File( "${outputDir}/results_kallisto/kallisto/Sample_X.count/counts_unfiltered/cells_x_genes.genes.txt" ).exists() - assert new File( "${outputDir}/results_kallisto/kallisto/Sample_X.count/counts_unfiltered/cells_x_genes.mtx" ).exists() - - assert new File( "${outputDir}/results_kallisto/kallisto/Sample_Y.count/counts_unfiltered/cells_x_genes.barcodes.txt" ).exists() - assert new File( "${outputDir}/results_kallisto/kallisto/Sample_Y.count/counts_unfiltered/cells_x_genes.genes.txt" ).exists() - assert new File( "${outputDir}/results_kallisto/kallisto/Sample_Y.count/counts_unfiltered/cells_x_genes.mtx" ).exists() + assert new File( "${outputDir}/results_kallisto/kallisto/mtx_conversions/Sample_X/Sample_X_matrix.h5ad" ).exists() + assert new File( "${outputDir}/results_kallisto/kallisto/mtx_conversions/Sample_Y/Sample_Y_matrix.h5ad" ).exists() // // Check if files are the same diff --git a/tests/main_pipeline_star.test b/tests/main_pipeline_star.test index d20657f1..de07c8d3 100644 --- a/tests/main_pipeline_star.test +++ b/tests/main_pipeline_star.test @@ -24,41 +24,24 @@ nextflow_pipeline { // General assertions // - // Did it finish successfully? - assert workflow.success + // Did it finish successfully? + assert workflow.success - // How many tasks were executed? - assert workflow.trace.tasks().size() == 14 + // How many tasks were executed? + assert workflow.trace.tasks().size() == 14 - // How many results were produced? - assert path("${outputDir}/results_star").list().size() == 4 - assert path("${outputDir}/results_star/star").list().size() == 3 - assert path("${outputDir}/results_star/star/mtx_conversions").list().size() == 4 - assert path("${outputDir}/results_star/fastqc").list().size() == 12 - assert path("${outputDir}/results_star/multiqc").list().size() == 3 + // How many results were produced? + assert path("${outputDir}/results_star").list().size() == 4 + assert path("${outputDir}/results_star/star").list().size() == 3 + assert path("${outputDir}/results_star/star/mtx_conversions").list().size() == 4 + assert path("${outputDir}/results_star/fastqc").list().size() == 12 + assert path("${outputDir}/results_star/multiqc").list().size() == 3 // // Check if files were produced // - // - // Check if main files exist - // - - assert new File( "${outputDir}/results_star/star/Sample_X/Sample_X.SJ.out.tab" ).exists() - assert new File( "${outputDir}/results_star/star/Sample_X/Sample_X.Solo.out/Barcodes.stats" ).exists() - assert new File( "${outputDir}/results_star/star/Sample_X/Sample_X.Solo.out/Gene/filtered/matrix.mtx.gz" ).exists() - assert new File( "${outputDir}/results_star/star/Sample_X/Sample_X.Solo.out/Gene/filtered/features.tsv.gz" ).exists() - assert new File( "${outputDir}/results_star/star/Sample_X/Sample_X.Solo.out/Gene/filtered/barcodes.tsv.gz" ).exists() assert new File( "${outputDir}/results_star/star/mtx_conversions/Sample_X/Sample_X_matrix.h5ad" ).exists() - assert new File( "${outputDir}/results_star/star/mtx_conversions/Sample_X/Sample_X_matrix.rds" ).exists() - - assert new File( "${outputDir}/results_star/star/Sample_Y/Sample_Y.SJ.out.tab" ).exists() - assert new File( "${outputDir}/results_star/star/Sample_Y/Sample_Y.Solo.out/Barcodes.stats" ).exists() - assert new File( "${outputDir}/results_star/star/Sample_Y/Sample_Y.Solo.out/Gene/filtered/matrix.mtx.gz" ).exists() - assert new File( "${outputDir}/results_star/star/Sample_Y/Sample_Y.Solo.out/Gene/filtered/features.tsv.gz" ).exists() - assert new File( "${outputDir}/results_star/star/Sample_Y/Sample_Y.Solo.out/Gene/filtered/barcodes.tsv.gz" ).exists() assert new File( "${outputDir}/results_star/star/mtx_conversions/Sample_Y/Sample_Y_matrix.h5ad" ).exists() - assert new File( "${outputDir}/results_star/star/mtx_conversions/Sample_Y/Sample_Y_matrix.rds" ).exists() // // Check if files are the same From ce0db16615336546d6683f5ec4da36b0b2316edb Mon Sep 17 00:00:00 2001 From: Felipe Marques de Almeida Date: Tue, 13 Feb 2024 11:15:15 +0000 Subject: [PATCH 06/13] update ci.yml for nf-test --- .github/workflows/ci.yml | 68 +++++++++++++++++++++++++++++----------- 1 file changed, 49 insertions(+), 19 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e8907caf..574c5fd3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,39 +1,43 @@ -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 pull_request: release: types: [published] + merge_group: + types: + - checks_requested + branches: + - master + - dev env: NXF_ANSI_LOG: false + NFTEST_VER: "0.8.1" 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: test: - name: Run pipeline with test data - # 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/scrnaseq') }}" + name: ${{ matrix.profile }} NF ${{ matrix.NXF_VER }} + needs: [changes, define_nxf_versions] runs-on: ubuntu-latest strategy: + fail-fast: false matrix: NXF_VER: - "23.04.0" - "latest-everything" - profile: [ - "test,docker --aligner alevin", - "test,docker --aligner kallisto", - "test,docker --aligner star", - "test,docker --aligner cellranger", - # "test,docker --aligner cellrangerarc", // this currently lacks a suitable test profile, see issue https://github.com/nf-core/scrnaseq/issues/290 - # "test,docker --aligner universc", // this is broken, see issue https://github.com/nf-core/scrnaseq/issues/289 + profile: + [ + "tests/main_pipeline_alevin.test", + "tests/main_pipeline_cellranger.test", + "tests/main_pipeline_kallisto.test", + "tests/main_pipeline_star.test", ] + steps: - name: Free some space run: | @@ -41,6 +45,7 @@ jobs: sudo rm -rf /opt/ghc sudo rm -rf "/usr/local/share/boost" sudo rm -rf "$AGENT_TOOLSDIRECTORY" + - name: Check out pipeline code uses: actions/checkout@v4 @@ -49,8 +54,33 @@ jobs: with: version: "${{ matrix.NXF_VER }}" - - name: Run pipeline with test data - # For example: adding multiple test runs with different parameters - # Remember that you can parallelise this by using strategy.matrix + - name: Cache nf-test installation + id: cache-software + uses: actions/cache@v3 + with: + path: | + /usr/local/bin/nf-test + /home/runner/.nf-test/nf-test.jar + key: ${{ runner.os }}-${{ env.NFTEST_VER }}-nftest + + - name: Install nf-test + if: steps.cache-software.outputs.cache-hit != 'true' + run: | + wget -qO- https://code.askimed.com/install/nf-test | bash + sudo mv nf-test /usr/local/bin/ + + - name: Run nf-test run: | - nextflow run ${GITHUB_WORKSPACE} -profile ${{ matrix.profile }} --outdir ./results + nf-test test "${{ matrix.profile }}" --junitxml=test.xml + + - name: Output log on failure + if: failure() + run: | + sudo apt install bat > /dev/null + batcat --decorations=always --color=always ${{ github.workspace }}/.nf-test/tests/*/meta/nextflow.log + + - name: Publish Test Report + uses: mikepenz/action-junit-report@v3 + if: always() # always run even if the previous step fails + with: + report_paths: test.xml From 4df4fbfce20b91b868518b267e2dce9d68e78f35 Mon Sep 17 00:00:00 2001 From: Felipe Marques de Almeida Date: Tue, 13 Feb 2024 11:16:37 +0000 Subject: [PATCH 07/13] also allow on push --- .github/workflows/ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 574c5fd3..ddecad72 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,6 +1,9 @@ # 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 pull_request: release: types: [published] From ae786d60635bf082c5d3fd4fa3c6326167e03460 Mon Sep 17 00:00:00 2001 From: Felipe Marques de Almeida Date: Tue, 13 Feb 2024 11:18:20 +0000 Subject: [PATCH 08/13] add if and remove needs --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ddecad72..8413df7e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,7 +25,7 @@ concurrency: jobs: test: name: ${{ matrix.profile }} NF ${{ matrix.NXF_VER }} - needs: [changes, define_nxf_versions] + if: "${{ github.event_name != 'push' || (github.event_name == 'push' && github.repository == 'nf-core/scrnaseq') }}" runs-on: ubuntu-latest strategy: fail-fast: false From e806454af392db3bd518c506c21674ebc2202ec7 Mon Sep 17 00:00:00 2001 From: Felipe Marques de Almeida Date: Tue, 13 Feb 2024 11:20:40 +0000 Subject: [PATCH 09/13] modify names to have only aligner name --- .github/workflows/ci.yml | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8413df7e..16953daa 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,7 +24,7 @@ concurrency: jobs: test: - name: ${{ matrix.profile }} NF ${{ matrix.NXF_VER }} + name: "aligner: ${{ matrix.profile }} ; NF: ${{ matrix.NXF_VER }}" if: "${{ github.event_name != 'push' || (github.event_name == 'push' && github.repository == 'nf-core/scrnaseq') }}" runs-on: ubuntu-latest strategy: @@ -33,13 +33,7 @@ jobs: NXF_VER: - "23.04.0" - "latest-everything" - profile: - [ - "tests/main_pipeline_alevin.test", - "tests/main_pipeline_cellranger.test", - "tests/main_pipeline_kallisto.test", - "tests/main_pipeline_star.test", - ] + profile: ["alevin", "cellranger", "kallisto", "star"] steps: - name: Free some space @@ -74,7 +68,7 @@ jobs: - name: Run nf-test run: | - nf-test test "${{ matrix.profile }}" --junitxml=test.xml + nf-test test tests/main_pipeline_"${{ matrix.profile }}".test --junitxml=test.xml - name: Output log on failure if: failure() From a2aeea40f2688c2b516ef2f49adc8f1505388c74 Mon Sep 17 00:00:00 2001 From: Felipe Marques de Almeida Date: Tue, 13 Feb 2024 12:02:35 +0000 Subject: [PATCH 10/13] fix quotation --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 16953daa..ea9587e5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -68,7 +68,7 @@ jobs: - name: Run nf-test run: | - nf-test test tests/main_pipeline_"${{ matrix.profile }}".test --junitxml=test.xml + "nf-test test tests/main_pipeline_${{ matrix.profile }}.test --junitxml=test.xml" - name: Output log on failure if: failure() From 8684445e6d2233b2117cfcd7894b862388312323 Mon Sep 17 00:00:00 2001 From: Felipe Marques de Almeida Date: Tue, 13 Feb 2024 12:03:50 +0000 Subject: [PATCH 11/13] removing quotations --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ea9587e5..36d997da 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -68,7 +68,7 @@ jobs: - name: Run nf-test run: | - "nf-test test tests/main_pipeline_${{ matrix.profile }}.test --junitxml=test.xml" + nf-test test tests/main_pipeline_${{ matrix.profile }}.test --junitxml=test.xml - name: Output log on failure if: failure() From da1eadeab233fc4500dcc5ebb2d34b7f9b9d7966 Mon Sep 17 00:00:00 2001 From: Felipe Marques de Almeida Date: Wed, 14 Feb 2024 08:15:48 +0000 Subject: [PATCH 12/13] updated tests to use assertAll() --- tests/main_pipeline_alevin.test | 76 +++++++++++++------------- tests/main_pipeline_cellranger.test | 82 +++++++++++++++-------------- tests/main_pipeline_kallisto.test | 72 +++++++++++++------------ tests/main_pipeline_star.test | 80 +++++++++++++++------------- 4 files changed, 163 insertions(+), 147 deletions(-) diff --git a/tests/main_pipeline_alevin.test b/tests/main_pipeline_alevin.test index f2730699..303a625b 100644 --- a/tests/main_pipeline_alevin.test +++ b/tests/main_pipeline_alevin.test @@ -20,42 +20,46 @@ nextflow_pipeline { then { - // - // General assertions - // - - // Did it finish successfully? - assert workflow.success - - // How many tasks were executed? - assert workflow.trace.tasks().size() == 16 - - // How many results were produced? - assert path("${outputDir}/results_alevin").list().size() == 5 - assert path("${outputDir}/results_alevin/alevin").list().size() == 4 - assert path("${outputDir}/results_alevin/alevin/mtx_conversions").list().size() == 4 - assert path("${outputDir}/results_alevin/alevinqc").list().size() == 2 - assert path("${outputDir}/results_alevin/fastqc").list().size() == 12 - assert path("${outputDir}/results_alevin/multiqc").list().size() == 3 - - // - // Check if files were produced - // - assert new File( "${outputDir}/results_alevin/alevin/mtx_conversions/Sample_X/Sample_X_matrix.h5ad" ).exists() - assert new File( "${outputDir}/results_alevin/alevin/mtx_conversions/Sample_Y/Sample_Y_matrix.h5ad" ).exists() - - // - // Check if files are the same - // - assert snapshot( - workflow, - path( "${outputDir}/results_alevin/alevin/Sample_X_alevin_results/af_quant/alevin/quants_mat_cols.txt" ), - path( "${outputDir}/results_alevin/alevin/Sample_X_alevin_results/af_quant/alevin/quants_mat.mtx" ), - path( "${outputDir}/results_alevin/alevin/Sample_X_alevin_results/af_quant/alevin/quants_mat_rows.txt" ), - path( "${outputDir}/results_alevin/alevin/Sample_Y_alevin_results/af_quant/alevin/quants_mat_cols.txt" ), - path( "${outputDir}/results_alevin/alevin/Sample_Y_alevin_results/af_quant/alevin/quants_mat.mtx" ), - path( "${outputDir}/results_alevin/alevin/Sample_Y_alevin_results/af_quant/alevin/quants_mat_rows.txt" ) - ).match() + assertAll( + + // + // General assertions + // + + // Did it finish successfully? + {assert workflow.success}, + + // How many tasks were executed? + {assert workflow.trace.tasks().size() == 16}, + + // How many results were produced? + {assert path("${outputDir}/results_alevin").list().size() == 5}, + {assert path("${outputDir}/results_alevin/alevin").list().size() == 4}, + {assert path("${outputDir}/results_alevin/alevin/mtx_conversions").list().size() == 4}, + {assert path("${outputDir}/results_alevin/alevinqc").list().size() == 2}, + {assert path("${outputDir}/results_alevin/fastqc").list().size() == 12}, + {assert path("${outputDir}/results_alevin/multiqc").list().size() == 3}, + + // + // Check if files were produced + // + {assert new File( "${outputDir}/results_alevin/alevin/mtx_conversions/Sample_X/Sample_X_matrix.h5ad" ).exists()}, + {assert new File( "${outputDir}/results_alevin/alevin/mtx_conversions/Sample_Y/Sample_Y_matrix.h5ad" ).exists()}, + + // + // Check if files are the same + // + {assert snapshot( + workflow, + path( "${outputDir}/results_alevin/alevin/Sample_X_alevin_results/af_quant/alevin/quants_mat_cols.txt" ), + path( "${outputDir}/results_alevin/alevin/Sample_X_alevin_results/af_quant/alevin/quants_mat.mtx" ), + path( "${outputDir}/results_alevin/alevin/Sample_X_alevin_results/af_quant/alevin/quants_mat_rows.txt" ), + path( "${outputDir}/results_alevin/alevin/Sample_Y_alevin_results/af_quant/alevin/quants_mat_cols.txt" ), + path( "${outputDir}/results_alevin/alevin/Sample_Y_alevin_results/af_quant/alevin/quants_mat.mtx" ), + path( "${outputDir}/results_alevin/alevin/Sample_Y_alevin_results/af_quant/alevin/quants_mat_rows.txt" ) + ).match()} + + ) // end of assertAll() } } diff --git a/tests/main_pipeline_cellranger.test b/tests/main_pipeline_cellranger.test index 314177e0..996c0f76 100644 --- a/tests/main_pipeline_cellranger.test +++ b/tests/main_pipeline_cellranger.test @@ -20,50 +20,54 @@ nextflow_pipeline { then { - // - // General assertions - // + assertAll( - // Did it finish successfully? - assert workflow.success + // + // General assertions + // - // How many tasks were executed? - assert workflow.trace.tasks().size() == 15 + // Did it finish successfully? + {assert workflow.success}, - // How many results were produced? - assert path("${outputDir}/results_cellranger").list().size() == 4 - assert path("${outputDir}/results_cellranger/cellranger").list().size() == 4 - assert path("${outputDir}/results_cellranger/cellranger/mtx_conversions").list().size() == 4 - assert path("${outputDir}/results_cellranger/cellranger/count").list().size() == 3 - assert path("${outputDir}/results_cellranger/fastqc").list().size() == 12 - assert path("${outputDir}/results_cellranger/multiqc").list().size() == 3 + // How many tasks were executed? + {assert workflow.trace.tasks().size() == 15}, - // - // Check if files were produced - // - assert new File( "${outputDir}/results_cellranger/cellranger/mtx_conversions/Sample_X/Sample_X_matrix.h5ad" ).exists() - assert new File( "${outputDir}/results_cellranger/cellranger/mtx_conversions/Sample_Y/Sample_Y_matrix.h5ad" ).exists() + // How many results were produced? + {assert path("${outputDir}/results_cellranger").list().size() == 4}, + {assert path("${outputDir}/results_cellranger/cellranger").list().size() == 4}, + {assert path("${outputDir}/results_cellranger/cellranger/mtx_conversions").list().size() == 4}, + {assert path("${outputDir}/results_cellranger/cellranger/count").list().size() == 3}, + {assert path("${outputDir}/results_cellranger/fastqc").list().size() == 12}, + {assert path("${outputDir}/results_cellranger/multiqc").list().size() == 3}, - // - // Check if files are the same - // - assert snapshot( - workflow, - path( "${outputDir}/results_cellranger/cellranger/count/Sample_X/outs/filtered_feature_bc_matrix/barcodes.tsv.gz" ), - path( "${outputDir}/results_cellranger/cellranger/count/Sample_X/outs/filtered_feature_bc_matrix/features.tsv.gz" ), - path( "${outputDir}/results_cellranger/cellranger/count/Sample_X/outs/filtered_feature_bc_matrix/matrix.mtx.gz" ), - path( "${outputDir}/results_cellranger/cellranger/count/Sample_Y/outs/filtered_feature_bc_matrix/barcodes.tsv.gz" ), - path( "${outputDir}/results_cellranger/cellranger/count/Sample_Y/outs/filtered_feature_bc_matrix/features.tsv.gz" ), - path( "${outputDir}/results_cellranger/cellranger/count/Sample_Y/outs/filtered_feature_bc_matrix/matrix.mtx.gz" ), - path( "${outputDir}/results_cellranger/cellranger/count/Sample_X/outs/raw_feature_bc_matrix/barcodes.tsv.gz" ), - path( "${outputDir}/results_cellranger/cellranger/count/Sample_X/outs/raw_feature_bc_matrix/features.tsv.gz" ), - path( "${outputDir}/results_cellranger/cellranger/count/Sample_X/outs/raw_feature_bc_matrix/matrix.mtx.gz" ), - path( "${outputDir}/results_cellranger/cellranger/count/Sample_Y/outs/raw_feature_bc_matrix/barcodes.tsv.gz" ), - path( "${outputDir}/results_cellranger/cellranger/count/Sample_Y/outs/raw_feature_bc_matrix/features.tsv.gz" ), - path( "${outputDir}/results_cellranger/cellranger/count/Sample_Y/outs/raw_feature_bc_matrix/matrix.mtx.gz" ), - path( "${outputDir}/results_cellranger/cellranger/mtx_conversions/Sample_X/Sample_X_matrix.rds" ), - path( "${outputDir}/results_cellranger/cellranger/mtx_conversions/Sample_Y/Sample_Y_matrix.rds" ) - ).match() + // + // Check if files were produced + // + {assert new File( "${outputDir}/results_cellranger/cellranger/mtx_conversions/Sample_X/Sample_X_matrix.h5ad" ).exists()}, + {assert new File( "${outputDir}/results_cellranger/cellranger/mtx_conversions/Sample_Y/Sample_Y_matrix.h5ad" ).exists()}, + + // + // Check if files are the same + // + {assert snapshot( + workflow, + path( "${outputDir}/results_cellranger/cellranger/count/Sample_X/outs/filtered_feature_bc_matrix/barcodes.tsv.gz" ), + path( "${outputDir}/results_cellranger/cellranger/count/Sample_X/outs/filtered_feature_bc_matrix/features.tsv.gz" ), + path( "${outputDir}/results_cellranger/cellranger/count/Sample_X/outs/filtered_feature_bc_matrix/matrix.mtx.gz" ), + path( "${outputDir}/results_cellranger/cellranger/count/Sample_Y/outs/filtered_feature_bc_matrix/barcodes.tsv.gz" ), + path( "${outputDir}/results_cellranger/cellranger/count/Sample_Y/outs/filtered_feature_bc_matrix/features.tsv.gz" ), + path( "${outputDir}/results_cellranger/cellranger/count/Sample_Y/outs/filtered_feature_bc_matrix/matrix.mtx.gz" ), + path( "${outputDir}/results_cellranger/cellranger/count/Sample_X/outs/raw_feature_bc_matrix/barcodes.tsv.gz" ), + path( "${outputDir}/results_cellranger/cellranger/count/Sample_X/outs/raw_feature_bc_matrix/features.tsv.gz" ), + path( "${outputDir}/results_cellranger/cellranger/count/Sample_X/outs/raw_feature_bc_matrix/matrix.mtx.gz" ), + path( "${outputDir}/results_cellranger/cellranger/count/Sample_Y/outs/raw_feature_bc_matrix/barcodes.tsv.gz" ), + path( "${outputDir}/results_cellranger/cellranger/count/Sample_Y/outs/raw_feature_bc_matrix/features.tsv.gz" ), + path( "${outputDir}/results_cellranger/cellranger/count/Sample_Y/outs/raw_feature_bc_matrix/matrix.mtx.gz" ), + path( "${outputDir}/results_cellranger/cellranger/mtx_conversions/Sample_X/Sample_X_matrix.rds" ), + path( "${outputDir}/results_cellranger/cellranger/mtx_conversions/Sample_Y/Sample_Y_matrix.rds" ) + ).match()} + + ) // end of assertAll() } } diff --git a/tests/main_pipeline_kallisto.test b/tests/main_pipeline_kallisto.test index 1b06f249..98ede8c4 100644 --- a/tests/main_pipeline_kallisto.test +++ b/tests/main_pipeline_kallisto.test @@ -20,45 +20,49 @@ nextflow_pipeline { then { - // - // General assertions - // + assertAll( - // Did it finish successfully? - assert workflow.success + // + // General assertions + // - // How many tasks were executed? - assert workflow.trace.tasks().size() == 14 + // Did it finish successfully? + {assert workflow.success}, - // How many results were produced? - assert path("${outputDir}/results_kallisto").list().size() == 4 - assert path("${outputDir}/results_kallisto/kallisto").list().size() == 4 - assert path("${outputDir}/results_kallisto/kallisto/mtx_conversions").list().size() == 4 - assert path("${outputDir}/results_kallisto/kallisto/Sample_X.count").list().size() == 9 - assert path("${outputDir}/results_kallisto/kallisto/Sample_Y.count").list().size() == 9 - assert path("${outputDir}/results_kallisto/fastqc").list().size() == 12 - assert path("${outputDir}/results_kallisto/multiqc").list().size() == 3 + // How many tasks were executed? + {assert workflow.trace.tasks().size() == 14}, - // - // Check if files were produced - // - assert new File( "${outputDir}/results_kallisto/kallisto/mtx_conversions/Sample_X/Sample_X_matrix.h5ad" ).exists() - assert new File( "${outputDir}/results_kallisto/kallisto/mtx_conversions/Sample_Y/Sample_Y_matrix.h5ad" ).exists() + // How many results were produced? + {assert path("${outputDir}/results_kallisto").list().size() == 4}, + {assert path("${outputDir}/results_kallisto/kallisto").list().size() == 4}, + {assert path("${outputDir}/results_kallisto/kallisto/mtx_conversions").list().size() == 4}, + {assert path("${outputDir}/results_kallisto/kallisto/Sample_X.count").list().size() == 9}, + {assert path("${outputDir}/results_kallisto/kallisto/Sample_Y.count").list().size() == 9}, + {assert path("${outputDir}/results_kallisto/fastqc").list().size() == 12}, + {assert path("${outputDir}/results_kallisto/multiqc").list().size() == 3}, - // - // Check if files are the same - // - assert snapshot( - workflow, - path( "${outputDir}/results_kallisto/kallisto/Sample_X.count/counts_unfiltered/cells_x_genes.barcodes.txt" ), - path( "${outputDir}/results_kallisto/kallisto/Sample_X.count/counts_unfiltered/cells_x_genes.genes.txt" ), - path( "${outputDir}/results_kallisto/kallisto/Sample_X.count/counts_unfiltered/cells_x_genes.mtx" ), - path( "${outputDir}/results_kallisto/kallisto/Sample_Y.count/counts_unfiltered/cells_x_genes.barcodes.txt" ), - path( "${outputDir}/results_kallisto/kallisto/Sample_Y.count/counts_unfiltered/cells_x_genes.genes.txt" ), - path( "${outputDir}/results_kallisto/kallisto/Sample_Y.count/counts_unfiltered/cells_x_genes.mtx" ), - path( "${outputDir}/results_kallisto/kallisto/mtx_conversions/Sample_X/Sample_X_matrix.rds" ), - path( "${outputDir}/results_kallisto/kallisto/mtx_conversions/Sample_Y/Sample_Y_matrix.rds" ) - ).match() + // + // Check if files were produced + // + {assert new File( "${outputDir}/results_kallisto/kallisto/mtx_conversions/Sample_X/Sample_X_matrix.h5ad" ).exists()}, + {assert new File( "${outputDir}/results_kallisto/kallisto/mtx_conversions/Sample_Y/Sample_Y_matrix.h5ad" ).exists()}, + + // + // Check if files are the same + // + {assert snapshot( + workflow, + path( "${outputDir}/results_kallisto/kallisto/Sample_X.count/counts_unfiltered/cells_x_genes.barcodes.txt" ), + path( "${outputDir}/results_kallisto/kallisto/Sample_X.count/counts_unfiltered/cells_x_genes.genes.txt" ), + path( "${outputDir}/results_kallisto/kallisto/Sample_X.count/counts_unfiltered/cells_x_genes.mtx" ), + path( "${outputDir}/results_kallisto/kallisto/Sample_Y.count/counts_unfiltered/cells_x_genes.barcodes.txt" ), + path( "${outputDir}/results_kallisto/kallisto/Sample_Y.count/counts_unfiltered/cells_x_genes.genes.txt" ), + path( "${outputDir}/results_kallisto/kallisto/Sample_Y.count/counts_unfiltered/cells_x_genes.mtx" ), + path( "${outputDir}/results_kallisto/kallisto/mtx_conversions/Sample_X/Sample_X_matrix.rds" ), + path( "${outputDir}/results_kallisto/kallisto/mtx_conversions/Sample_Y/Sample_Y_matrix.rds" ) + ).match()} + + ) // end of assertAll() } } diff --git a/tests/main_pipeline_star.test b/tests/main_pipeline_star.test index de07c8d3..6616ea87 100644 --- a/tests/main_pipeline_star.test +++ b/tests/main_pipeline_star.test @@ -20,49 +20,53 @@ nextflow_pipeline { then { - // - // General assertions - // + assertAll( - // Did it finish successfully? - assert workflow.success + // + // General assertions + // - // How many tasks were executed? - assert workflow.trace.tasks().size() == 14 + // Did it finish successfully? + {assert workflow.success}, - // How many results were produced? - assert path("${outputDir}/results_star").list().size() == 4 - assert path("${outputDir}/results_star/star").list().size() == 3 - assert path("${outputDir}/results_star/star/mtx_conversions").list().size() == 4 - assert path("${outputDir}/results_star/fastqc").list().size() == 12 - assert path("${outputDir}/results_star/multiqc").list().size() == 3 + // How many tasks were executed? + {assert workflow.trace.tasks().size() == 14}, - // - // Check if files were produced - // - assert new File( "${outputDir}/results_star/star/mtx_conversions/Sample_X/Sample_X_matrix.h5ad" ).exists() - assert new File( "${outputDir}/results_star/star/mtx_conversions/Sample_Y/Sample_Y_matrix.h5ad" ).exists() + // How many results were produced? + {assert path("${outputDir}/results_star").list().size() == 4}, + {assert path("${outputDir}/results_star/star").list().size() == 3}, + {assert path("${outputDir}/results_star/star/mtx_conversions").list().size() == 4}, + {assert path("${outputDir}/results_star/fastqc").list().size() == 12}, + {assert path("${outputDir}/results_star/multiqc").list().size() == 3}, - // - // Check if files are the same - // - assert snapshot( - workflow, - path( "${outputDir}/results_star/star/Sample_X/Sample_X.SJ.out.tab" ), - path( "${outputDir}/results_star/star/Sample_X/Sample_X.Solo.out/Barcodes.stats" ), - path( "${outputDir}/results_star/star/Sample_X/Sample_X.Solo.out/Gene/filtered/matrix.mtx.gz" ), - path( "${outputDir}/results_star/star/Sample_X/Sample_X.Solo.out/Gene/filtered/features.tsv.gz" ), - path( "${outputDir}/results_star/star/Sample_X/Sample_X.Solo.out/Gene/filtered/barcodes.tsv.gz" ), - // path( "${outputDir}/results_star/star/mtx_conversions/Sample_X/Sample_X_matrix.h5ad" ), // does not match - path( "${outputDir}/results_star/star/mtx_conversions/Sample_X/Sample_X_matrix.rds" ), - path( "${outputDir}/results_star/star/Sample_Y/Sample_Y.SJ.out.tab" ), - path( "${outputDir}/results_star/star/Sample_Y/Sample_Y.Solo.out/Barcodes.stats" ), - path( "${outputDir}/results_star/star/Sample_Y/Sample_Y.Solo.out/Gene/filtered/matrix.mtx.gz" ), - path( "${outputDir}/results_star/star/Sample_Y/Sample_Y.Solo.out/Gene/filtered/features.tsv.gz" ), - path( "${outputDir}/results_star/star/Sample_Y/Sample_Y.Solo.out/Gene/filtered/barcodes.tsv.gz" ), - // path( "${outputDir}/results_star/star/mtx_conversions/Sample_Y/Sample_Y_matrix.h5ad" ), // does not match - path( "${outputDir}/results_star/star/mtx_conversions/Sample_Y/Sample_Y_matrix.rds" ), - ).match() + // + // Check if files were produced + // + {assert new File( "${outputDir}/results_star/star/mtx_conversions/Sample_X/Sample_X_matrix.h5ad" ).exists()}, + {assert new File( "${outputDir}/results_star/star/mtx_conversions/Sample_Y/Sample_Y_matrix.h5ad" ).exists()}, + + // + // Check if files are the same + // + {assert snapshot( + workflow, + path( "${outputDir}/results_star/star/Sample_X/Sample_X.SJ.out.tab" ), + path( "${outputDir}/results_star/star/Sample_X/Sample_X.Solo.out/Barcodes.stats" ), + path( "${outputDir}/results_star/star/Sample_X/Sample_X.Solo.out/Gene/filtered/matrix.mtx.gz" ), + path( "${outputDir}/results_star/star/Sample_X/Sample_X.Solo.out/Gene/filtered/features.tsv.gz" ), + path( "${outputDir}/results_star/star/Sample_X/Sample_X.Solo.out/Gene/filtered/barcodes.tsv.gz" ), + // path( "${outputDir}/results_star/star/mtx_conversions/Sample_X/Sample_X_matrix.h5ad" ), // does not match + path( "${outputDir}/results_star/star/mtx_conversions/Sample_X/Sample_X_matrix.rds" ), + path( "${outputDir}/results_star/star/Sample_Y/Sample_Y.SJ.out.tab" ), + path( "${outputDir}/results_star/star/Sample_Y/Sample_Y.Solo.out/Barcodes.stats" ), + path( "${outputDir}/results_star/star/Sample_Y/Sample_Y.Solo.out/Gene/filtered/matrix.mtx.gz" ), + path( "${outputDir}/results_star/star/Sample_Y/Sample_Y.Solo.out/Gene/filtered/features.tsv.gz" ), + path( "${outputDir}/results_star/star/Sample_Y/Sample_Y.Solo.out/Gene/filtered/barcodes.tsv.gz" ), + // path( "${outputDir}/results_star/star/mtx_conversions/Sample_Y/Sample_Y_matrix.h5ad" ), // does not match + path( "${outputDir}/results_star/star/mtx_conversions/Sample_Y/Sample_Y_matrix.rds" ), + ).match()} + + ) // end of assertAll() } } From 0e5e6aabd05a2c0a12601f517f5eddb6ec56680b Mon Sep 17 00:00:00 2001 From: Felipe Marques de Almeida Date: Wed, 14 Feb 2024 08:21:57 +0000 Subject: [PATCH 13/13] update changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a7c8ed27..9f920a4d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## TBD + +- [[#91](https://github.com/nf-core/scrnaseq/issues/91)] - Change from pytests to nf-test + ## v2.5.1 - Fix that cellranger workflow couldn't be run and enable CI for this workflow ([#288](https://github.com/nf-core/scrnaseq/pull/288)).