我想在VP上显示重要基因的基因标签,我如何设置一个阈值来显示数据集中上调和下调的前x个基因。
非常感谢!
数据代码
Pro_FvsM <- data.frame(log2FC = FprovM_df$log.foldchange_F_pro.M,
logpv = -log10(FprovM_df$pvalue))
Pro_FvsM$diffexpressed <- "NON-Significant"
Pro_FvsM$diffexpressed[Pro_FvsM$log2FC > 0.8] <- "UP"
Pro_FvsM$diffexpressed[Pro_FvsM$log2FC < -0.8] <- "DOWN"
GeneList <- FprovM_df$Genes
Pro_FvsM_2 <- cbind(Pro_FvsM, GeneList)
Pro_FvsM_2$genelabels <- ""
地块代码
ggplot(Pro_FvsM_2) + geom_point(aes(log2FC, logpv, col = diffexpressed)) + geom_text_repel(aes(log2FC, logpv), label = ifelse(Pro_FvsM_2$GeneList == TRUE, as.character(Pro_FvsM_2$GeneList), ""), box.padding = unit(0.75, "lines"), hjust = 0.35) + theme(legend.title = element_blank(), text = element_text(size = 15)) + scale_color_manual(values = c("red", "blue", "green"))
1条答案
按热度按时间lmvvr0a81#
你可以把数据分成子集,然后绘图,你没有提供一个可复制的例子,所以我从这里下载了一些类似的基因数据,然后把它作为
df
读入。代码:
情节: