How to realize manhattan Diagram in r language
This article mainly introduces "how to realize Manhattan diagram in r language". In daily operation, I believe many people have doubts about how to realize Manhattan diagram in r language. Xiaobian consulted all kinds of materials and sorted out simple and easy operation methods. I hope to help you answer the doubts of "how to realize Manhattan diagram in r language"! Next, please follow the small series to learn together!
I. R-qqman package
The R package will be installed and loaded as follows:
Install: install.packages ('qqman ')
Loading: library(qqman)
head(gwasResults,3) #view qqman provide qwas sample data (gwasResult)
SNP CHR BP P
1 rs1 1 1 0.9148060
2 rs2 1 2 0.9370754
3 rs3 1 3 0.2861395
Among them: SNP--snp name, CHR--chromosome number, BP--base position, P--p value;
The simplest Manhattan:
manhattan(gwasResults)
2) Add title, adjust color, highlight some SNPs and other details
head(snpOfInterest) #View built-in highlight snp data, snpOfInterest can be set by yourself
manhattan(gwasResults, col = c("blue4", "orange3"), main = "Results from simulated trait",genomewideline = FALSE, suggestiveline = FALSE,highlight = snpsOfInterest[1:10])
Among them, parameters:
CHR3 green dot from snpsOfInterest, highlight parameter control;
The blue horizontal line is controlled by the parameter sugfestival line;
The red horizontal line is controlled by the parameter genomeguideline;
3) Batch expression of gene names
gwasResults[3057,1]