association.plot: Visualize associations between features and classes

View source: R/association_plot.R

association.plotR Documentation

Visualize associations between features and classes

Description

This function visualizes different measures of association between features and the label, computed previously with the check.associations function

Usage

association.plot(siamcat, fn.plot=NULL, color.scheme = "RdYlBu",
sort.by = "fc", max.show = 50, plot.type = "quantile.box",
panels = c("fc", "auroc"), prompt=TRUE, verbose = 1)

Arguments

siamcat

object of class siamcat-class

fn.plot

string, filename for the pdf-plot. If fn.plot is NULL, the plot will be produced in the active graphics device.

color.scheme

valid R color scheme or vector of valid R colors (must be of the same length as the number of classes), defaults to 'RdYlBu'

sort.by

string, sort features by p-value ("p.val"), by fold change ("fc") or by prevalence shift ("pr.shift"), defaults to "fc"

max.show

integer, how many associated features should be shown, defaults to 50

plot.type

string, specify how the abundance should be plotted, must be one of these: c("bean", "box", "quantile.box", "quantile.rect"), defaults to "quantile.box"

panels

vector, name of the panels to be plotted next to the abundances, possible entries are c("fc", "auroc", "prevalence"), defaults to c("fc", "auroc")

prompt

boolean, turn on/off prompting user input when not plotting into a pdf-file, defaults to TRUE

verbose

integer, control output: 0 for no output at all, 1 for only information about progress and success, 2 for normal level of information and 3 for full debug information, defaults to 1

Details

This function visualizes the results of the computations carried out in the check.associations function. It produces a plot of the top max.show associated features at a user-specified significance level alpha.

For binary classification problems, the plot will show the distribution of the log10-transformed abundances for both classes, a P-value from the significance test, and user-selected panels for the effect size (AU-ROC, prevalence shift, or generalized fold change). For regression problems, the plot will show the Spearman correlation, the significance, and the linear model effect size.

Value

Does not return anything, but instead produces association plot

Examples

# Example data
data(siamcat_example)

# Simple example
association.plot(siamcat_example, fn.plot = "./assoc_plot.pdf")

# Plot associations as box plot
association.plot(siamcat_example,
    fn.plot = "./assoc_plot_box.pdf",
    plot.type = "box")

# Additionally, sort by p-value instead of by fold change
association.plot(siamcat_example,
    fn.plot = "./assoc_plot_fc.pdf",
    plot.type = "box", sort.by = "p.val")

# Custom colors
association.plot(siamcat_example,
    fn.plot = "./assoc_plot_blue_yellow.pdf",
    plot.type = "box", color.scheme = c("cornflowerblue", "#ffc125"))

zellerlab/siamcat documentation built on Feb. 1, 2024, 2:21 a.m.