Closed exhaustedpigeon-1 closed 2 years ago
Managed to figure it out! I'll close this.
test$cellike = as.character(test$cellike)
for (i in 1:nrow(test)) {
test$cellike[i] = if_else(test$OC1[i] > max(test$AC1[i],test$OPC1[i]),"OC1",
if_else(test$AC1[i]>max(test$OC1[i],test$OPC1[i]),"AC1","OPC1"))}
test$cellike = as.factor(test$cellike)
I am using a dataset looking at tumor cells. I can categorize these tumor cells as AC-like, OPC-like, ODC-like using the
AddModuleScore()
function. I want to create a violin plot to look at specific gene expression levels across AC, OPC, and ODC-like tumor cells. So, the y-axis is expression level and the x-axis is AC-like, OPC-like, and ODC-like and there are three side-by-side violin plots.I tried following #3366 and #4551, but I'm very new to R and scRNA-seq analysis so I am having a difficult time understanding/modifying the code.
I've made 3 clusters: `AClist <- list(c('Gene1','Gene2','Gene3')) seurat <- AddModuleScore(object = seurat, features = AClist, ctrl = 100, name = 'AC')
OPClist <- list(c('Gene1','Gene2','Gene3')) seurat <- AddModuleScore(object = seurat, features = OPClist, ctrl = 100, name = 'OPC')
ODClist <- list(c('Gene1','Gene2','Gene3')) seurat <- AddModuleScore(object = seurat, features = ODClist, ctrl = 100, name = 'ODC') ` How to I find the highest module score across the three and return the column name? I'd appreciate any and all help!