subset.dnapath_list: Subset function for 'dnapath_list' object.

View source: R/dna.R

subset.dnapath_listR Documentation

Subset function for 'dnapath_list' object.


Subset function for 'dnapath_list' object.


## S3 method for class 'dnapath_list'
subset(x, pathways = NULL, genes = NULL, ...)



A 'dnapath_list' object from dnapath.


A set of pathways to index on. This can be (1) a vector of character strings, corresponding to pathway names or regular expressions used to find pathways, (2) a vector of indices to select pathways, (3) a vector of negative indices indicating pathways to remove, or (4) a logical (boolean) vector that is the same length of current number of pathways in x.


A set of gene names to index on; exact matching is used. Only pathways containing these genes are retained.


Additional arguments are ignored.


A subset of the differential network analysis results.


# Obtain a pathway list for this short example:
pathway_list <- get_reactome_pathways("human", overlap_limit = NULL,
                                      min_size = 13, max_size = 19)
# Run the differential network analysis.
results <- dnapath(x = meso$gene_expression, pathway_list = pathway_list,
                   group_labels = meso$groups, n_perm = 5, seed = 0)
summary(results) # Summary over all pathways in the pathway list.

# Subset on pathways that contain "cell cycle" in its name.
cell_cycle_pathways <- subset(results, pathways = "cell cycle")
# Subset on pathways that contain the gene 1026 (Entrezgene ID).
pathways_with_1026 <- subset(results, genes = "1026")

# Multiple pathways and/or genes can also be specified. 
# Specifying both acts as an "OR" operation. For example, the following subset 
# will contain pathways containing the words "acetylation" or "methylation" 
# OR pathways that contain the genes "1108" or "11200". 
results_OR <- subset(results, 
                     pathways = c("acetylation", "methylation"),
                     genes = c("1108", "11200"))
# To subset on pathways that have both a specific pathway name AND
# certain genes, call the subset function twice: once specifying the
# `pathways` argument, then pass those results back into subset() with the
# `genes` argument specified. For example:
results_AND <- subset(results, 
                      pathways = c("acetylation", "methylation"))
results_AND <- subset(results_AND,
                      genes = c("1108", "11200"))

dnapath documentation built on May 9, 2022, 9:05 a.m.