Skip to content

Commit

Permalink
updated tests to use assertAll()
Browse files Browse the repository at this point in the history
  • Loading branch information
fmalmeida committed Feb 14, 2024
1 parent 8684445 commit da1eade
Show file tree
Hide file tree
Showing 4 changed files with 163 additions and 147 deletions.
76 changes: 40 additions & 36 deletions tests/main_pipeline_alevin.test
Original file line number Diff line number Diff line change
Expand Up @@ -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()

}
}
Expand Down
82 changes: 43 additions & 39 deletions tests/main_pipeline_cellranger.test
Original file line number Diff line number Diff line change
Expand Up @@ -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()

}
}
Expand Down
72 changes: 38 additions & 34 deletions tests/main_pipeline_kallisto.test
Original file line number Diff line number Diff line change
Expand Up @@ -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()

}
}
Expand Down
Loading

0 comments on commit da1eade

Please sign in to comment.