get_se_colData: Get SummarizedExperiment column data from colData

get_se_colDataR Documentation

Get SummarizedExperiment column data from colData

Description

Get SummarizedExperiment column data from colData

Usage

get_se_colData(x, use_values = NULL, verbose = FALSE, ...)

Arguments

x

SummarizedExperiment object

use_values

character values, default NULL. Optionally used to validate input values in one of two ways:

  1. Vector of values typically named by colnames(x) that should be applied to each column in x matching the order of the colnames.

  2. Vector of values that matches colnames(colData(x)), which should be converted to named vector of values, with names matching colnames(x).

Either way, when use_values is supplied, the output will be a named vector, with names defined using colnames(x).

verbose

logical indicating whether to print verbose output.

...

additional arguments are ignored.

Value

data.frame or DFrame when use_values is not supplied, or character vector named by colnames(x) when use_values is supplied.

See Also

Other jam utility functions: blockArrowMargin(), find_colname(), fold_to_log2fold(), get_se_assaydata(), gradient_rect(), handle_highlightPoints(), log2fold_to_fold(), logAxis(), outer_legend(), points2polygonHull(), update_function_params(), update_list_elements()

Examples


set.seed(123)
m <- matrix(rnorm(8100), ncol=9)
colnames(m) <- head(letters, 9)
rownames(m) <- as.character(1:900)
countse <- SummarizedExperiment::SummarizedExperiment(
   assays=list(counts=m))
SummarizedExperiment::colData(countse)$type <- rep(LETTERS[1:3], each=3)
SummarizedExperiment::colData(countse)$class <- rep(c("WT", "KO"), c(6, 3))

# use colname in colData
get_se_colData(countse, "type")

# use two colnames in colData
get_se_colData(countse, c("class", "type"))

# use three colnames in colData, one is missing
get_se_colData(countse, c("class", "type", "detail"))

# use named vector, which put it into proper order colnames(x)
use_values <- setNames(tail(LETTERS, 9), rev(head(letters, 9)))
use_values
get_se_colData(countse, use_values)

# use unnamed vector, which does not re-order values
unname(use_values)
get_se_colData(countse, unname(use_values))


jmw86069/jamma documentation built on June 13, 2025, 3:58 p.m.