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 reporting components to include all links #915

Merged
merged 19 commits into from
Nov 26, 2024
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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,14 @@

- 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).

- Update `get_task_info`, `get_method_info` and `get_metrics_info` reporting components with more info and extend output (PR #915).

## Bug fixes

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

- Fix path in `touch` cmd in `reporting/process_task_results/run_test.sh` (PR #915).

# openproblems v2.0.0

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.
Expand Down
52 changes: 45 additions & 7 deletions src/reporting/get_method_info/script.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ library(rlang, warn.conflicts = FALSE)

## VIASH START
par <- list(
input = "resources_test/openproblems/task_results_v3/raw/method_configs.yaml",
input = "method_configs.yaml",
output = "resources_test/openproblems/task_results_v3/processed/method_info.json"
)
## VIASH END
Expand All @@ -27,22 +27,57 @@ outputs <- map(configs, function(config) {
info <- config$info

# add extra info
info$config_path <- gsub(".*/src/", "src/", build_info$config)
info$comp_path <- gsub(".*/src/", "src/", build_info$config) %>% gsub("/config.vsh.yaml", "", .)
info$task_id <- gsub("/.*", "", config$namespace)
info$id <- config$name
info$namespace <- config$namespace
info$label <- config$label %||% info$label
info$summary <- config$summary %||% info$summary
info$description <- config$description %||% info$description
info$commit_sha <- build_info$git_commit %||% "missing-sha"
info$code_version <- "missing-version"
info$code_version <- config$version
info$code_url <- config$links$repository
info$documentation_url <- config$links$documentation
# 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.
engines <- config$engines
has_docker <- any(map_lgl(engines, ~ .x$type == "docker"))
if (has_docker) {
info$image <- paste0(
"https://",
config$links$docker_registry, "/",
config$package_config$organization, "/",
config$package_config$name, "/",
gsub("src/", "", info$comp_path),
":",
info$code_version
)
} else {
info$image <- paste0(
"https://github.com/orgs/openproblems-bio/packages?repo_name=",
config$package_config$name,
"&q=",
gsub("src/", "", info$comp_path)
)
}
info$implementation_url <- paste0(
build_info$git_remote, "/blob/",
build_info$git_commit, "/",
info$config_path
info$comp_path
)
info$type_info <- NULL

# Flatten references
if (!is.null(config$references) && config$references != "") {
info <- imap(config$references, function(value, key) {
info[[paste0("references_", key)]] <- value
return(info)
})[[1]]
}
info$references <- NULL

print(info)


# ↑ this could be used as the new format

# construct v1 format
Expand All @@ -53,10 +88,13 @@ outputs <- map(configs, function(config) {
method_summary = info$summary,
method_description = info$description,
is_baseline = grepl("control", info$type),
paper_reference = info$reference %||% NA_character_,
code_url = info$repository_url %||% NA_character_,
references_doi = info$references_doi %||% NA_character_,
references_bibtex = info$references_bibtex %||% NA_character_,
code_url = info$code_url %||% NA_character_,
documentation_url = info$documentation_url %||% NA_character_,
image = info$image %||% NA_character_,
implementation_url = info$implementation_url %||% NA_character_,
code_version = NA_character_,
code_version = info$code_version %||% NA_character_,
commit_sha = info$commit_sha
)

Expand Down
29 changes: 24 additions & 5 deletions src/reporting/get_metric_info/script.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,36 @@ outputs <- map(configs, function(config) {
config$info$metrics,
function(info) {
# add extra info
info$config_path <- gsub(".*/src/", "src/", build_info$config)
info$comp_path <- gsub(".*/src/", "src/", build_info$config) %>% gsub("/config.vsh.yaml", "", .)
info$task_id <- gsub("/.*", "", config$namespace)
info$id <- info$name
info$name <- NULL
info$component_name <- config$name
info$namespace <- config$namespace
info$commit_sha <- build_info$git_commit %||% "missing-sha"
info$code_version <- "missing-version"
info$code_version <- config$version %||% "missing-version"
info$image_url <- paste0(
"https://",
config$links$docker_registry, "/",
config$package_config$organization, "/",
config$package_config$name, "/",
gsub("src/", "", info$comp_path),
":",
info$code_version
)
info$implementation_url <- paste0(
build_info$git_remote, "/blob/",
build_info$git_commit, "/",
info$config_path
info$comp_path
)
# Flatten references
if (!is.null(info$references) && info$references != "") {
info <- imap(info$references, function(value, key) {
info[[paste0("references_", key)]] <- value
return(info)
})[[1]]
}
info$references <- NULL

# ↑ this could be used as the new format

Expand All @@ -52,9 +69,11 @@ outputs <- map(configs, function(config) {
metric_name = info$label,
metric_summary = info$summary,
metric_description = info$description,
paper_reference = info$reference %||% NA_character_,
references_doi = info$references_doi %||% NA_character_,
references_bibtex = info$references_bibtex %||% NA_character_,
implementation_url = info$implementation_url %||% NA_character_,
code_version = NA_character_,
image = info$image_url %||% NA_character_,
code_version = info$code_version %||% NA_character_,
commit_sha = info$commit_sha,
maximize = info$maximize
)
Expand Down
9 changes: 7 additions & 2 deletions src/reporting/get_task_info/script.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ info <- yaml::yaml.load_file(par$input)

# construct v1 format
repo <-
if ("name" %in% names(info) && "organization" %in% names(info)) {
if ("links" %in% names(info) && "repository" %in% names(info$links)) {
info$links$repository
} else if ("name" %in% names(info) && "organization" %in% names(info)) {
paste0(info$organization, "/", info$name)
} else {
"openproblems-bio/openproblems"
Expand All @@ -33,7 +35,10 @@ out <- list(
task_summary = info$summary,
task_description = description,
repo = repo,
authors = info$authors
issue_tracker = info$links$issue_tracker %||% NA_character_,
authors = info$authors,
version = info$version,
license = info$license %||% NA_character_
)

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