R: Filtering of gene sets

Filter gene sets {GiANT} | R Documentation

## Filtering of gene sets

### Description

Filters gene sets according to different criteria.

### Usage

    filterGeneSets(
    	geneSets,
    	includedGenes = NULL,
    	minIntersectSize = length(includedGenes),
    	adjMatrix = NULL,
    	steps = NULL)

### Arguments

`geneSets` | A list of gene sets, where each gene set is a vector of gene names corresponding to the row names of `dat`.
`includedGenes` | A vector of gene names whose occurence in each of the gene sets is checked. The further parameters how these genes are used to filter gene sets
`minIntersectSize` | If this parameter is not `NULL`, only gene sets with an intersection of at least `minIntersectSize` genes with respect to `includedGenes` (or `includedGenes` expanded by its interactions if `adjMatrix` and `steps` are supplied) are included in the result set. By default, this is the size of `includedGenes`, requiring `includedGenes` to be a subset of each gene set.
`adjMatrix` | An optional adjacency matrix in which an entry is `1` if there is a direct interaction between the corresponding genes and `0` otherwise. If this is non-null, the set of genes in `includedGenes` is expanded by adding all genes whose distance in the adjacency graph is at most `steps`.
`steps` | The maximum distance of interacting genes to the genes in `includedGenes` according to `adjMatrix` to be added to the expanded gene list. E.g., `steps = 1` means that all genes which are direct interaction partners of the initial genes in `includedGenes` are added to `includedGenes`.

### Value

Returns a filtered list of gene sets with the same structure as `geneSets`.

### See Also

`geneSetAnalysis`, `preprocessGs`

### Examples

    geneSets <- list(
    		gs1 = paste("gene",1:20,sep=""),
    		gs2 = paste("gene",50:60,sep=""),
    		gs3 = paste("gene",90:92,sep=""),
    		gs4 = paste("gene",55:65,sep="")
    	)

    newGeneSets1 <- filterGeneSets(
    	geneSets = geneSets,
    	includedGenes = c("gene55","gene60"))

    newGeneSets2 <- filterGeneSets(
    	geneSets = geneSets,
    	includedGenes = c("gene1","gene55","gene20","gene100"),
    	minIntersectSize = 2)

    examplePathway <- c("gene1","gene2","gene3","gene4")
    pathwayAdjMatrix <- matrix(0,100,100)
    rownames(pathwayAdjMatrix) <- paste("gene",1:100,sep="")
    colnames(pathwayAdjMatrix) <- paste("gene",1:100,sep="")

    # gene1 interacts with gene2 and gene3
    # -> step 1 if gene1 is starting point
    pathwayAdjMatrix[1,2:3] <- 1
    pathwayAdjMatrix[2:3,1] <- 1

    # gene3 interacts with gene4
    # -> step 2 if gene1 is starting point
    pathwayAdjMatrix[3,4] <- 1
    pathwayAdjMatrix[4,3] <- 1

    newGeneSets3 <- filterGeneSets(
    	geneSets = geneSets,
    	includedGenes = "gene1",
    	adjMatrix = pathwayAdjMatrix,
    	steps = 2)

[Package GiANT version 1.2 Index]