View source: R/plotting_functions.R
plot_region_data | R Documentation |
This is a function to plot statistics on a particular scaffold or chromosome, or in a particular region of that scaffold or chromosome. The input may be 1) the raw tibble from any of the loading functions, 2) a reordered tibble, or 3) a tibble with cumulative positions. This function will operate differently on each of these input types. If the input already has cumulative positions (i.e. column bp_cum), then the "from" and "to" variables are interpreted as "from = bp_cum start" and "to = bp_cum end". If the input does not have column bp_cum, then this function will generate bp_cum according to the desired chromosome or scaffold, assume that the supplied "from" and "to" arguments are scaffold positions, and determine the appropriate "from" and "to" coordinates from the new bp_cum coordinates. You may only specify a chromosome OR a scaffold.
plot_region_data(
input,
chromosome = NA,
scaffold = NA,
from = 1,
to = NA,
type = "gwas",
color = "black",
plotting_column = "stat",
scaffold_lengths,
include_all_p = FALSE
)
input |
A tibble with four named columns (scaf, ps, stat, and chr) |
chromosome |
Chromosome to plot. This OR scaffold may be specified. |
scaffold |
Scaffold to plot. This OR chromosome may be specified. |
from |
Start position, if desired. |
to |
End position, if desired |
type |
Type of statistic: gwas, popgen. |
color |
Color for points. |
plotting_column |
Name of the column to plot. Usually will be 'stat' |
scaffold_lengths |
Path to a two-column tab delimited file with scaffold and length. |
include_all_p |
Plot p-values <0.05? |
A ggplot.
a1 <- system.file("extdata", "test.gemma_gwas.txt.gz",
package = "gwplotting")
a2 <- system.file("extdata", "test.chromSizes.txt.gz",
package="gwplotting")
b <- load_gemma_gwas( a1, pval = 'p_wald' )
chrom <- b$chr[ b$scaf == "scaffold_1000" ][1]
c <- plot_region_data( b, chromosome = chrom, type = 'gwas',
plotting_column = 'stat', scaffold_lengths = a2)
c
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.