From 4a3d212289dcb604925c47210520c99399dc2b66 Mon Sep 17 00:00:00 2001 From: atrigila <18577080+atrigila@users.noreply.github.com> Date: Sun, 17 Nov 2024 21:41:15 +0000 Subject: [PATCH 1/6] always run tests --- .github/workflows/ci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f95ad981..00b0a0d2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -113,7 +113,6 @@ jobs: nf-test test \ --ci \ --tag ${{matrix.test_profile}} \ - --changed-since HEAD^ \ --profile "+${{ matrix.compute_profile }}" \ --junitxml=test.xml \ --debug From 44a73308223791f04f3b23fd62331286e010f79d Mon Sep 17 00:00:00 2001 From: atrigila <18577080+atrigila@users.noreply.github.com> Date: Sun, 17 Nov 2024 21:41:29 +0000 Subject: [PATCH 2/6] check if column exists --- assets/differentialabundance_report.Rmd | 40 ++++++++++++++----------- 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/assets/differentialabundance_report.Rmd b/assets/differentialabundance_report.Rmd index 240c3ffe..5e92e3c0 100644 --- a/assets/differentialabundance_report.Rmd +++ b/assets/differentialabundance_report.Rmd @@ -896,24 +896,28 @@ for (i in 1:nrow(contrasts)){ contrast_de <- round_dataframe_columns(contrast_de, digits=params$report_round_digits) print( htmltools::tagList(datatable(contrast_de, caption = paste('Differential genes', dir, 'in', contrast_descriptions[i], " (check", differential_files[[i]], "for more detail)"), rownames = FALSE) )) - # Plot Differentially Expressed Genes by Gene Biotype - gene_biotype_table <- contrast_de %>% - group_by(`Gene biotype`) %>% - summarise(count = dplyr::n(), .groups = 'drop') %>% - filter(count > 0) %>% - arrange(desc(count)) - - gene_biotype_plot <- ggplot(gene_biotype_table, aes(x = reorder(`Gene biotype`, -count), y = count)) + - geom_bar(stat = "identity", position = position_dodge()) + - labs( - title = paste0("Differentially Expressed Genes by Gene Biotype (", dir, ")"), - x = "Gene Biotype", - y = "Number of Differentially Expressed Genes" ) + - theme_minimal() + - theme(axis.text.x = element_text(angle = 45, hjust = 1)) - - print(gene_biotype_plot) - + # Check if Gene biotype column exists + if ("Gene biotype" %in% colnames(contrast_de)) { + # Plot Differentially Expressed Genes by Gene Biotype + gene_biotype_table <- contrast_de %>% + group_by(`Gene biotype`) %>% + summarise(count = dplyr::n(), .groups = 'drop') %>% + filter(count > 0) %>% + arrange(desc(count)) + + gene_biotype_plot <- ggplot(gene_biotype_table, aes(x = reorder(`Gene biotype`, -count), y = count)) + + geom_bar(stat = "identity", position = position_dodge()) + + labs( + title = paste0("Differentially Expressed Genes by Gene Biotype (", dir, ")"), + x = "Gene Biotype", + y = "Number of Differentially Expressed Genes" ) + + theme_minimal() + + theme(axis.text.x = element_text(angle = 45, hjust = 1)) + + print(gene_biotype_plot) + } else { + cat("Column 'Gene biotype' does not exist. Skipping plot.\n") + } }else{ cat(paste0("No significantly differential '", dir, "' genes.\n\n")) } From f59c538f508ef64586b1c7592e72bfb7be0ea9de Mon Sep 17 00:00:00 2001 From: atrigila <18577080+atrigila@users.noreply.github.com> Date: Sun, 17 Nov 2024 21:41:49 +0000 Subject: [PATCH 3/6] update tests with versions --- tests/.nftignore | 6 ++--- tests/test.nf.test | 2 ++ tests/test.nf.test.snap | 34 +++++++++++++++++++++++++++- tests/test_affy.nf.test | 8 +++---- tests/test_affy.nf.test.snap | 32 +++++++++++++++++++++++++- tests/test_maxquant.nf.test | 2 ++ tests/test_maxquant.nf.test.snap | 28 ++++++++++++++++++++++- tests/test_nogtf.nf.test | 2 ++ tests/test_nogtf.nf.test.snap | 22 +++++++++++++++++- tests/test_rnaseq_limma.nf.test | 2 ++ tests/test_rnaseq_limma.nf.test.snap | 34 +++++++++++++++++++++++++++- tests/test_soft.nf.test | 2 ++ tests/test_soft.nf.test.snap | 26 ++++++++++++++++++++- 13 files changed, 186 insertions(+), 14 deletions(-) diff --git a/tests/.nftignore b/tests/.nftignore index 21b57c58..cfb2b95c 100644 --- a/tests/.nftignore +++ b/tests/.nftignore @@ -11,7 +11,5 @@ report/*.html report/*.zip *html shinyngs_app/**/data.rds -report/gsea/phenotype_uninvolved_lesional/h.all.v2022.1.Hs.symbols/phenotype_uninvolved_lesional.h.all.v2022.1.Hs.symbols.HALLMARK_GLYCOLYSIS.html -report/gsea/phenotype_uninvolved_lesional/h.all.v2022.1.Hs.symbols/phenotype_uninvolved_lesional.h.all.v2022.1.Hs.symbols.HALLMARK_GLYCOLYSIS.tsv -report/gsea/phenotype_uninvolved_lesional/h.all.v2022.1.Hs.symbols/phenotype_uninvolved_lesional.h.all.v2022.1.Hs.symbols.HALLMARK_P53_PATHWAY.html -report/gsea/phenotype_uninvolved_lesional/h.all.v2022.1.Hs.symbols/phenotype_uninvolved_lesional.h.all.v2022.1.Hs.symbols.HALLMARK_P53_PATHWAY.tsv +report/gsea/phenotype_uninvolved_lesional/h.all.v2022.1.Hs.symbols/phenotype_uninvolved_lesional.h.all.v2022.1.Hs.symbols.HALLMARK_GLYCOLYSIS.{html,tsv} +report/gsea/phenotype_uninvolved_lesional/h.all.v2022.1.Hs.symbols/phenotype_uninvolved_lesional.h.all.v2022.1.Hs.symbols.HALLMARK_P53_PATHWAY.{html,tsv} diff --git a/tests/test.nf.test b/tests/test.nf.test index cbaf90eb..744dc9c5 100644 --- a/tests/test.nf.test +++ b/tests/test.nf.test @@ -24,6 +24,8 @@ nextflow_pipeline { { assert snapshot( // Number of successful tasks workflow.trace.succeeded().size(), + // pipeline versions.yml file for multiqc from which Nextflow version is removed because we tests pipelines on multiple Nextflow versions + removeNextflowVersion("$outputDir/pipeline_info/collated_versions.yml"), // All stable path name, with a relative path stable_name, // All files with stable contents diff --git a/tests/test.nf.test.snap b/tests/test.nf.test.snap index 829201f0..c270c2f6 100644 --- a/tests/test.nf.test.snap +++ b/tests/test.nf.test.snap @@ -2,6 +2,38 @@ "Test profile": { "content": [ 21, + { + "DESEQ2_DIFFERENTIAL": { + "r-base": "4.1.3", + "bioconductor-deseq2": "1.34.0" + }, + "GSEA_GSEA": { + "gsea": "4.3.2" + }, + "GTF_TO_TABLE": { + "atlas-gene-annotation-manipulation": "1.1.1" + }, + "GUNZIP_GTF": { + "gunzip": 1.1 + }, + "PLOT_DIFFERENTIAL": { + "r-base": "4.3.3", + "r-shinyngs": "2.0.0" + }, + "PLOT_EXPLORATORY": { + "r-shinyngs": "2.0.0" + }, + "TABULAR_TO_GSEA_CHIP": { + "bash": "4.2.25 3" + }, + "VALIDATOR": { + "r-base": "4.3.3", + "r-shinyngs": "2.0.0" + }, + "Workflow": { + "nf-core/differentialabundance": "v1.6.0dev" + } + }, [ "other", "other/deseq2", @@ -154,6 +186,6 @@ "nf-test": "0.9.0", "nextflow": "24.10.0" }, - "timestamp": "2024-11-08T14:00:03.015341477" + "timestamp": "2024-11-17T21:24:54.504828126" } } \ No newline at end of file diff --git a/tests/test_affy.nf.test b/tests/test_affy.nf.test index 9e8ac746..5fab9052 100644 --- a/tests/test_affy.nf.test +++ b/tests/test_affy.nf.test @@ -18,10 +18,8 @@ nextflow_pipeline { // stable_name: All files + folders in ${params.outdir}/ with a stable name def stable_name = getAllFilesFromDir(params.outdir, relative: true, includeDir: true, ignore: ['pipeline_info/*.{html,json,txt}', 'report/gsea/phenotype_uninvolved_lesional/**/*.png', - 'report/gsea/phenotype_uninvolved_lesional/h.all.v2022.1.Hs.symbols/phenotype_uninvolved_lesional.h.all.v2022.1.Hs.symbols.HALLMARK_GLYCOLYSIS.html', - 'report/gsea/phenotype_uninvolved_lesional/h.all.v2022.1.Hs.symbols/phenotype_uninvolved_lesional.h.all.v2022.1.Hs.symbols.HALLMARK_GLYCOLYSIS.tsv', - 'report/gsea/phenotype_uninvolved_lesional/h.all.v2022.1.Hs.symbols/phenotype_uninvolved_lesional.h.all.v2022.1.Hs.symbols.HALLMARK_P53_PATHWAY.html', - 'report/gsea/phenotype_uninvolved_lesional/h.all.v2022.1.Hs.symbols/phenotype_uninvolved_lesional.h.all.v2022.1.Hs.symbols.HALLMARK_P53_PATHWAY.tsv']) + 'report/gsea/phenotype_uninvolved_lesional/h.all.v2022.1.Hs.symbols/phenotype_uninvolved_lesional.h.all.v2022.1.Hs.symbols.HALLMARK_GLYCOLYSIS.{html,tsv}', + 'report/gsea/phenotype_uninvolved_lesional/h.all.v2022.1.Hs.symbols/phenotype_uninvolved_lesional.h.all.v2022.1.Hs.symbols.HALLMARK_P53_PATHWAY.{html,tsv}']) // stable_path: All files in ${params.outdir}/ with stable content def stable_path = getAllFilesFromDir(params.outdir, ignoreFile: 'tests/.nftignore') assertAll( @@ -29,6 +27,8 @@ nextflow_pipeline { { assert snapshot( // Number of successful tasks workflow.trace.succeeded().size(), + // pipeline versions.yml file for multiqc from which Nextflow version is removed because we tests pipelines on multiple Nextflow versions + removeNextflowVersion("$outputDir/pipeline_info/collated_versions.yml"), // All stable path name, with a relative path stable_name, // All files with stable contents diff --git a/tests/test_affy.nf.test.snap b/tests/test_affy.nf.test.snap index bfe2c0fc..0e0ffd60 100644 --- a/tests/test_affy.nf.test.snap +++ b/tests/test_affy.nf.test.snap @@ -2,6 +2,36 @@ "Test affy profile": { "content": [ 16, + { + "AFFY_JUSTRMA_RAW": { + "r-base": "4.3.1", + "bioconductor-affy": "1.78.0" + }, + "GSEA_GSEA": { + "gsea": "4.3.2" + }, + "LIMMA_DIFFERENTIAL": { + "r-base": "4.3.3", + "bioconductor-limma": "3.58.1" + }, + "PLOT_DIFFERENTIAL": { + "r-base": "4.3.3", + "r-shinyngs": "2.0.0" + }, + "PLOT_EXPLORATORY": { + "r-shinyngs": "2.0.0" + }, + "TABULAR_TO_GSEA_CHIP": { + "bash": "4.2.25 3" + }, + "VALIDATOR": { + "r-base": "4.3.3", + "r-shinyngs": "2.0.0" + }, + "Workflow": { + "nf-core/differentialabundance": "v1.6.0dev" + } + }, [ "other", "other/affy", @@ -210,6 +240,6 @@ "nf-test": "0.9.0", "nextflow": "24.10.0" }, - "timestamp": "2024-11-08T15:05:24.153458864" + "timestamp": "2024-11-17T21:29:47.480048632" } } \ No newline at end of file diff --git a/tests/test_maxquant.nf.test b/tests/test_maxquant.nf.test index 86447bee..a9c7cc7f 100644 --- a/tests/test_maxquant.nf.test +++ b/tests/test_maxquant.nf.test @@ -24,6 +24,8 @@ nextflow_pipeline { { assert snapshot( // Number of successful tasks workflow.trace.succeeded().size(), + // pipeline versions.yml file for multiqc from which Nextflow version is removed because we tests pipelines on multiple Nextflow versions + removeNextflowVersion("$outputDir/pipeline_info/collated_versions.yml"), // All stable path name, with a relative path stable_name, // All files with stable contents diff --git a/tests/test_maxquant.nf.test.snap b/tests/test_maxquant.nf.test.snap index 28acf7e4..3782d8e2 100644 --- a/tests/test_maxquant.nf.test.snap +++ b/tests/test_maxquant.nf.test.snap @@ -2,6 +2,32 @@ "Test maxquant profile": { "content": [ 20, + { + "LIMMA_DIFFERENTIAL": { + "r-base": "4.3.3", + "bioconductor-limma": "3.58.1" + }, + "PLOT_DIFFERENTIAL": { + "r-base": "4.3.3", + "r-shinyngs": "2.0.0" + }, + "PLOT_EXPLORATORY": { + "r-shinyngs": "2.0.0" + }, + "PROTEUS": { + "r-base": "4.2.1", + "r-proteus-bartongroup": "0.2.16", + "r-plotly": "4.10.2", + "bioconductor-limma": "3.54.0" + }, + "VALIDATOR": { + "r-base": "4.3.3", + "r-shinyngs": "2.0.0" + }, + "Workflow": { + "nf-core/differentialabundance": "v1.6.0dev" + } + }, [ "other", "other/limma", @@ -147,6 +173,6 @@ "nf-test": "0.9.0", "nextflow": "24.10.0" }, - "timestamp": "2024-11-07T16:57:00.079425408" + "timestamp": "2024-11-17T21:32:05.655955914" } } \ No newline at end of file diff --git a/tests/test_nogtf.nf.test b/tests/test_nogtf.nf.test index ea685265..263513d2 100644 --- a/tests/test_nogtf.nf.test +++ b/tests/test_nogtf.nf.test @@ -24,6 +24,8 @@ nextflow_pipeline { { assert snapshot( // Number of successful tasks workflow.trace.succeeded().size(), + // pipeline versions.yml file for multiqc from which Nextflow version is removed because we tests pipelines on multiple Nextflow versions + removeNextflowVersion("$outputDir/pipeline_info/collated_versions.yml"), // All stable path name, with a relative path stable_name, // All files with stable contents diff --git a/tests/test_nogtf.nf.test.snap b/tests/test_nogtf.nf.test.snap index c07ecb96..ec570320 100644 --- a/tests/test_nogtf.nf.test.snap +++ b/tests/test_nogtf.nf.test.snap @@ -2,6 +2,26 @@ "Test no gtf profile": { "content": [ 13, + { + "DESEQ2_DIFFERENTIAL": { + "r-base": "4.1.3", + "bioconductor-deseq2": "1.34.0" + }, + "PLOT_DIFFERENTIAL": { + "r-base": "4.3.3", + "r-shinyngs": "2.0.0" + }, + "PLOT_EXPLORATORY": { + "r-shinyngs": "2.0.0" + }, + "VALIDATOR": { + "r-base": "4.3.3", + "r-shinyngs": "2.0.0" + }, + "Workflow": { + "nf-core/differentialabundance": "v1.6.0dev" + } + }, [ "other", "other/deseq2", @@ -82,6 +102,6 @@ "nf-test": "0.9.0", "nextflow": "24.10.0" }, - "timestamp": "2024-11-08T14:08:09.370720729" + "timestamp": "2024-11-17T21:34:30.304565869" } } \ No newline at end of file diff --git a/tests/test_rnaseq_limma.nf.test b/tests/test_rnaseq_limma.nf.test index 276d82c4..5139b177 100644 --- a/tests/test_rnaseq_limma.nf.test +++ b/tests/test_rnaseq_limma.nf.test @@ -24,6 +24,8 @@ nextflow_pipeline { { assert snapshot( // Number of successful tasks workflow.trace.succeeded().size(), + // pipeline versions.yml file for multiqc from which Nextflow version is removed because we tests pipelines on multiple Nextflow versions + removeNextflowVersion("$outputDir/pipeline_info/collated_versions.yml"), // All stable path name, with a relative path stable_name, // All files with stable contents diff --git a/tests/test_rnaseq_limma.nf.test.snap b/tests/test_rnaseq_limma.nf.test.snap index 3da2acf4..d3195034 100644 --- a/tests/test_rnaseq_limma.nf.test.snap +++ b/tests/test_rnaseq_limma.nf.test.snap @@ -2,6 +2,38 @@ "Test rnaseq limma profile": { "content": [ 20, + { + "GSEA_GSEA": { + "gsea": "4.3.2" + }, + "GTF_TO_TABLE": { + "atlas-gene-annotation-manipulation": "1.1.1" + }, + "GUNZIP_GTF": { + "gunzip": 1.1 + }, + "LIMMA_DIFFERENTIAL": { + "r-base": "4.3.3", + "bioconductor-limma": "3.58.1" + }, + "PLOT_DIFFERENTIAL": { + "r-base": "4.3.3", + "r-shinyngs": "2.0.0" + }, + "PLOT_EXPLORATORY": { + "r-shinyngs": "2.0.0" + }, + "TABULAR_TO_GSEA_CHIP": { + "bash": "4.2.25 3" + }, + "VALIDATOR": { + "r-base": "4.3.3", + "r-shinyngs": "2.0.0" + }, + "Workflow": { + "nf-core/differentialabundance": "v1.6.0dev" + } + }, [ "other", "other/limma", @@ -145,6 +177,6 @@ "nf-test": "0.9.0", "nextflow": "24.10.0" }, - "timestamp": "2024-11-08T13:12:28.480773381" + "timestamp": "2024-11-17T21:37:45.162699026" } } \ No newline at end of file diff --git a/tests/test_soft.nf.test b/tests/test_soft.nf.test index 92ed8af5..0d8b6605 100644 --- a/tests/test_soft.nf.test +++ b/tests/test_soft.nf.test @@ -24,6 +24,8 @@ nextflow_pipeline { { assert snapshot( // Number of successful tasks workflow.trace.succeeded().size(), + // pipeline versions.yml file for multiqc from which Nextflow version is removed because we tests pipelines on multiple Nextflow versions + removeNextflowVersion("$outputDir/pipeline_info/collated_versions.yml"), // All stable path name, with a relative path stable_name, // All files with stable contents diff --git a/tests/test_soft.nf.test.snap b/tests/test_soft.nf.test.snap index f4db77b6..4f279620 100644 --- a/tests/test_soft.nf.test.snap +++ b/tests/test_soft.nf.test.snap @@ -2,6 +2,30 @@ "Test soft profile": { "content": [ 10, + { + "GEOQUERY_GETGEO": { + "r-base": "4.2.1", + "bioconductor-geoquery": "2.66.0" + }, + "LIMMA_DIFFERENTIAL": { + "r-base": "4.3.3", + "bioconductor-limma": "3.58.1" + }, + "PLOT_DIFFERENTIAL": { + "r-base": "4.3.3", + "r-shinyngs": "2.0.0" + }, + "PLOT_EXPLORATORY": { + "r-shinyngs": "2.0.0" + }, + "VALIDATOR": { + "r-base": "4.3.3", + "r-shinyngs": "2.0.0" + }, + "Workflow": { + "nf-core/differentialabundance": "v1.6.0dev" + } + }, [ "other", "other/affy", @@ -70,6 +94,6 @@ "nf-test": "0.9.0", "nextflow": "24.10.0" }, - "timestamp": "2024-11-08T14:12:26.809162392" + "timestamp": "2024-11-17T21:40:28.282036327" } } \ No newline at end of file From 1a3bbc7e01afbaae6702b5d237127b5076b96fec Mon Sep 17 00:00:00 2001 From: atrigila <18577080+atrigila@users.noreply.github.com> Date: Sun, 17 Nov 2024 21:45:49 +0000 Subject: [PATCH 4/6] update changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6bbc2f5c..f10a7aa1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,12 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added +- [[#358](https://github.com/nf-core/differentialabundance/pull/358)] - Added software version check in nf-tests and gene biotype column check in `.Rmd` ([@atrigila](https://github.com/atrigila), review by [@pinin4fjords](https://github.com/pinin4fjords)) - [[#345](https://github.com/nf-core/differentialabundance/pull/345)] - Plot differentially expressed genes by gene biotype ([@atrigila](https://github.com/atrigila), review by [@grst](https://github.com/grst)) - [[#343](https://github.com/nf-core/differentialabundance/pull/343)] - Add pipeline-level nf-tests ([@atrigila](https://github.com/atrigila), review by [@pinin4fjords](https://github.com/pinin4fjords) and [@nschcolnicov](https://github.com/nschcolnicov)) - [[#286](https://github.com/nf-core/differentialabundance/pull/286)] - Integration of limma voom for rnaseq data ([@KamilMaliszArdigen](https://github.com/KamilMaliszArdigen), review by [@pinin4fjords](https://github.com/pinin4fjords)) ### Fixed +- [[#358](https://github.com/nf-core/differentialabundance/pull/358)] - Fixed nf-tests not running due to `--changed-since HEAD^`([@atrigila](https://github.com/atrigila), review by [@pinin4fjords](https://github.com/pinin4fjords)) - [[#344](https://github.com/nf-core/differentialabundance/pull/344)] - Fixed replacement of NA sub-strings ([@atrigila](https://github.com/atrigila), suggested by [@BEFH](https://github.com/BEFH), review by [@apeltzer](https://github.com/apeltzer) and [@nschcolnicov](https://github.com/nschcolnicov)) - [[#342](https://github.com/nf-core/differentialabundance/pull/342)] - Fixed incorrectly colored dots in report volcano plots for logFC thresholds <1 ([@WackerO](https://github.com/WackerO), review by [@pinin4fjords](https://github.com/pinin4fjords)) From 52f817e9e11721dd1d8cd903cd4f9cdd3a3232bb Mon Sep 17 00:00:00 2001 From: atrigila <18577080+atrigila@users.noreply.github.com> Date: Tue, 19 Nov 2024 12:17:29 +0000 Subject: [PATCH 5/6] adjust indent --- assets/differentialabundance_report.Rmd | 43 ++++++++++++------------- 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/assets/differentialabundance_report.Rmd b/assets/differentialabundance_report.Rmd index 5e92e3c0..3ae5d8be 100644 --- a/assets/differentialabundance_report.Rmd +++ b/assets/differentialabundance_report.Rmd @@ -896,28 +896,27 @@ for (i in 1:nrow(contrasts)){ contrast_de <- round_dataframe_columns(contrast_de, digits=params$report_round_digits) print( htmltools::tagList(datatable(contrast_de, caption = paste('Differential genes', dir, 'in', contrast_descriptions[i], " (check", differential_files[[i]], "for more detail)"), rownames = FALSE) )) - # Check if Gene biotype column exists - if ("Gene biotype" %in% colnames(contrast_de)) { - # Plot Differentially Expressed Genes by Gene Biotype - gene_biotype_table <- contrast_de %>% - group_by(`Gene biotype`) %>% - summarise(count = dplyr::n(), .groups = 'drop') %>% - filter(count > 0) %>% - arrange(desc(count)) - - gene_biotype_plot <- ggplot(gene_biotype_table, aes(x = reorder(`Gene biotype`, -count), y = count)) + - geom_bar(stat = "identity", position = position_dodge()) + - labs( - title = paste0("Differentially Expressed Genes by Gene Biotype (", dir, ")"), - x = "Gene Biotype", - y = "Number of Differentially Expressed Genes" ) + - theme_minimal() + - theme(axis.text.x = element_text(angle = 45, hjust = 1)) - - print(gene_biotype_plot) - } else { - cat("Column 'Gene biotype' does not exist. Skipping plot.\n") - } + if ("Gene biotype" %in% colnames(contrast_de)) { + # Plot Differentially Expressed Genes by Gene Biotype + gene_biotype_table <- contrast_de %>% + group_by(`Gene biotype`) %>% + summarise(count = dplyr::n(), .groups = 'drop') %>% + filter(count > 0) %>% + arrange(desc(count)) + + gene_biotype_plot <- ggplot(gene_biotype_table, aes(x = reorder(`Gene biotype`, -count), y = count)) + + geom_bar(stat = "identity", position = position_dodge()) + + labs( + title = paste0("Differentially Expressed Genes by Gene Biotype (", dir, ")"), + x = "Gene Biotype", + y = "Number of Differentially Expressed Genes" ) + + theme_minimal() + + theme(axis.text.x = element_text(angle = 45, hjust = 1)) + + print(gene_biotype_plot) + } else { + cat("Column 'Gene biotype' does not exist. Skipping plot.\n") + } }else{ cat(paste0("No significantly differential '", dir, "' genes.\n\n")) } From be5172592f43d6df18b050ee1b745314cb13188d Mon Sep 17 00:00:00 2001 From: atrigila <18577080+atrigila@users.noreply.github.com> Date: Tue, 19 Nov 2024 16:29:17 +0000 Subject: [PATCH 6/6] re-indent --- assets/differentialabundance_report.Rmd | 34 ++++++++++++------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/assets/differentialabundance_report.Rmd b/assets/differentialabundance_report.Rmd index 3ae5d8be..6f79348d 100644 --- a/assets/differentialabundance_report.Rmd +++ b/assets/differentialabundance_report.Rmd @@ -897,23 +897,23 @@ for (i in 1:nrow(contrasts)){ print( htmltools::tagList(datatable(contrast_de, caption = paste('Differential genes', dir, 'in', contrast_descriptions[i], " (check", differential_files[[i]], "for more detail)"), rownames = FALSE) )) if ("Gene biotype" %in% colnames(contrast_de)) { - # Plot Differentially Expressed Genes by Gene Biotype - gene_biotype_table <- contrast_de %>% - group_by(`Gene biotype`) %>% - summarise(count = dplyr::n(), .groups = 'drop') %>% - filter(count > 0) %>% - arrange(desc(count)) - - gene_biotype_plot <- ggplot(gene_biotype_table, aes(x = reorder(`Gene biotype`, -count), y = count)) + - geom_bar(stat = "identity", position = position_dodge()) + - labs( - title = paste0("Differentially Expressed Genes by Gene Biotype (", dir, ")"), - x = "Gene Biotype", - y = "Number of Differentially Expressed Genes" ) + - theme_minimal() + - theme(axis.text.x = element_text(angle = 45, hjust = 1)) - - print(gene_biotype_plot) + # Plot Differentially Expressed Genes by Gene Biotype + gene_biotype_table <- contrast_de %>% + group_by(`Gene biotype`) %>% + summarise(count = dplyr::n(), .groups = 'drop') %>% + filter(count > 0) %>% + arrange(desc(count)) + + gene_biotype_plot <- ggplot(gene_biotype_table, aes(x = reorder(`Gene biotype`, -count), y = count)) + + geom_bar(stat = "identity", position = position_dodge()) + + labs( + title = paste0("Differentially Expressed Genes by Gene Biotype (", dir, ")"), + x = "Gene Biotype", + y = "Number of Differentially Expressed Genes" ) + + theme_minimal() + + theme(axis.text.x = element_text(angle = 45, hjust = 1)) + + print(gene_biotype_plot) } else { cat("Column 'Gene biotype' does not exist. Skipping plot.\n") }