Learn R Programming

Qploidy (version 1.0.1)

plot_baf: Plot BAF

Description

This function generates a BAF (B-allele frequency) plot for visualizing genomic data. It allows customization of dot size, expected and estimated peaks, centromere positions, and area colors.

Usage

plot_baf(
  data_sample,
  area_single,
  ploidy,
  dot.size = 1,
  add_estimated_peaks = FALSE,
  add_expected_peaks = FALSE,
  centromeres = NULL,
  add_centromeres = FALSE,
  colors = FALSE,
  font_size = 12
)

Value

A ggplot object representing the BAF plot.

Arguments

data_sample

A data.frame containing BAF and genomic position information. Must include columns `Chr`, `Position`, and `sample`.

area_single

Numeric value defining the area around the expected peak to be considered.

ploidy

Integer or vector specifying the expected ploidy. If a vector, it must match the number of chromosomes in `data_sample`.

dot.size

Numeric value for the size of the dots in the plot. Default is 1.

add_estimated_peaks

Logical. If TRUE, adds lines for estimated peaks. Default is FALSE.

add_expected_peaks

Logical. If TRUE, adds lines for expected peaks. Default is FALSE.

centromeres

Named vector defining centromere positions for each chromosome. Names must match chromosome IDs in `data_sample`.

add_centromeres

Logical. If TRUE, adds vertical lines at centromere positions. Default is FALSE.

colors

Logical. If TRUE, adds area colors to the plot. Default is FALSE.

font_size

Numeric value for the font size of plot labels. Default is 12.