flowGraph: flowGraph object constructor.

View source: R/00_flowgraph_constructor.R

flowGraphR Documentation

flowGraph object constructor.

Description

Initializes a flowGraph object given the cell counts for one or more flow cytometry sample(s). The flowGraph object returned holds meta data for each sample, each cell population node, edges representing how each cell population node relate to one another, and features for these nodes and edges.

Usage

flowGraph(
  input_,
  meta = NULL,
  class = "class",
  no_cores = 1,
  markers = NULL,
  layout_fun = "layout.reingold.tilford",
  max_layer = NULL,
  cumsumpos = FALSE,
  prop = TRUE,
  specenr = TRUE,
  path = NULL,
  calculate_summary = TRUE,
  node_features = "SpecEnr",
  edge_features = "NONE",
  test_name = "t_diminish",
  test_custom = "t",
  diminish = TRUE,
  label1 = NULL,
  label2 = NULL,
  save_plots = FALSE
)

Arguments

input_

Any of the following:

  • a numeric matrix or vector of the cell counts; its column/names must be the phenotype names and its rownames must be sample ID's.

All input samples should have the same markers and partitionsPerMarker.

meta

A data frame with meta data for each Phenotypes or sample; One of its column names should be "id" whose values correspond to the name of each Phenotypes object. We also recommend for it to have a column named "class" where one of its unique values is "control".

class

A string corresponding to the column name or index of meta whose values represent the class label of each sample; OR a vector the same length as the the number of samples in input_ specifiying the class of each given sample — this vector will be appended to meta under column name class.

no_cores

An integer indicating how many cores to parallelize on.

markers

A string vector of marker names used in input_.

layout_fun

A string of a function from the igraph package that indicates what layout should be used if a cell hierarchy is to be ploted; all such functions have prefix layout_. This is defaulted to e.g. layout_fun="layout.reingold.tilford".

max_layer

And integer indicating the maximum layer in the cell hierarchy to analyze; set to 'NULL' to analyze all layers.

cumsumpos

A logical variable indicating whether or not to cumulate cell counts; this applies only when partitionsPerMarker > 3 and will convert e.g. the count of A+ or A++ into the sum of the counts of A+, A++, A+++, ..., or A++, A+++, ... .

prop

A logical variable indicating whether or not to calculate the proportion feature; this can be done later on with flowGraph_prop.

specenr

logical variable: whether or not to calculate the SpecEnr feature, Default: T

path

A string indicating the folder path to where the flowGraph object should save its elements, Default = NULL (don't save).

calculate_summary

A logical variable indicating whether or not to calculate the summary statistics for SpecEnr based on default parameters using the fg_summary summary function on class specified in parameter class.

node_features

A string vector indicating which node feature(s) to perform summary statistics on; set to NULL or "NONE" and the function will perform summary statistics on all or no node features.

edge_features

A string vector indicating which edge feature(s) to perform summary statistics on; set to NULL or "NONE" and the function will perform summary statistics on all or no edge features.

test_name

A string with the name of the test you are performing.

test_custom

See fg_summary.

diminish

A logical variable; applicable if calculate_summary is TRUE; see fg_summary.

label1

A string indicating a class label in fg_get_meta(fg)[,class]; set to NULL if you would like to compare all classes aganst all classes; applicable if calculate_summary is TRUE.

label2

A string indicating a class label in fg_get_meta(fg)[,class]; applicable if calculate_summary is TRUE.

save_plots

A logical indicating whether or not to save plots.

Details

flowGraph is the constructor for the flowGraph object. The user can choose to input as input_ a vector, a Phenotypes object (meaning there is only one sample), a matrix, or a Phenotypes object list. If the user is also inputting a sample meta data frame, it must contain a id column corresponding to sample names.

Value

flowGraph object

See Also

flowGraph-class fg_get_feature fg_get_feature_desc fg_get_summary fg_get_summary_desc fg_add_feature fg_rm_feature fg_add_summary fg_rm_summary fg_gsub_markers fg_gsub_ids fg_merge_samples fg_extract_samples fg_extract_phenotypes fg_merge registerDoParallel Matrix

Examples


no_cores <- 1
samplen <- 10
meta_file <- data.frame(
    id=1:samplen,
    class=append(rep("control", samplen/2), rep("exp", samplen/2)),
    stringsAsFactors=FALSE
)


## using the constructor -----------------------

data(fg_data_pos30)

# input: vector of load-able Phenotypes paths
fg <- flowGraph(fg_data_pos30$count[1,], no_cores=no_cores)

# input: matrix + vector of class corresponding to samples
fg <- flowGraph(fg_data_pos30$count, class=fg_data_pos30$meta$class,
                no_cores=no_cores)
# - save to file directly
# fg <- flowGraph(fg_data_pos30$count, class=fg_data_pos30$meta$class,
#                no_cores=no_cores, path="path_to_folder)

# input: matrix + meta data frame
# fg <- flowGraph(fg_data_pos30$count, meta=fg_data_pos30$meta,
#                 no_cores=no_cores)



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