Learn R Programming

qtl2 (version 0.42)

plot_geno: Plot multiple individuals' genome-wide genotypes

Description

Plot multiple individuals' genome-wide genotypes

Usage

plot_geno(
  geno,
  map,
  ind = NULL,
  chr = NULL,
  gap = 0,
  col = NULL,
  na_col = "white",
  chrlines = "white",
  swap_axes = FALSE,
  ...
)

Value

None.

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

Individuals to plot, either a numeric indexes or IDs.

chr

Selected chromosomes to plot; a vector of character strings.

gap

Gap between chromosomes

col

Vector of colors for the different genotypes.

na_col

Color for missing segments.

chrlines

Color for lines separating chromosomes

swap_axes

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

...

Additional graphics parameters

See Also

plot_onegeno(), plot_genoprob()

Examples

Run this code
# load data and calculate genotype probabilities
iron <- read_cross2(system.file("extdata", "iron.zip", package="qtl2"))
iron <- iron[1:50, ] # subset to first 50 individuals
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, minprob=0.5)

# re-code the X chr, (5,6) -> (1,3)
m[["X"]] <- (m[["X"]] - 5)*2 + 1

# plot phased genotypes
plot_geno(m, map, col=c("#FFDC00", "#00C800", "#0064C9"))

# this is more interesting for Diversity Outbred mouse data
if (FALSE) {
file <- paste0("https://raw.githubusercontent.com/rqtl/",
               "qtl2data/main/DOex/DOex.zip")
DOex <- read_cross2(file)
# subset to first 25 individuals
DOex <- DOex[1:25, ]
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_geno(ph, DOex$gmap)
}

Run the code above in your browser using DataLab