Description Usage Arguments Details Value Author(s) Examples
The function develops Mahnattan plot of p-values scaled to -log10(p). If polar type of Manhattan plot is desired use the function manhatton.circos. Manhattan plot (Gibson 2010) are popular in plotting association mapping results, however can be used to plot other results genome-wide.
1 2 3 | manhatton.plot(dataframe, SNPname, chromosome, position, pvcol, ylabel = "pvalue", pconv= "-log10", ymax = "maximum",
ymin = "minimum", gapbp = 500, pch = c(18, 19, 20), color = c("midnightblue",
"lightpink4", "blue"), line1, line2)
|
dataframe |
dataframe with SNP name (SNPname), chromosome, physical position (position), p-value columns. |
SNPname |
Name of variable consisting of SNP name - (eg. "SNPN") |
chromosome |
Name of variable column consisting of chromosome - ( eg. "chr") |
position |
Name of variable column consisting of physical position of SNPs - (eg. "physicaldis") |
pvcol |
Name of p-value column to be used for plotting, dataframe can consists of multiple p-value column, can be plotted one by one. Note that p-value should not contain zero or Inf or NaNs |
ylabel |
Y axis label, only if pconv is not "-log10", defualt is "pvalue" |
ymax |
Maximum value to be plotted in Y axis, if ymax is less than 8, the plot will set the maximum to 8 otherwise user defined maximum. |
ymin |
Minimum value to be plotted in X axis. |
gapbp |
Gap between two adjecent chromsomome for plotting. Should be specified to scale of distances provided for X axis (ie. base pair). The default value is 500. |
pch |
The list of symbol type used to plot in the plot, maximum allowed is equal to number of chrosomomes plotted. If the number is less than total number of chromosomes, the pch is recycled till end. |
color |
The list of color type used to plot in the plot, maximum allowed is equal to number of chrosomomes plotted. If the number is less than total number of chromosomes, the color is recycled till end. The number of color should be equal to number of pch. |
line1 |
Value at the point where you need to Horizental threshold line 1. NULL for no line |
line2 |
Value at the point where you need to Horizental threshold line 2. NULL for no line |
Most of plot prameters (not conflicting with specified here) can be applied to plot.
Produce Manhattan plot
Umesh Rosyara
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | # Example 1
data12 <- data.frame (snp = 1: 2000*20 , chr = c(rep(1:20, each = 2000)),
pos= rep(1:2000, 20), pval= rnorm(2000*20, 0.001, 0.005))
manhatton.plot(dataframe = data12, SNPname = "snp", chromosome = "chr",
position = "pos", pvcol = "pval",ymax = "maximum", ymin = 0, gapbp = 500,
color=c("hotpink3","dodgerblue4"), line1 = 3, line2 = 5, pch = c(1,20) )
manhatton.plot(dataframe = data12, SNPname = "snp", chromosome = "chr", position = "pos",
pvcol = "pval",ymax = 10, ymin = 2, gapbp = 500, color=c("dodgerblue4"),
line1 = 3, line2 = 5, pch = 20 )
manhatton.plot(dataframe = data12, SNPname = "snp", chromosome = "chr", position = "pos",
pvcol = "pval",ymax = "maximum", ymin = 0, gapbp = 500,
color=c("midnightblue", "lightpink4", "blue"),
line1 = 3, line2 = 5, pch = c("*", "+", "a") )
manhatton.plot(dataframe = data12, SNPname = "snp", chromosome = "chr", position = "pos",
pvcol = "pval",ymax = "maximum", ymin = 0, gapbp = 500, color= "cadetblue",
line1 = 3, line2 = 5, pch = 19)
# all different color and pch example
cbPalette <- c("#999999", "#E69F00", "#56B4E9", "#009E73",
"#F0E442", "#0072B2", "#D55E00", "#CC79A7","#CD661D", "#FF00FF","#8B6508",
"#D2691E","#008B00", "#8B1A1A", "#8B3A62", "#8B864E", "#3CB371", "#8B5742",
"#8B5A00", "#36648B")
manhatton.plot(dataframe = data12, SNPname = "snp", chromosome = "chr", position = "pos",
pvcol = "pval",ymax = "maximum", ymin = 0, gapbp = 500, color= cbPalette,
line1 = 3, line2 = 5, pch = 1:20)
# Example 2
set.seed(123)
data22 <- data.frame (snp = 1: 20000*5 , chr = c(rep(1:5, each = 20000)),
pos= rep(1:20000, 5), pval1= rnorm(20000*5, 0.2, 0.3),
pval2 = rnorm(20000*5, 0.2, 0.3) )
# the above simulation produce negative values so the following will replace
# negative values with NA
data22$pval1[data22$pval1 < 0] <- NA
# removal of negative values
dat2 <- data22[!is.na(data22$pval1),]
op <- par(mfrow=c(2,1), cex.axis = 0.75, font = 1, family = "serif")
par(op)
manhatton.plot(dataframe = dat2, SNPname = "snp", chromosome = "chr", position = "pos",
pvcol = "pval1", line1 = 4, line2 = 8, ymax = "maximum", ymin = 0, gapbp = 2000)
title(main = "Mahattan plot of results for trait1", sub = "Method: Linear mixed model")
manhatton.plot(dataframe = dat2, SNPname = "snp", chromosome = "chr", position = "pos",
pvcol = "pval2", line1 = 4, line2 = 8, ymax = "maximum", ymin = 0)
title(main = "Mahattan plot of results for trait2", sub = "Method: Linear mixed model")
# Example 3, plotting simple p-value or R-square
data13 <- data.frame (snp = 1: 2000*20 , chr = c(rep(1:20, each = 2000)),
pos= rep(1:2000, 20), pval= rnorm(2000*20, 0.15, 0.05))
manhatton.plot(dataframe = data13, pconv= "NULL", ylabel = "R-square", SNPname = "snp", chromosome = "chr",
position = "pos", pvcol = "pval",ymax = "maximum", ymin = 0, gapbp = 500,
color=c("hotpink3","dodgerblue4"), line1 = 3, line2 = 5, pch = c(1,20) )
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.