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

Update task result rendering #296

Merged
merged 31 commits into from
Dec 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
8b96d92
add OPv2 PR #269
KaiWaldrant Oct 30, 2023
5774e82
set OP to metadata branch
KaiWaldrant Nov 10, 2023
1ef616f
wip batch_integration results
KaiWaldrant Nov 10, 2023
d08d477
WIP add v2 results
KaiWaldrant Nov 21, 2023
d0b1ce4
WIP fix pmap issue
KaiWaldrant Nov 21, 2023
f356525
restore original code
KaiWaldrant Nov 22, 2023
ee46b85
update bat_int_feat results
KaiWaldrant Nov 22, 2023
1d36757
remove obsolete code
KaiWaldrant Nov 22, 2023
5e47721
update OP-v2 repo
KaiWaldrant Nov 22, 2023
b8083e2
fix task description error
KaiWaldrant Nov 22, 2023
565961a
update OPv2 version
KaiWaldrant Nov 29, 2023
34f1502
replace "\n" from descriptions
KaiWaldrant Nov 29, 2023
354f3e7
update results
KaiWaldrant Nov 29, 2023
c22b7f8
Update results
KaiWaldrant Nov 29, 2023
55379a2
update for funky heatmap
rcannood Nov 29, 2023
7e21e95
update results
KaiWaldrant Nov 30, 2023
85436d2
update metrics for multiple references
KaiWaldrant Nov 30, 2023
0fa2812
remove bat_int substasks
KaiWaldrant Dec 7, 2023
c8cb1ac
Merge branch 'update/add_v2_results' of github.com:openproblems-bio/w…
rcannood Dec 14, 2023
fe7204a
Merge remote-tracking branch 'origin/main' into update/add_v2_results
rcannood Dec 19, 2023
228fcf1
update bibliography
rcannood Dec 19, 2023
05501ff
fix references, use native referencing functionality, minor adjustmen…
rcannood Dec 19, 2023
3a807de
remove unused file
rcannood Dec 19, 2023
a65c9ac
add bib library to pages
rcannood Dec 19, 2023
a35c69e
restore batch_integration dirs
KaiWaldrant Dec 20, 2023
c74a736
rerun `_generate_task_pages.py`
KaiWaldrant Dec 20, 2023
17af5b2
fix script
rcannood Dec 20, 2023
eb6d755
fix script
rcannood Dec 20, 2023
c8fbbd6
fixes to task info
rcannood Dec 20, 2023
df6412a
update changelog
rcannood Dec 20, 2023
7f7846f
Merge remote-tracking branch 'origin/main' into update/add_v2_results
rcannood Dec 20, 2023
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
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@
- Simplify footer
- Update openproblems-v2 submodule

