Tag Archives: length.out = len)[ypos] : replacement has length zero

[Solved] Error in ans[ypos] <- rep(yes, length.out = len)[ypos] : replacement has length zero

When running the following command:

ego.down <- enrichGO(gene = down$newid,
                   universe = bg.list$newid,
                   OrgDb = org.Hs.eg.db,
                   keyType       = 'ENSEMBL',
                   ont = "BP", # biological process, change this to "MF" for molecular function, or "CC" for cellular components
                   pAdjustMethod = "BH",
                   pvalueCutoff = 0.01,
                   qvalueCutoff = 0.05,
                   readable = TRUE)
saveRDS(ego.down,file="./GOBP.down.shRBBP6.2.RDS")

dotplot(ego.down,showCategory=20,x="GeneRatio",font.size=13) + ggtitle("GO (BP) terms of down-regulated genes\nCW468_shRBBP6_2")+
scale_y_discrete(labels=function(x) str_wrap(x,width = 40))  +
  theme(plot.title = element_text(size=16,face = "bold",hjust = .5),
        legend.title = element_text(size=15),
        legend.text = element_text(size=14))

Error reported:

Error in ans[ypos] <- rep(yes, length.out = len)[ypos] : replacement has length zero

After checking, it is found that the threshold is set too high. Just lower the threshold:

pvalueCutoff = 0.01,
qvalueCutoff = 0.05,

Replace the above with:

pvalueCutoff = 0.2,
qvalueCutoff = 0.2,