Calculate driver activities in batch from the SJARACNe directory
getActivity_inBatch.Rd
This function is used to calculate the driver activities of multiple groups from a scMINER directory. To calculate driver activities of one single group, please use getActivity_individual()
.
Usage
getActivity_inBatch(
input_eset,
sjaracne_dir,
group_name,
group_exclude = NULL,
network_tag.tf = NULL,
network_tag.sig = NULL,
driver_type = "TF_SIG",
activity_method = "mean",
do.z_normalization = TRUE
)
Arguments
- input_eset
The expression set object which has been filtered, normalized and log-transformed
- sjaracne_dir
The path to the SJARACNe directory
- group_name
Character, name of the column for grouping, usually the column of cell types or clusters
- group_exclude
A vector of group names to exclude in activity calculation
- network_tag.tf
Character or
NULL
, the tag used to distinguish different SJARACNe runs from the same input files. This is usually the name of the folder(s) in "TF
" folder of each group. Default:NULL
.- network_tag.sig
Character or
NULL
, the tag used to distinguish different SJARACNe runs from the same input files. This is usually the name of the folder(s) in "SIG
" folder of each group. Default:NULL
.- driver_type
Character, type of the pre-defined driver list to use. Should be one of: "
TF
" for transcriptional factors only, "SIG
" for signaling genes only, or "TF_SIG
" for both. Default: "TF_SIG
".- activity_method
Character, method used to calculate the activity: "
mean
" (the default), "weightedmean
", "absmean
" or "maxmean
".- do.z_normalization
Logical, whether to do the z-normalization on the gene expression values in each sample. Set if to
FALSE
only when the expression values has been scaled in each cell. Default:TRUE
.
Value
A expression set object. The assayData
is the activity matrix of all cells of all groups, drivers by cells. The phenoData
and featureData
are exactly save with the input eset.
Examples
data(pbmc14k_expression.eset)
## 1. when no tag was used in running SJARACNE: the network file folder ("sjaracne_workflow-*") is directly under TF/SIG folder of each group.
activity.eset <- getActivity_inBatch(input_eset = pbmc14k_expression.eset,
sjaracne_dir = system.file("extdata/demo_pbmc14k/SJARACNe", package = "scMINER"),
group_name = "trueLabel",
driver_type = "TF_SIG",
activity_method = "mean",
do.z_normalization = TRUE)
#> 7 groups were found in trueLabel ...
#> Checking network files for each group ...
#> Group 1 / 7 : B ...
#> TF network check passed!
#> SIG network check passed!
#> Group 2 / 7 : CD4TCM ...
#> TF network check passed!
#> SIG network check passed!
#> Group 3 / 7 : CD4TN ...
#> TF network check passed!
#> SIG network check passed!
#> Group 4 / 7 : CD4Treg ...
#> TF network check passed!
#> SIG network check passed!
#> Group 5 / 7 : CD8TN ...
#> TF network check passed!
#> SIG network check passed!
#> Group 6 / 7 : Monocyte ...
#> TF network check passed!
#> SIG network check passed!
#> Group 7 / 7 : NK ...
#> TF network check passed!
#> SIG network check passed!
#> Calculating activity for each group ...
#> Group 1 / 7 : B ...
#> Activity calculation is completed successfully!
#> Group 2 / 7 : CD4TCM ...
#> Activity calculation is completed successfully!
#> Group 3 / 7 : CD4TN ...
#> Activity calculation is completed successfully!
#> Group 4 / 7 : CD4Treg ...
#> Activity calculation is completed successfully!
#> Group 5 / 7 : CD8TN ...
#> Activity calculation is completed successfully!
#> Group 6 / 7 : Monocyte ...
#> Activity calculation is completed successfully!
#> Group 7 / 7 : NK ...
#> Activity calculation is completed successfully!
#> NAs were found in the activity matrix and have been replaced by the minimum value: -0.3879122 .
## 2. when tag (e.g. "bt100_pc001" ) was used: the network file folder ("sjaracne_workflow-*") is directly under a subfolder "bs_100" of the TF/SIG folder of each group.
activity.eset <- getActivity_inBatch(input_eset = pbmc14k_expression.eset,
sjaracne_dir = system.file("extdata/demo_pbmc14k/SJARACNe", package = "scMINER"),
group_name = "trueLabel",
network_tag.tf = "bt100_pc001",
network_tag.sig = "bt100_pc001",
driver_type = "TF_SIG",
activity_method = "mean",
do.z_normalization = TRUE)
#> 7 groups were found in trueLabel ...
#> Checking network files for each group ...
#> Group 1 / 7 : B ...
#> TF network check passed!
#> SIG network check passed!
#> Group 2 / 7 : CD4TCM ...
#> TF network check passed!
#> SIG network check passed!
#> Group 3 / 7 : CD4TN ...
#> TF network check passed!
#> SIG network check passed!
#> Group 4 / 7 : CD4Treg ...
#> TF network check passed!
#> SIG network check passed!
#> Group 5 / 7 : CD8TN ...
#> TF network check passed!
#> SIG network check passed!
#> Group 6 / 7 : Monocyte ...
#> TF network check passed!
#> SIG network check passed!
#> Group 7 / 7 : NK ...
#> TF network check passed!
#> SIG network check passed!
#> Calculating activity for each group ...
#> Group 1 / 7 : B ...
#> Activity calculation is completed successfully!
#> Group 2 / 7 : CD4TCM ...
#> Activity calculation is completed successfully!
#> Group 3 / 7 : CD4TN ...
#> Activity calculation is completed successfully!
#> Group 4 / 7 : CD4Treg ...
#> Activity calculation is completed successfully!
#> Group 5 / 7 : CD8TN ...
#> Activity calculation is completed successfully!
#> Group 6 / 7 : Monocyte ...
#> Activity calculation is completed successfully!
#> Group 7 / 7 : NK ...
#> Activity calculation is completed successfully!
#> NAs were found in the activity matrix and have been replaced by the minimum value: -0.3879122 .
## 3. to calculate the activities of TF only
activity.eset <- getActivity_inBatch(input_eset = pbmc14k_expression.eset,
sjaracne_dir = system.file("extdata/demo_pbmc14k/SJARACNe", package = "scMINER"),
group_name = "trueLabel",
network_tag.tf = "bt100_pc001",
network_tag.sig = "bt100_pc001",
driver_type = "TF",
activity_method = "mean",
do.z_normalization = TRUE)
#> 7 groups were found in trueLabel ...
#> Checking network files for each group ...
#> Group 1 / 7 : B ...
#> TF network check passed!
#> Group 2 / 7 : CD4TCM ...
#> TF network check passed!
#> Group 3 / 7 : CD4TN ...
#> TF network check passed!
#> Group 4 / 7 : CD4Treg ...
#> TF network check passed!
#> Group 5 / 7 : CD8TN ...
#> TF network check passed!
#> Group 6 / 7 : Monocyte ...
#> TF network check passed!
#> Group 7 / 7 : NK ...
#> TF network check passed!
#> Calculating activity for each group ...
#> Group 1 / 7 : B ...
#> Activity calculation is completed successfully!
#> Group 2 / 7 : CD4TCM ...
#> Activity calculation is completed successfully!
#> Group 3 / 7 : CD4TN ...
#> Activity calculation is completed successfully!
#> Group 4 / 7 : CD4Treg ...
#> Activity calculation is completed successfully!
#> Group 5 / 7 : CD8TN ...
#> Activity calculation is completed successfully!
#> Group 6 / 7 : Monocyte ...
#> Activity calculation is completed successfully!
#> Group 7 / 7 : NK ...
#> Activity calculation is completed successfully!
#> NAs were found in the activity matrix and have been replaced by the minimum value: -0.3425395 .
## 4. to exclude some groups in the activity calculation (e.g. "NK" and "Monocyte")
activity.eset <- getActivity_inBatch(input_eset = pbmc14k_expression.eset,
sjaracne_dir = system.file("extdata/demo_pbmc14k/SJARACNe", package = "scMINER"),
group_name = "trueLabel",
group_exclude = c("NK", "Monocyte"),
network_tag.tf = "bt100_pc001",
network_tag.sig = "bt100_pc001",
driver_type = "TF",
activity_method = "mean",
do.z_normalization = TRUE)
#> 7 groups were found in trueLabel ...
#> 5 groups left after excluding the groups specified by group_exclude: B, CD4TCM, CD4TN, CD4Treg, CD8TN ...
#> Checking network files for each group ...
#> Group 1 / 5 : B ...
#> TF network check passed!
#> Group 2 / 5 : CD4TCM ...
#> TF network check passed!
#> Group 3 / 5 : CD4TN ...
#> TF network check passed!
#> Group 4 / 5 : CD4Treg ...
#> TF network check passed!
#> Group 5 / 5 : CD8TN ...
#> TF network check passed!
#> Calculating activity for each group ...
#> Group 1 / 5 : B ...
#> Activity calculation is completed successfully!
#> Group 2 / 5 : CD4TCM ...
#> Activity calculation is completed successfully!
#> Group 3 / 5 : CD4TN ...
#> Activity calculation is completed successfully!
#> Group 4 / 5 : CD4Treg ...
#> Activity calculation is completed successfully!
#> Group 5 / 5 : CD8TN ...
#> Activity calculation is completed successfully!
#> NAs were found in the activity matrix and have been replaced by the minimum value: -0.3425395 .
## 5. when calculate the activities from the gene expression values scaled by other methods (e.g. ScaleData() from Seurat package)
activity.eset <- getActivity_inBatch(input_eset = pbmc14k_expression.eset,
sjaracne_dir = system.file("extdata/demo_pbmc14k/SJARACNe", package = "scMINER"),
group_name = "trueLabel",
network_tag.tf = "bt100_pc001",
network_tag.sig = "bt100_pc001",
driver_type = "TF_SIG",
activity_method = "mean",
do.z_normalization = FALSE)
#> 7 groups were found in trueLabel ...
#> Checking network files for each group ...
#> Group 1 / 7 : B ...
#> TF network check passed!
#> SIG network check passed!
#> Group 2 / 7 : CD4TCM ...
#> TF network check passed!
#> SIG network check passed!
#> Group 3 / 7 : CD4TN ...
#> TF network check passed!
#> SIG network check passed!
#> Group 4 / 7 : CD4Treg ...
#> TF network check passed!
#> SIG network check passed!
#> Group 5 / 7 : CD8TN ...
#> TF network check passed!
#> SIG network check passed!
#> Group 6 / 7 : Monocyte ...
#> TF network check passed!
#> SIG network check passed!
#> Group 7 / 7 : NK ...
#> TF network check passed!
#> SIG network check passed!
#> Calculating activity for each group ...
#> Group 1 / 7 : B ...
#> Activity calculation is completed successfully!
#> Group 2 / 7 : CD4TCM ...
#> Activity calculation is completed successfully!
#> Group 3 / 7 : CD4TN ...
#> Activity calculation is completed successfully!
#> Group 4 / 7 : CD4Treg ...
#> Activity calculation is completed successfully!
#> Group 5 / 7 : CD8TN ...
#> Activity calculation is completed successfully!
#> Group 6 / 7 : Monocyte ...
#> Activity calculation is completed successfully!
#> Group 7 / 7 : NK ...
#> Activity calculation is completed successfully!
#> NAs were found in the activity matrix and have been replaced by the minimum value: 0 .