knitr::opts_chunk$set(echo = FALSE, warning = FALSE, message = FALSE)
suppressPackageStartupMessages(library(magrittr))
DT::datatable(matrix())
$(document).ready(function() {
  $("a[role='button']").unwrap();
});
body .main-container {
  max-width: 1440px !important;
}
other_params <- scdrake::scdrake_list(params$other_params)

Show details

  • ID: r other_params$id
  • Name: r other_params$name
  • Description: r other_params$description
  • Source column / level: r other_params$source_column / r other_params$group_level
  • Block column: r other_params$block_column
  • Test type: r other_params$test_type
  • p-value type: r other_params$pval_type
  • LFC direction: r other_params$lfc_direction
  • LFC test: |LFC| > r other_params$lfc_test
  • Min. proportion: r other_params$min_prop
  • Standardized LFC: r other_params$std_lfc


{.tabset}

Dimred plots {.tabset}

x <- scdrake::lapply_rows(other_params$dimred_plots, FUN = function(par) {
  scdrake::md_header(stringr::str_to_upper(par$plot_dimreds), 3)
  p <- par$plot
  scdrake::highlight_points(p, column_name = "colour_by", levels = other_params$group_level) %>% print()
})

Marker table

cat(other_params$heatmap_file_rel, "\n\n")

cat("
<button class='btn btn-success' type='button' data-toggle='collapse' data-target='#table_info'
aria-expanded='false' aria-controls='table_info' style='margin-bottom: 0;'>
  Show table info
</button>
")

cat("
<div class='collapse' id='table_info'>
<hr />
<div class='card card-body'>

Genes in the current cell group (cluster) were tested against each other cell group using the selected test
(all pairwise comparisons).

Table columns:

<ul>
<li>
top - top genes from each pairwise comparison, e.g. top <= 1 will contain the top gene from each pairwise comparison to every other cluster.
If T is instead, say, 5, the set will consist of the union of the top 5 genes from each pairwise comparison.
</li>
<li>
lfc_summary or auc_summary - the summary effect size is defined as the effect size from the pairwise comparison
with the lowest p-value. The effect size can be either log2 fold-change or area under the curve (for Wilcox test).
</li>
<li>pval - combined p-value from all pairwise comparisons</li>
<li>fdr - p-value adjusted for multiple testing issue (false discovery rate)</li>
<li>avg_self - average log2 counts in the current group</li>
<li>avg_other - average log2 counts in the other groups</li>
<li>pct_self - percentage of cells with detected expression (counts > 0) in the current group</li>
<li>pct_other - percentage of cells with detected expression (counts > 0) in the other groups</li>
<li>lfc_&lt;cell_group&gt; or auc_&lt;cell_group&gt; - effect size of the current group versus some other one</li>
</ul>

For more details see the documentation of the used methods from scran package:
<a href='https://rdrr.io/bioc/scran/man/combineMarkers.html' target='_blank'>combineMarkers()</a> and
<a href='https://rdrr.io/bioc/scran/man/findMarkers.html' target='_blank'>findMarkers()</a>

</div>
</div>
")

markers <- other_params$markers
assert_that(is.data.frame(markers))
if (other_params$test_type == "wilcox") {
  effect_colnames <- str_subset(colnames(markers), "^auc_")
} else {
  effect_colnames <- str_subset(colnames(markers), "^lfc_")
}

if ("top" %in% colnames(markers)) {
  order_col <- "top"
} else {
  order_col <- "fdr"
}

download_title <- other_params$id

table_dt <- DT::datatable(
  markers,
  filter = "top",
  rownames = FALSE,
  escape = FALSE,
  width = "100%",
  class = "display compact",
  extensions = c("Buttons", "FixedHeader"),
  options = list(
    pageLength = 100,
    order = list(which(colnames(markers) == order_col) - 1, "asc"),
    autoWidth = TRUE,
    dom = "Bipfrtip",
    fixedHeader = TRUE,
    lengthMenu = list(list(10, 25, 50, -1), list(10, 25, 50, "All")),
    buttons =
      list("copy", "print", list(
        extend = "collection",
        text = "Download",
        buttons = list(
          list(extend = "excel", title = download_title),
          list(extend = "pdf", title = download_title),
          list(extend = "csv", title = download_title)
        )
      ))
  )
) %>%
  DT::formatSignif(columns = c("lfc_summary", "pval", "fdr", "avg_self", "avg_other", effect_colnames), digits = 3)

table_dt

{-}





bioinfocz/scdrake documentation built on Sept. 19, 2024, 4:43 p.m.