rtemisseq / globals.R
egenn's picture
init
977cc7d
raw
history blame
2.92 kB
# globals.R
# seqvizlive
# EDG rtemis.org
# Themes ----
# {bg_dark, bg_light} also used by plot.bg
bg_dark <- "#191919"
bg_light <- "#ffffff"
primary_dark <- "#72CDF4"
primary_light <- "#1295D8"
seconday_dark <- "#808080"
secondary_light <- "#808080"
info_dark <- "#FEB2E0"
info_light <- "#E44C9A"
success_dark <- "#B4DC55"
success_light <- "#84C234"
bslib_dark <- bslib::bs_theme(
bg = bg_dark,
fg = "#fff",
primary = primary_dark,
secondary = seconday_dark,
success = success_dark,
info = info_dark,
`tooltip-bg` = "#bbbbbb",
`tooltip-color` = info_dark,
`tooltip-opacity` = .95
) |>
bslib::bs_add_rules(sass::sass_file("www/rtemislive.scss"))
bslib_light <- bslib::bs_theme(
bg = bg_light,
fg = "#000",
primary = primary_light,
secondary = secondary_light,
success = success_light,
info = info_light,
`tooltip-bg` = "#303030",
`tooltip-color` = info_light,
`tooltip-opacity` = .95
) |>
bslib::bs_add_rules(sass::sass_file("www/rtemislive.scss"))
# from rtemislive
rthelp <- function(..., title = NULL, class = "rthelp") {
div(
div(HTML(paste0(title, " Instructions")),
style = "color: #808080; font-weight: 300; padding-bottom:.5em;"
),
HTML(paste0("<i>", paste(..., sep = "<br>")), "</i>"),
class = class
)
} # rtemislive::rthelp
rthelp_inline <- function(..., title = NULL, class = "rthelp-inline") {
rthelp(..., title = title, class = class)
} # rtemislive::rthelp_inline
bold <- function(x) {
paste0("<b>", x, "</b>")
}
hilite <- function(x) {
paste0("<span style='color: #72CDF4;font-weight: bold;'>", x, "</span>")
}
#' Summarize a3 object in HTML
#'
#' @param x a3 object
#'
#' @return HTML string
#' @author EDG
summarize_a3 <- function(x) {
htmltools::HTML(
paste0(
if (!is.null(x$UniprotID)) paste0("Uniprot ID: ", hilite(x$UniprotID), "<br>"),
paste0("Sequence length: ", hilite(length(x$Sequence)), "<br>"),
"<ul>",
if (length(x$Annotations$Site) > 0) paste("<li>", hilite(length(x$Annotations$Site)), "site annotations<br>"),
if (length(x$Annotations$Region) > 0) paste("<li>", hilite(length(x$Annotations$Region)), "region annotations<br>"),
if (length(x$Annotations$PTM) > 0) paste("<li>", hilite(length(x$Annotations$PTM)), "PTM annotations<br>"),
if (length(x$Annotations$Cleavage_site) > 0) paste("<li>", hilite(length(x$Annotations$Cleavage_site)), " cleavage site annotations<br>"),
if (length(x$Annotations$Variant) > 0) paste("<li>", hilite(length(x$Annotations$Variant)), "variant annotations<br>"),
"</ul>",
if (!is.null(x$Reference)) a("Reference", href = x$Reference, target = "_blank")
)
)
} # seqvizlive::summarize_a3
# Create list using custom bullet
rhelplist <- function(x, bullet = bsicons::bs_icon("arrow-right-short")) {
htmltools::HTML(
paste0(
bullet, "<i>", x, "</i>", "<br>"
)
)
} # seqvizlive::rtlist