EnrichmentJaccard: EnrichmentJaccard - using gsea list and LeadingEdgeIndexed...

EnrichmentJaccardR Documentation

EnrichmentJaccard - using gsea list and LeadingEdgeIndexed result, compute pairwise jaccard index of leadingedge genes within celltypes. saves a heatmap of modules for each cell type in savpath if saveplot = TRUE. Returns a gsea result dataframe with all celltypes combined and module annotated with average within celltype jaccard index and leadingedge genes.

Description

EnrichmentJaccard - using gsea list and LeadingEdgeIndexed result, compute pairwise jaccard index of leadingedge genes within celltypes. saves a heatmap of modules for each cell type in savpath if saveplot = TRUE. Returns a gsea result dataframe with all celltypes combined and module annotated with average within celltype jaccard index and leadingedge genes.

Usage

EnrichmentJaccard(
  ...,
  gsealist,
  indexedgenes,
  saveplot = FALSE,
  returnJaccardMtx = FALSE,
  figpath
)

Arguments

gsealist

results from FgseaList or RunFgseaOnRankList (recommend first lapply filter(padj < 0.05 e.g.) )

indexedgenes

results fro mLeadingEdgeIndexed

saveplot

if TRUE saves jaccard index heatmap to figpath

figpath

place to save figures, a file.path().

Value

curated dataframe of gsea results with average jaccard index.

Examples

## Not run: 
# read baseline enrichemnt results
g0 = FgseaList(rank.list.celltype = t1hvl_rank, pathways = btm,  BPPARAM = pparam)
filtered_g0 = lapply(g0, function(x) x %>% filter(padj < 0.05))

  compute jaccard index of leadingedge genes within celltype
  li = LeadingEdgeIndexed(gsea.result.list = g0,padj.threshold = 0.05)

  # enrichment jaccard
  d = EnrichmentJaccard(gsealist = filtered_g0, indexedgenes = li,
  saveplot = TRUE, figpath = figpath,
  fontsize_row = 7.5, fontsize_col = 7.5)
  d = d %>%
  mutate(leadingEdge = map_chr(leadingEdge, toString)) %>%
  select(celltype, av_jaccard,everything())
  write_delim(d,file = paste0(datapath, 'g0jaccard.csv'),delim = ',')

## End(Not run)


MattPM/scglmmr documentation built on April 26, 2024, 12:55 a.m.