This function interprets a vector from SiMLR (similarity-driven multivariate linear reconstruction) specifically focusing on a given variable (e.g., a specific principal component or cluster). It extracts and normalizes the vector associated with the specified SiMLR variable, sorts it to identify the top elements, and optionally filters out non-significant values. This function is useful for understanding the contribution of different features in the context of the SiMLR analysis.

interpret_simlr_vector(
  simlrResult,
  simlrMats,
  simlrVariable,
  n2show = 5,
  shortnames = TRUE,
  return_dataframe = FALSE
)

Arguments

simlrResult

A list containing SiMLR analysis results, which should include a matrix `v` representing vectors of interest (e.g., principal components).

simlrMats

A list of matrices associated with SiMLR analysis, where each matrix corresponds to a different modality or data type analyzed by SiMLR.

simlrVariable

A string specifying the variable within `simlrResult` to interpret. The variable name should include both an identifier (e.g., "PC" for principal component) and a numeric index.

n2show

An integer specifying the number of top elements to show from the sorted, normalized vector. Defaults to 5. If `NULL` or greater than the length of the vector, all elements are shown.

shortnames

boolean

return_dataframe

boolean

Value

A named vector of the top `n2show` elements (or all if `n2show` is `NULL` or too large), sorted in decreasing order of their absolute values. Elements are named according to their identifiers in `simlrMats` and filtered to exclude non-significant values (absolute value > 0).

Examples

# This example assumes you have SiMLR result `simlrResult`, matrices `simlrMats`, and you want to 
# interpret the first principal component "PC1".
# simlrResult <- list(v = list(PC = matrix(runif(20), ncol = 2)))
# simlrMats <- list(PC = matrix(runif(100), ncol = 10))
# simlrVariable <- "PC1"
# interpretedVector <- interpret_simlr_vector(simlrResult, simlrMats, simlrVariable)
# print(interpretedVector)