View source: R/plotting_functions.R
plot_qq | R Documentation |
Generate qq (quantile-quantile) plots for p-values, splitting by provided
facets, using either a snpRdata object or a data.frame. Produces a
ggplot
object, which is modifiable as usual.
plot_qq(x, plot_var, facets = NULL, lambda_gc_correction = FALSE)
x |
snpRdata object or data.frame containing p-values to plot. |
plot_var |
character, name of the p-values to plot. For a snpRdata
object, the name should refer to the name of the column produced when
fetching data via |
facets |
character, default NULL. Facets by which to split the plot. See
|
lambda_gc_correction |
Correct for inflated significance due to
population and/or family structure using the |
William Hemstrom
Price, A., Zaitlen, N., Reich, D. et al. New approaches to population stratification in genome-wide association studies. Nat Rev Genet 11, 459–463 (2010). https://doi.org/10.1038/nrg2813
## Not run:
# from a snpRdata object directly
x <- stickSNPs
sample.meta(x)$phenotype <- sample(c("case", "control"), nsamps(stickSNPs), TRUE)
x <- calc_association(x, c("pop.fam", "pop", ".base"), "phenotype",
method = "armitage")
p <- plot_qq(x, "p_armitage_phenotype", c("pop.fam", "pop", ".base"))
# from a data.frame
y <- get.snpR.stats(x, c("pop.fam", "pop", ".base"), "association")
y <- y$single
# with facet/subfacet columns:
p <- plot_qq(y, "p_armitage_phenotype", c("fam.pop", "pop", ".base"))
# from raw data with only one faceting column
z <- y[y$facet == "pop",]
z <- z[,c(1, 5)]
colnames(z)[1] <- "pop"
p <- plot_qq(z, "p_armitage_phenotype", "pop")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.