Skip to content

Commit f52c8c4

Browse files
Update reporting components to include all links (#915)
* update get_method_info * update get_task_info * update get_metric_info * simplify gsub code * fix implementation url * fix typo * update touch url * add name to image * change image order * update task info output * add code version * update changelog * fix image url * Add image link for nextflow method * flatten references * update references output * fix method references output --------- Co-authored-by: Robrecht Cannoodt <[email protected]>
1 parent 927b5a6 commit f52c8c4

File tree

4 files changed

+80
-14
lines changed

4 files changed

+80
-14
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,14 @@
2828

2929
- Update `dataset_id` for `tenx_visium`, `zenodo_spatial`, `zenodo_spatial_slidetags` datasets and use `mouse_brain_coronal` as a test resource in the `spatially_variable_genes` task (PR #908).
3030

31+
- Update `get_task_info`, `get_method_info` and `get_metrics_info` reporting components with more info and extend output (PR #915).
32+
3133
## Bug fixes
3234

3335
- Fix extracting metadata from anndata files in the `extract_metadata` component (PR #914).
3436

37+
- Fix path in `touch` cmd in `reporting/process_task_results/run_test.sh` (PR #915).
38+
3539
# openproblems v2.0.0
3640

3741
A major update to the OpenProblems framework, switching from a Python-based framework to a Viash + Nextflow-based framework. This update features the same concepts as the previous version, but with a new implementation that is more flexible, scalable, and maintainable.

src/reporting/get_method_info/script.R

Lines changed: 45 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ library(rlang, warn.conflicts = FALSE)
55

66
## VIASH START
77
par <- list(
8-
input = "resources_test/openproblems/task_results_v3/raw/method_configs.yaml",
8+
input = "method_configs.yaml",
99
output = "resources_test/openproblems/task_results_v3/processed/method_info.json"
1010
)
1111
## VIASH END
@@ -27,22 +27,57 @@ outputs <- map(configs, function(config) {
2727
info <- config$info
2828

2929
# add extra info
30-
info$config_path <- gsub(".*/src/", "src/", build_info$config)
30+
info$comp_path <- gsub(".*/src/", "src/", build_info$config) %>% gsub("/config.vsh.yaml", "", .)
3131
info$task_id <- gsub("/.*", "", config$namespace)
3232
info$id <- config$name
3333
info$namespace <- config$namespace
3434
info$label <- config$label %||% info$label
3535
info$summary <- config$summary %||% info$summary
3636
info$description <- config$description %||% info$description
3737
info$commit_sha <- build_info$git_commit %||% "missing-sha"
38-
info$code_version <- "missing-version"
38+
info$code_version <- config$version
39+
info$code_url <- config$links$repository
40+
info$documentation_url <- config$links$documentation
41+
# Check if the method has a docker container to create an image url. If it does not have a docker it will be a nextflow component consisting of different components that will have a docker image.
42+
engines <- config$engines
43+
has_docker <- any(map_lgl(engines, ~ .x$type == "docker"))
44+
if (has_docker) {
45+
info$image <- paste0(
46+
"https://",
47+
config$links$docker_registry, "/",
48+
config$package_config$organization, "/",
49+
config$package_config$name, "/",
50+
gsub("src/", "", info$comp_path),
51+
":",
52+
info$code_version
53+
)
54+
} else {
55+
info$image <- paste0(
56+
"https://github.com/orgs/openproblems-bio/packages?repo_name=",
57+
config$package_config$name,
58+
"&q=",
59+
gsub("src/", "", info$comp_path)
60+
)
61+
}
3962
info$implementation_url <- paste0(
4063
build_info$git_remote, "/blob/",
4164
build_info$git_commit, "/",
42-
info$config_path
65+
info$comp_path
4366
)
4467
info$type_info <- NULL
4568

69+
# Flatten references
70+
if (!is.null(config$references) && config$references != "") {
71+
info <- imap(config$references, function(value, key) {
72+
info[[paste0("references_", key)]] <- value
73+
return(info)
74+
})[[1]]
75+
}
76+
info$references <- NULL
77+
78+
print(info)
79+
80+
4681
# ↑ this could be used as the new format
4782

4883
# construct v1 format
@@ -53,10 +88,13 @@ outputs <- map(configs, function(config) {
5388
method_summary = info$summary,
5489
method_description = info$description,
5590
is_baseline = grepl("control", info$type),
56-
paper_reference = info$reference %||% NA_character_,
57-
code_url = info$repository_url %||% NA_character_,
91+
references_doi = info$references_doi %||% NA_character_,
92+
references_bibtex = info$references_bibtex %||% NA_character_,
93+
code_url = info$code_url %||% NA_character_,
94+
documentation_url = info$documentation_url %||% NA_character_,
95+
image = info$image %||% NA_character_,
5896
implementation_url = info$implementation_url %||% NA_character_,
59-
code_version = NA_character_,
97+
code_version = info$code_version %||% NA_character_,
6098
commit_sha = info$commit_sha
6199
)
62100

src/reporting/get_metric_info/script.R

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,36 @@ outputs <- map(configs, function(config) {
2828
config$info$metrics,
2929
function(info) {
3030
# add extra info
31-
info$config_path <- gsub(".*/src/", "src/", build_info$config)
31+
info$comp_path <- gsub(".*/src/", "src/", build_info$config) %>% gsub("/config.vsh.yaml", "", .)
3232
info$task_id <- gsub("/.*", "", config$namespace)
3333
info$id <- info$name
3434
info$name <- NULL
3535
info$component_name <- config$name
3636
info$namespace <- config$namespace
3737
info$commit_sha <- build_info$git_commit %||% "missing-sha"
38-
info$code_version <- "missing-version"
38+
info$code_version <- config$version %||% "missing-version"
39+
info$image_url <- paste0(
40+
"https://",
41+
config$links$docker_registry, "/",
42+
config$package_config$organization, "/",
43+
config$package_config$name, "/",
44+
gsub("src/", "", info$comp_path),
45+
":",
46+
info$code_version
47+
)
3948
info$implementation_url <- paste0(
4049
build_info$git_remote, "/blob/",
4150
build_info$git_commit, "/",
42-
info$config_path
51+
info$comp_path
4352
)
53+
# Flatten references
54+
if (!is.null(info$references) && info$references != "") {
55+
info <- imap(info$references, function(value, key) {
56+
info[[paste0("references_", key)]] <- value
57+
return(info)
58+
})[[1]]
59+
}
60+
info$references <- NULL
4461

4562
# ↑ this could be used as the new format
4663

@@ -52,9 +69,11 @@ outputs <- map(configs, function(config) {
5269
metric_name = info$label,
5370
metric_summary = info$summary,
5471
metric_description = info$description,
55-
paper_reference = info$reference %||% NA_character_,
72+
references_doi = info$references_doi %||% NA_character_,
73+
references_bibtex = info$references_bibtex %||% NA_character_,
5674
implementation_url = info$implementation_url %||% NA_character_,
57-
code_version = NA_character_,
75+
image = info$image_url %||% NA_character_,
76+
code_version = info$code_version %||% NA_character_,
5877
commit_sha = info$commit_sha,
5978
maximize = info$maximize
6079
)

src/reporting/get_task_info/script.R

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ info <- yaml::yaml.load_file(par$input)
1515

1616
# construct v1 format
1717
repo <-
18-
if ("name" %in% names(info) && "organization" %in% names(info)) {
18+
if ("links" %in% names(info) && "repository" %in% names(info$links)) {
19+
info$links$repository
20+
} else if ("name" %in% names(info) && "organization" %in% names(info)) {
1921
paste0(info$organization, "/", info$name)
2022
} else {
2123
"openproblems-bio/openproblems"
@@ -33,7 +35,10 @@ out <- list(
3335
task_summary = info$summary,
3436
task_description = description,
3537
repo = repo,
36-
authors = info$authors
38+
issue_tracker = info$links$issue_tracker %||% NA_character_,
39+
authors = info$authors,
40+
version = info$version,
41+
license = info$license %||% NA_character_
3742
)
3843

3944
# show warning when certain data is missing and return null?

0 commit comments

Comments
 (0)