plotTrinucleotide: Plot Trinucleotide SBS Data

View source: R/plotTrinucleotide.R

plotTrinucleotideR Documentation

Plot Trinucleotide SBS Data

Description

This function processes and plots trinucleotide data. It first applies specified filters and transformations to the data and then generates a visual representation of the results.

Usage

plotTrinucleotide(
  trinuc_df,
  exclude_if_type_present = NULL,
  retain_if_type_present = NULL,
  remove_type = NULL,
  normalize_counts = TRUE,
  show_overlap_type = TRUE,
  ylim = c(0, 0.5),
  plot_title = "Trinucleotide Profile",
  y_axis_title = "Percentage of Single Base Substitutions",
  draw_x_axis_labels = TRUE,
  draw_y_axis_labels = TRUE,
  draw_y_axis_title = TRUE,
  output_file = "./trinucleotide_profile.pdf",
  ggsave_params = list(width = 17, height = 6, units = "cm", device = "pdf")
)

Arguments

trinuc_df

DataFrame with trinucleotide data.

exclude_if_type_present

Vector specifying mutation locus readpair overlap types (CO_MUT, SO_MUT, CO_REF, SO_REF, DO, SO_OTHER, CO_OTHER) whose non-zero presence triggers exclusion of loci. For instance, using 'c("DO")' will exclude any loci that contain even a single discordant read-pair overlap (DO).

retain_if_type_present

Vector specifying mutation locus readpair overlap types (CO_MUT, SO_MUT, CO_REF, SO_REF, DO, SO_OTHER, CO_OTHER) whose non-zero presence is necessary to retain those mutation locus. For instance, using 'c("CO")' will retain any loci that contain even a single concordant read-pair overlap (CO_MUT).

remove_type

Vector specifying mutation locus readpair overlap types (e.g., SO_MUT, CO_REF, DO) to set to 0 across all loci in the dataframe.

normalize_counts

Logical; if TRUE, normalize SBS counts to sum to 1.

show_overlap_type

Logical; if TRUE, show read-pair overlap types.

ylim

Numeric; limits of the y-axis for the plot.

plot_title

String; title for the plots.

y_axis_title

String; title for the y-axis.

draw_x_axis_labels

Logical; whether to draw x-axis labels.

draw_y_axis_labels

Logical; whether to draw y-axis labels.

draw_y_axis_title

Logical; whether to display a title for the y-axis.

output_file

String; name and path of output pdf file.

ggsave_params

A list of parameters to be passed to ggplot2::ggsave(). This list can include any of the arguments that 'ggsave()' accepts. Default settings of 'ggsave()' will be used unless specified. Example: 'list(width = 10, height = 8, dpi = 300)'

Details

The function handles data normalization, exclusion, and retention based on provided column names, and it creates detailed plots with options for customization of plot aesthetics.

Value

A trinucleotide SBS plot object and an optional pdf file.

Examples

## Not run: 
 plotTrinucleotide(trinuc_df)

## End(Not run)


hw538/cfDNAPro documentation built on Feb. 17, 2025, 6:09 p.m.