10.1 Calculate the activities
scMINER provides two functions, getActivity_individual()
and getActivity_inBatch()
, to calculate the driver activities.
10.1.1 Calculate activities per group
getActivity_individual()
is designed to calculate the activities per group. It takes the network files as the input:
## let's use B cell as an example
activity_B.eset <- getActivity_individual(input_eset = pbmc14k_log2cpm.eset[, pData(pbmc14k_log2cpm.eset)$trueLabel == "B"],
network_file.tf = system.file("extdata/demo_pbmc14k/PBMC14k/SJARACNe/B/TF/bt100_pc001/consensus_network_ncol_.txt", package = "scMINER"),
network_file.sig = system.file("extdata/demo_pbmc14k/PBMC14k/SJARACNe/B/SIG/bt100_pc001/consensus_network_ncol_.txt", package = "scMINER"),
driver_type = "TF_SIG")
10.1.2 Calculate activities in batch
If you need to calculate the activity for multiple groups, this is usually the case, you can do it using getActivity_individual()
as shown above one by one and merge the esets after that. Or, scMINER privides another function, getActivity_inBatch()
, to calculate the activity in batch:
## let's use B cell as an example
activity.eset <- getActivity_inBatch(input_eset = pbmc14k_log2cpm.eset, sjaracne_dir = system.file("extdata/demo_pbmc14k/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 : Monocyte ...
## TF network check passed!
## SIG network check passed!
## Group 2 / 7 : B ...
## TF network check passed!
## SIG network check passed!
## Group 3 / 7 : CD4Treg ...
## TF network check passed!
## SIG network check passed!
## Group 4 / 7 : CD4TN ...
## TF network check passed!
## SIG network check passed!
## Group 5 / 7 : CD4TCM ...
## TF network check passed!
## SIG network check passed!
## Group 6 / 7 : NK ...
## TF network check passed!
## SIG network check passed!
## Group 7 / 7 : CD8TN ...
## TF network check passed!
## SIG network check passed!
## Calculating activity for each group ...
## Group 1 / 7 : Monocyte ...
## Activity calculation is completed successfully!
## Group 2 / 7 : B ...
## Activity calculation is completed successfully!
## Group 3 / 7 : CD4Treg ...
## Activity calculation is completed successfully!
## Group 4 / 7 : CD4TN ...
## Activity calculation is completed successfully!
## Group 5 / 7 : CD4TCM ...
## Activity calculation is completed successfully!
## Group 6 / 7 : NK ...
## Activity calculation is completed successfully!
## Group 7 / 7 : CD8TN ...
## Activity calculation is completed successfully!
## NAs were found in the activity matrix and have been replaced by the minimum value: -0.3968794 .