subsetByCluster: Create data subset by cluster

View source: R/subset-object.R

subsetByClusterR Documentation

Create data subset by cluster

Description

Subset functions allow to conveniently split your data by certain characteristics such as cell lines, conditions, cluster etc. or for specific cell ids. This might be useful if you want apply some machine learning algorithms such as clustering and correlation on only a subset of cells. See details for more information.

Usage

subsetByCluster(
  object,
  new_name,
  cluster_variable,
  cluster,
  suffix = FALSE,
  suffix_sep = "_",
  phase = NULL,
  verbose = NULL
)

subsetByGroup(
  object,
  new_name = NULL,
  grouping_variable,
  groups,
  suffix = FALSE,
  suffix_sep = "_",
  phase = NULL,
  verbose = NULL
)

Arguments

object

A valid cypro object.

new_name

Character value. Denotes the name of the output object. If set to NULL the name of the input object is taken and suffixed with '_subset'.

cluster_variable, grouping_variable

Character value. Denotes variable from which to subset the cells.

cluster, groups

Character vector. Denotes the exact cluster/group names carried by the variable specified with argument cluster_variable/grouping_variable to be kept.

suffix

Logical value. If set to TRUE the character value provided with arugment new_name is used to suffix the original name as well as the current default directory.

suffix_sep

Character value. Denotes the string to insert between the object name / storage directory and the input value for new_name if suffix is set to TRUE.

verbose

Logical. If set to TRUE informative messages regarding the computational progress will be printed.

(Warning messages will always be printed.)

Details

Creating subsets of your data affects analysis results such as clustering and correlation which is why these results are reset in the subsetted object and must be computed again. To prevent inadvertent overwriting the default directory is reset as well. Make sure to set a new one via setDefaultDirectory().

The mechanism with which you create the subset is stored in the output object. Use printSubsetHistory() to reconstruct the way from the original object to the current one.

Value

A cypro object that contains the data for the subsetted cells.

Note

In case of experiment set ups with multiple phases:

As creating subsets of your data affects downstream analysis results you have to manually specify the phase for which the grouping of interest has been calculated.

The output object contains data for all phases but only for those cells that matched the input for argument cluster/groups in the specified variable during the specified phase.


theMILOlab/cypro documentation built on April 5, 2022, 2:03 a.m.