Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Output notebook #167

Merged
merged 8 commits into from
Oct 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- [[#137](https://github.com/nf-core/differentialabundance/pull/137)] - Add `--sizefactors_from_controls` and `--gene_id_col` for DESeq2 module to modules.config ([@WackerO](https://github.com/WackerO), review by [@pinin4fjords](https://github.com/pinin4fjords))
- [[#145](https://github.com/nf-core/differentialabundance/pull/145)] - Template update for nf-core/tools v2.9 ([@nf-core-bot](https://github.com/nf-core-bot), review by [@pinin4fjords](https://github.com/pinin4fjords), [@WackerO](https://github.com/WackerO))
- [[#147](https://github.com/nf-core/differentialabundance/pull/147)] - Add Maxquant analysis module ([@WackerO](https://github.com/WackerO), review by [@pinin4fjords](https://github.com/pinin4fjords))
- [[#166](https://github.com/nf-core/differentialabundance/issues/166)] - Output a parameter-resolved R Markdown document, as well as rendered HTML ([@pinin4fjords](https://github.com/pinin4fjords), review by )

### `Fixed`

Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,13 @@ For more details and further functionality, please refer to the [usage documenta

The pipeline reports its outcomes in two forms.

#### Markdown-derived HTML report
#### R markdown and HTML

The primary workflow output is an HTML-format report produced from an [R markdown template](assets/differentialabundance_report.Rmd) (you can also supply your own). This leverages helper functions from [shinyngs](https://github.com/pinin4fjords/shinyngs) to produce rich plots and tables, but does not provide significant interactivity.

![screenshot of the markdown report](docs/images/markdown_report.png "Markdown report")

The primary workflow output is an HTML-format report produced from an [R markdown template](assets/differentialabundance_report.Rmd). This leverages helper functions from [shinyngs](https://github.com/pinin4fjords/shinyngs) to produce rich plots and tables, but does not provide significant interactivity.
Additionally, a zip file is produced by the pipeline, containing an R markdown file and all necessary file inputs for reporting. The markdown file is the same as the input template, but with the parameters set appropriately, so that you can run the reporting yourself in RStudio, and add any customisations you need.

#### Shiny-based data mining app

Expand Down
8 changes: 8 additions & 0 deletions conf/modules.config
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,14 @@ process {
]
}

withName: MAKE_REPORT_BUNDLE {
publishDir = [
path: { "${params.outdir}/report" },
mode: params.publish_dir_mode,
pattern: '*.zip'
]
}

withName: CUSTOM_MATRIXFILTER {
publishDir = [
enabled: false
Expand Down
1 change: 1 addition & 0 deletions docs/output.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ This directory contains the main reporting output of the workflow.

- `report/`
- `*.html`: an HTML report file named according to the value of `params.study_name`, containing graphical and tabular summary results for the workflow run.
- `*.zip`: a zip file containing an R markdown file with parameters set and all necessary input files to open and customise the reporting.

</details>

Expand Down
29 changes: 29 additions & 0 deletions docs/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,35 @@ To override the above options, you may also supply your own features table as a

By default, if you don't provide features, for non-array data the workflow will fall back to attempting to use the matrix itself as a source of feature annotations. For this to work you must make sure to set the `features_id_col`, `features_name_col` and `features_metadata_cols` parameters to the appropriate values, for example by setting them to 'gene_id' if that is the identifier column on the matrix. This will cause the gene ID to be used everywhere rather than more accessible gene symbols (as can be derived from the GTF), but the workflow should run. Please use this option for MaxQuant analysis, i.e. do not provide features.

## Working with the output R markdown file

The pipeline produces an R markdown file which, if you're proficient in R, you can use to tweak the report after it's generated (**note**- if you need the same customisations repeatedly we would recommend you supply your own template using the `report_file` parameter).

To work with R markdown files you will need Rstudio. You will also need to have the ShinyNGS R module [installed](https://github.com/pinin4fjords/shinyngs#installation), since it supplies a lot of the accessory plotting functions etc that you will need. The exact way you will do this may depend on your exact systems, but for example

### 1. Create a conda environment with Shinyngs and activate it

```bash
conda create -n shinyngs r-shinyngs
conda activate shinyngs
```

### 2. Open RStudio from this environment

For example, on a Mac Terminal:

```bash
open -na Rstudio
```

Now, unzip the report archive, and in RStudio change directory to that location:

```
setwd("/path/to/unzipped/directory")
```

Now open the R Markdown file from the RStudio UI, and you should have everything you need to run the various code segments and render the whole document to HTML again if you wish.

## Shiny app generation

The pipeline is capable of building, and even deploying (to [shinyapps.io](https://www.shinyapps.io/)) for you a Shiny app built with [ShinyNGS](https://github.com/pinin4fjords/shinyngs). There is a basic example running [here](https://pinin4fjords.shinyapps.io/tester/) which shows what this might look like.
Expand Down
7 changes: 6 additions & 1 deletion modules.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
},
"rmarkdownnotebook": {
"branch": "master",
"git_sha": "603ecbd9f45300c9788f197d2a15a005685b4220",
"git_sha": "4e640839b1076da7c2a2a4a8f160815e00eedfba",
"installed_by": ["modules"]
},
"shinyngs/app": {
Expand All @@ -94,6 +94,11 @@
"branch": "master",
"git_sha": "d0b4fc03af52a1cc8c6fb4493b921b57352b1dd8",
"installed_by": ["modules"]
},
"zip": {
"branch": "master",
"git_sha": "9ba4f5972ae27474f752ddb20e855f48047aa6c8",
"installed_by": ["modules"]
}
}
},
Expand Down
56 changes: 50 additions & 6 deletions modules/nf-core/rmarkdownnotebook/main.nf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 36 additions & 0 deletions modules/nf-core/zip/main.nf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

43 changes: 43 additions & 0 deletions modules/nf-core/zip/meta.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions tower.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
reports:
"**/report/*.html":
display: "Final differential abundance report"
"**/report/*.zip":
display: "Report bundle (markdown + input files)"
pipeline_info/**:
display: "Pipeline run info"
"**/plots/exploratory/**/html/*.html":
Expand Down
10 changes: 10 additions & 0 deletions workflows/differentialabundance.nf
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ include { AFFY_JUSTRMA as AFFY_JUSTRMA_RAW } from '../modules/n
include { AFFY_JUSTRMA as AFFY_JUSTRMA_NORM } from '../modules/nf-core/affy/justrma/main'
include { PROTEUS_READPROTEINGROUPS as PROTEUS } from '../modules/nf-core/proteus/readproteingroups/main'
include { GEOQUERY_GETGEO } from '../modules/nf-core/geoquery/getgeo/main'
include { ZIP as MAKE_REPORT_BUNDLE } from '../modules/nf-core/zip/main'

/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down Expand Up @@ -584,6 +585,15 @@ workflow DIFFERENTIALABUNDANCE {
ch_report_input_files
)

// Make a report bundle comprising the markdown document and all necessary
// input files

MAKE_REPORT_BUNDLE(
RMARKDOWNNOTEBOOK.out.parameterised_notebook
.combine(ch_report_input_files)
.map{[it[0], it[1..-1]]}
)

}

/*
Expand Down