Skip to content

Commit

Permalink
use of decoupleR:run_viper instead of dorothea:run_viper
Browse files Browse the repository at this point in the history
  • Loading branch information
olapuentesantana committed May 24, 2023
1 parent 554f31b commit 6b5abf1
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 14 deletions.
6 changes: 5 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ Imports:
progeny,
easierData,
dorothea (>= 1.6.0),
decoupleR,
quantiseqr,
ROCR,
grDevices,
Expand All @@ -51,18 +52,21 @@ Imports:
DESeq2,
utils,
dplyr,
tidyr,
tibble,
matrixStats,
rlang,
BiocParallel,
reshape2,
rstatix,
ggrepel,
magrittr,
coin
Suggests:
knitr, rmarkdown, BiocStyle, testthat, SummarizedExperiment
biocViews: GeneExpression, Software, Transcription, SystemsBiology, Pathways, GeneSetEnrichment, ImmunoOncology, Epigenetics, Classification, BiomedicalInformatics, Regression, ExperimentHubSoftware
VignetteBuilder: knitr
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.2.1
RoxygenNote: 7.2.3
Config/testthat/edition: 3
5 changes: 4 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export(explore_biomarkers)
export(predict_immune_response)
export(retrieve_easier_score)
import(ggplot2)
import(magrittr)
importFrom(BiocParallel,MulticoreParam)
importFrom(BiocParallel,bplapply)
importFrom(BiocParallel,register)
Expand All @@ -24,7 +25,7 @@ importFrom(ROCR,performance)
importFrom(ROCR,plot)
importFrom(ROCR,prediction)
importFrom(coin,pvalue)
importFrom(dorothea,run_viper)
importFrom(decoupleR,run_viper)
importFrom(dplyr,filter)
importFrom(easierData,get_HGNC_annotation)
importFrom(easierData,get_TCGA_mean_pancancer)
Expand Down Expand Up @@ -64,6 +65,8 @@ importFrom(stats,prcomp)
importFrom(stats,quantile)
importFrom(stats,sd)
importFrom(stats,var)
importFrom(tibble,column_to_rownames)
importFrom(tidyr,pivot_wider)
importFrom(utils,View)
importFrom(utils,combn)
importFrom(utils,data)
Expand Down
33 changes: 22 additions & 11 deletions R/compute_TF_activity.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@
#' the estimation of human transcription factor activities."
#' Genome Research. 2019. DOI: 10.1101/gr.240663.118.
#'
#' @importFrom dorothea run_viper
#' @import magrittr
#' @importFrom stats na.exclude
#' @importFrom dplyr filter
#' @importFrom decoupleR run_viper
#' @importFrom tidyr pivot_wider
#' @importFrom tibble column_to_rownames
#' @importFrom easierData get_TCGA_mean_pancancer get_TCGA_sd_pancancer
#'
#' @param RNA_tpm data.frame containing TPM values with HGNC symbols
Expand Down Expand Up @@ -93,17 +96,25 @@ compute_TF_activity <- function(RNA_tpm = NULL,
round(length(genes_kept) / length(all_regulated_transcripts), 3) * 100, "%)"
)
}
# TF activity: run viper
tf_activity <- dorothea::run_viper(
input = E, regulons = regulons,
options = list(
method = "none", minsize = 4, eset.filter = FALSE,
cores = 1, verbose = FALSE
)
)

# Samples as rows, TFs as columns
tf_activity <- t(tf_activity)
# Remove genes with all NA/Inf values
E <- E[!is.na(apply(E, 1, sum)), ]
E <- E[!is.infinite(apply(E, 1, sum)), ]

# TF activity: run viper
tf_activity_df <- decoupleR::run_viper(mat = E,
network = regulons,
.source = "tf",
minsize = 4,
eset.filter = FALSE,
method = "none",
verbose = FALSE)
# To matrix
tf_activity <- tf_activity_df %>%
tidyr::pivot_wider(id_cols = condition,
names_from = source,
values_from = score) %>%
tibble::column_to_rownames("condition")

if (verbose) message("TF activity computed! \n")

Expand Down
2 changes: 1 addition & 1 deletion vignettes/easier_user_manual.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ knitr::opts_chunk$set(
```

```{r setup, include = FALSE}
library("easier")
#library("easier")
```

# Introduction {#introduction}
Expand Down

0 comments on commit 6b5abf1

Please sign in to comment.