fg_get_feature_means: Retrieves feature summaries.

View source: R/01_flowgraph_accessors.R

fg_get_feature_meansR Documentation

Retrieves feature summaries.

Description

Retrieves a feature summary (e.g. colMeans) for samples specified by sample id's id OR class label label for class class given a feature specified by type and feat.

Usage

fg_get_feature_means(
  fg,
  type = c("node", "edge"),
  feature = "count",
  class = NULL,
  label = NULL,
  id = NULL,
  summary_fun = colMeans
)

Arguments

fg

flowGraph object.

type

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

feature

A string indicating feature name the summary was created for;

class

A string corresponding to a column name of the meta slot of fg whose values represent the class label of each sample on which the summary was created to compare or analyze;

label

A string indicating a class label.

id

A string vector containing the sample id's corresponding to the id column of the meta slot of fg.

summary_fun

A function that takes in a matrix and outputs a vector the same length as the number of columns this matrix has.

Value

A list containing two numeric vectors calculated using the summary_fun function on the subset of samples specified by sample id's id OR class label label for class class from a feature matrix specified by type and feat.

See Also

flowGraph-class fg_get_summary_desc fg_add_summary fg_rm_summary fg_get_summary

Examples


 no_cores <- 1
 data(fg_data_pos30)
 fg <- flowGraph(fg_data_pos30$count, class=fg_data_pos30$meta$class,
                 no_cores=no_cores)
 fg <- fg_summary(fg, no_cores=no_cores, class="class", label1="control",
                  overwrite=FALSE, test_name="t", diminish=FALSE)
 show(fg)
 feat_mean <- fg_get_feature_means(fg, type="node", feature="count",
                                   class="class", label="control")


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