Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

This palatte have 20 colors! No more than 4 columns! 错误: names of text should have overlap to levels in align_to. #79

Open
Jingjing0124 opened this issue Jul 12, 2024 · 6 comments

Comments

@Jingjing0124
Copy link

老师您好 ClusterGVi 最后添加各cluster 富集注释信息时出现 This palatte have 20 colors! No more than 4 columns! 错误: names of text should have overlap to levels in align_to.
请问如何解决

@junjunlab
Copy link
Owner

请提供你的代码

@Taoli0113
Copy link

Taoli0113 commented Aug 13, 2024

请提供你的代码

老师您好,我遇到了相同的问题@junjun,我的WGCNA结果总共有26个module,60个样本,包含19200个基因,使用clusterGVis的heatmap可以绘制,但enrichGO以后添加富集功能信息报错,我的代码如下:
library(ClusterGVis)
library(ComplexHeatmap)
library(org.Hs.eg.db)
library(cols4all)

write.csv(datExpr0,"datExpr0.csv")
str(bwnet)

exp <- datExpr0
expt <- t(datExpr0)

get data

cw <- clusterData(exp = exp,
cluster.method = "wgcna",
object = bwnet_filtered)
str(cw)

add gene name

markGenes = rownames(expt)[sample(1:nrow(expt),30,replace = F)]

pdf('./ClusterGVis/GvisCluster_cw_16Area_line.pdf', height = 6, width = 16, onefile = F)
visCluster(
object = cw,
plot.type = "line", #折线图
add.mline = TRUE #是否显示中位折线
)
dev.off()

heatmap

pdf('./ClusterGVis/netht.pdf',height = 10,width = 6,onefile = F)
visCluster(object = cw,
plot.type = "heatmap",
markGenes = markGenes)
dev.off()

GO

enrich <- enrichCluster(object = cw,
OrgDb = org.Hs.eg.db,
type = "BP", #"BP","MF","CC" or "KEGG"
pvalueCutoff = 0.05,
topn = 5,
add.gene = TRUE) #显示top5 GO term
head(enrich)
write.csv(enrich,"./ClusterGVis/GO_P0.05_500_cw.csv")

pdf('./ClusterGVis/GO_P0.05_cw.pdf', height = 20, width = 12, onefile = F)
visCluster(
object = cw,
plot.type = "both",
column_names_rot = 60,
markGenes.side = "left",
genes.gp = c('italic',fontsize = 13),
show_row_dend = F,
ht.col.list = list(col_range = c(-2, 0, 2),
col_color = c("#0da9ce", "white", "#e74a32")),
annoTerm.data = enrich,
go.size = "pval", #按p值显示注释大小
line.side = "left" #将表达趋势折线图放到左侧
)
dev.off()

最后一张图报错:

visCluster(

  • object = cw,
  • plot.type = "both",
  • column_names_rot = 60,
  • markGenes.side = "left",
  • genes.gp = c('italic',fontsize = 13),
  • show_row_dend = F,
  • ht.col.list = list(col_range = c(-2, 0, 2),
  •                  col_color =  c("#0da9ce", "white", "#e74a32")),
    
  • annoTerm.data = enrich,
  • go.size = "pval", #按p值显示注释大小
  • line.side = "left" #将表达趋势折线图放到左侧
  • )
    This palatte have 20 colors!
    No more than 4 columns!
    Error: names of text should have overlap to levels in align_to.
    In addition: Warning message:
    Unknown or uninitialised column: size.

@elegantmedstu
Copy link

elegantmedstu commented Oct 17, 2024

当绘制kegg时报错,绘制go时无问题。
报错是:This palatte have 20 colors!
No more than 4 columns!
Error: names of text should have overlap to levels in align_to.
错误似乎出现在参数plot.type = "both",当单纯绘制线图或者热图时没有出现报错

enrich <- enrichCluster(object = ck,
OrgDb = org.Hs.eg.db,
organism = 'hsa',
topn = 3,
add.gene = T, # whether return genes for output, default FALSE.
type = "KEGG", # which type to choose for enrichment "BP","MF","CC","KEGG" or "ownSet".
pvalueCutoff = 0.05,
seed = 5201314)
'select()' returned 1:1 mapping between keys and columns
'select()' returned 1:1 mapping between keys and columns
'select()' returned 1:1 mapping between keys and columns
'select()' returned 1:1 mapping between keys and columns
'select()' returned 1:many mapping between keys and columns
'select()' returned 1:1 mapping between keys and columns
'select()' returned 1:1 mapping between keys and columns
'select()' returned 1:1 mapping between keys and columns
Warning messages:
1: In clusterProfiler::bitr(tmp$gene, fromType = fromType, toType = toType, :
43.72% of input gene IDs are fail to map...
2: In clusterProfiler::bitr(tmp$gene, fromType = fromType, toType = toType, :
30.16% of input gene IDs are fail to map...
3: In clusterProfiler::bitr(tmp$gene, fromType = fromType, toType = toType, :
32.4% of input gene IDs are fail to map...
4: In clusterProfiler::bitr(tmp$gene, fromType = fromType, toType = toType, :
37.24% of input gene IDs are fail to map...
5: In clusterProfiler::bitr(tmp$gene, fromType = fromType, toType = toType, :
33.84% of input gene IDs are fail to map...
6: In clusterProfiler::bitr(tmp$gene, fromType = fromType, toType = toType, :
34.11% of input gene IDs are fail to map...
7: In clusterProfiler::bitr(tmp$gene, fromType = fromType, toType = toType, :
37.57% of input gene IDs are fail to map...
8: In clusterProfiler::bitr(tmp$gene, fromType = fromType, toType = toType, :
32.42% of input gene IDs are fail to map...

visCluster(object = ck,
plot.type = "both", # the plot type to choose which incuding "line","heatmap" and "both".
column_names_rot = 45,
markGenes = markGenes,
annoTerm.data = enrich,
go.size = 10,
#go.size = "pval", #按P值调整字体大小
line.side = "left", # 通路富集的注释连接与折线图的右边似乎并不太恰当
show_row_dend = F, # 不显示聚类树
term.text.limit = c(8,18))
This palatte have 20 colors!
No more than 4 columns!
Error: names of text should have overlap to levels in align_to.

@elegantmedstu
Copy link

问题出现在dd.gene = T,当设置为T时返回第5行,引起报错
enrichCluster(object = ck,
OrgDb = org.Hs.eg.db,
organism = 'hsa',
topn = 3,
add.gene = T, # whether return genes for output, default FALSE.
type = "KEGG", # which type to choose for enrichment "BP","MF","CC","KEGG" or "ownSet".
pvalueCutoff = 0.05,
seed = 5201314)

一个解决方法是:visCluster(object = ck,plot.type = "both",column_names_rot = 45,markGenes = markGenes,annoTerm.data = enrich[,1:4])

@junjunlab
Copy link
Owner

富集结果不能超过四列数据,可以自己处理一下

@Taoli0113
Copy link

富集结果不能超过四列数据,可以自己处理一下

好的好的,谢谢junjun老师!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants