knitr::opts_chunk$set(echo = FALSE, fig.keep = "all", fig.retina = 1, dpi = 72)
# add plot paths as JS global
printf("<script>const reportPlots = JSON.parse('%s');</script>\n", jsonlite::toJSON(plots))

Summary

rightColumnCards <- list(
    bslib::card(
        bslib::card_header("Objects"),
        bslib::card_body_fill(htmltools::pre(htmltools::code(objectsShow)))
    )
)

if (!is.null(plots$overview$chord) || !is.null(plots$overview$venn) || !is.null(plots$overview$UpSet))
{
    tabs <- list()
    makeTab <- function(title, plot) bslib::nav(title, bslib::card_body_fill(htmltools::HTML(utils$plotImg(plot))))
    if (!is.null(plots$overview$chord))
        tabs <- c(tabs, list(makeTab("Chord diagram", plots$overview$chord)))
    if (!is.null(plots$overview$venn))
        tabs <- c(tabs, list(makeTab("Venn diagram", plots$overview$venn)))
    if (!is.null(plots$overview$UpSet))
        tabs <- c(tabs, list(makeTab("UpSet diagram", plots$overview$UpSet)))
    rightColumnCards <- c(rightColumnCards,
                          list(style = "grid-template-rows: 2fr 3fr;",
                               do.call(bslib::navs_tab_card, c(list(title = "Feature distribution"), tabs))))
}

bslib::layout_column_wrap(
    width = 1/2,
    height = "100%",
    heights_equal = "row",
    style = "padding-bottom: 10px; padding-right: 10px; grid-template-columns: 2fr 1fr;",
    bslib::layout_column_wrap(
        width = 1,
        heights_equal = "row",
        bslib::card(
            bslib::card_header("Most intense feature of each group"),
            bslib::card_body_fill(htmltools::HTML(utils$plotImg(plots$overview$chroms)))
        ),
        bslib::card(
            bslib::card_header("Retention vs m/z"),
            bslib::card_body_fill(htmltools::HTML(utils$plotImg(plots$overview$retMZ)))
        )
    ),
    do.call(bslib::layout_column_wrap, c(list(
        width = 1,
        heights_equal = "row"
    ), rightColumnCards))
)







rickhelmus/patRoon documentation built on April 25, 2024, 8:15 a.m.