Skip to contents

Creates a plot for an object of class IBDprob. Six types of plot can be made:

  • singleGeno A plot for a single genotype showing the IBD probabilities for all parents across the genome.

  • allGeno A plot showing for all genotypes the IBD probabilities of the parent with the highest probability per marker.

  • pedigree A plot showing the structure of the pedigree of the population.

  • map A plot of the genetic map showing the length of the chromosomes and the positions of the markers.

  • meanProbs A plot showing the coverage of each parent across the population.

  • totalCoverage A plot showing the total coverage of each parent.

Usage

# S3 method for IBDprob
plot(
  x,
  ...,
  plotType = c("singleGeno", "allGeno", "pedigree", "map", "meanProbs", "totalCoverage"),
  genotype,
  chr = NULL,
  title = NULL,
  output = TRUE
)

Arguments

x

An object of class IBDprob.

...

Further arguments. Unused.

plotType

A character string indicating the type of plot that should be made.

genotype

A character string indicating the genotype for which the plot should be made. Only for plotType = "singleGeno".

chr

A character vector indicating the chromosomes to which the coverage should be restricted. Only for plotType = "meanProbs" and plotType = "totalCoverage". If NULL all chromosomes are included.

title

A character string, the title of the plot.

output

Should the plot be output to the current device? If FALSE, only a ggplot object is invisibly returned.

Value

A ggplot object is invisibly returned.

Examples

if (FALSE) {
## Compute IBD probabilities for Steptoe Morex.
## Add extra evaluation positions in between exiting marker positions
## to assure evaluation positions are at most 2 cM apart.
SxMIBD_Ext <- calcIBD(popType = "DH",
                      markerFile = system.file("extdata/SxM", "SxM_geno.txt",
                                              package = "statgenIBD"),
                      mapFile = system.file("extdata/SxM", "SxM_map.txt",
                                           package = "statgenIBD"),
                      evalDist = 2)

## Plot results for genotype dh005.
plot(SxMIBD_Ext,
     plotType = "singleGeno",
     genotype = "dh005")

## Plot results for all genotypes.
plot(SxMIBD_Ext,
     plotType = "allGeno")

## Plot structure of the pedigree.
plot(SxMIBD_Ext,
     plotType = "pedigree")

## Plot genetic map.
plot(SxMIBD_Ext,
     plotType = "map")

## Plot coverage across population.
plot(SxMIBD_Ext,
     plotType = "meanProbs")

## Plot total coverage.
plot(SxMIBD_Ext,
     plotType = "totalCoverage")
}