fea2incidMat {FGNet} | R Documentation

## Transforms FEA output into incidence matrices.

### Description

Transforms the Funtional Enrichment Analysis (FEA) results into cluster-gene incidence matrices.

### Usage

    fea2incidMat(feaResults, key = "Genes", sepChar = NULL, clusterColumn = NULL,
        filterAttribute = NULL, filterOperator = "<", filterThreshold = 0,
        removeFilteredGtl = NULL)

### Arguments

`feaResults` | list or data.frame/matrix. Output from one of the FEA functions.
`key` | "Genes" or "Terms". To build gene- or term-based networks.
`sepChar` | character. Character separating genes or terms in the same field. By default: "," for genes and ";" for terms.
`clusterColumn` | character. Name of the column that contains the value to group gene-term sets. Only required if it is different than "Cluster" or "Metagroup".
`filterAttribute` | character or data.frame. Attribute to filter the clusters/metagroups. Filtered clusters/metagroups will not be included in the matrices (and subsequent networks). Its value should be the data.frame column to use for filtering. It can be provided as character (column name) or data.frame (subset of the data.frame with drop=FALSE).
`filterOperator` | character. Logical operator used for filtering. i.e. ">" (bigger than), "<=" (smaller or equal than), "==" (equal), "!=" (different), "%%" (included in),... The evaluation order is left to right: filterAttribute ">" filterThreshold, will filter out clusters with filter attribute bigger than the threshold.
`filterThreshold` | numeric. Sets the value to compare to.
`removeFilteredGtl` | logical. Only used by GeneTerm Linker term network. If FALSE, it includes generic terms filtered by GeneTerm Linker from final metagroups.

### Value

List:

`clustersMatrix or metagroupsMatrix` | Incidende matrix with the genes or Terms in each cluster or metagroup.
`gtSetsMatrix` | Incidende matrix with the genes or Terms in each gene-term set
`filteredOut` | Clusters or metagroups which where filtered out and therefore not included in the incidence matrices. NULL if none.

### See Also

Next step in the workflow: `functionalNetwork()`

Overview of the package: `FGNet`

Package tutorial: `vignette("FGNet-vignette")`

### Examples

    ## Not run:
    jobID <- 3907019
    results <- fea_gtLinker_getResults(jobID)
    incidMat <- fea2incidMat(results)

    # Filtering (threshold)
    incidMat <- fea2incidMat(results,
        filterAttribute="Silhouette Width", filterThreshold=0.2)

    incidMat$filteredOut
    head(incidMat$metagroupsMatrix)
    head(incidMat$gtSetsMatrix)

    functionalNetwork(incidMat)

    # Term-based network
    incidMatTerms <- fea2incidMat(results, key="Terms")
    functionalNetwork(incidMatTerms, plotOutput="dynamic")

    # Including generic terms filterd by GtLinker from final metagroups:
    incidMatTerms <- fea2incidMat(results, key="Terms",removeFilteredGtl=FALSE)
    functionalNetwork(incidMatTerms, plotOutput="dynamic", plotType="bipartite")

    # Filtering by keyword
    keywords <- c("rna")
    selectedGroups <- sapply(getTerms(results),
        function(x)
        any(grep(paste("(", paste(keywords, collapse="|") ,")",sep=""), tolower(x))))

    resultsCbind <- results
    resultsCbind$metagroups <- cbind(results$metagroups,
        selectedKeywords=as.numeric(selectedGroups))

    matSelectedGroups <- fea2incidMat(resultsCbind,
        filterAttribute="selectedKeywords", filterThreshold=1)

    functionalNetwork(matSelectedGroups)
    getTerms(results)[selectedGroups]

    ## End(Not run)

[Package FGNet version 3.16.0 Index]