collapsePathways {fgsea} | R Documentation

## Collapse list of enriched pathways to independent ones.

### Description

Collapse list of enriched pathways to independent ones.

### Usage

    collapsePathways(
      fgseaRes,
      pathways,
      stats,
      pval.threshold = 0.05,
      nperm = 10/pval.threshold,
      gseaParam = 1
    )

### Arguments

`fgseaRes` | Table with results of running fgsea(), should be filtered by p-value, for example by selecting ones with padj < 0.01.
`pathways` | List of pathways, should contain all the pathways present in 'fgseaRes'.
`stats` | Gene-level statistic values used for ranking, the same as in 'fgsea()'.
`pval.threshold` | Two pathways are considered dependent when p-value of enrichment of one pathways on background of another is greater then 'pval.threshold'.
`nperm` | Number of permutations to test for independence, should be several times greater than '1/pval.threhold'. Default value: '10/pval.threshold'.
`gseaParam` | GSEA parameter, same as for 'fgsea()'

### Value

Named list with two elments: 'mainPathways' containing IDs of pathways not reducable to each other, and 'parentPathways' with vector describing for all the pathways to which ones they can be reduced. For pathways from 'mainPathwyas' vector 'parentPathways' contains 'NA' values.

### Examples

    data(examplePathways)
    data(exampleRanks)
    fgseaRes <- fgsea(examplePathways, exampleRanks, nperm=10000, maxSize=500)
    collapsedPathways <- collapsePathways(fgseaRes[order(pval)][padj < 0.01],
                                          examplePathways, exampleRanks)
    mainPathways <- fgseaRes[pathway %in% collapsedPathways$mainPathways][
                             order(-NES), pathway]

[Package fgsea version 1.20.0 Index]