diff --git a/modules.json b/modules.json index 88382b1fc..15390c5fe 100644 --- a/modules.json +++ b/modules.json @@ -226,7 +226,7 @@ }, "summarizedexperiment/summarizedexperiment": { "branch": "master", - "git_sha": "874dace043f1400fddca70dc9786fa4e82e6f5ac", + "git_sha": "05a252a330273c67795aed2b18e86c53c4c9382a", "installed_by": ["modules"] }, "trimgalore": { diff --git a/modules/nf-core/summarizedexperiment/summarizedexperiment/main.nf b/modules/nf-core/summarizedexperiment/summarizedexperiment/main.nf index 8d4ac483e..cc37092fd 100644 --- a/modules/nf-core/summarizedexperiment/summarizedexperiment/main.nf +++ b/modules/nf-core/summarizedexperiment/summarizedexperiment/main.nf @@ -30,7 +30,7 @@ process SUMMARIZEDEXPERIMENT_SUMMARIZEDEXPERIMENT { cat <<-END_VERSIONS > versions.yml "${task.process}": - r: \$( R --version | sed '1!d; s/.*version //; s/ .*//' ) + bioconductor-summarizedexperiment: \$(Rscript -e "library(SummarizedExperiment); cat(as.character(packageVersion('SummarizedExperiment')))") END_VERSIONS """ } diff --git a/modules/nf-core/summarizedexperiment/summarizedexperiment/templates/summarizedexperiment.r b/modules/nf-core/summarizedexperiment/summarizedexperiment/templates/summarizedexperiment.r index e2f74e632..58cd8473b 100644 --- a/modules/nf-core/summarizedexperiment/summarizedexperiment/templates/summarizedexperiment.r +++ b/modules/nf-core/summarizedexperiment/summarizedexperiment/templates/summarizedexperiment.r @@ -130,7 +130,7 @@ parse_metadata <- function(metadata_path, ids, metadata_id_col = NULL){ rownames(metadata) <- metadata[[metadata_id_col]] - metadata + metadata[ids,, drop=FALSE] } ################################################ @@ -154,7 +154,7 @@ if ('assay_names' %in% names(args_opt)){ assay_list <- lapply(matrix_files, function(m){ mat <- read_delim_flexible(m, row.names = 1, stringsAsFactors = FALSE) - mat[,sapply(mat, is.numeric)] + mat[,sapply(mat, is.numeric), drop = FALSE] }) checkRowColNames(assay_list) @@ -173,10 +173,6 @@ if ('$coldata' != ''){ metadata_id_col = args_opt\$coldata_id_col ) - assay_list <- lapply(assay_list, function(m){ - m[,rownames(coldata)] - }) - colData(se) <- DataFrame(coldata) } @@ -189,10 +185,6 @@ if ('$rowdata' != ''){ metadata_id_col = args_opt\$rowdata_id_col ) - assay_list <- lapply(assay_list, function(m){ - m[rownames(rowdata), ] - }) - rowData(se) <- DataFrame(rowdata) } @@ -232,7 +224,6 @@ summarizedexperiment.version <- as.character(packageVersion('SummarizedExperimen writeLines( c( '"${task.process}":', - paste(' r-base:', r.version), paste(' bioconductor-summarizedexperiment:', summarizedexperiment.version) ), 'versions.yml') diff --git a/modules/nf-core/summarizedexperiment/summarizedexperiment/tests/main.nf.test.snap b/modules/nf-core/summarizedexperiment/summarizedexperiment/tests/main.nf.test.snap index 769d37f94..6989f937e 100644 --- a/modules/nf-core/summarizedexperiment/summarizedexperiment/tests/main.nf.test.snap +++ b/modules/nf-core/summarizedexperiment/summarizedexperiment/tests/main.nf.test.snap @@ -36,14 +36,14 @@ "versions_single_matrix": { "content": [ [ - "versions.yml:md5,1fdcee094bb7ec091b4e445b933d0db3" + "versions.yml:md5,9fb424df9dedf0dc55c95215ae802bb9" ] ], "meta": { "nf-test": "0.8.4", "nextflow": "23.10.1" }, - "timestamp": "2024-02-09T14:03:08.335086603" + "timestamp": "2024-03-08T14:45:26.13363" }, "gene_log_multi_matrix_rowdata_stub": { "content": [ @@ -73,38 +73,38 @@ "versions_multi_matrix_rowdata_stub": { "content": [ [ - "versions.yml:md5,290f4dc3e123c9468040095de6ffe2e2" + "versions.yml:md5,9fb424df9dedf0dc55c95215ae802bb9" ] ], "meta": { "nf-test": "0.8.4", "nextflow": "23.10.1" }, - "timestamp": "2024-02-09T13:57:52.239867923" + "timestamp": "2024-03-08T14:46:04.546156" }, "versions_multi_matrix_stub": { "content": [ [ - "versions.yml:md5,290f4dc3e123c9468040095de6ffe2e2" + "versions.yml:md5,9fb424df9dedf0dc55c95215ae802bb9" ] ], "meta": { "nf-test": "0.8.4", "nextflow": "23.10.1" }, - "timestamp": "2024-02-09T13:58:07.911717413" + "timestamp": "2024-03-08T14:46:21.128541" }, "versions_multi_matrix_rowdata_coldata_stub": { "content": [ [ - "versions.yml:md5,290f4dc3e123c9468040095de6ffe2e2" + "versions.yml:md5,9fb424df9dedf0dc55c95215ae802bb9" ] ], "meta": { "nf-test": "0.8.4", "nextflow": "23.10.1" }, - "timestamp": "2024-02-09T13:57:39.554437332" + "timestamp": "2024-03-08T14:45:43.440258" }, "gene_log_multi_matrix": { "content": "7c35131fdd46dcdba6c71f7f11d5b2c7", @@ -142,26 +142,26 @@ "versions_single_matrix_stub": { "content": [ [ - "versions.yml:md5,290f4dc3e123c9468040095de6ffe2e2" + "versions.yml:md5,9fb424df9dedf0dc55c95215ae802bb9" ] ], "meta": { "nf-test": "0.8.4", "nextflow": "23.10.1" }, - "timestamp": "2024-02-09T13:58:23.263373495" + "timestamp": "2024-03-08T14:46:37.670798" }, "versions_multi_matrix_rowdata": { "content": [ [ - "versions.yml:md5,1fdcee094bb7ec091b4e445b933d0db3" + "versions.yml:md5,9fb424df9dedf0dc55c95215ae802bb9" ] ], "meta": { "nf-test": "0.8.4", "nextflow": "23.10.1" }, - "timestamp": "2024-02-09T14:02:24.434806727" + "timestamp": "2024-03-08T14:44:42.420728" }, "gene_log_multi_matrix_rowdata_coldata": { "content": "7c35131fdd46dcdba6c71f7f11d5b2c7", @@ -174,25 +174,25 @@ "versions_multi_matrix": { "content": [ [ - "versions.yml:md5,1fdcee094bb7ec091b4e445b933d0db3" + "versions.yml:md5,9fb424df9dedf0dc55c95215ae802bb9" ] ], "meta": { "nf-test": "0.8.4", "nextflow": "23.10.1" }, - "timestamp": "2024-02-09T14:02:46.374127565" + "timestamp": "2024-03-08T14:45:04.188507" }, "versions_multi_matrix_rowdata_coldata": { "content": [ [ - "versions.yml:md5,1fdcee094bb7ec091b4e445b933d0db3" + "versions.yml:md5,9fb424df9dedf0dc55c95215ae802bb9" ] ], "meta": { "nf-test": "0.8.4", "nextflow": "23.10.1" }, - "timestamp": "2024-02-09T14:02:01.257461683" + "timestamp": "2024-03-08T14:44:20.698714" } } \ No newline at end of file diff --git a/subworkflows/local/quantify_pseudo_alignment/tests/main.nf.test b/subworkflows/local/quantify_pseudo_alignment/tests/main.nf.test new file mode 100644 index 000000000..9309200d7 --- /dev/null +++ b/subworkflows/local/quantify_pseudo_alignment/tests/main.nf.test @@ -0,0 +1,148 @@ +nextflow_workflow { + + name "Test Workflow QUANTIFY_PSEUDO_ALIGNMENT" + script "../main.nf" + workflow "QUANTIFY_PSEUDO_ALIGNMENT" + + tag 'SALMON_QUANT' + tag 'KALLISTO_QUANT' + tag 'CUSTOM_TX2GENE' + tag 'TXIMETA_TXIMPORT' + tag 'SUMMARIZEDEXPERIMENT_SUMMARIZEDEXPERIMENT' + + test("salmon") { + + setup { + run("SALMON_INDEX") { + script "../../../../modules/nf-core/salmon/index/main.nf" + process { + """ + input[0] = Channel.of([file(params.modules_testdata_base_path + "genomics/homo_sapiens/genome/genome.fasta", checkIfExists: true)]) + input[1] = Channel.of([file(params.modules_testdata_base_path + "genomics/homo_sapiens/genome/transcriptome.fasta", checkIfExists: true)]) + """ + } + } + } + + when { + workflow { + """ + input[0] = [ + [ id: 'samplesheet' ], + file(params.pipelines_testdata_base_path + '/csv/samplesheet_micro.csv', checkIfExists: true) + ] + input[1] = [ + [ id: 'test' ], + [ + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/fastq/test_1.fastq.gz', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/fastq/test_2.fastq.gz', checkIfExists: true) + ] + ] + input[2] = SALMON_INDEX.out.index + input[3] = Channel.of(file(params.modules_testdata_base_path + "genomics/homo_sapiens/genome/transcriptome.fasta", checkIfExists: true)) + input[4] = Channel.of(file(params.modules_testdata_base_path + "genomics/homo_sapiens/genome/genome.gtf", checkIfExists: true)) + input[5] = 'gene_id' + input[6] = 'gene_name' + input[7] = 'salmon' + input[8] = false + input[9] = 'A' + input[10] = null + input[11] = null + """ + } + } + + then { + assertAll( + { assert workflow.success }, + { assert snapshot( + workflow.out.tpm_gene, + workflow.out.counts_gene, + workflow.out.lengths_gene, + workflow.out.counts_gene_length_scaled, + workflow.out.tpm_transcript, + workflow.out.lengths_transcript, + workflow.out.merged_gene_rds, + workflow.out.merged_gene_rds_length_scaled, + workflow.out.merged_gene_rds_scaled, + workflow.out.merged_counts_transcript, + workflow.out.merged_tpm_transcript, + workflow.out.merged_transcript_rds, + workflow.out.versions + ).match() + } + ) + } + + } + + test("kallisto") { + + setup { + run("KALLISTO_INDEX") { + script "../../../../modules/nf-core/kallisto/index/main.nf" + process { + """ + input[0] = Channel.of([ + [ id:'transcriptome' ], // meta map + file(params.modules_testdata_base_path + "genomics/homo_sapiens/genome/transcriptome.fasta", checkIfExists: true) + ]) + """ + } + } + } + + + when { + workflow { + """ + input[0] = [ + [ id: 'samplesheet' ], + file(params.pipelines_testdata_base_path + '/csv/samplesheet_micro.csv', checkIfExists: true) + ] + input[1] = [ + [ id: 'test' ], + [ + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/fastq/test_1.fastq.gz', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/fastq/test_2.fastq.gz', checkIfExists: true) + ] + ] + input[2] = KALLISTO_INDEX.out.index + input[3] = Channel.of(file(params.modules_testdata_base_path + "genomics/homo_sapiens/genome/transcriptome.fasta", checkIfExists: true)) + input[4] = Channel.of(file(params.modules_testdata_base_path + "genomics/homo_sapiens/genome/genome.gtf", checkIfExists: true)) + input[5] = 'gene_id' + input[6] = 'gene_name' + input[7] = 'kallisto' + input[8] = null + input[9] = null + input[10] = [] + input[11] = [] + """ + } + } + + then { + assertAll( + { assert workflow.success }, + { assert snapshot( + workflow.out.tpm_gene, + workflow.out.counts_gene, + workflow.out.lengths_gene, + workflow.out.counts_gene_length_scaled, + workflow.out.tpm_transcript, + workflow.out.lengths_transcript, + workflow.out.merged_gene_rds, + workflow.out.merged_gene_rds_length_scaled, + workflow.out.merged_gene_rds_scaled, + workflow.out.merged_counts_transcript, + workflow.out.merged_tpm_transcript, + workflow.out.merged_transcript_rds, + workflow.out.versions + ).match() + } + ) + } + + } + +} diff --git a/subworkflows/local/quantify_pseudo_alignment/tests/main.nf.test.snap b/subworkflows/local/quantify_pseudo_alignment/tests/main.nf.test.snap new file mode 100644 index 000000000..3c82cb297 --- /dev/null +++ b/subworkflows/local/quantify_pseudo_alignment/tests/main.nf.test.snap @@ -0,0 +1,224 @@ +{ + "kallisto": { + "content": [ + [ + [ + { + "id": "all_samples" + }, + "all_samples.gene_tpm.tsv:md5,23fa0c64cfbd198806b53897de791b8b" + ] + ], + [ + [ + { + "id": "all_samples" + }, + "all_samples.gene_counts.tsv:md5,4ba44e5ebc9ed0ca2ca008d10a1dddc3" + ] + ], + [ + [ + { + "id": "all_samples" + }, + "all_samples.gene_lengths.tsv:md5,b031192af7a8f64dcc887978a69fdbb7" + ] + ], + [ + [ + { + "id": "all_samples" + }, + "all_samples.gene_counts_length_scaled.tsv:md5,078746568e3fd0c995559352b661b2d9" + ] + ], + [ + [ + { + "id": "all_samples" + }, + "all_samples.transcript_tpm.tsv:md5,de458e1c2a579e53bd7671c5176f5d0c" + ] + ], + [ + [ + { + "id": "all_samples" + }, + "all_samples.transcript_lengths.tsv:md5,131952a97905469ab012f0f46e52405c" + ] + ], + [ + [ + { + "id": "all_samples" + }, + "all_samples.SummarizedExperiment.rds:md5,ba4ff9c05eea56d71bb2de77ae960f9c" + ] + ], + [ + [ + { + "id": "all_samples" + }, + "all_samples.SummarizedExperiment.rds:md5,d8a8f1b178acd49dc04c6dabbc00bbab" + ] + ], + [ + [ + { + "id": "all_samples" + }, + "all_samples.SummarizedExperiment.rds:md5,d535f7e33c2a7fd98aeedbfe23fc9cfe" + ] + ], + [ + [ + { + "id": "all_samples" + }, + "all_samples.transcript_counts.tsv:md5,c5a43880cd87d00ef40de5df9ca3afa7" + ] + ], + [ + [ + { + "id": "all_samples" + }, + "all_samples.transcript_tpm.tsv:md5,de458e1c2a579e53bd7671c5176f5d0c" + ] + ], + [ + [ + { + "id": "all_samples" + }, + "all_samples.SummarizedExperiment.rds:md5,a681c620612c2496ea8294af38c7443e" + ] + ], + [ + "versions.yml:md5,b44caeec65491d47e098c7ddaf024b96", + "versions.yml:md5,dbf98ec672f75a683c28dcf4121364d2", + "versions.yml:md5,e9e7d18c3de83f1113fb1ff0c55d35ed", + "versions.yml:md5,ea39658f8685118d81d42acd451e66ea" + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "24.02.0" + }, + "timestamp": "2024-03-12T10:33:14.836979" + }, + "salmon": { + "content": [ + [ + [ + { + "id": "all_samples" + }, + "all_samples.gene_tpm.tsv:md5,9711ed8364c3a1ea4fc87bd5e0780835" + ] + ], + [ + [ + { + "id": "all_samples" + }, + "all_samples.gene_counts.tsv:md5,865a4706b8bf47f476d8298fdd344902" + ] + ], + [ + [ + { + "id": "all_samples" + }, + "all_samples.gene_lengths.tsv:md5,158e17a7bda7827b3d528f379e81d2bd" + ] + ], + [ + [ + { + "id": "all_samples" + }, + "all_samples.gene_counts_length_scaled.tsv:md5,46194b28815747fe3c3d5a619fa994a7" + ] + ], + [ + [ + { + "id": "all_samples" + }, + "all_samples.transcript_tpm.tsv:md5,e0c16bf083ebb88bcfaf27cfba12d3e9" + ] + ], + [ + [ + { + "id": "all_samples" + }, + "all_samples.transcript_lengths.tsv:md5,f39a15fea56a5a8e5776dcdda0c8f102" + ] + ], + [ + [ + { + "id": "all_samples" + }, + "all_samples.SummarizedExperiment.rds:md5,504f040f8916a0cb0d462fa4991ec4ee" + ] + ], + [ + [ + { + "id": "all_samples" + }, + "all_samples.SummarizedExperiment.rds:md5,f3082e7eba40fa82d018d3d3b94b83b7" + ] + ], + [ + [ + { + "id": "all_samples" + }, + "all_samples.SummarizedExperiment.rds:md5,477703064bec63ece90942f25121bda2" + ] + ], + [ + [ + { + "id": "all_samples" + }, + "all_samples.transcript_counts.tsv:md5,f68224a34261b93f432ef4f97dfabe15" + ] + ], + [ + [ + { + "id": "all_samples" + }, + "all_samples.transcript_tpm.tsv:md5,e0c16bf083ebb88bcfaf27cfba12d3e9" + ] + ], + [ + [ + { + "id": "all_samples" + }, + "all_samples.SummarizedExperiment.rds:md5,8d52eafb09e5c901ed384c7e5403a0bc" + ] + ], + [ + "versions.yml:md5,4c3564e1ba17d8ce2b0ee784251ddd87", + "versions.yml:md5,b44caeec65491d47e098c7ddaf024b96", + "versions.yml:md5,dbf98ec672f75a683c28dcf4121364d2", + "versions.yml:md5,e9e7d18c3de83f1113fb1ff0c55d35ed" + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "24.02.0" + }, + "timestamp": "2024-03-12T10:31:15.969548" + } +} \ No newline at end of file diff --git a/subworkflows/local/quantify_pseudo_alignment/tests/nextflow.config b/subworkflows/local/quantify_pseudo_alignment/tests/nextflow.config new file mode 100644 index 000000000..701741690 --- /dev/null +++ b/subworkflows/local/quantify_pseudo_alignment/tests/nextflow.config @@ -0,0 +1,9 @@ +process { + withName: 'SALMON_INDEX' { + ext.args = { [ + params.gencode ? '--gencode' : '', + params.pseudo_aligner_kmer_size ? "-k ${params.pseudo_aligner_kmer_size}": '', + '--keepDuplicates' + ].join(' ').trim() } + } +} diff --git a/subworkflows/nf-core/fastq_subsample_fq_salmon/tests/nextflow.config b/subworkflows/nf-core/fastq_subsample_fq_salmon/tests/nextflow.config index 7fc4d632b..d20ca1d26 100644 --- a/subworkflows/nf-core/fastq_subsample_fq_salmon/tests/nextflow.config +++ b/subworkflows/nf-core/fastq_subsample_fq_salmon/tests/nextflow.config @@ -2,6 +2,7 @@ process { publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } + withName: FQ_SUBSAMPLE { ext.args = '--record-count 1000000 --seed 1' }