plot_snpasso: Plot SNP associations

View source: R/plot_snpasso.R

plot_snpassoR Documentation

Plot SNP associations

Description

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

Usage

plot_snpasso(
  scan1output,
  snpinfo,
  genes = NULL,
  lodcolumn = 1,
  show_all_snps = TRUE,
  chr = NULL,
  add = FALSE,
  drop_hilit = NA,
  col_hilit = "violetred",
  col = "darkslateblue",
  gap = NULL,
  minlod = 0,
  sdp_panel = FALSE,
  strain_labels = names(qtl2::CCcolors),
  ...
)

Arguments

scan1output

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

snpinfo

Data frame with SNP information with the following columns (the last three are generally derived from with 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.

chr

Vector of character strings with chromosome IDs to plot.

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. The default is 1% of the total genome length.

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.

sdp_panel

Include a panel with the strain distribution patterns for the highlighted SNPs

strain_labels

Labels for the strains, if sdp_panel=TRUE.

...

Additional graphics parameters.

Value

None.

Hidden graphics parameters

A number of graphics parameters can be passed via .... For example, bgcolor to control the background color,altbgcolor to control the background color on alternate chromosomes, altcol to control the point 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. If you are including genes and/or SDP panels, you can use panel_prop to control the relative heights of the panels, from top to bottom.

See Also

plot_scan1(), plot_coef(), plot_coefCC()

Examples

## Not run: 
# load example DO data from web
file <- paste0("https://raw.githubusercontent.com/rqtl/",
               "qtl2data/main/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)

# query function for grabbing info about variants in region
snp_dbfile <- system.file("extdata", "cc_variants_small.sqlite", package="qtl2")
query_variants <- create_variant_query_func(snp_dbfile)

# SNP association scan
out_snps <- scan1snps(apr, DOex$pmap, DOex$pheno, query_func=query_variants,
                      chr=2, start=97, end=98, 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(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)

# query function for finding genes in region
gene_dbfile <- system.file("extdata", "mouse_genes_small.sqlite", package="qtl2")
query_genes <- create_gene_query_func(gene_dbfile)
genes <- query_genes(2, 97, 98)

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

# plot SNP asso results with genes plus SDPs of highlighted SNPs
plot(out_snps$lod, out_snps$snpinfo, drop_hilit=2, genes=genes, sdp_panel=TRUE)

## End(Not run)


qtl2 documentation built on May 29, 2024, 11:46 a.m.