Skip to content

Commit

Permalink
Merge pull request #253 from WackerO/enrich_qval
Browse files Browse the repository at this point in the history
Added separate param for setting adjusted pval threshold for pathway analysis
  • Loading branch information
WackerO authored Dec 2, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
2 parents d904f4b + f6e4db0 commit 8a3e561
Showing 8 changed files with 26 additions and 25 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -20,6 +20,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

- [#253](https://github.com/qbic-pipelines/rnadeseq/pull/253) Added separate param for adjusted p-value threshold for gprofiler
- [#245](https://github.com/qbic-pipelines/rnadeseq/pull/245) Added background gene list to pathway analysis output

### Changed
19 changes: 11 additions & 8 deletions assets/RNAseq_report.Rmd
Original file line number Diff line number Diff line change
@@ -46,6 +46,7 @@ params:
datasources: ''
heatmaps_cluster_rows: ''
heatmaps_cluster_cols: ''
pathway_adj_pval_threshold: ''

#Additional args for the report
path_proj_summary: ''
@@ -2058,6 +2059,8 @@ if (!isProvided(params$datasources)) {
# ------------------
# Set default params
# ------------------
pathway_adj_pval_threshold <- ifelse(params$pathway_adj_pval_threshold == -1, params$adj_pval_threshold, params$pathway_adj_pval_threshold)
pathway_pval_text <- format(pathway_adj_pval_threshold, scientific=F)
# Set theme for graphs
theme_set(theme_classic())
@@ -2096,7 +2099,7 @@ for (file in contrast_files){
correction_method="fdr",
sources=datasources,
evcodes=TRUE,
user_threshold=params$adj_pval_threshold,
user_threshold=pathway_adj_pval_threshold,
custom_bg=custom_background,
domain_scope="custom_annotated"
)
@@ -2112,7 +2115,7 @@ for (file in contrast_files){
correction_method="fdr",
sources=datasources,
evcodes=TRUE,
user_threshold=params$adj_pval_threshold,
user_threshold=pathway_adj_pval_threshold,
domain_scope="annotated"
)
pathway_gostres_nobg <- gostres_nobg$result
@@ -2126,7 +2129,7 @@ for (file in contrast_files){
correction_method="fdr",
sources=datasources,
evcodes=TRUE,
user_threshold=params$adj_pval_threshold,
user_threshold=pathway_adj_pval_threshold,
domain_scope="annotated"
)
}
@@ -2413,7 +2416,7 @@ gost_text,
"\n
## Enriched pathways
The plot below summarizes the pathways that were found significantly enriched in DE genes for each contrast (padj value <= ", pval_text, ").
The plot below summarizes the pathways that were found significantly enriched in DE genes for each contrast (padj value <= ", pathway_pval_text, ").
Only contrasts for which an enriched pathway was found are shown.
Hover over the dots to reveal the pathway names. The table below provides more detail on all enriched pathways."))
```
@@ -2449,7 +2452,7 @@ if (length(q_list) > 0) {
significant=T,
correction_method="fdr",
sources=datasources,
user_threshold=params$adj_pval_threshold,
user_threshold=pathway_adj_pval_threshold,
custom_bg=custom_background,
domain_scope="custom_annotated"
)
@@ -2459,7 +2462,7 @@ if (length(q_list) > 0) {
significant=T,
correction_method="fdr",
sources=datasources,
user_threshold=params$adj_pval_threshold,
user_threshold=pathway_adj_pval_threshold,
domain_scope="annotated"
)
}
@@ -2472,7 +2475,7 @@ if (length(q_list) > 0) {
if (nrow(path_enrich) > 0){
pg2 <- gostplot(gostres, capped=T, interactive=T)
pg2[['x']][['layout']][['annotations']][[1]][['x']] <- -params$adj_pval_threshold
pg2[['x']][['layout']][['annotations']][[1]][['x']] <- -pathway_adj_pval_threshold
# limit gostplot y maximum dynamically for all subplots
for (counter in c(1:length(contrast_files))) {
@@ -2693,7 +2696,7 @@ For pathway analysis, the R packages `gprofiler2 v", version_gprofiler2,
" `, `AnnotationDbi v", version_annotation,
"` and `", name_species, " v", version_annotation,
"` were used. ", database_string, ".\n",
"Pathways were classified as enriched for those genes with an adjusted p-value <= ", pval_text, "."
"Pathways were classified as enriched for those genes with an adjusted p-value <= ", pathway_pval_text, "."
))
```

2 changes: 2 additions & 0 deletions bin/Execute_report.R
Original file line number Diff line number Diff line change
@@ -37,6 +37,7 @@ option_list = list(
make_option("--datasources", type="character", default=NULL, help="Which datasources to use for pathway analysis.", metavar="character"),
make_option("--heatmaps_cluster_rows", action="store_true", default=FALSE, help="Whether to activate row clustering when generating heatmaps of gene expression in enriched pathways."),
make_option("--heatmaps_cluster_cols", action="store_true", default=FALSE, help="Whether to activate column clustering when generating heatmaps of gene expression in enriched pathways."),
make_option("--pathway_adj_pval_threshold", type="double", default=-1, help="Which adjusted p value threshold to use for pathway analysis."),

make_option(c("-s", "--proj_summary"), type="character", default=NULL, help="Project summary file", metavar="character"),
make_option(c("--path_quote"), type="character", default=NULL, help="Path to the quote PDF", metavar="character"),
@@ -89,6 +90,7 @@ rmarkdown::render(opt$report, output_file = opt$output, knit_root_dir = wd, outp
datasources = opt$datasources,
heatmaps_cluster_rows = opt$heatmaps_cluster_rows,
heatmaps_cluster_cols = opt$heatmaps_cluster_cols,
pathway_adj_pval_threshold = opt$pathway_adj_pval_threshold,

path_proj_summary = opt$proj_summary,
path_quote = opt$path_quote,
1 change: 1 addition & 0 deletions conf/test.config
Original file line number Diff line number Diff line change
@@ -28,6 +28,7 @@ params {
software_versions = 'https://raw.githubusercontent.com/qbic-pipelines/rnadeseq/dev/testdata/software_versions.csv'
multiqc = 'https://raw.githubusercontent.com/qbic-pipelines/rnadeseq/dev/testdata/MultiQC.zip'
run_pathway_analysis = true
pathway_adj_pval_threshold = 0.0004
datasources = 'KEGG,REAC'
genome = 'GRCm38'
quote = 'https://raw.githubusercontent.com/qbic-pipelines/rnadeseq/dev/testdata/offer_example.pdf'
2 changes: 2 additions & 0 deletions modules/local/report.nf
Original file line number Diff line number Diff line change
@@ -44,6 +44,7 @@ process REPORT {
def datasources_opt = params.datasources ? "--datasources $params.datasources" : ''
def heatmaps_cluster_rows_opt = params.heatmaps_cluster_rows ? "--heatmaps_cluster_rows TRUE" : ''
def heatmaps_cluster_cols_opt = params.heatmaps_cluster_cols ? "--heatmaps_cluster_cols TRUE" : ''
def pathway_adj_pval_threshold_opt = params.pathway_adj_pval_threshold == -1 ? "--pathway_adj_pval_threshold $params.adj_pval_threshold" : "--pathway_adj_pval_threshold $params.pathway_adj_pval_threshold"


def quote_opt = params.quote != 'NO_FILE5' ? "--path_quote $params.quote" : ''
@@ -87,6 +88,7 @@ process REPORT {
$datasources_opt \
$heatmaps_cluster_rows_opt \
$heatmaps_cluster_cols_opt \
$pathway_adj_pval_threshold_opt \
$quote_opt \
$software_versions_opt \
--proj_summary $proj_summary \
1 change: 1 addition & 0 deletions nextflow.config
Original file line number Diff line number Diff line change
@@ -42,6 +42,7 @@ params {
datasources = null
heatmaps_cluster_rows = true
heatmaps_cluster_cols = false
pathway_adj_pval_threshold = -1

// Additional args for the report
project_summary = null
5 changes: 5 additions & 0 deletions nextflow_schema.json
Original file line number Diff line number Diff line change
@@ -156,6 +156,11 @@
"type": "boolean",
"default": false,
"description": "Whether to activate column clustering when generating heatmaps of gene expression in enriched pathways."
},
"pathway_adj_pval_threshold": {
"type": "number",
"default": -1,
"description": "Adjusted p value (float) to use as threshold for pathway analysis. If omitted, will use the value of the parameter adj_pval_threshold (default 0.05)."
}
}
},
20 changes: 3 additions & 17 deletions tests/test.yml
Original file line number Diff line number Diff line change
@@ -68,28 +68,14 @@
- path: results_test/pathway_analysis/DE_contrast_condition_genotype_WT_vs_KO/gost_pathway_gostplot.png
- path: results_test/pathway_analysis/DE_contrast_condition_genotype_WT_vs_KO/gost_pathway_gostplot.svg
- path: results_test/pathway_analysis/DE_contrast_condition_genotype_WT_vs_KO/pathway_enrichment_results.tsv
md5sum: 92736a4c802ebd4e644682308ecf46dc
md5sum: f0832e1cbdd4cfb4af84740d82a877a3
- path: results_test/pathway_analysis/DE_contrast_condition_genotype_WT_vs_KO/KEGG_pathway_enrichment_results.tsv
md5sum: 92115e662e0e2489ad05d28f3981fa3a
- path: results_test/pathway_analysis/DE_contrast_condition_genotype_WT_vs_KO/REAC_pathway_enrichment_results.tsv
md5sum: 9077c63139668fd01d3f4086e6acb7bc
md5sum: 29b3ba7ab3ebf9eacc7a021a9b67cdc1
- path: results_test/pathway_analysis/DE_contrast_condition_genotype_WT_vs_KO/enrichment_plots/KEGG_pathway_enrichment_plot.pdf
- path: results_test/pathway_analysis/DE_contrast_condition_genotype_WT_vs_KO/enrichment_plots/KEGG_pathway_enrichment_plot.png
- path: results_test/pathway_analysis/DE_contrast_condition_genotype_WT_vs_KO/enrichment_plots/REAC_pathway_enrichment_plot.pdf
- path: results_test/pathway_analysis/DE_contrast_condition_genotype_WT_vs_KO/enrichment_plots/REAC_pathway_enrichment_plot.png
- path: results_test/pathway_analysis/DE_contrast_condition_genotype_WT_vs_KO/KEGG_pathways/mmu04360.DE_contrast_condition_genotype_WT_vs_KO.png
- path: results_test/pathway_analysis/DE_contrast_condition_genotype_WT_vs_KO/KEGG_pathways/mmu04360.png
- path: results_test/pathway_analysis/DE_contrast_condition_genotype_WT_vs_KO/KEGG_pathways/mmu04360.xml
- path: results_test/pathway_analysis/DE_contrast_condition_genotype_WT_vs_KO/KEGG_pathways/mmu04610.DE_contrast_condition_genotype_WT_vs_KO.png
- path: results_test/pathway_analysis/DE_contrast_condition_genotype_WT_vs_KO/KEGG_pathways/mmu04610.png
- path: results_test/pathway_analysis/DE_contrast_condition_genotype_WT_vs_KO/KEGG_pathways/mmu04610.xml
- path: results_test/pathway_analysis/DE_contrast_condition_treatment_Treated_vs_Control/pathway_enrichment_results.tsv
md5sum: 0a425c10e229bb775597be176c414705
- path: results_test/pathway_analysis/DE_contrast_condition_treatment_Treated_vs_Control/REAC_pathway_enrichment_results.tsv
md5sum: 6594fdb8c0eb591fa131982a8be00877
- path: results_test/pathway_analysis/DE_contrast_condition_treatment_Treated_vs_Control/gost_pathway_venn_diagram.pdf
- path: results_test/pathway_analysis/DE_contrast_condition_treatment_Treated_vs_Control/gost_pathway_venn_diagram.png
- path: results_test/pathway_analysis/DE_contrast_condition_treatment_Treated_vs_Control/gost_pathway_venn_diagram.svg
- path: results_test/pathway_analysis/DE_contrast_condition_treatment_Treated_vs_Control/enrichment_plots/REAC_pathway_enrichment_plot.pdf
- path: results_test/pathway_analysis/DE_contrast_condition_treatment_Treated_vs_Control/enrichment_plots/REAC_pathway_enrichment_plot.png
md5sum: 68b329da9893e34099c7d8ad5cb9c940
- path: results_test/RNAseq_report.html

0 comments on commit 8a3e561

Please sign in to comment.