plotGBSR: Draw line plots of specified statistics

View source: R/PlotFunctions.R

plotGBSRR Documentation

Draw line plots of specified statistics

Description

Draw line plots of specified statistics

Usage

plotGBSR(
  x,
  stats = c("dp", "missing", "het"),
  coord = NULL,
  lwd = 0.5,
  binwidth = NULL,
  color = c(Marker = "darkblue", Ref = "darkgreen", Het = "magenta", Alt = "blue")
)

Arguments

x

A GbsrGenotypeData object.

stats

A string to specify statistics to be drawn.

coord

A vector with two integer specifying the number of rows and columns to draw faceted line plots for chromosomes.

lwd

A numeric value to specify the line width in plots.

binwidth

An integer to specify bin width of the histogram. This argument only work with stats = "marker" and is passed to the ggplot function.

color

A strings vector named "Marker", "Ref", "Het", "Alt" to specify line colors. ⁠stats = "geno⁠ only requires "Ref", "Het" and "Alt", while others uses the value named "Marker".

Details

You can draw line plots of several summary statistics of genotype counts and read counts per sample and per marker. The "stats" argument can take the following values:

marker

Marker density.

geno

Proportion of missing genotype calls.

missing

Proportion of missing genotype calls.

het

Proportion of heterozygote calls.

raf

Reference allele frequency.

dp

Total read counts.

ad_ref

Reference allele read counts.

ad_alt

Alternative allele read counts.

rrf

Reference allele read frequency.

mean_ref

Mean of reference allele read counts.

sd_ref

Standard deviation of reference allele read counts.

median_ref

Quantile of reference allele read counts.

mean_alt

Mean of alternative allele read counts.

sd_alt

Standard deviation of alternative allele read counts.

median_alt

Quantile of alternative allele read counts.

mq

Mapping quality.

fs

Phred-scaled p-value (strand bias)

qd

Variant Quality by Depth

sor

Symmetric Odds Ratio (strand bias)

mqranksum

Alt vs. Ref read mapping qualities

readposranksum

Alt vs. Ref read position bias

baseqranksum

Alt Vs. Ref base qualities

To draw line plots for "missing", "het", "raf", you need to run countGenotype() first to obtain statistics. Similary, "dp", "ad_ref", "ad_alt", "rrf" requires values obtained via countRead(). "mq", "fs", "qd", "sor", "mqranksum", "readposranksum", #' and "baseqranksum" only work with target = "marker", if your data contains those values supplied via SNP calling tools like GATK.

Value

A ggplot object.

Examples

# Load data in the GDS file and instantiate a [GbsrGenotypeData] object.
gds_fn <- system.file("extdata", "sample.gds", package = "GBScleanR")
gds <- loadGDS(gds_fn)

# Summarize genotype count information to be used in `plotGBSR()`
gds <- countGenotype(gds)

# Draw line plots of missing rate, heterozygosity, proportion of genotype
# calls per SNP.
plotGBSR(gds, stats = "missing")

# Close the connection to the GDS file
closeGDS(gds)


tomoyukif/GBScleanR documentation built on Oct. 31, 2024, 2:43 a.m.