Last updated: 2024-05-22

Checks: 7 0

Knit directory: PPP/

This reproducible R Markdown analysis was created with workflowr (version 1.7.1). The Checks tab describes the reproducibility checks that were applied when the results were created. The Past versions tab lists the development history.


Great! Since the R Markdown file has been committed to the Git repository, you know the exact version of the code that produced these results.

Great job! The global environment was empty. Objects defined in the global environment can affect the analysis in your R Markdown file in unknown ways. For reproduciblity it’s best to always run the code in an empty environment.

The command set.seed(20240521) was run prior to running the code in the R Markdown file. Setting a seed ensures that any results that rely on randomness, e.g. subsampling or permutations, are reproducible.

Great job! Recording the operating system, R version, and package versions is critical for reproducibility.

Nice! There were no cached chunks for this analysis, so you can be confident that you successfully produced the results during this run.

Great job! Using relative paths to the files within your workflowr project makes it easier to run your code on other machines.

Great! You are using Git for version control. Tracking code development and connecting the code version to the results is critical for reproducibility.

The results in this page were generated with repository version 94fd282. See the Past versions tab to see a history of the changes made to the R Markdown and HTML files.

Note that you need to be careful to ensure that all relevant files for the analysis have been committed to Git prior to generating the results (you can use wflow_publish or wflow_git_commit). workflowr only checks the R Markdown file, but you know if there are other scripts or data files that it depends on. Below is the status of the Git repository when the results were generated:


Ignored files:
    Ignored:    .DS_Store
    Ignored:    .Rhistory
    Ignored:    data/.DS_Store
    Ignored:    data/viper/.DS_Store
    Ignored:    data/viper/regulon/.DS_Store

Note that any generated files, e.g. HTML, png, CSS, etc., are not included in this status report because it is ok for generated content to have uncommitted changes.


These are the previous versions of the repository in which changes were made to the R Markdown (analysis/viper_1.Rmd) and HTML (docs/viper_1.html) files. If you’ve configured a remote Git repository (see ?wflow_git_remote), click on the hyperlinks in the table below to view the files as they were in that past version.

File Version Author Date Message
Rmd 94fd282 Zhen Zuo 2024-05-22 update viper input prepare
html 94fd282 Zhen Zuo 2024-05-22 update viper input prepare

Introduction

The VIPER (Virtual Inference of Protein-activity by Enriched Regulon analysis) algorithm allows computational inference of protein activity, on an individual sample basis, from gene expression profile data. It uses the expression of genes that are most directly regulated by a given protein, such as the targets of a transcription factor (TF), as an accurate reporter of its activity.

We have shown that analysis of TF targets inferred by the ARACNe algorithm, using the Master Regulator Inference algorithm (MARINA), is effective in identifying drivers of specific cellular phenotype which could be experimentally validated.

Load packages

library(viper)
library(aracne.networks)
library(dplyr)
library(plyr)
library(stringr)
library(Biobase)
library(EnsDb.Hsapiens.v86)

Extract context-specific networks

ARACNe-AP was run on RNA-Seq datasets normalized using Variance-Stabilizing Transformation. The raw data was downloaded on April 15th, 2015 from the TCGA official website.

Extract ARACNe-inferred gene networks from TCGA tumor datasets.

items <- data(package="aracne.networks")$results[, "Item"]
print(items)
 [1] "regulonblca" "regulonbrca" "reguloncesc" "reguloncoad" "regulonesca"
 [6] "regulongbm"  "regulonhnsc" "regulonkirc" "regulonkirp" "regulonlaml"
