plot_onegeno: Plot one individual's genome-wide genotypes

View source: R/plot_onegeno.R

plot_onegenoR Documentation

Plot one individual's genome-wide genotypes

Description

Plot one individual's genome-wide genotypes

Usage

plot_onegeno(
  geno,
  map,
  ind = 1,
  chr = NULL,
  col = NULL,
  na_col = "white",
  swap_axes = FALSE,
  border = "black",
  shift = FALSE,
  chrwidth = 0.5,
  ...
)

Arguments

geno

Imputed phase-known genotypes, as a list of matrices (as produced by maxmarg()) or a list of three-dimensional arrays (as produced by guess_phase()).

map

Marker map (a list of vectors of marker positions).

ind

Individual to plot, either a numeric index or an ID.

chr

Selected chromosomes to plot; a vector of character strings.

col

Vector of colors for the different genotypes.

na_col

Color for missing segments.

swap_axes

If TRUE, swap the axes, so that the chromosomes run horizontally.

border

Color of outer border around chromosome rectangles.

shift

If TRUE, shift the chromosomes so they all start at 0.

chrwidth

Total width of rectangles for each chromosome, as a fraction of the distance between them.

...

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. These are not included as formal parameters in order to avoid cluttering the function definition.

Examples

# load data and calculate genotype probabilities
iron <- read_cross2(system.file("extdata", "iron.zip", package="qtl2"))
iron <- iron["146", ] # subset to individual 146
map <- insert_pseudomarkers(iron$gmap, step=1)
pr <- calc_genoprob(iron, map, error_prob=0.002)

# infer genotypes, as those with maximal marginal probability
m <- maxmarg(pr)

# guess phase
ph <- guess_phase(iron, m)

# plot phased genotypes
plot_onegeno(ph, map, shift=TRUE, col=c("slateblue", "Orchid"))

# this is more interesting for Diversity Outbred mouse data
## Not run: 
file <- paste0("https://raw.githubusercontent.com/rqtl/",
               "qtl2data/main/DOex/DOex.zip")
DOex <- read_cross2(file)
# subset to individuals labeled "232" and "256"
DOex <- DOex[c("232", "256"), ]
pr <- calc_genoprob(DOex, error_prob=0.002)

# infer genotypes, as those with maximal marginal probability
m <- maxmarg(pr, minprob=0.5)
# guess phase
ph <- guess_phase(DOex, m)

# plot phased genotypes
plot_onegeno(ph, DOex$gmap, shift=TRUE)
plot_onegeno(ph, DOex$gmap, ind="256", shift=TRUE)

## End(Not run)


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