addModuleScore | R Documentation |
This function calculates a module score from a set of features across all cells. This allows for
grouping of multiple features together into a single quantitative measurement. Currently, this
function only works for modules derived from the GeneScoreMatrix
. Each module is added as a
new column in cellColData
addModuleScore(
ArchRProj = NULL,
useMatrix = NULL,
name = "Module",
features = NULL,
nBin = 25,
nBgd = 100,
seed = 1,
threads = getArchRThreads(),
verbose = TRUE,
logFile = createLogFile("addModuleScore")
)
ArchRProj |
An |
useMatrix |
The name of the matrix to be used for calculation of the module score. See |
name |
The name to be given to the designated module. If |
features |
A list of feature names to be grouped into modules. For example, |
nBin |
The number of bins to use to divide all features for identification of signal-matched features for background calculation |
nBgd |
The number of background features to use for signal normalization. |
seed |
A number to be used as the seed for random number generation required when sampling cells for the background set. It is recommended to keep track of the seed used so that you can reproduce results downstream. |
threads |
The number of threads to be used for parallel computing. |
verbose |
A boolean value that determines whether standard output includes verbose sections. |
logFile |
The path to a file to be used for logging ArchR output. |
# Get Test ArchR Project
proj <- getTestProject()
# Add Module Score
proj <- addModuleScore(proj, useMatrix = "GeneScoreMatrix", nBin = 25, nBgd = 25, features = list(TScore = c('CD3D', 'CD3E')))
#Check
split(proj@cellColData$Module.TScore, proj@cellColData$CellType) %>% lapply(mean) %>% unlist
# B M T
# -4.352769 -8.438259 9.942678
#Get T cell Features
features <- getGenes()
T <- features[features$symbol %in% c("CD3D", "CD3E")]
B <- features[features$symbol %in% c("MS4A1")]
# Add Module Score
proj <- addModuleScore(proj, useMatrix = "TileMatrix", nBin = 25, nBgd = 25, features = list(TScore = T, BScore = B))
#Check
split(proj@cellColData$Module.TScore, proj@cellColData$CellType) %>% lapply(mean) %>% unlist
# B M T
# -0.03866667 -0.05303030 0.10306122
split(proj@cellColData$Module.BScore, proj@cellColData$CellType) %>% lapply(mean) %>% unlist
# B M T
# 0.10000000 -0.03939394 -0.05387755
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.