Description Usage Arguments Details Value Examples
View source: R/plotting_functions.R
This function will calculate the coordinates of scaffold spans or gene models for addition to a ggplot. It will use scaffold spans encoded in the input tibble. GFF features of the specified type will be plotted if a GFF file is specified.
1 2 | add_annotations(input, ymin, ymax, scaffold_lengths, gff = NA,
feature = NA, mapping = NA)
|
input |
Tibble containing scaf, ps, stat, chr, and bp_cum ONLY for the region you want to plot. |
ymin |
Minimum y positions for geom_rects. |
ymax |
Maximum y positions for geom_rects. |
scaffold_lengths |
Path to a two-column tab-delimited file containing scaffold names and their lengths. |
gff |
Path to a GFF or BED format file, if plotting gene models. |
feature |
GFF feature type to plot. Usually genes. Not extensively tested. |
mapping |
Path to reordering file. |
The input must only contain information from the region that you want to plot.
A four-column tibble containing an ID, xmins, xmaxs, ymins, and ymaxs for use in a geom_rect() call.
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 | a1 <- system.file("extdata", "test.gemma_gwas.txt.gz",
package = "gwplotting")
a2 <- system.file("extdata", "test.chromSizes.txt.gz",
package="gwplotting")
# Load statistics, add cumulative positions (bp_cum)
b <- load_gemma_gwas( a1, pval = 'p_wald' )
c <- get_cumulative_positions( b, scaffold_lengths = a2 )
# Get scaffold rects
scafs <- add_annotations( c, ymin = 0, ymax = 0.5 )
scafs
# Add rects to a plot of the region data
d <- plot_region_data( c, chromosome = 1, type = 'gwas',
plotting_column = 'stat', scaffold_lengths = a2) +
geom_rect( inherit.aes = F,
data = scafs,
mapping = aes( xmin = xmins,
xmax = xmaxs,
ymin = ymins,
ymax = ymaxs),
color = 'black',
alpha = 0.5,
size = 0.25 )
d
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.