[11] "regulonlihc" "regulonluad" "regulonlusc" "regulonnet"  "regulonov"  
[16] "regulonpaad" "regulonpcpg" "regulonprad" "regulonread" "regulonsarc"
[21] "regulonstad" "regulontgct" "regulonthca" "regulonthym" "regulonucec"
df <- read.csv("data/viper/aracne.networks.csv")
knitr::kable(df)
regulon description
regulonblca Human Bladder Carcinoma context-specific ARACNe interactome
regulonbrca Human Breast Carcinoma context-specific ARACNe interactome
reguloncesc Human Cervical Squamous Carcinoma context-specific ARACNe interactome
reguloncoad Human Colon Adenocarcinoma context-specific ARACNe interactome
regulonesca Human Esophageal Carcinoma context-specific ARACNe interactome
regulongbm Human Glioblastoma context-specific ARACNe interactome
regulonhnsc Human Head and Neck Squamous Carcinoma context-specific ARACNe interactome
regulonkirc Human Kidney Renal Clear Cell Carcinoma context-specific ARACNe interactome
regulonkirp Human Kidney Papillary Carcinoma context-specific ARACNe interactome
regulonlaml Human Acute Myeloid Leukemia context-specific ARACNe interactome
regulonlihc Human Liver Hepatocellular Carcinoma context-specific ARACNe interactome
regulonluad Human Lung Adenocarcinoma context-specific ARACNe interactome
regulonlusc Human Lung Squamous Carcinoma context-specific ARACNe interactome
regulonnet Human Neuroendocrine tumor context-specific ARACNe interactome
regulonov Human Ovarian Carcinoma context-specific ARACNe interactome
regulonpaad Human Pancreas Carcinoma context-specific ARACNe interactome
regulonpcpg Human Pheochromocytoma and Paraganglioma context-specific ARACNe interactome
regulonprad Human Prostate Carcinoma context-specific ARACNe interactome
regulonread Human Rectal Adenocarcinoma context-specific ARACNe interactome
regulonsarc Human Sarcoma context-specific ARACNe interactome
regulonstad Human Stomach Adenocarcinoma context-specific ARACNe interactome
regulontgct Human Testicular Cancer context-specific ARACNe interactome
regulonthca Human Thyroid Carcinoma context-specific ARACNe interactome
regulonthym Human Thymoma context-specific ARACNe interactome
regulonucec Human Utherine Corpus Endometroid Carcinoma context-specific ARACNe interactome

Process network and save as adj files

Export network to adj files

for (item in items) {
    if (!file.exists(paste("data/viper/regulon/", item, ".adj",
            sep = ""))) {
        get(item)
        write.regulon(get(item), file = paste("data/viper/regulon/", item, ".adj",
            sep = ""))
    }
}

Convert Entrez Gene ids to SYMBOL.

for (item in items) {
    if (!file.exists(paste("data/viper/regulon/", item, "_SYMBOL.adj", sep = ""))) {
        df <- read.csv(paste("data/viper/regulon/", item, ".adj", sep = ""),
            sep = "\t")

        geneID <- ensembldb::select(EnsDb.Hsapiens.v86, keys = as.character(df$Regulator),
            keytype = "ENTREZID", columns = c("SYMBOL", "ENTREZID", "GENEID"))
        df$Regulator <- plyr::mapvalues(df$Regulator, from = geneID$ENTREZID,
            to = geneID$SYMBOL, warn_missing = FALSE)

        geneID <- ensembldb::select(EnsDb.Hsapiens.v86, keys = as.character(df$Target),
            keytype = "ENTREZID", columns = c("SYMBOL", "ENTREZID", "GENEID"))
        df$Target <- plyr::mapvalues(df$Target, from = geneID$ENTREZID,
            to = geneID$SYMBOL, warn_missing = FALSE)

        can_be_integer <- function(x) {
            suppressWarnings(!is.na(as.integer(x)))
        }
        f1 <- !sapply(df$Regulator, can_be_integer)
        f2 <- !sapply(df$Target, can_be_integer)
        df <- df[f1 & f2, ]
        write.table(df, file = paste("data/viper/regulon/", item, "_SYMBOL.adj",
            sep = ""),sep = "\t",quote = FALSE, row.names = FALSE)
    }
}

Define RNA-seq and network pairs