* Updates to the way tasks are rendered (PR #296):

- Show task motivation, if present.
- Allow multiple citations for datasets, methods, and metrics.
- Render dataset name instead of dataset id in figures and tables.
- Change the way bibliographic references are rendered.

## BUG FIXES

* Updated the `openproblems-v2` submodule (PR #295). This fixes a deprecation error due to an update in ruamel.yaml.
Expand Down
2 changes: 1 addition & 1 deletion _openproblems-v2
Submodule _openproblems-v2 updated 116 files
2,504 changes: 1,526 additions & 978 deletions bibliography/library.bib

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion results/_generate_task_pages.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@
title: "{task_name}"
subtitle: "{task_summary}"
engine: knitr
image: featured.png
image: thumbnail.svg
page-layout: full
css: ../task_template.css
bibliography: ../../bibliography/library.bib
---

```{{r}}
Expand Down
4 changes: 2 additions & 2 deletions results/_include/_baseline_descriptions.qmd
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
```{r}
```{r baseline_descriptions}
#| echo: false
baselines <- method_info %>% filter(is_baseline)
lines <- pmap_chr(baselines, function(method_name, method_summary, reference, code_url, ...) {
summ <- (method_summary %|% "Missing 'method_summary'") %>% str_replace_all("\\. *$", "")
summ <- (method_summary %|% "Missing 'method_summary'") %>% str_replace_all("\\n", " ") %>% str_replace_all("\\. *$", "")
glue::glue("* **{method_name}**: {summ}.")
})
knitr::asis_output(paste(lines, collapse = "\n"))
Expand Down
12 changes: 4 additions & 8 deletions results/_include/_dataset_descriptions.qmd
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
```{r}
```{r dataset_description}
#| echo: false
lines <- pmap_chr(dataset_info, function(dataset_name, dataset_summary, data_reference, ...) {
ref <-
if (!is.na(data_reference)) {
paste0("<sup>", cite_fun(data_reference, "html"), "</sup>")
} else {
""
}
summ <- (dataset_summary %|% "Missing 'dataset_summary'") %>% str_replace_all("\\. *$", "")
ref <- split_cite_fun(data_reference)
if (ref != "") ref <- paste0(" ", ref)
summ <- (dataset_summary %|% "Missing 'dataset_summary'") %>% str_replace_all("\\n", " ") %>% str_replace_all("\\. *$", "")
glue::glue("* **{dataset_name}**{ref}: {summ}.")
})
knitr::asis_output(paste(lines, collapse = "\n"))
Expand Down
39 changes: 18 additions & 21 deletions results/_include/_load_data.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ library(kableExtra)

# read task info
task_info <- jsonlite::read_json(paste0(params$data_dir, "/task_info.json"))

# add missing data
task_info$task_description <- task_info$task_description %||% NA_character_
task_info$task_motivation <- task_info$task_motivation %||% NA_character_

`%|%` <- function(x, y) {
ifelse(is.na(x), y, x)
Expand All @@ -22,43 +25,37 @@ dataset_info <- jsonlite::read_json(paste0(params$data_dir, "/dataset_info.json"
results <- jsonlite::read_json(paste0(params$data_dir, "/results.json"), simplifyVector = TRUE)
qc <- jsonlite::read_json(paste0(params$data_dir, "/quality_control.json"), simplifyVector = TRUE)

# add missing columns
for (col in c("method_summary")) {
method_info[[col]] <- method_info[[col]] %||% NA_character_
}
for (col in c("metric_summary")) {
metric_info[[col]] <- metric_info[[col]] %||% NA_character_
}
for (col in c("dataset_summary")) {
for (col in c("dataset_summary", "dataset_name")) {
dataset_info[[col]] <- dataset_info[[col]] %||% NA_character_
}

# fill missing data
dataset_info$dataset_name <- dataset_info$dataset_name %|% dataset_info$dataset_id

num_methods <- sum(!method_info$is_baseline)
num_baselines <- sum(method_info$is_baseline)
num_datasets <- nrow(dataset_info)
num_metrics <- nrow(metric_info)

split_cite_fun <- function(keys) {
if (is.null(keys)) return("")

keys <- keys[!is.na(keys)]
if (length(keys) == 0) return("")

link_fun <- function(label, url, format = "markdown") {
if (format == "markdown") {
paste0("[", label, "](", url, ")")
} else {
paste0("<a href=\"", url, "\" target=\"_blank\">", label, "</a>")
}
refs <- unlist(stringr::str_split(keys, ", *"))
# inner_str <- sapply(refs, function(ref) cite_fun(ref, format = format))
# paste0("<sup>", paste(inner_str, collapse = ", "), "</sup>")
# paste0("[", paste(inner_str, collapse = ", "), "]")
paste0("[@", paste(refs, collapse = "; @"), "]")
}
cite_map <- list()
cite_fun <- function(key, format = "markdown") {
# if (is.null(options("citation_map"))) {
# options("citation_map" = list())
# }
# cm <- options("citation_map")
if (!key %in% names(cite_map)) {
cite_map[[key]] <<- length(cite_map) + 1
# options("citation_map" = cm)
}
num <- cite_map[[key]]
link_fun(num, paste0("/bibliography/#", key), format = format)
}

```


Expand Down
16 changes: 9 additions & 7 deletions results/_include/_method_descriptions.qmd
Original file line number Diff line number Diff line change
@@ -1,25 +1,27 @@
```{r}
```{r method_description}
#| echo: false
# show each method just once
lines <- pmap_chr(method_info, function(method_name, method_summary, paper_reference, code_url, code_version, ...) {

links <- c()
if (!is.na(code_url)) {
links <- c(links, glue::glue(" [Docs]({code_url})"))
}
version_label <-
if (!is.na(code_version)) {
if (!is.na(code_version) && code_version != "missing-version") {
glue::glue(" Software version {code_version}.")
} else {
""
}
ref <-
if (!is.na(paper_reference)) {
paste0("<sup>", cite_fun(paper_reference, "html"), "</sup>")
ref <- split_cite_fun(paper_reference)
if (ref != "") ref <- paste0(" ", ref)
links_label <-
if (length(links) > 0) {
glue::glue(" Links: {paste(links, collapse = ', ')}.")
} else {
""
}
links_label <- glue::glue(" Links: {paste(links, collapse = ', ')}.")
summ <- (method_summary %|% "Missing 'method_summary'") %>% str_replace_all("\\. *$", "")
summ <- (method_summary %|% "Missing 'method_summary'") %>% str_replace_all("\\n", " ") %>% str_replace_all("\\. *$", "")
glue::glue("* **{method_name}**{ref}: {summ}.{version_label}{links_label}")
})
knitr::asis_output(paste(lines, collapse = "\n"))
Expand Down
10 changes: 3 additions & 7 deletions results/_include/_metric_descriptions.qmd
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
```{r}
#| echo: false
lines <- pmap_chr(metric_info, function(metric_name, metric_summary, paper_reference, ...) {
ref <-
if (!is.na(paper_reference)) {
paste0("<sup>", cite_fun(paper_reference, "html"), "</sup>")
} else {
""
}
summ <- (metric_summary %|% "Missing 'metric_summary'") %>% str_replace_all("\\. *$", "")
ref <- split_cite_fun(paper_reference)
if (ref != "") ref <- paste0(" ", ref)
summ <- (metric_summary %|% "Missing 'metric_summary'") %>% str_replace_all("\\n", " ") %>% str_replace_all("\\. *$", "")
glue::glue("* **{metric_name}**{ref}: {summ}.")
})
knitr::asis_output(paste(lines, collapse = "\n"))
Expand Down
12 changes: 4 additions & 8 deletions results/_include/_results_table.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Results table of the scores per method, dataset and metric (after scaling). Use
```{r resultstable}
#| echo: false
res_tib0 <- results %>%
unnest(scaled_scores) %>%
unnest(metric_values) %>%
unnest(resources) %>%
left_join(method_info %>% select(-commit_sha, -code_version, -task_id), by = "method_id") %>%
filter(!is_baseline) %>%
Expand All @@ -14,7 +14,7 @@ mean_na_zero <- function(x) {
}

res_tib1 <- res_tib0 %>%
group_by(method_id, method_name, paper_reference, code_url, code_version) %>%
group_by(method_id, method_name, paper_reference, code_url) %>%
summarise_if(is.numeric, mean_na_zero) %>%
ungroup() %>%
mutate(
Expand All @@ -27,16 +27,12 @@ res_tib <- res_tib1 %>%
arrange(desc(mean_score)) %>%
rowwise() %>%
mutate(
method_label = ifelse(is.na(paper_reference), method_name, glue::glue("{method_name} <sup>{cite_fun(paper_reference, format = 'html')}</sup>")),
dataset_label = ifelse(is.na(data_reference), dataset_name, glue::glue("{dataset_name} <sup>{cite_fun(data_reference, format = 'html')}</sup>")),
# method_label = method_name,
# dataset_label = dataset_name,
peak_memory_gb = peak_memory_mb / 1024
) %>%
ungroup() %>%
select(
method_label,
dataset_label,
method_name,
dataset_name,
mean_score,
any_of(metric_info$metric_id),
duration_sec,
Expand Down
10 changes: 6 additions & 4 deletions results/_include/_summary_figure.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,12 @@ palettes <- list(
# column_info = column_info %>% filter(id %in% colnames(summary_all)),
# column_groups = column_groups,
# palettes = palettes,
# # determine xmax expand heuristically
# expand = c(xmax = max(str_length(tail(column_info$name, 4))) / 5),
# # determine offset heuristically
# col_annot_offset = max(str_length(column_info$name)) / 5,
# position_args = position_arguments(
# # determine xmax expand heuristically
# expand_xmax = max(str_length(tail(column_info$name, 4))) / 5,
# # determine offset heuristically
# col_annot_offset = max(str_length(column_info$name)) / 5
# ),
# add_abc = FALSE,
# scale_column = FALSE
# )
Expand Down
26 changes: 11 additions & 15 deletions results/_include/_task_template.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,17 @@
`r num_methods` methods • `r num_metrics` metrics • `r num_datasets` datasets
:::

## Description
`r task_info$task_description %|% "Missing 'task_description'"`
Data:
<a href="data/task_info.json" class="btn btn-secondary">Task info</a>
<a href="data/method_info.json" class="btn btn-secondary">Method info</a>
<a href="data/metric_info.json" class="btn btn-secondary">Metric info</a>
<a href="data/dataset_info.json" class="btn btn-secondary">Dataset info</a>
<a href="data/results.json" class="btn btn-secondary">Results</a>
<a href="data/quality_control.json" class="btn btn-secondary">Quality control</a>

`r task_info$task_motivation %|% ""`

`r task_info$task_description %|% ""`

## Summary

Expand Down Expand Up @@ -40,19 +49,6 @@

</details>


<details><summary>Download raw data</summary>

<a href="data/task_info.json" class="btn btn-secondary">Task info</a>
<a href="data/method_info.json" class="btn btn-secondary">Method info</a>
<a href="data/metric_info.json" class="btn btn-secondary">Metric info</a>
<a href="data/dataset_info.json" class="btn btn-secondary">Dataset info</a>
<a href="data/results.json" class="btn btn-secondary">Results</a>
<a href="data/quality_control.json" class="btn btn-secondary">Quality control</a>

</details>


<details><summary>Quality control results</summary>

{{< include ../_include/_qc_table.qmd >}}
Expand Down
1 change: 1 addition & 0 deletions results/batch_integration_embed/index.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ engine: knitr
image: thumbnail.svg
page-layout: full
css: ../task_template.css
bibliography: ../../bibliography/library.bib
---

```{r}
Expand Down
1 change: 1 addition & 0 deletions results/batch_integration_feature/index.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ engine: knitr
image: thumbnail.svg
page-layout: full
css: ../task_template.css
bibliography: ../../bibliography/library.bib
---

```{r}
Expand Down
1 change: 1 addition & 0 deletions results/batch_integration_graph/index.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ engine: knitr
image: thumbnail.svg
page-layout: full
css: ../task_template.css
bibliography: ../../bibliography/library.bib
---

```{r}
Expand Down
1 change: 1 addition & 0 deletions results/cell_cell_communication_ligand_target/index.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ engine: knitr
image: thumbnail.svg
page-layout: full
css: ../task_template.css
bibliography: ../../bibliography/library.bib
---

```{r}
Expand Down
1 change: 1 addition & 0 deletions results/cell_cell_communication_source_target/index.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ engine: knitr
image: thumbnail.svg
page-layout: full
css: ../task_template.css
bibliography: ../../bibliography/library.bib
---

```{r}
Expand Down
1 change: 1 addition & 0 deletions results/denoising/index.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ engine: knitr
image: thumbnail.svg
page-layout: full
css: ../task_template.css
bibliography: ../../bibliography/library.bib
---

```{r}
Expand Down
1 change: 1 addition & 0 deletions results/dimensionality_reduction/index.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ engine: knitr
image: thumbnail.svg
page-layout: full
css: ../task_template.css
bibliography: ../../bibliography/library.bib
---

```{r}
Expand Down
1 change: 1 addition & 0 deletions results/label_projection/index.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ engine: knitr
image: thumbnail.svg
page-layout: full
css: ../task_template.css
bibliography: ../../bibliography/library.bib
---

```{r}
Expand Down
3 changes: 2 additions & 1 deletion results/matching_modalities/index.qmd
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
---
title: "Matching modalities"
title: "Multimodal Data Integration"
subtitle: "Alignment of cellular profiles from two different modalities"
engine: knitr
image: thumbnail.svg
page-layout: full
css: ../task_template.css
bibliography: ../../bibliography/library.bib
---

```{r}
Expand Down
Loading