Learn R Programming

GSNA (version 0.1.4.2)

buildGeneSetNetworkGeneric: buildGeneSetNetworkGeneric

Description

General function to create a GSNData object and calculate a distance matrix within. Employed by buildGeneSetNetworkSTLF(), buildGeneSetNetworkLF(), buildGeneSetNetworkJaccard() and buildGeneSetNetworkJaccard() functions.

Usage

buildGeneSetNetworkGeneric(
  object = NULL,
  ref.background = NULL,
  geneSetCollection = NULL,
  distMatrixFun,
  distance,
  optimal_extreme
)

Value

This function returns a GSNData object.

Arguments

object

An object of type GSNData. If NULL, a new one is instantiated.

ref.background

(required) A character vector corresponding to the genes observable in a differential expression, ATAC-Seq or other dataset. This corresponds to the background used in tools like DAVID.

geneSetCollection

(required) A gene set collection either in the form of a tmod object, or a list of gene sets / modules as character vectors containing gene symbols and names corresponding to the gene module identifier.

distMatrixFun

(required) Function for calculating the distance matrix. Functions used for this purpose are expected to return a square numeric matrix corresponding to the distances between all gene sets. (see scoreLFMatrix_C, scoreJaccardMatrix_C, scoreOCMatrix_C )

distance

(required) Name of the distance matrix being calculated.

optimal_extreme

(required) Indicates whether max or min values are most significant in the specified distance matrix. Can be 'max' or 'min'.

Details

In most cases, users will want to run the specific buildGeneSetNetworkSTLF(), buildGeneSetNetworkLF(), buildGeneSetNetworkJaccard() or buildGeneSetNetworkJaccard() functions instead of this, but this function can be used for adding support for new distance metrics.

See Also

buildGeneSetNetworkJaccard

buildGeneSetNetworkOC

buildGeneSetNetworkLF

buildGeneSetNetworkSTLF

Examples

Run this code

library(GSNA)

# In this example, we generate a gene set network from CERNO example
# data. We begin by subsetting the CERNO data for significant results:
sig_pathways.cerno <- subset( Bai_CiHep_DN.cerno, adj.P.Val <= 0.05 )

# Now create a gene set collection containing just the gene sets
# with significant CERNO results, by subsetting Bai_gsc.tmod using
# the gene set IDs as keys:
sig_pathways.tmod <- Bai_gsc.tmod[sig_pathways.cerno$ID]

# And obtain a background gene set from differential expression data:
background_genes <- toupper( rownames( Bai_CiHep_v_Fib2.de ) )

# Build a gene set network. This does the same thing as
# buildGeneSetNetworkSTLF(), but can be adapted to novel distance
# metrics by providing a different matrix scoring function, distance
# name, and optimal_extreme:
sig_pathways.GSN <-
   buildGeneSetNetworkGeneric( geneSetCollection = sig_pathways.tmod,
                               ref.background = background_genes,
                               distMatrixFun = scoreLFMatrix_C,
                               distance = 'stlf',
                               optimal_extreme = "min"
                                )

Run the code above in your browser using DataLab