Learn R Programming

diemr (version 1.4.3)

plotMarkerAxis: Add a Marker Axis with Chromosome Names to a Plot of Polarized Genotypes

Description

This function adds a marker axis with chromosome names to an existing plot of polarized genotypes. It requires that the plot is already created using plotPolarized.

Usage

plotMarkerAxis(
  includedSites,
  ChosenSites,
  tickDist = 1e+06,
  axisInfo = NULL,
  ...
)

Value

Returns an invisible axisInfo list with the tick positions and labels for the marker axis.

Arguments

includedSites

A character path to a file with columns CHROM and POS.

ChosenSites

A logical vector indicating which sites are to be included in the analysis.

tickDist

A numeric indicating the spacing of physical tick marks along a chromosome.

axisInfo

A list with user-defined tick positions and labels for marker axis. See Details.

...

additional arguments.

Details

The includedSites file should ideally be generated by vcf2diem to ensure congruence between the plotted genotypes and the respective metadata.

Tick mark distances within a chromosome are located at tickDist and formated to multiples of millions.

The optional axisInfo argument must have five named elements with the following information:

  • CHROMbreaks: Numeric vector with positions defining ticks separating chromosomes. The metric for all positions is in the number of markers.

  • CHROMnamesPos: Numeric vector with positions to place the chromosome labels.

  • CHROMnames: Character vector with the names of the chromosomes. Must be the same length as CHROMnamesPos.

  • ticksPos: Numeric vector with positions of ticks within chromosomes.

  • ticksNames: Character vector with the names to be displayed at ticksPos.

When axisInfo = NULL, the function extracts the necessary information from the includedSites file.

Examples

Run this code
if (FALSE) {
# Run this example in a working directory with write permissions
myo <- system.file("extdata", "myotis.vcf", package = "diemr")
vcf2diem(myo, "myo")
inds <- 1:14
fit <- diem("myo-001.txt", ChosenInds = inds, ploidy = FALSE)
gen <- importPolarized("myo-001.txt", fit$markerPolarity, inds)
h <- apply(gen, 1, function(x) pHetErrOnStateCount(sStateCount(x)))[1, ]
plotPolarized(gen, h, xlab = "")
plotMarkerAxis("myo-includedSites.txt", rep(TRUE, 11), tickDist = 100)
}

Run the code above in your browser using DataLab