visualizations: Write all relevant visualizations to pdf

View source: R/visualization_utils.R

visualizationsR Documentation

Write all relevant visualizations to pdf

Description

A wrapper around all the major visualization functions, used for visualizing data between major steps of data preprocessing. Saves all visualizations as PDFs with a set prefix on filenames.

Usage

visualizations(
  object,
  prefix,
  format = "pdf",
  perplexity = 30,
  merge = FALSE,
  remove_singles = FALSE
)

Arguments

object

A MetaboSet object

prefix

character, a file path prefix added to the file paths

format

character, format in which the plots should be saved, DOES NOT support raster formats

perplexity

perplexity for t-SNE plots

merge

logical, whether the files should be merged to a single PDF, see Details

remove_singles

logical, whether to remove single plot files after merging. Only used if merge = TRUE

Details

If merge is TRUE and format id pdf, then a file containing all the visualizations named prefix.pdf will be created. NOTE: on Windows this requires installation of pdftk (https://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/) and on Linux you need to have pdfunite installed. On MacOS, no external software is needed. Note that at least on Windows, prefix should be a path from the root, so that the underlying system command will find the files. The type of visualizations to be saved depends on the type of object. Here is a comprehensive list of the visualizations:

  • Distribution of quality metrics and flags plot_quality

  • Boxplots of each sample in injection order plot_sample_boxplots

  • PCA scores plot of samples colored by injection order plot_pca

  • t-SNE plot of samples colored by injection order plot_tsne

  • If the object has over 60 samples, hexbin versions of the PCA and t-SNE plots above plot_pca_hexbin, plot_tsne_hexbin

  • Dendrogram of samples ordered by hierarchical clustering, sample labels colored by group if present plot_dendrogram

  • heat map of intersample distances, ordered by hierarchical clustering plot_sample_heatmap

  • If the object has QC samples:

    • Density function of the intersample distances in both QCs and biological samples plot_dist_density

    • Histograms of p-values from linear regression of features against injection order in both QCs and biological samples plot_p_histogram

  • If the object has a group column:

    • PCA and tSNE plots with points shaped and colored by group plot_pca, plot_tsne

  • If the object has a time column:

    • PCA and tSNE plots with points shaped and colored by time plot_pca, plot_tsne

    • Dendrogram of samples ordered by hierarchical clustering, sample labels colored by time point plot_dendrogram

  • If the object has a group column OR a time column:

    • Boxplots of samples ordered and colored by group and/or time plot_sample_boxplots

  • If the object has a group column AND a time column:

    • PCA and tSNE plots with points shaped by group and colored by time plot_pca, plot_tsne

  • If the object has a time column AND a subject column:

    • PCA and tSNE plots with arrows connecting the samples of each subject in time point order plot_pca_arrows, plot_tsne_arrows

See Also

save_plot


antonvsdata/notame documentation built on Sept. 14, 2024, 11:09 p.m.