df <- read.csv("data/viper/RNA_regulon_pairs.csv")
knitr::kable(df)
Lable RNA regulon description
kirc_normal data/viper/RNA_BCM_v1/ccRCC_RNAseq_circRNA_RSEM_UQ_log2_Normal.txt regulonkirc Human Kidney Renal Clear Cell Carcinoma context-specific ARACNe interactome
kirc_tumor data/viper/RNA_BCM_v1/ccRCC_RNAseq_circRNA_RSEM_UQ_log2_Tumor.txt regulonkirc Human Kidney Renal Clear Cell Carcinoma context-specific ARACNe interactome
hnsc_normal data/viper/RNA_BCM_v1/HNSCC_RNAseq_gene_RSEM_coding_UQ_1500_log2_Normal.txt regulonhnsc Human Head and Neck Squamous Carcinoma context-specific ARACNe interactome
hnsc_tumor data/viper/RNA_BCM_v1/HNSCC_RNAseq_gene_RSEM_coding_UQ_1500_log2_Tumor.txt regulonhnsc Human Head and Neck Squamous Carcinoma context-specific ARACNe interactome
lusc_normal data/viper/RNA_BCM_v1/LSCC_RNAseq_gene_RSEM_coding_UQ_1500_log2_Normal.txt regulonlusc Human Lung Squamous Carcinoma context-specific ARACNe interactome
lusc_tumor data/viper/RNA_BCM_v1/LSCC_RNAseq_gene_RSEM_coding_UQ_1500_log2_Tumor.txt regulonlusc Human Lung Squamous Carcinoma context-specific ARACNe interactome
luad_normal data/viper/RNA_BCM_v1/LUAD_RNAseq_gene_RSEM_coding_UQ_1500_log2_Normal.txt regulonluad Human Lung Adenocarcinoma context-specific ARACNe interactome
luad_tumor data/viper/RNA_BCM_v1/LUAD_RNAseq_gene_RSEM_coding_UQ_1500_log2_Tumor.txt regulonluad Human Lung Adenocarcinoma context-specific ARACNe interactome
paad_normal data/viper/RNA_BCM_v1/PDAC_RNAseq_gene_RSEM_coding_UQ_1500_log2_Normal.txt regulonpaad Human Pancreas Carcinoma context-specific ARACNe interactome
paad_tumor data/viper/RNA_BCM_v1/PDAC_RNAseq_gene_RSEM_coding_UQ_1500_log2_Tumor.txt regulonpaad Human Pancreas Carcinoma context-specific ARACNe interactome

Extract and process gene expression signatures

for (i in 1:nrow(df)) {
    exprsFile <- df$RNA[i]
    adjfile <- paste("data/viper/regulon/", df$regulon[1], "_SYMBOL.adj", sep = "")
    exprs <- as.matrix(read.table(exprsFile, header = TRUE, sep = "\t",
        row.names = 1, as.is = TRUE))
    rownames(exprs) <- sub("\\..*$", "", rownames(exprs))
    geneID <- ensembldb::select(EnsDb.Hsapiens.v86, keys = rownames(exprs),
        keytype = "GENEID", columns = c("SYMBOL", "ENTREZID", "GENEID"))
    rownames(exprs) <- plyr::mapvalues(rownames(exprs), from = geneID$GENEID,
        to = geneID$SYMBOL, warn_missing = FALSE)
    print(table(sapply(rownames(exprs), function(x) startsWith(x, "ENSG"))))
    exprs <- exprs[!sapply(rownames(exprs), function(x) startsWith(x, "ENSG")),
        ]
    # Identify duplicated row names
    duplicated_rows <- duplicated(rownames(exprs))
    # Remove rows with duplicated row names
    cleaned_exprs <- exprs[!duplicated_rows, , drop = FALSE]
    saveRDS(cleaned_exprs, paste("data/viper/exprs/", df$Lable[i], ".RDS", sep = ""))
}

FALSE 
 6913 

FALSE 
 6913 

FALSE  TRUE 
57207  3462 

FALSE  TRUE 
57207  3462 

FALSE  TRUE 
57207  3462 

FALSE  TRUE 
57207  3462 

FALSE  TRUE 
57207  3462 

FALSE  TRUE 
57207  3462 

FALSE  TRUE 
57207  3462 

FALSE  TRUE 
57207  3462 

sessionInfo()
R version 4.4.0 (2024-04-24)
Platform: aarch64-apple-darwin20
Running under: macOS Sonoma 14.5

Matrix products: default
BLAS:   /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/lib/libRblas.0.dylib 
LAPACK: /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/lib/libRlapack.dylib;  LAPACK version 3.12.0

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

time zone: America/New_York
tzcode source: internal

attached base packages:
[1] stats4    stats     graphics  grDevices utils     datasets  methods  
[8] base     

