Skip to content

Commit

Permalink
TF activity inference working
Browse files Browse the repository at this point in the history
  • Loading branch information
olapuentesantana committed Feb 20, 2024
1 parent 4724419 commit fd5a45d
Show file tree
Hide file tree
Showing 9 changed files with 43 additions and 54 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,6 @@

# R project file
easier.Rproj

# Omnipath log
omnipathr-log/
7 changes: 4 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,13 @@ Imports:
rstatix,
ggrepel,
magrittr,
coin
coin,
OmnipathR
Suggests:
knitr, rmarkdown, BiocStyle, testthat, SummarizedExperiment, viper
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.3
RoxygenNote: 7.3.1
Config/testthat/edition: 3
8 changes: 2 additions & 6 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ importFrom(ROCR,performance)
importFrom(ROCR,plot)
importFrom(ROCR,prediction)
importFrom(coin,pvalue)
importFrom(decoupleR,run_viper)
importFrom(decoupleR,get_collectri)
importFrom(decoupleR,run_wmean)
importFrom(dplyr,filter)
importFrom(easierData,get_HGNC_annotation)
importFrom(easierData,get_TCGA_mean_pancancer)
Expand All @@ -42,7 +43,6 @@ importFrom(ggpubr,ggarrange)
importFrom(ggpubr,text_grob)
importFrom(ggrepel,geom_text_repel)
importFrom(grDevices,recordPlot)
importFrom(graphics,abline)
importFrom(graphics,legend)
importFrom(graphics,lines)
importFrom(graphics,par)
Expand All @@ -53,11 +53,9 @@ importFrom(progeny,getModel)
importFrom(progeny,progeny)
importFrom(quantiseqr,run_quantiseq)
importFrom(reshape2,melt)
importFrom(rlang,.data)
importFrom(rstatix,wilcox_effsize)
importFrom(rstatix,wilcox_test)
importFrom(stats,aggregate)
importFrom(stats,cor)
importFrom(stats,median)
importFrom(stats,na.exclude)
importFrom(stats,na.omit)
Expand All @@ -67,8 +65,6 @@ importFrom(stats,sd)
importFrom(stats,var)
importFrom(tibble,column_to_rownames)
importFrom(tidyr,pivot_wider)
importFrom(utils,View)
importFrom(utils,combn)
importFrom(utils,data)
importFrom(utils,head)
importFrom(utils,tail)
6 changes: 4 additions & 2 deletions R/compute_TF_activity.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#'
#' @import magrittr
#' @importFrom stats na.exclude
#' @importFrom dplyr filter
#' @importFrom decoupleR get_collectri run_wmean
#' @importFrom tidyr pivot_wider
#' @importFrom tibble column_to_rownames
Expand Down Expand Up @@ -81,7 +82,7 @@ compute_TF_activity <- function(RNA_tpm = NULL,
# collectTRI network
net <- decoupleR::get_collectri(organism='human', split_complexes=FALSE)
all_regulated_transcripts <- unique(net$target)
all_tfs <- unique(net$tf)
all_tfs <- unique(net$source)

# check what is the percentage of genes we have in our data
genes_kept <- intersect(rownames(E), all_regulated_transcripts)
Expand All @@ -103,12 +104,13 @@ compute_TF_activity <- function(RNA_tpm = NULL,
# TF activity: run viper
tf_activity_df <- decoupleR::run_wmean(mat = E,
net = net,
.source='tf',
.source='source',
.target='target',
.mor='mor',
minsize = 5)
# To matrix
tf_activity <- tf_activity_df %>%
dplyr::filter(statistic == "wmean") %>%
tidyr::pivot_wider(id_cols = condition,
names_from = source,
values_from = score) %>%
Expand Down
6 changes: 6 additions & 0 deletions R/easier-package.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#' @keywords internal
"_PACKAGE"

## usethis namespace: start
## usethis namespace: end
NULL
23 changes: 0 additions & 23 deletions R/easier-pkg.R

This file was deleted.

23 changes: 23 additions & 0 deletions man/easier-package.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 0 additions & 20 deletions man/easier-pkg.Rd

This file was deleted.

1 change: 1 addition & 0 deletions vignettes/easier_user_manual.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ suppressPackageStartupMessages({
For this example we will use gene expression data (counts and tpm values). Other variables include patient best overall response (BOR) to anti-PD-L1 therapy, tumor mutational burden (TMB) and the cancer type the cohort belongs to.

```{r, eval=TRUE}
dataset_mariathasan <- get_Mariathasan2018_PDL1_treatment()
# patient response
Expand Down

0 comments on commit fd5a45d

Please sign in to comment.