plot_pxg: Plot phenotype vs genotype

View source: R/plot_pxg.R

plot_pxgR Documentation

Plot phenotype vs genotype

Description

Plot phenotype vs genotype for a single putative QTL and a single phenotype.

Usage

plot_pxg(
  geno,
  pheno,
  sort = TRUE,
  SEmult = NULL,
  pooledSD = TRUE,
  swap_axes = FALSE,
  jitter = 0.2,
  force_labels = TRUE,
  alternate_labels = FALSE,
  omit_points = FALSE,
  ...
)

Arguments

geno

Vector of genotypes, for example as produced by maxmarg() with specific chr and pos.

pheno

Vector of phenotypes.

sort

If TRUE, sort genotypes from largest to smallest.

SEmult

If specified, interval estimates of the within-group averages will be displayed, as ⁠mean +/- SE * SEmult⁠.

pooledSD

If TRUE and SEmult is specified, calculated a pooled within-group SD. Otherwise, get separate estimates of the within-group SD for each group.

swap_axes

If TRUE, swap the axes, so that the genotypes are on the y-axis and the phenotype is on the x-axis.

jitter

Amount to jitter the points horizontally, if a vector of length > 0, it is taken to be the actual jitter amounts (with values between -0.5 and 0.5).

force_labels

If TRUE, force all genotype labels to be shown.

alternate_labels

If TRUE, place genotype labels in two rows

omit_points

If TRUE, omit the points, just plotting the averages (and, potentially, the +/- SE intervals).

...

Additional graphics parameters, passed to plot().

Value

(Invisibly) A matrix with rows being the genotype groups and columns for the means and (if SEmult is specified) the SEs.

Hidden graphics parameters

A number of graphics parameters can be passed via .... For example, bgcolor to control the background color, and seg_width, seg_lwd, and seg_col to control the lines at the confidence intervals. Further, 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. These are not included as formal parameters in order to avoid cluttering the function definition.

See Also

plot_coef()

Examples

# read data
iron <- read_cross2(system.file("extdata", "iron.zip", package="qtl2"))


# insert pseudomarkers into map
map <- insert_pseudomarkers(iron$gmap, step=1)

# calculate genotype probabilities
probs <- calc_genoprob(iron, map, error_prob=0.002)

# inferred genotype at a 28.6 cM on chr 16
geno <- maxmarg(probs, map, chr=16, pos=28.6, return_char=TRUE)

# plot phenotype vs genotype
plot_pxg(geno, log10(iron$pheno[,1]), ylab=expression(log[10](Liver)))

# include +/- 2 SE intervals
plot_pxg(geno, log10(iron$pheno[,1]), ylab=expression(log[10](Liver)),
         SEmult=2)

# plot just the means
plot_pxg(geno, log10(iron$pheno[,1]), ylab=expression(log[10](Liver)),
         omit_points=TRUE)

# plot just the means +/- 2 SEs
plot_pxg(geno, log10(iron$pheno[,1]), ylab=expression(log[10](Liver)),
         omit_points=TRUE, SEmult=2)

qtl2 documentation built on April 22, 2023, 1:10 a.m.