snp_manhattan | R Documentation |
Creates a manhattan plot.
snp_manhattan(
gwas,
infos.chr,
infos.pos,
colors = c("black", "grey60"),
dist.sep.chrs = 1e+07,
ind.highlight = integer(0),
col.highlight = "red",
labels = NULL,
npoints = NULL,
coeff = 1
)
gwas |
A |
infos.chr |
Vector of integers specifying each SNP's chromosome. |
infos.pos |
Vector of integers specifying the physical position
on a chromosome (in base pairs) of each SNP. |
colors |
Colors used for each chromosome (they are recycled). Default is an alternation of black and gray. |
dist.sep.chrs |
"Physical" distance that separates two chromosomes. Default is 10 Mbp. |
ind.highlight |
Indices of SNPs you want to highlight (of interest). Default doesn't highlight any SNPs. |
col.highlight |
Color used for highlighting SNPs. Default uses red. |
labels |
Labels of the x axis. Default uses the number of the
chromosome there are in |
npoints |
Number of points to keep (ranked by p-value) in order to get
a lighter object (and plot). Default doesn't cut anything.
If used, the resulting object will have an attribute called |
coeff |
Relative size of text. Default is |
If you don't have information of chromosome and position, you should simply
use plot
instead.
A ggplot2
object. You can plot it using the print
method.
You can modify it as you wish by adding layers. You might want to read
this chapter
to get more familiar with the package ggplot2.
set.seed(9)
test <- snp_attachExtdata()
G <- test$genotypes
y <- rnorm(nrow(G))
gwas <- big_univLinReg(G, y)
snp_qq(gwas)
gwas_gc <- snp_gc(gwas) # this modifies `attr(gwas_gc, "transfo")`
snp_qq(gwas_gc)
# The next plot should be prettier with a real dataset
snp_manhattan(gwas_gc,
infos.chr = test$map$chromosome,
infos.pos = test$map$physical.pos) +
ggplot2::geom_hline(yintercept = -log10(5e-8), linetype = 2, color = "red")
p <- snp_qq(gwas_gc) +
ggplot2::aes(text = asPlotlyText(test$map)) +
ggplot2::labs(subtitle = NULL, x = "Expected -log10(p)", y = "Observed -log10(p)")
## Not run: plotly::ggplotly(p, tooltip = "text")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.