Given genes, calculate pseudobulk expression
Idents(combined) <- 'cluster'
DefaultAssay(combined) <- 'RNA'
combined <- NormalizeData(combined)
plotBulkHeatmap <- function(x){
combined.tmp <- ScaleData(combined, features = x)
x <- intersect(x, GetAssayData(combined.tmp, slot = 'scale.data'))
mat <- AverageExpression(combined.tmp, features = x, slot = 'scale.data')
mat1 <- mat$RNA
re <- pheatmap::pheatmap(mat1, angle_col = 45, border = NA)
return(re)
}
plotBulkHeatmap2 <- function(x){
x <- intersect(x, rownames(GetAssayData(combined, slot = 'data')))
mat <- AverageExpression(combined, features = x, slot = 'data')
mat1 <- t(scale(t(mat$RNA)))
re <- pheatmap::pheatmap(mat1, angle_col = 45, border = NA)
return(re)
}
gn <- c('SOX9', 'HOXP', 'MKI67', 'EOMES', 'NEUROD2', 'SATB2', 'NR4A2', 'GAD1', 'GAD2')
plotBulkHeatmap(gn)
## Centering and scaling data matrix
## Finished averaging RNA for cluster RG
## Finished averaging RNA for cluster Cycling
## Finished averaging RNA for cluster OPC
## Finished averaging RNA for cluster IP
## Finished averaging RNA for cluster ExN
## Finished averaging RNA for cluster ExM
## Finished averaging RNA for cluster ExU
## Finished averaging RNA for cluster ExDp
## Finished averaging RNA for cluster InMGE
## Finished averaging RNA for cluster InCGE
## Finished averaging RNA for cluster InPSB
## Finished averaging RNA for cluster Mic
## Finished averaging RNA for cluster Per
## Finished averaging RNA for cluster End
## Finished averaging SCT for cluster RG
## Finished averaging SCT for cluster Cycling
## Finished averaging SCT for cluster OPC
## Finished averaging SCT for cluster IP
## Finished averaging SCT for cluster ExN
## Finished averaging SCT for cluster ExM
## Finished averaging SCT for cluster ExU
## Finished averaging SCT for cluster ExDp
## Finished averaging SCT for cluster InMGE
## Finished averaging SCT for cluster InCGE
## Finished averaging SCT for cluster InPSB
## Finished averaging SCT for cluster Mic
## Finished averaging SCT for cluster Per
## Finished averaging SCT for cluster End
## Finished averaging RNA for cluster RG
## Finished averaging RNA for cluster Cycling
## Finished averaging RNA for cluster OPC
## Finished averaging RNA for cluster IP
## Finished averaging RNA for cluster ExN
## Finished averaging RNA for cluster ExM
## Finished averaging RNA for cluster ExU
## Finished averaging RNA for cluster ExDp
## Finished averaging RNA for cluster InMGE
## Finished averaging RNA for cluster InCGE
## Finished averaging RNA for cluster InPSB
## Finished averaging RNA for cluster Mic
## Finished averaging RNA for cluster Per
## Finished averaging RNA for cluster End
## Finished averaging SCT for cluster RG
## Finished averaging SCT for cluster Cycling
## Finished averaging SCT for cluster OPC
## Finished averaging SCT for cluster IP
## Finished averaging SCT for cluster ExN
## Finished averaging SCT for cluster ExM
## Finished averaging SCT for cluster ExU
## Finished averaging SCT for cluster ExDp
## Finished averaging SCT for cluster InMGE
## Finished averaging SCT for cluster InCGE
## Finished averaging SCT for cluster InPSB
## Finished averaging SCT for cluster Mic
## Finished averaging SCT for cluster Per
## Finished averaging SCT for cluster End