Skip to contents

This function is used to calculate activities from gene expression matrix and networks. This is an internal function for cal_Activity(), getActivity_individual(), getActivity_inBatch().

Usage

cal_Activity(
  target_list = NULL,
  cal_mat = NULL,
  activity_method = "mean",
  do.std = TRUE
)

Arguments

target_list

a list of source genes returned by get_net2target_list(), for each source gene, the value if a data frame with "target", "MI" and "spearman" as the columns.

cal_mat

a matrix of normalized and log-transformed gene expression values

activity_method

Character, method used to calculate the activity: "mean" (the default), "weightedmean", "absmean" or "maxmean".

do.std

Logical, whether to do the z-normalization on the gene expression values in each sample. Default: TRUE.

Value

a matrix of activities, drivers by cells

Examples

net_data <-  read.table(system.file("extdata/demo_pbmc14k/SJARACNe/B/TF/bt100_pc001/consensus_network_ncol_.txt", package = "scMINER"),
                        header = TRUE, sep = "\t", stringsAsFactors = FALSE, quote = "",
                        colClasses = c("character", "character", "character", "character", "numeric", "numeric", "numeric", "numeric", "numeric"))
target_list <- get_net2target_list(net_data)

data(pbmc14k_expression.eset)

act_mat <- cal_Activity(target_list = target_list, cal_mat = exprs(pbmc14k_expression.eset), activity_method = 'mean', do.std = TRUE)