From 20ef4deb894a1c815485c0d6b5df9e39a48a1f81 Mon Sep 17 00:00:00 2001 From: J Wokaty Date: Tue, 1 Nov 2022 11:26:08 -0400 Subject: [PATCH 1/8] bump x.y.z version to even y prior to creation of RELEASE_3_16 branch --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index ae6ec9e..d316846 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: easier Title: Estimate Systems Immune Response from RNA-seq data -Version: 1.3.2 +Version: 1.4.0 Authors@R: c( person( From 5c4616cdf2e4a1fedb1e0f3a85fd1c2c1a16359e Mon Sep 17 00:00:00 2001 From: J Wokaty Date: Tue, 1 Nov 2022 11:26:08 -0400 Subject: [PATCH 2/8] bump x.y.z version to odd y following creation of RELEASE_3_16 branch --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index d316846..693802d 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: easier Title: Estimate Systems Immune Response from RNA-seq data -Version: 1.4.0 +Version: 1.5.0 Authors@R: c( person( From d96072915c3912fcd4f4b4da63bc30ab3aa28970 Mon Sep 17 00:00:00 2001 From: J Wokaty Date: Tue, 25 Apr 2023 11:34:46 -0400 Subject: [PATCH 3/8] bump x.y.z version to even y prior to creation of RELEASE_3_17 branch --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 693802d..240a097 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: easier Title: Estimate Systems Immune Response from RNA-seq data -Version: 1.5.0 +Version: 1.6.0 Authors@R: c( person( From 0291eca2a4f352e929c187b5fb2743adc4cfb1c3 Mon Sep 17 00:00:00 2001 From: olapuente Date: Tue, 16 May 2023 13:13:47 +0200 Subject: [PATCH 4/8] Removed NA LR pairs --- vignettes/easier_user_manual.Rmd | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/vignettes/easier_user_manual.Rmd b/vignettes/easier_user_manual.Rmd index 2f2b681..ad51896 100644 --- a/vignettes/easier_user_manual.Rmd +++ b/vignettes/easier_user_manual.Rmd @@ -269,7 +269,12 @@ More detailed information on how these networks were obtained can be found in th ```{r, eval=TRUE} lrpair_weights <- compute_LR_pairs(RNA_tpm = RNA_tpm, cancer_type = "pancan") + +# Remove LR which are not found (NA's) +na_lrpairs <- names(lrpair_weights)[is.na(apply(lrpair_weights, 2, sum))] +lrpair_weights <- lrpair_weights[, -which(colnames(lrpair_weights) %in% na_lrpairs)] head(lrpair_weights[,1:5]) + ``` Via `cancer_type`, a cancer-specific ligand-receptor pairs network can be chosen. With `cancer_type` set to `pancan`, a pan-cancer network will be used and this is based on the union of all ligand-receptor pairs present across the 18 cancer-specific networks. From 143cff1a9f39bbc2f3aed7ebc59c3e6af032906d Mon Sep 17 00:00:00 2001 From: olapuente Date: Tue, 16 May 2023 13:19:42 +0200 Subject: [PATCH 5/8] version bump z=1 --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 240a097..ff3f3b7 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: easier Title: Estimate Systems Immune Response from RNA-seq data -Version: 1.6.0 +Version: 1.6.1 Authors@R: c( person( From 8e1472d0497127eb018e5a08fa1cf25bd904df96 Mon Sep 17 00:00:00 2001 From: olapuente Date: Fri, 19 May 2023 10:16:35 +0200 Subject: [PATCH 6/8] Delete automatically NAs in LRpairs computation --- R/compute_LR_pairs.R | 2 ++ vignettes/easier_user_manual.Rmd | 5 ----- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/R/compute_LR_pairs.R b/R/compute_LR_pairs.R index 9b82e9e..adb8f79 100644 --- a/R/compute_LR_pairs.R +++ b/R/compute_LR_pairs.R @@ -166,6 +166,8 @@ compute_LR_pairs <- function(RNA_tpm = NULL, colnames(LR_pairs_computed)[pos_keep] <- combo_name LR_pairs_computed <- LR_pairs_computed[, -pos_remove] } + # Remove LR pairs with all NA values + LR_pairs_computed <- LR_pairs_computed[, !is.na(apply(LR_pairs_computed, 2, sum))] if (verbose) message("Ligand-Receptor pair weights computed \n") return(as.data.frame(LR_pairs_computed)) diff --git a/vignettes/easier_user_manual.Rmd b/vignettes/easier_user_manual.Rmd index ad51896..2f2b681 100644 --- a/vignettes/easier_user_manual.Rmd +++ b/vignettes/easier_user_manual.Rmd @@ -269,12 +269,7 @@ More detailed information on how these networks were obtained can be found in th ```{r, eval=TRUE} lrpair_weights <- compute_LR_pairs(RNA_tpm = RNA_tpm, cancer_type = "pancan") - -# Remove LR which are not found (NA's) -na_lrpairs <- names(lrpair_weights)[is.na(apply(lrpair_weights, 2, sum))] -lrpair_weights <- lrpair_weights[, -which(colnames(lrpair_weights) %in% na_lrpairs)] head(lrpair_weights[,1:5]) - ``` Via `cancer_type`, a cancer-specific ligand-receptor pairs network can be chosen. With `cancer_type` set to `pancan`, a pan-cancer network will be used and this is based on the union of all ligand-receptor pairs present across the 18 cancer-specific networks. From 554f31bc62adca1b82bab05107dddd389d891854 Mon Sep 17 00:00:00 2001 From: olapuente Date: Fri, 19 May 2023 10:20:50 +0200 Subject: [PATCH 7/8] Modified version number z --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index ff3f3b7..4a72e64 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: easier Title: Estimate Systems Immune Response from RNA-seq data -Version: 1.6.1 +Version: 1.6.2 Authors@R: c( person( From 6b5abf1a0f9989c404d6635dc85a2d6e84c95a00 Mon Sep 17 00:00:00 2001 From: olapuente Date: Wed, 24 May 2023 17:40:59 +0200 Subject: [PATCH 8/8] use of decoupleR:run_viper instead of dorothea:run_viper --- DESCRIPTION | 6 +++++- NAMESPACE | 5 ++++- R/compute_TF_activity.R | 33 +++++++++++++++++++++----------- vignettes/easier_user_manual.Rmd | 2 +- 4 files changed, 32 insertions(+), 14 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 4a72e64..2415522 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -41,6 +41,7 @@ Imports: progeny, easierData, dorothea (>= 1.6.0), + decoupleR, quantiseqr, ROCR, grDevices, @@ -51,12 +52,15 @@ Imports: DESeq2, utils, dplyr, + tidyr, + tibble, matrixStats, rlang, BiocParallel, reshape2, rstatix, ggrepel, + magrittr, coin Suggests: knitr, rmarkdown, BiocStyle, testthat, SummarizedExperiment @@ -64,5 +68,5 @@ biocViews: GeneExpression, Software, Transcription, SystemsBiology, Pathways, Ge VignetteBuilder: knitr Encoding: UTF-8 Roxygen: list(markdown = TRUE) -RoxygenNote: 7.2.1 +RoxygenNote: 7.2.3 Config/testthat/edition: 3 diff --git a/NAMESPACE b/NAMESPACE index 5da3218..b09d448 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -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) @@ -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) @@ -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) diff --git a/R/compute_TF_activity.R b/R/compute_TF_activity.R index 116bc6a..e583dc6 100644 --- a/R/compute_TF_activity.R +++ b/R/compute_TF_activity.R @@ -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 @@ -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") diff --git a/vignettes/easier_user_manual.Rmd b/vignettes/easier_user_manual.Rmd index 2f2b681..67bfe23 100644 --- a/vignettes/easier_user_manual.Rmd +++ b/vignettes/easier_user_manual.Rmd @@ -59,7 +59,7 @@ knitr::opts_chunk$set( ``` ```{r setup, include = FALSE} -library("easier") +#library("easier") ``` # Introduction {#introduction}