YuLab-SMU / ChIPseeker

:dart: ChIP peak Annotation, Comparison and Visualization
https://onlinelibrary.wiley.com/share/author/GYJGUBYCTRMYJFN2JFZZ?target=10.1002/cpz1.585
219 stars 74 forks source link

col parameter in plotAnnopie #201

Closed MingLi-929 closed 1 year ago

MingLi-929 commented 1 year ago

when input col parameter, plotAnnopie create an error

library(TxDb.Hsapiens.UCSC.hg19.knownGene)

files <- getSampleFiles()
txdb <- TxDb.Hsapiens.UCSC.hg19.knownGene

peakAnno <- annotatePeak(files[[4]], 
                         tssRegion=c(-3000, 3000),
                         TxDb=txdb, annoDb="org.Hs.eg.db")

nrow <- nrow(peakAnno@annoStat)

col <- c("#8dd3c7", "#ffffb3", "#bebada",
         "#fb8072", "#80b1d3", "#fdb462",
         "#b3de69", "#fccde5", "#d9d9d9",
         "#bc80bd", "#ccebc5", "#ffed6f")

cols <- col[1:nrow]

plotAnnoPie(peakAnno,col = col[1:nrow])

come with following error

> plotAnnoPie(peakAnno,col = col[1:nrow])
 Error in if (is.na(col)) { : the condition has length > 1
MingLi-929 commented 1 year ago

this bug come from https://github.com/YuLab-SMU/ChIPseeker/blob/6161ead8a0497b9d9302d6be114640094b68a39f/R/plotAnno.R#L86-L88

when the col parameter is inputed

> is.na(col[1:nrow])
 [1] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE

the bug come from above

MingLi-929 commented 1 year ago

bug fix via 8f82281