other attached packages:
 [1] EnsDb.Hsapiens.v86_2.99.0 ensembldb_2.28.0         
 [3] AnnotationFilter_1.28.0   GenomicFeatures_1.56.0   
 [5] AnnotationDbi_1.66.0      GenomicRanges_1.56.0     
 [7] GenomeInfoDb_1.40.0       IRanges_2.38.0           
 [9] S4Vectors_0.42.0          stringr_1.5.1            
[11] plyr_1.8.9                dplyr_1.1.4              
[13] aracne.networks_1.30.0    viper_1.38.0             
[15] Biobase_2.64.0            BiocGenerics_0.50.0      
[17] workflowr_1.7.1          

loaded via a namespace (and not attached):
  [1] bitops_1.0-7                DBI_1.2.2                  
  [3] rlang_1.1.3                 magrittr_2.0.3             
  [5] git2r_0.33.0                matrixStats_1.3.0          
  [7] e1071_1.7-14                compiler_4.4.0             
  [9] RSQLite_2.3.6               getPass_0.2-4              
 [11] png_0.1-8                   callr_3.7.6                
 [13] vctrs_0.6.5                 ProtGenerics_1.36.0        
 [15] pkgconfig_2.0.3             crayon_1.5.2               
 [17] fastmap_1.2.0               XVector_0.44.0             
 [19] utf8_1.2.4                  Rsamtools_2.20.0           
 [21] promises_1.3.0              rmarkdown_2.27             
 [23] UCSC.utils_1.0.0            ps_1.7.6                   
 [25] purrr_1.0.2                 bit_4.0.5                  
 [27] xfun_0.44                   zlibbioc_1.50.0            
 [29] cachem_1.1.0                jsonlite_1.8.8             
 [31] blob_1.2.4                  later_1.3.2                
 [33] DelayedArray_0.30.0         BiocParallel_1.38.0        
 [35] parallel_4.4.0              R6_2.5.1                   
 [37] bslib_0.7.0                 stringi_1.8.4              
 [39] rtracklayer_1.64.0          jquerylib_0.1.4            
 [41] SummarizedExperiment_1.34.0 Rcpp_1.0.12                
 [43] knitr_1.46                  mixtools_2.0.0             
 [45] httpuv_1.6.15               Matrix_1.7-0               
 [47] splines_4.4.0               tidyselect_1.2.1           
 [49] abind_1.4-5                 rstudioapi_0.16.0          
 [51] yaml_2.3.8                  codetools_0.2-20           
 [53] curl_5.2.1                  processx_3.8.4             
 [55] lattice_0.22-6              tibble_3.2.1               
 [57] KEGGREST_1.44.0             evaluate_0.23              
 [59] survival_3.6-4              proxy_0.4-27               
 [61] kernlab_0.9-32              Biostrings_2.72.0          
 [63] pillar_1.9.0                MatrixGenerics_1.16.0      
 [65] whisker_0.4.1               KernSmooth_2.23-24         
 [67] plotly_4.10.4               generics_0.1.3             
 [69] RCurl_1.98-1.14             rprojroot_2.0.4            
 [71] ggplot2_3.5.1               munsell_0.5.1              
 [73] scales_1.3.0                class_7.3-22               
 [75] glue_1.7.0                  lazyeval_0.2.2             
 [77] tools_4.4.0                 BiocIO_1.14.0              
 [79] data.table_1.15.4           GenomicAlignments_1.40.0   
 [81] XML_3.99-0.16.1             fs_1.6.4                   
 [83] grid_4.4.0                  tidyr_1.3.1                
 [85] colorspace_2.1-0            nlme_3.1-164               
 [87] GenomeInfoDbData_1.2.12     restfulr_0.0.15            
 [89] cli_3.6.2                   fansi_1.0.6                
 [91] S4Arrays_1.4.1              segmented_2.1-0            
 [93] viridisLite_0.4.2           gtable_0.3.5               
 [95] sass_0.4.9                  digest_0.6.35              
 [97] SparseArray_1.4.1           rjson_0.2.21               
 [99] htmlwidgets_1.6.4           memoise_2.0.1              
[101] htmltools_0.5.8.1           lifecycle_1.0.4            
[103] httr_1.4.7                  bit64_4.0.5                
[105] MASS_7.3-60.2