科研绘图

2023-10-14 | 环状曼哈顿图

2023-10-13  本文已影响0人  千万别加香菜

数据准备

#SNP chr    pos Somatic cell score  Milk yield Fat   percentage
#1 SNP1   1  59082        0.000244361 0.000484255    0.001379210
#2 SNP2   1 118164        0.000532272 0.000039800    0.000598951

通过R的merge将三个数据合并为上述要求,输入文件只需要是chr bp value形式即可

绘图
library(CMplot)
data1 <- read.table("wag_A-H.windowed.weir.fst",sep='\t', header = TRUE)
data2 <- read.table("A_H-Wag.norm.XPEHH",sep='\t', header = TRUE)
data3 <- read.table("wag_A-H-lnratio.txt", sep='\t', header = TRUE)

merged_data <- merge(merge(data1, data2, by=c("CHR","BP")), 
                     data3, by=c("CHR","BP"))
input_data <- merged_data[,c(3,1,2,4,6,8)]

CMplot(input_data,type="p",plot.type="c",LOG10=FALSE,outward=TRUE,
       col=matrix(c("#4DAF4A", NA, NA,
                    "dodgerblue4","deepskyblue", NA,
                    "dodgerblue1", "olivedrab3", "darkgoldenrod1"), 
                    nrow=3, byrow=TRUE),
       chr.labels=paste("Chr",c(1:29),sep=""),threshold=NULL,r=1.5,cir.chr.h=1.5,
       cir.band=1,file="jpg", dpi=600,chr.den.col="black",
       file.output=T,verbose=TRUE,width=10,height=10)

结果示意

image.png
上一篇 下一篇

猜你喜欢

热点阅读