library(dplyr)
library(DTSEA)
# Load the data
data("example_disease_list", package = "DTSEA")
data("example_drug_target_list", package = "DTSEA")
data("example_ppi", package = "DTSEA")
# Run the DTSEA and sort the result dataframe by normalized enrichment scores
# (NES)
result <- DTSEA(
network = example_ppi,
disease = example_disease_list,
drugs = example_drug_target_list,
verbose = FALSE
) %>%
arrange(desc(NES))
# Or you can utilize the multi-core advantages by enable nproc parameters
# on non-Windows operating systems.
if (FALSE) result <- DTSEA(
network = example_ppi,
disease = example_disease_list,
drugs = example_drug_target_list,
nproc = 10, verbose = FALSE
)
# We can extract the significantly NES > 0 drug items.
result %>%
filter(NES > 0 & pval < .05)
# Or we can draw the enrichment plot of the first predicted drug.
fgsea::plotEnrichment(
pathway = example_drug_target_list %>%
filter(drug_id == slice(result, 1)$drug_id) %>%
pull(gene_target),
stats = random.walk(network = example_ppi,
p0 = calculate_p0(nodes = example_ppi,
disease = example_disease_list)
)
)
# If you have obtained the supplemental data, then you can do random walk
# with restart in the real data set
# supp_data <- get_data(c("graph", "disease_related", "example_ppi"))
# result <- DTSEA(network = supp_data[["graph"]],
# disease = supp_data[["disease_related"]],
# drugs = supp_data[["drug_targets"]],
# verbose = FALSE)
Run the code above in your browser using DataLab