diff --git a/CHANGELOG.md b/CHANGELOG.md index 91deffb6..8c27546e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,9 +12,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - [[#369]](https://github.com/nf-core/smrnaseq/issues/369) - Fix [Linting](https://github.com/nf-core/smrnaseq/pull/377) - Fixed linting warnings and updated modules & subworkflows. - [[#374]](https://github.com/nf-core/smrnaseq/pull/374) - Fix [default tests](https://github.com/nf-core/smrnaseq/issues/375) so that they do not require additional profiles in CI. Change GitHub CI fail-fast strategy to false. - [[#371]](https://github.com/nf-core/smrnaseq/issues/371) - Fix [Plain test profile](https://github.com/nf-core/smrnaseq/pull/372) - Updated default protocol value to "custom". -- [[#187]](https://github.com/nf-core/smrnaseq/issues/187) - Fix checking number of samples which causes error in plotMDS. +- [[#380]](https://github.com/nf-core/smrnaseq/pull/380) - Fix checking number of samples which causes error in plotMDS. Add nf-tests for local modules using custom R scripts: [edgeR_mirBase.R](https://github.com/nf-core/smrnaseq/issues/187). - [[#378]](https://github.com/nf-core/smrnaseq/pull/378) - Fix [`--mirtrace_species` bug](<(https://github.com/nf-core/smrnaseq/issues/348)>). Make `MIRTRACE` process conditional. Add mirgenedb test. - [[#375]](https://github.com/nf-core/smrnaseq/pull/375) - Test merging of [technical repeats](https://github.com/nf-core/smrnaseq/issues/212). +- [[#382]](https://github.com/nf-core/smrnaseq/pull/382) - Add nf-tests for local modules using custom R scripts: [collapse_mirtop.R](https://github.com/nf-core/smrnaseq/issues/174). ## v2.3.1 - 2024-04-18 - Gray Zinc Dalmation Patch diff --git a/modules/local/datatable_merge.nf b/modules/local/datatable_merge/datatable_merge.nf similarity index 100% rename from modules/local/datatable_merge.nf rename to modules/local/datatable_merge/datatable_merge.nf diff --git a/modules/local/datatable_merge/tests/datatable_merge.nf.test b/modules/local/datatable_merge/tests/datatable_merge.nf.test new file mode 100644 index 00000000..78ed4491 --- /dev/null +++ b/modules/local/datatable_merge/tests/datatable_merge.nf.test @@ -0,0 +1,71 @@ +nextflow_process { + + name "Test Process TABLE_MERGE" + script "../datatable_merge.nf" + process "TABLE_MERGE" + tag "modules" + tag "modules_local" + tag "table_merge" + + test("Contains hsa-miR-365b-3p, hsa-miR-7-5p, hsa-miR-103a-3p") { + + when { + params { + outdir = "${outputDir}" + } + process { + """ + input[0] = [file("https://github.com/nf-core/test-datasets/raw/smrnaseq/nf-test_data/datatable_merge/small_mirtop_dataset.txt", checkIfExists: true)] + """ + } + } + + then { + assert process.success + assert snapshot(process.out).match() + + with(process.out.mirna_tsv) { + with(get(0)) { + assert get(0).endsWith(".tsv") + + // Check for specific miRNAs + def lines = path(get(0)).readLines() + assert lines.any { it.contains("hsa-miR-365b-3p") } + assert lines.any { it.contains("hsa-miR-7-5p") } + assert lines.any { it.contains("hsa-miR-103a-3p") } + } + } + } + } + + test("Does not contain hsa-miR-107, hsa-miR-365a-3p") { + + when { + params { + outdir = "${outputDir}" + } + process { + """ + input[0] = [file("https://github.com/nf-core/test-datasets/raw/smrnaseq/nf-test_data/datatable_merge/small_mirtop_dataset.txt", checkIfExists: true)] + """ + } + } + + then { + assert process.success + assert snapshot(process.out).match() + + with(process.out.mirna_tsv) { + with(get(0)) { + assert get(0).endsWith(".tsv") + + // Check for the absence of specific miRNAs + def lines = path(get(0)).readLines() + assert !lines.any { it.contains("hsa-miR-107") } + assert !lines.any { it.contains("hsa-miR-365a-3p") } + } + } + } + } + +} diff --git a/modules/local/datatable_merge/tests/datatable_merge.nf.test.snap b/modules/local/datatable_merge/tests/datatable_merge.nf.test.snap new file mode 100644 index 00000000..dc37576f --- /dev/null +++ b/modules/local/datatable_merge/tests/datatable_merge.nf.test.snap @@ -0,0 +1,48 @@ +{ + "Contains hsa-miR-365b-3p, hsa-miR-7-5p, hsa-miR-103a-3p": { + "content": [ + { + "0": [ + "mirna.tsv:md5,f59a6aeb15588c43c2977950a1b0a080" + ], + "1": [ + "versions.yml:md5,3a8ba7faff9d6dadf80e1a1b026acbe1" + ], + "mirna_tsv": [ + "mirna.tsv:md5,f59a6aeb15588c43c2977950a1b0a080" + ], + "versions": [ + "versions.yml:md5,3a8ba7faff9d6dadf80e1a1b026acbe1" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "24.04.4" + }, + "timestamp": "2024-08-21T14:27:11.151441241" + }, + "Does not contain hsa-miR-107, hsa-miR-365a-3p": { + "content": [ + { + "0": [ + "mirna.tsv:md5,f59a6aeb15588c43c2977950a1b0a080" + ], + "1": [ + "versions.yml:md5,3a8ba7faff9d6dadf80e1a1b026acbe1" + ], + "mirna_tsv": [ + "mirna.tsv:md5,f59a6aeb15588c43c2977950a1b0a080" + ], + "versions": [ + "versions.yml:md5,3a8ba7faff9d6dadf80e1a1b026acbe1" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "24.04.4" + }, + "timestamp": "2024-08-21T14:27:39.584509005" + } +} \ No newline at end of file diff --git a/subworkflows/local/mirna_quant.nf b/subworkflows/local/mirna_quant.nf index 98002274..79a9f1e6 100644 --- a/subworkflows/local/mirna_quant.nf +++ b/subworkflows/local/mirna_quant.nf @@ -20,7 +20,7 @@ include { BAM_SORT_STATS_SAMTOOLS as BAM_STATS_MATURE include { SEQCLUSTER_SEQUENCES } from '../../modules/local/seqcluster_collapse.nf' include { MIRTOP_QUANT } from '../../modules/local/mirtop_quant.nf' -include { TABLE_MERGE } from '../../modules/local/datatable_merge.nf' +include { TABLE_MERGE } from '../../modules/local/datatable_merge/datatable_merge.nf' include { EDGER_QC } from '../../modules/local/edger_qc/edger_qc.nf' workflow MIRNA_QUANT {