Description Usage Arguments Hidden graphics parameters See Also Examples
View source: R/plot_genoprob.R
Plot the genotype probabilities for one individual on one chromosome, as a heat map.
1 2 3 4 5 6 |
probs |
Genotype probabilities (as produced by |
map |
Marker map (a list of vectors of marker positions). |
ind |
Individual to plot, either a numeric index or an ID. |
chr |
Selected chromosome to plot; a single character string. |
geno |
Optional vector of genotypes or alleles to be shown (vector of integers or character strings) |
color_scheme |
Color scheme for the heatmap (ignored if |
col |
Optional vector of colors for the heatmap. |
threshold |
Threshold for genotype probabilities; only genotypes that achieve this value somewhere on the chromosome will be shown. |
swap_axes |
If TRUE, swap the axes, so that the genotypes are on the x-axis and the chromosome position is on the y-axis. |
... |
Additional graphics parameters passed to |
x |
Genotype probabilities (as produced by [qtl2geno::calc_genoprob()]) or allele dosages (as produced by qtl2geno::genoprob_to_alleleprob()]). (For the S3 type plot function, this has to be called 'x'.) |
A number of graphics parameters can be passed via .... For
example, hlines, hlines_col, hlines_lwd, and hlines_lty to
control the horizontal grid lines. (Use hlines=NA to avoid
plotting horizontal grid lines.) Similarly vlines, vlines_col,
vlines_lwd, and vlines_lty for vertical grid lines. You can
also use many standard graphics parameters like xlab and xlim.
These are not included as formal parameters in order to avoid
cluttering the function definition.
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 48 49 | # load data and calculate genotype probabilities
library(qtl2geno)
iron <- read_cross2(system.file("extdata", "iron.zip", package="qtl2geno"))
iron <- iron[,"2"] # subset to chr 2
map <- insert_pseudomarkers(iron$gmap, step=1)
pr <- calc_genoprob(iron, map, error_prob=0.002)
# plot the probabilities for the individual labeled "262"
# (white = 0, black = 1)
plot_genoprob(pr, map, ind="262")
# change the x-axis label
plot_genoprob(pr, map, ind="262", xlab="Position (cM)")
# swap the axes so that the chromosome runs vertically
plot_genoprob(pr, map, ind="262", swap_axes=TRUE, ylab="Position (cM)")
# This is more interesting for a Diversity Outbred mouse example
## Not run:
file <- paste0("https://raw.githubusercontent.com/rqtl/",
"qtl2data/master/DOex/DOex.zip")
DOex <- read_cross2(file)
# subset to chr 2 and X and individuals labeled "232" and "256"
DOex <- DOex[c("232", "256"), c("2", "X")]
pr <- calc_genoprob(DOex, error_prob=0.002)
# plot individual "256" on chr 2 (default is to pick first chr in the probs)
plot_genoprob(pr, DOex$pmap, ind="256")
# omit states that never have probability >= 0.5
plot_genoprob(pr, DOex$pmap, ind="256", threshold=0.05)
# X chr male 232: just show the AY-HY genotype probabilities
plot_genoprob(pr, DOex$pmap, ind="232", chr="X", geno=paste0(LETTERS[1:8], "Y"))
# could also indicate genotypes by number
plot_genoprob(pr, DOex$pmap, ind="232", chr="X", geno=37:44)
# and can use negative indexes
plot_genoprob(pr, DOex$pmap, ind="232", chr="X", geno=-(1:36))
# X chr female 256: just show the first 36 genotype probabilities
plot_genoprob(pr, DOex$pmap, ind="256", chr="X", geno=1:36)
# again, can give threshold to omit genotypes whose probabilities never reach that threshold
plot_genoprob(pr, DOex$pmap, ind="256", chr="X", geno=1:36, threshold=0.5)
# can also look at the allele dosages
apr <- genoprob_to_alleleprob(pr)
plot_genoprob(apr, DOex$pmap, ind="232")
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.