fg_plot_box: Creates a boxplot of the values of one node/edge

View source: R/04_flowgraph_plots.R

fg_plot_boxR Documentation

Creates a boxplot of the values of one node/edge

Description

Creates a boxplot comparing the features of samples belonging to different classes corresponding to an existing summary statistic using ggplot2.

Usage

fg_plot_box(
  fg,
  type = "node",
  index = 1,
  summary_meta = NULL,
  node_edge = 1,
  adjust_custom = "byLayer",
  p_thres = 0.05,
  filter_adjust0 = 0.5,
  filter_es = 0.5,
  filter_btwn_tpthres = 0.05,
  filter_btwn_es = 0.5,
  paired = FALSE,
  dotplot = TRUE,
  outlier = TRUE,
  all_labels = FALSE,
  show_mean = TRUE,
  main = NULL,
  path = NULL
)

Arguments

fg

flowGraph object.

type

A string indicating feature type the summary was created for 'node' or 'edge'.

index

The user must provide type and additionally, one of summary_meta or index.

index is an integer indicating the row in fg_get_summary_desc(<flowGraph>) of the corresponding type and summary the user would like to retrieve.

summary_meta

The user must provide type and additionally, one of summary_meta or index.

summary_meta is a list containing feature (feature name), test_name (summary statistic name), class (class), label1, and label2 (class labels compared). See fg_get_summary_desc for details.

node_edge

An integer/index of or a string of the cell population (node) / edge name (edge) the user wants to plot.

adjust_custom

A function or a string indicating the test adjustment method to use. If a string is provided, it should be one of c("holm", "hochberg", "hommel", "bonferroni", "BH", "BY", "fdr", "none") (see p.adjust.methods). If a function is provided, it should take as input a numeric vector and output the same vector adjusted.

p_thres

A numeric variable indicating a p-value threshold

filter_adjust0

A numeric variable indicating what percentage of SpecEnr values compared (minimum) should be not close to 0. Set to 1 to not conduct filtering.

filter_es

A numeric variable between 0 and 1 indicating what the Cohen's D value of the nodes/edges in question must be greater or equal to, to be significant.

filter_btwn_tpthres

A numeric variable between 0 and 1 indicating the unadjusted T-test p-value threshold used to test whether the actual and expected feature values used to calculate the specified SpecEnr feature are significantly different for each sample class. Note this only needs to be specified for SpecEnr features. Combined with filter_btwn_es, we conduct three tests to understand if there is an actual large difference between actual and expected features: (1,2) T-test of significance between the actual and expected raw feature value (e.g. proportion) for samples in each of the compared classes, (3) and the T-test of significance between the differences of actual and expected feature values of the two classes. If any two of the three tests come out as insignificant, we set the p-value for the associated node/edge to 1.

filter_btwn_es

A numeric variable between 0 and 1 indicating what the Cohen's D value of the nodes/edges in question must be greater or equal to, to be significant – see filter_btwn_tpthres.

paired

A logical indicating whether the summary is paired.

dotplot

A logical indicating whether or not to plot sample points.

outlier

A logical indicating whether or not outliers should be plotted.

all_labels

A logical indicating whether or not to plot samples of all classes outside of just those used in the summary statistic test.

show_mean

A logical indicating whether or not to label the mean.

main

A string or the title of the plot; if left as NULL, a default title will be applied.

path

A string indicating the path to where the function should save the plot; leave as NULL to not save the plot. Static plots are saved as PNG.

Details

The plot is made using the ggplot2 package. The interactive version is the same as the static version, it is only here to support the shiny app.

Value

A static boxplot.

See Also

flowGraph-class fg_plot plot_gr fg_get_feature fg_get_summary fg_plot_qq

Examples


 no_cores <- 1
 data(fg_data_pos2)
 fg <- flowGraph(fg_data_pos2$count, class=fg_data_pos2$meta$class,
                 no_cores=no_cores)

 fg_plot_box(fg, type="node", summary_meta=NULL, adjust_custom="byLayer", index=1, node_edge=10)


aya49/flowGraph documentation built on Feb. 4, 2024, 6:40 p.m.