two_method_pathway_enrichment: two_method_pathway_enrichment

View source: R/two_method_pathway_enrichment.R

two_method_pathway_enrichmentR Documentation

two_method_pathway_enrichment

Description

Pathway analysis of each cell-type based on cell-type specificity and rank improvement by scMappR.

Usage

two_method_pathway_enrichment(
  DEG_list,
  theSpecies,
  scMappR_vals,
  background_genes = NULL,
  output_directory = "output",
  plot_names = "reweighted",
  number_genes = -9,
  newGprofiler = TRUE,
  toSave = FALSE,
  path = NULL
)

Arguments

DEG_list

Differentially expressed genes (gene_name, padj, log2fc).

theSpecies

Human, mouse, or a character that is compatible with g:ProfileR.

scMappR_vals

cell weighted Fold-changes of differentially expressed genes.

background_genes

A list of background genes to test against. NULL assumes all genes in g:profileR gene set databases.

output_directory

Path to the directory where files will be saved.

plot_names

Names of output.

number_genes

Number of genes to if there are many, many DEGs.

newGprofiler

Whether to use g:ProfileR or gprofiler2 (T/F).

toSave

Allow scMappR to write files in the current directory (T/F).

path

If toSave == TRUE, path to the directory where files will be saved.

Details

This function re-ranks cwFoldChanges based on their absolute cell-type specificity scores (per-celltype) as well as their rank increase in cell-type specificity before completing an ordered pathway analysis. In the second method, only genes with a rank increase in cell-type specificity were included.

Value

List with the following elements:

rank_increase

A list containing the degree of rank change between bulk DE genes and cwFold-changes. Pathway enrichment and TF enrichment of these reranked genes.

non_rank_increase

list of DFs containing the pathway and TF enrichment of cwFold-changes.

Examples



# load data for scMappR
data(PBMC_example)
bulk_DE_cors <- PBMC_example$bulk_DE_cors
bulk_normalized <- PBMC_example$bulk_normalized
odds_ratio_in <- PBMC_example$odds_ratio_in
case_grep <- "_female"
control_grep <- "_male"
max_proportion_change <- 10
print_plots <- FALSE
theSpecies <- "human"

# calculate cwFold-changes
toOut <- scMappR_and_pathway_analysis(count_file = bulk_normalized, 
                                      signature_matrix = odds_ratio_in, 
                                      DEG_list = bulk_DE_cors, case_grep = case_grep,
                                      control_grep = control_grep, rda_path = "", 
                                      max_proportion_change = 10, print_plots = TRUE, 
                                      plot_names = "tst1", theSpecies = "human", 
                                      output_directory = "tester",
                                      sig_matrix_size = 3000,
                                      up_and_downregulated = FALSE, 
                                      internet = FALSE)

# complete pathway enrichment using both methods
twoOutFiles <- two_method_pathway_enrichment(DEG_list = bulk_DE_cors,theSpecies = "human",
scMappR_vals = toOut$cellWeighted_Foldchange, background_genes = rownames(bulk_normalized), 
output_directory = "newfun_test",plot_names = "nonreranked_", toSave = FALSE)


 

scMappR documentation built on July 9, 2023, 6:26 p.m.