scatter_plot: Locus scatter plot

View source: R/scatter_plot.R

scatter_plotR Documentation

Locus scatter plot

Description

Produces a base graphics scatter plot from a 'locus' class object. This function is called by locus_plot() to generate the scatter plot portion. Can be used manually with set_layers().

Usage

scatter_plot(
  loc,
  index_snp = loc$index_snp,
  pcutoff = 5e-08,
  scheme = c("grey", "dodgerblue", "red"),
  cex = 1,
  cex.axis = 0.9,
  cex.lab = 1,
  xlab = NULL,
  ylab = NULL,
  yzero = (loc$yvar == "logP"),
  xticks = TRUE,
  border = FALSE,
  showLD = TRUE,
  LD_scheme = c("grey", "royalblue", "cyan2", "green3", "orange", "red", "purple"),
  recomb_col = "blue",
  legend_pos = "topleft",
  labels = NULL,
  label_x = 4,
  label_y = 4,
  eqtl_gene = NULL,
  beta = NULL,
  add = FALSE,
  align = TRUE,
  ...
)

Arguments

loc

Object of class 'locus' to use for plot. See locus.

index_snp

Specifies index SNP or a vector of SNPs to be shown in a different colour and symbol. Defaults to the SNP with the lowest p-value. Set to NULL to not show this.

pcutoff

Cut-off for p value significance. Defaults to p = 5e-08. Set to NULL to disable.

scheme

Vector of 3 colours if LD is not shown: 1st = normal points, 2nd = colour for significant points, 3rd = index SNP(s).

cex

Specifies size for points.

cex.axis

Specifies font size for axis numbering.

cex.lab

Specifies font size for axis titles.

xlab

x axis title.

ylab

y axis title.

yzero

Logical whether to force y axis limit to include y=0.

xticks

Logical whether x axis numbers and axis title are plotted.

border

Logical whether a bounding box is plotted around upper and lower plots.

showLD

Logical whether to show LD with colours

LD_scheme

Vector of colours for plotting LD. The first colour is for SNPs which lack LD information. The next 5 colours are for r2 or D' LD results ranging from 0 to 1 in intervals of 0.2. The final colour is for the index SNP.

recomb_col

Colour for recombination rate line if recombination rate data is present. Set to NA to hide the line. See link_recomb() to add recombination rate data.

legend_pos

Position of legend. See legend(). Set to NULL to hide legend.

labels

Character vector of SNP or genomic feature IDs to label. The value "index" selects the highest point or index SNP as defined when locus() is called. Set to NULL to remove all labels.

label_x

Value or vector for position of label as percentage of x axis scale.

label_y

Value or vector for position of label as percentage of y axis scale.

eqtl_gene

Column name in loc$data for colouring eQTL genes.

beta

Optional column name for beta coefficient to display upward triangles for positive beta and downward triangles for negative beta (significant SNPs only).

add

Logical whether to add points to an existing plot or generate a new plot.

align

Logical whether to set par() to align the plot.

...

Other arguments passed to plot() to control the scatter plot e.g. main, ylim etc.

Details

Advanced users familiar with base graphics can customise every single point on the scatter plot, by adding columns named bg, col, pch or cex directly to the dataframe stored in ⁠$data⁠ element of the 'locus' object. Setting these will overrule any default settings. These columns refer to their respective base graphics arguments, see graphics::points().

Value

No return value. Produces a scatter plot using base graphics.

See Also

locus() set_layers()


myles-lewis/locuszoomr documentation built on April 16, 2024, 11:13 p.m.