renderFeatureStatsDataTable: Create a DT::datatable of feature level statistics for use in...

View source: R/shiny-utils.R

renderFeatureStatsDataTableR Documentation

Create a DT::datatable of feature level statistics for use in shiny bits

Description

We often want to display an interactive table of feature level statistics for all features. This function is a convenience wrapper to do that.

Usage

renderFeatureStatsDataTable(
  x,
  features = NULL,
  digits = 3,
  columns = NULL,
  feature.link.fn = NULL,
  order.by = "logFC",
  order.dir = c("desc", "asc"),
  filter = "none",
  length.opts = c(10, 25, 50, 100, 250)
)

Arguments

x

A 'SparrowResult' or 'data.frame' of feature level statistics. When 'x' is a 'SparrowResult', the 'logFC' feature level statistics will be extracted for display.

features

A character vector that specifies the subset of ‘feature_id'’s to display from 'x'. If 'NULL' (default), all of 'x' will be used.

digits

number of digits to round the numeric columns to

columns

the columns from 'x' to use. If 'missing', then only ‘c(’symbol', 'feature_id', 'logFC', 'pval', 'padj', order.by)' will be used. If explicitly set to 'NULL' all columns will be used.

feature.link.fn

A function that receives the data.frame of statistics to be rendered and transforms one of its columns into a hyperlink for further reference. Refer to [ncbi.entrez.link()] as an example.

order.by

name of the column to order the geneset stats by

order.dir

do we order the table by the values in 'order.by' in '"desc"'-ending, or '"asc"'-ending order (default: '"desc"')

filter

passed to [DT::datatable()]

length.opts

parameter passed as an option to [DT::datatable()] that specifies how long the table can be per page.

Value

A [DT::datatable()] of feature statistics

Examples

sr <- sparrow::exampleSparrowResult()
lfc <- sparrow::logFC(sr)
if (interactive()) {
  renderFeatureStatsDataTable(sr, sample(lfc$feature_id, 200),
                              feature.link.fn = ncbi.entrez.link)
}

lianos/sparrow.shiny documentation built on Oct. 12, 2023, 2:43 a.m.