plot_snpasso: Plot SNP associations

Description Usage Arguments Hidden graphics parameters See Also Examples

View source: R/plot_snpasso.R

Description

Plot SNP associations, with possible expansion from distinct snps to all snps.

Usage

1
2
3
4
plot_snpasso(scan1output, snpinfo, genes = NULL, lodcolumn = 1,
  show_all_snps = TRUE, add = FALSE, drop_hilit = NA,
  col_hilit = "violetred", col = "darkslateblue", gap = 25, minlod = 0,
  ...)

Arguments

scan1output

Output of qtl2scan::scan1() using SNP probabilities derived by qtl2scan::genoprob_to_snpprob().

snpinfo

Data frame with SNP information with the following columns (the last three are generally derived from with qtl2scan::index_snps()):

  • chr - Character string or factor with chromosome

  • pos - Position (in same units as in the "map" attribute in genoprobs.

  • sdp - Strain distribution pattern: an integer, between 1 and 2^n - 2 where n is the number of strains, whose binary encoding indicates the founder genotypes

  • snp - Character string with SNP identifier (if missing, the rownames are used).

  • index - Indices that indicate equivalent groups of SNPs.

  • intervals - Indexes that indicate which marker intervals the SNPs reside.

  • on_map - Indicate whether SNP coincides with a marker in the genoprobs

genes

Optional data frame containing gene information for the region, with columns start and stop in Mbp, strand (as "-", "+", or NA), and Name. If included, a two-panel plot is produced, with SNP associations above and gene locations below.

lodcolumn

LOD score column to plot (a numeric index, or a character string for a column name). Only one value allowed.

show_all_snps

If TRUE, expand to show all SNPs.

add

If TRUE, add to current plot (must have same map and chromosomes).

drop_hilit

SNPs with LOD score within this amount of the maximum SNP association will be highlighted.

col_hilit

Color of highlighted points

col

Color of other points

gap

Gap between chromosomes.

minlod

Minimum LOD to display. (Mostly for GWAS, in which case using minlod=1 will greatly increase the plotting speed, since the vast majority of points would be omittted.

...

Additional graphics parameters.

Hidden graphics parameters

A number of graphics parameters can be passed via .... For example, bgcolor to control the background color and altbgcolor to control the background color on alternate chromosomes. cex for character expansion for the points (default 0.5), pch for the plotting character for the points (default 16), and ylim for y-axis limits.

See Also

plot_scan1(), plot_coef(), plot_coefCC()

Examples

 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
# load example DO data from web
library(qtl2geno)
file <- paste0("https://raw.githubusercontent.com/rqtl/",
               "qtl2data/master/DOex/DOex.zip")
DOex <- read_cross2(file)

# subset to chr 2
DOex <- DOex[,"2"]

# calculate genotype probabilities and convert to allele probabilities
pr <- calc_genoprob(DOex, error_prob=0.002)
apr <- genoprob_to_alleleprob(pr)

# download snp info from web
tmpfile <- tempfile()
file <- paste0("https://raw.githubusercontent.com/rqtl/",
               "qtl2data/master/DOex/c2_snpinfo.rds")
download.file(file, tmpfile, quiet=TRUE)
snpinfo <- readRDS(tmpfile)
unlink(tmpfile)

# SNP association scan
library(qtl2scan)
out_snps <- scan1snps(apr, DOex$pmap, DOex$pheno, snpinfo=snpinfo, keep_all_snps=TRUE)

# plot results
plot_snpasso(out_snps$lod, out_snps$snpinfo)

# can also just type plot()
plot(out_snps$lod, out_snps$snpinfo)

# plot just subset of distinct SNPs
plot_snpasso(out_snps$lod, out_snps$snpinfo, show_all_snps=FALSE)

# highlight the top snps (with LOD within 1.5 of max)
plot(out_snps$lod, out_snps$snpinfo, drop_hilit=1.5)

# download gene info from web
tmpfile <- tempfile()
file <- paste0("https://raw.githubusercontent.com/rqtl/",
               "qtl2data/master/DOex/c2_genes.rds")
download.file(file, tmpfile, quiet=TRUE)
genes <- readRDS(tmpfile)
unlink(tmpfile)

# plot SNP association results with gene locations
plot(out_snps$lod, out_snps$snpinfo, drop_hilit=1.5, genes=genes)

rqtl/qtl2plot documentation built on May 28, 2019, 2:36 a.m.