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

Added project info to report #197

Merged
merged 9 commits into from
Jan 29, 2024
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- [[#222](https://github.com/nf-core/differentialabundance/pull/222)] - Add rounding to all numeric report tables ([@WackerO](https://github.com/WackerO), review by [@pinin4fjords](https://github.com/pinin4fjords))
- [[#219](https://github.com/nf-core/differentialabundance/pull/219)] - Template update for nf-core/tools v2.11.1 ([@WackerO](https://github.com/WackerO), review by [@pinin4fjords](https://github.com/pinin4fjords))
- [[#197](https://github.com/nf-core/differentialabundance/pull/197)] - Add contributor info to report ([@WackerO](https://github.com/WackerO), review by [@pinin4fjords](https://github.com/pinin4fjords))

### `Fixed`

Expand Down
31 changes: 30 additions & 1 deletion assets/differentialabundance_report.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ params:
study_abundance_type: NULL
report_file: NULL,
report_title: NULL,
report_contributors: NULL
report_author: NULL,
report_description: NULL,
report_scree: NULL
Expand Down Expand Up @@ -220,13 +221,14 @@ make_params_table <- function(name, pattern = NULL, remove_pattern = FALSE){
}

report_title <- paste0('Differential ', params$features_type, ' abundance report', ifelse(is.null(params$report_title), '', paste0(': ', params$report_title)))
report_subtitle <- paste0(ifelse(is.null(params$report_author), '', paste0('By ', params$report_author, ', ')), 'differentialabundance workflow version', versions[["Workflow.nf-core/differentialabundance"]])
report_subtitle <- paste0(ifelse(is.null(params$report_author), '', paste0('By ', params$report_author, ', ')), '<br>differentialabundance workflow version', versions[["Workflow.nf-core/differentialabundance"]])
```

---
title: "<img src=\"`r file.path(params$input_dir, params$logo)`\" style=\"float: left;\"/>`r report_title`"
subtitle: `r report_subtitle`
---
\

<!-- set notebook defaults -->

Expand All @@ -250,6 +252,33 @@ cat(paste0("
"))
```

<!-- Include PI/contact info if provided -->

```{r, results='asis', echo=F, eval=!is.null(params$report_contributors)}
PIs <- gsub("\n", "<br>", params$report_contributors, fixed=T) # Insert correct linebreaks for HTML
WackerO marked this conversation as resolved.
Show resolved Hide resolved
PIs <- simpleSplit(PIs, ";") # Split at semicolon to get list of PIs
PIs <- lapply(PIs, function (s) {
splt <- simpleSplit(s, "<br>")
first <- head(splt, 1)
rest <- tail(splt, length(splt)-1)
paste0("**", first, "**<br>", paste(rest, collapse="<br>")) # Make first line of each contributor bold
})

if (length(PIs) > 1) {
for (r in 1:length(PIs)) {
if (r %% 2 != 0) {
cat(paste0("<div class='div-row'>")) # For 1., 3. etc. entry open surrounding div that will contain 2 PIs next to each other
}
cat(paste0("<div class='div-column'>", PIs[r], "</div>")) # Create inner div containing the PI info itself
if (r %% 2 == 0 || r == length(PIs)) {
cat(paste0("</div>")) # For 2., 4. etc. entry and for last entry, close outer div
}
}
} else if (length(PIs) == 1) {
cat(paste0("", PIs, ""))
}
```

<!-- Load input data -->

```{r, echo=FALSE}
Expand Down
11 changes: 11 additions & 0 deletions assets/nf-core_style.css
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,14 @@ a {
color: #24b064;
text-decoration: none;
}

.div-row {
display: flex;
margin-bottom: 25px;
}

.div-column {
flex: 1;
display: inline-block;
box-sizing: border-box;
}
3 changes: 3 additions & 0 deletions conf/test.config
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,7 @@ params {
// Activate GSEA
gsea_run = true
gene_sets_files = 'https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/genomics/mus_musculus/gene_set_analysis/mh.all.v2022.1.Mm.symbols.gmt'

// Report options
report_contributors = 'Jane Doe\nDirector of Institute of Microbiology\nUniversity of Smallville;John Smith\nPhD student\nInstitute of Microbiology\nUniversity of Smallville'
}
19 changes: 10 additions & 9 deletions nextflow.config
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,16 @@ params {
sizefactors_from_controls = false

// Reporting
logo_file = "${projectDir}/docs/images/nf-core-differentialabundance_logo_light.png"
css_file = "${projectDir}/assets/nf-core_style.css"
citations_file = "${projectDir}/CITATIONS.md"
report_file = "${projectDir}/assets/differentialabundance_report.Rmd"
report_title = null
report_author = null
report_description = null
report_scree = true
report_round_digits = 4
logo_file = "${projectDir}/docs/images/nf-core-differentialabundance_logo_light.png"
css_file = "${projectDir}/assets/nf-core_style.css"
citations_file = "${projectDir}/CITATIONS.md"
report_file = "${projectDir}/assets/differentialabundance_report.Rmd"
report_title = null
report_author = null
report_contributors = null
report_description = null
report_scree = true
report_round_digits = 4

// Sample sheet options
observations_type = 'sample'
Expand Down
5 changes: 5 additions & 0 deletions nextflow_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1044,6 +1044,11 @@
"fa_icon": "fas fa-user-edit",
"description": "An author for reporting outputs"
},
"report_contributors": {
"type": "string",
"description": "Semicolon-separated string of contributor info that should be listed in the report.",
"help_text": "List here names, roles, affiliations, contact info etc. of contributors to your project. Entries of different contributors are separated by semicolons, linebreaks within a contributor are separated by \n. The first line of each contributor will be bold in the report. E.g.: 'Jane Doe\nDirector of Institute of Microbiology\nUniversity of Smallville;John Smith\nPhD student\nUniversity of Smallville'"
},
"report_description": {
"type": "string",
"default": "None",
Expand Down