Dragonlongzhilin / RenalTumor

Single-cell multi-omics analysis reveals regulatory programs in clear cell renal cell carcinoma
https://www.nature.com/articles/s41421-022-00415-0
74 stars 30 forks source link

Error in motif enrichment script #5

Open emanuelavilla opened 1 year ago

emanuelavilla commented 1 year ago

Hello there!

I am using your code to recreate some plots for my data. However, I got an error when I tried to create the ggseqlogo plots with chromvar assay. In particular, when I run this code

pdf("5.Motif/cellType.specific.TFs.chromVAR.logo.pdf") cellType.TFs.PPM <- sapply(idents, function(x){ cellType.top.TFs <- head(rownames(cellType.motifs.chromVAR[[x]])) cellType.top.TFs <- gsub("-", "_", cellType.top.TFs) index <- match(cellType.top.TFs, names(human_pwms_v2)) PPM.list <- lapply(index, function(y){ PPM <- PWMatrixToProbMatrix(human_pwms_v2[[y]]) }) names(PPM.list) <- as.character(unlist(scATAC.data@assays$Peaks@motifs@motif.names[index])) p <- ggseqlogo(PPM.list) + ggtitle(x) + theme(plot.title = element_text(hjust = 0.5)) print(p) return(PPM.list) }) dev.off()

I received the message

Error in PWMatrixToProbMatrix(mouse_pwms_v2[[y]]) : x must be a TFBSTools::PWMatrix object

It worked for the motif plot. In addition, I am murine data, so I am using mouse_pwms_v2, but I don't think this is the problem.

Do you have any suggestions or it also happened to you while analysing your data?

Dragonlongzhilin commented 1 year ago

Hi, I tested mouse_pwms_v2 and human_pwms_v2 and did not encounter any errors. Here is the code that I tested. `library(chromVARmotifs)

data("human_pwms_v2")

data("mouse_pwms_v2") library(ggplot2)

library(ggseqlogo)

PPM.mouse <- PWMatrixToProbMatrix(mouse_pwms_v2[["Q8K439_MOUSE_LINE3883_Zfp263_I_N2"]])

PPM.human<- PWMatrixToProbMatrix(human_pwms_v2[["ENSG00000105717_LINE11890_PBX4_I_N5"]])

ggseqlogo(list(mouse = PPM.mouse, human = PPM.human)) ` I don't know why you're getting the error. I guess there might be a problem with the format of the data you inputted. Can you provide more information about your code?