fg_save_plots {flowGraph} | R Documentation

## Saves numerous plots for all summary statistics to a folder.

### Description

Saves numerous plots for all summary statistics in a given flowGraph object to a user specified folder.

### Usage

    fg_save_plots(
      fg,
      plot_path,
      plot_types = "node",
      interactive = FALSE,
      adjust_custom = "byLayer",
      label_max = 10,
      box_no = 20,
      paired = FALSE,
      logged = FALSE,
      filter_adjust0 = 1,
      filter_es = 0,
      filter_btwn_tpthres = 1,
      filter_btwn_es = 0,
      overwrite = TRUE,
      node_labels = "NONE",
      ...
    )

### Arguments

`fg` | flowGraph object.
`plot_path` | A string indicating the folder path to where the function should save the plots.
`plot_types` | A string or a vector of strings indicating what feature types and their summaries the function should plot for: 'node' or 'edge'.
`interactive` | A logical indicating whether the QQ plot, p-value vs difference plot, and the cell hierarchy plots should be interactive; see functions `fg_plot` and `fg_plot_qq`.
`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.
`label_max` | An integer indicating how many labels should be shown in the functions `fg_plot_pVSdiff` and `fg_plot`.
`box_no` | An integer indicating the maximum number of boxplots to save; used in function `fg_plot_box`.
`paired` | A logical indicating whether the summary is paired; used in function `fg_plot_box`.
`logged` | A logical indicating whether or not to log the summary statistic p value in the qq plots.
`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. This parameter is used for the QQ and the pVSdifference plots.
`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`.
`overwrite` | A logical variable indicating whether or not to replace old plots if they exist under the same folder name.
`node_labels` | Parameter for the `fg_plot` function.
`...` | Other parameters for the `fg_plot` function.

### Details

The interactive plots are made using the `ggiraph` package.

### Value

No return; plots are saved to file.

### See Also

`flowGraph-class` `fg_plot` `plot_gr` `fg_get_feature` `fg_get_summary` `fg_plot_qq` `fg_plot_pVSdiff` `fg_plot_box`

### 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_save_plots(fg, "temp")

[Package flowGraph version 1.2.0 Index]