find_mutations: Mutation Analysis Related to Signature Scores

View source: R/find_mutations.R

find_mutationsR Documentation

Mutation Analysis Related to Signature Scores

Description

This function searches for mutations related to a specific signature score and conducts statistical tests to evaluate their significance. It can generate oncoprints and box plots to visualize the relationships and save the results.

Usage

find_mutations(
  mutation_matrix,
  signature_matrix,
  id_signature_matrix = "ID",
  signature,
  min_mut_freq = 0.05,
  plot = TRUE,
  method = "multi",
  point.alpha = 0.1,
  save_path = NULL,
  palette = "jco",
  show_plot = TRUE,
  show_col = FALSE,
  width = 8,
  height = 4,
  oncoprint_group_by = "mean",
  oncoprint_col = "#224444",
  gene_counts = 10,
  jitter = FALSE,
  genes = NULL,
  point_size = 4.5
)

Arguments

mutation_matrix

A matrix with sample names in the rows and genes in the columns representing mutation data.

signature_matrix

A dataframe with identifier and target signatures.

id_signature_matrix

The column name in the signature_matrix that acts as the identifier.

signature

The name of the target signature for analysis.

min_mut_freq

The minimum frequency of mutations required to consider a gene in the analysis.

plot

A logical value; if TRUE, results will be plotted and saved at 'save_path'.

method

Specifies the statistical test method; "multi" for both Cuzick and Wilcoxon tests or "Wilcoxon" for only the Wilcoxon test.

save_path

The directory path where plots and statistical analysis results will be saved.

palette

The color palette for box plots.

show_plot

A logical variable; if TRUE, plots will be rendered on display.

show_col

Whether to show the color code of the palette.

width

The width of the oncoprint plot.

height

The height of the oncoprint plot.

oncoprint_group_by

Specifies how to group the oncoprint, options are "mean" or "quantile".

oncoprint_col

The color for mutations in the oncoprint.

gene_counts

The number of genes to display in the oncoprint.

jitter

A logical value; if TRUE, adds jitter to the box plot points.

genes

A vector of gene names for drawing; if NULL, genes are selected based on mutation frequency.

point_size

The size of points in the box plot.

point_alpha

The transparency level of points in the box plot.

Value

Returns a list containing results from the statistical tests, oncoprint plots, and box plots.

Author(s)

Dongqiang Zeng

Examples

# Load mutation and signature data
maf_file <- "path_to_maf_file"
mut_list <- make_mut_matrix(maf = maf_file, isTCGA = TRUE, category = "multi")
mut <- mut_list$snp
# Assume 'tcga_stad_sig' is preloaded with appropriate data
results <- find_mutations(mutation_matrix = mut, signature_matrix = tcga_stad_sig,
                          id_signature_matrix = "ID", signature = "CD_8_T_effector",
                          min_mut_freq = 0.01, plot = TRUE, method = "multi",
                          save_path = "path_to_save_results")

IOBR/IOBR documentation built on Sept. 9, 2024, 8:36 p.m.