phiPlot: Makes Phi ~ Hybrid Index Plots for Alpha and Beta

View source: R/phiPlot.R

phiPlotR Documentation

Makes Phi ~ Hybrid Index Plots for Alpha and Beta

Description

This function generates the Phi ~ Hybrid Index genomic cline plot shown in Gompert et al. (2012). Outlier genomic clines are colored black, whereas non-outliers are gray. Phi is the Prob. Ancestry for P1. 1-Phi = P(P0 ancestry). The plot can be printed to the plot window in Rstudio (default) or saved to file by specifying a file prefix with the saveToFile option.

Usage

phiPlot(
  outlier.list,
  popname = "Population 1",
  overlap.zero = TRUE,
  qn.interval = TRUE,
  both.outlier.tests = FALSE,
  line.size = 0.25,
  saveToFile = NULL,
  plotDIR = "./plots",
  showPLOTS = FALSE,
  device = "pdf",
  neutral.color = "gray",
  neutral.line.color = "black",
  neutral.line.size = 1,
  zero.line = TRUE,
  zero.linetype = "dashed",
  alpha.color = "blue",
  beta.color = "red",
  both.color = "purple",
  margins = c(150, 5.5, 5.5, 5.5),
  margin.units = "points",
  phi.height = 7,
  phi.width = 7,
  phi.units = "in",
  phi.text.size = 18,
  phi.dpi = 300,
  hist.height = 1.5,
  hist.width = 1,
  hist.x.origin = 0,
  hist.y.origin = 1.05,
  hist.color = "gray57",
  hist.fill = "gray57",
  hist.axis.text.size = 12,
  hist.axis.title.size = 12,
  hist.binwidth = 0.1
)

Arguments

outlier.list

List of data.frames returned from get_bgc_outliers(). see ?get_bgc_outliers for more info

popname

Population name to use as the plot title

overlap.zero

Boolean. If TRUE, outliers include when the credible doesn't contain 0

qn.interval

Boolean. If TRUE, outliers = outside quantile interval

both.outlier.tests

If TRUE, outliers = both overlap.zero and qn.interval

line.size

Size of regression lines in plot. Default = 0.25

saveToFile

If specified, saves plots to file. The value for saveToFile should be the prefix for the filename you want to save to

plotDIR

Directory path. If saveToFile is specified, plots are saved in this directory

showPLOTS

Boolean Whether to print the plots to the screen

device

File format to save plot. Supports ggplot2::ggsave devices

neutral.color

Color for non-outlier loci. Default = "gray"

neutral.line.color

Color for dashed linear line showing mean Default = "black"

neutral.line.size

Size for dashed linear line showing mean. Default = 1.0

zero.line

Boolean to include linear line for alpha=0 and beta=0. Default = TRUE

zero.linetype

Character string to set linetype for zero.line. Default = "dashed"

alpha.color

Color for alpha outlier loci. Default = "blue"

beta.color

Color for beta outlier loci. Default = "red"

both.color

Color for SNPs that are both alpha and beta outliers. Default = "purple"

margins

Vector of margins for phi plot: c(Top, Right, Bottom, Left) Top is extended to include the Hybrid Index histogram

margin.units

Units for margins parameter. Default = "points"

phi.height

Height for Phi plot. Default = 7

phi.width

Width for Phi plot. Default = 7

phi.units

Units for phi height and width. Default = "in"

phi.text.size

Size for Phi plot text. Default = 18

phi.dpi

DPI for saving Phi plot. Default = 300

hist.height

Height of Hybrid Index histogram in Phi data coordinates E.g., If you want the histogram to be equal to half the height of the phi plot, set hist.height to 0.5

hist.width

Height of Hybrid Index histogram in Phi data coordinates E.g., If you want the histogram to be the same width as the Phi plot, set this to 1.0

hist.x.origin

X Origin (in Phi data coordinates) for Hybrid Index histogram

hist.y.origin

Y origin (in Phi data coordinates) for Hybrid Index histogram. Set to just above the Phi plot by default

hist.color

Color of Hybrid Index histogram

hist.fill

Fill for Hybrid Index histogram

hist.axis.text.size

Text size for histogram x-axis

hist.axis.title.size

Title size for histogram x-axis

hist.binwidth

Binwidth for Hybrid Index histogram

Details

Calculates Phi and Plots Phi ~ Hybrid Index, Highlighting Outliers.

Examples

phiPlot(outlier.list = outliers, saveToFile = "pop1_phiPlot",
plotDIR = "./bgc_plots", device = "png")

phiPlot(outlier.list = gene.outliers, popname = "Mus musculus",
line.size = 0.1, qn.interval = FALSE, overlap.zero = FALSE,
both.outlier.tests = TRUE, saveToFile = "mus_phiPlot")

phiPlot(outlier.list = full.outliers, popname = "G. gorilla",
overlap.zero = FALSE)

btmartin721/ClineHelpR documentation built on Oct. 15, 2024, 5:05 a.m.