• Load packages
  • Generating the regulon object for Gene Expression
  • Run Viper on Gene Expression Data

Last updated: 2024-06-16

Checks: 6 1

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.


The R Markdown is untracked by Git. To know which version of the R Markdown file created these results, you’ll want to first commit it to the Git repo. If you’re still working on the analysis, you can ignore this warning. When you’re finished, you can run wflow_publish to commit the R Markdown file and build the HTML.

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 15464ce. 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:    .RData
    Ignored:    .Rhistory
    Ignored:    analysis/.DS_Store
    Ignored:    analysis/.RData
    Ignored:    analysis/.Rhistory
    Ignored:    code/.DS_Store
    Ignored:    code/TieDIE-devel/.DS_Store
    Ignored:    code/TieDIE-devel/examples/.DS_Store
    Ignored:    code/TieDIE-devel/examples/hnsc/.DS_Store
    Ignored:    code/TieDIE-tiedie2/.DS_Store
    Ignored:    code/TieDIE-tiedie2/examples/.DS_Store
    Ignored:    data/.DS_Store
    Ignored:    data/Phosphoproteome_BCM_GENCODE_v34_harmonized_v1/.DS_Store
    Ignored:    data/Phosphoproteome_BCM_GENCODE_v34_harmonized_v1/README/.DS_Store
    Ignored:    data/Proteome_BCM_GENCODE_v34_harmonized_v1/.DS_Store
    Ignored:    data/Proteome_BCM_GENCODE_v34_harmonized_v1/README/.DS_Store
    Ignored:    output/.DS_Store
    Ignored:    output/expr/.DS_Store
    Ignored:    output/pho/.DS_Store
    Ignored:    output/regulon/.DS_Store
    Ignored:    temp/.DS_Store

Untracked files:
    Untracked:  analysis/Identify_Transcription_Regulators.Rmd
    Untracked:  output/expr/dset_hnsc.RDS
    Untracked:  output/expr/dset_kirc.RDS
    Untracked:  output/expr/dset_luad.RDS
    Untracked:  output/expr/dset_lusc.RDS
    Untracked:  output/expr/dset_paad.RDS
    Untracked:  output/expr/hnsc/
    Untracked:  output/expr/kirc/
    Untracked:  output/expr/luad/
    Untracked:  output/expr/lusc/
    Untracked:  output/expr/paad/
    Untracked:  output/expr/regul_hnsc.RDS
    Untracked:  output/expr/regul_kirc.RDS
    Untracked:  output/expr/regul_luad.RDS
    Untracked:  output/expr/regul_lusc.RDS
    Untracked:  output/expr/regul_paad.RDS
    Untracked:  output/pho/dset_hnsc.RDS
    Untracked:  output/pho/dset_kirc.RDS
    Untracked:  output/pho/dset_luad.RDS
    Untracked:  output/pho/dset_lusc.RDS
    Untracked:  output/pho/dset_paad.RDS
    Untracked:  output/pho/hnsc/
    Untracked:  output/pho/kirc/
    Untracked:  output/pho/luad/
    Untracked:  output/pho/lusc/
    Untracked:  output/pho/paad/
    Untracked:  output/pho/regul_hnsc.RDS
    Untracked:  output/pho/regul_kirc.RDS
    Untracked:  output/pho/regul_luad.RDS
    Untracked:  output/pho/regul_lusc.RDS
    Untracked:  output/pho/regul_paad.RDS

Unstaged changes:
    Modified:   analysis/ContextSpecificNetworks.Rmd
    Modified:   analysis/Identify_Kinase_Regulators.Rmd
    Modified:   analysis/KSEA.Rmd
    Deleted:    output/regulon/KSA_gold_standard.adj
    Deleted:    output/regulon/raw/regulonblca.adj
    Deleted:    output/regulon/raw/regulonbrca.adj
    Deleted:    output/regulon/raw/reguloncesc.adj
    Deleted:    output/regulon/raw/reguloncoad.adj
    Deleted:    output/regulon/raw/regulonesca.adj
    Deleted:    output/regulon/raw/regulongbm.adj
    Deleted:    output/regulon/raw/regulonkirp.adj
    Deleted:    output/regulon/raw/regulonlaml.adj
    Deleted:    output/regulon/raw/regulonlihc.adj
    Deleted:    output/regulon/raw/regulonnet.adj
    Deleted:    output/regulon/raw/regulonov.adj
    Deleted:    output/regulon/raw/regulonpcpg.adj
    Deleted:    output/regulon/raw/regulonprad.adj
    Deleted:    output/regulon/raw/regulonread.adj
    Deleted:    output/regulon/raw/regulonsarc.adj
    Deleted:    output/regulon/raw/regulonstad.adj
    Deleted:    output/regulon/raw/regulontgct.adj
    Deleted:    output/regulon/raw/regulonthca.adj
    Deleted:    output/regulon/raw/regulonthym.adj
    Deleted:    output/regulon/raw/regulonucec.adj
    Deleted:    output/regulon/regulonblca.adj
    Deleted:    output/regulon/regulonbrca.adj
    Deleted:    output/regulon/reguloncesc.adj
    Deleted:    output/regulon/reguloncoad.adj
    Deleted:    output/regulon/regulonesca.adj
    Deleted:    output/regulon/regulongbm.adj
    Modified:   output/regulon/regulonhnsc.adj
    Modified:   output/regulon/regulonkirc.adj
    Deleted:    output/regulon/regulonkirp.adj
    Deleted:    output/regulon/regulonlaml.adj
    Deleted:    output/regulon/regulonlihc.adj
    Modified:   output/regulon/regulonluad.adj
    Modified:   output/regulon/regulonlusc.adj
    Deleted:    output/regulon/regulonnet.adj
    Deleted:    output/regulon/regulonov.adj
    Modified:   output/regulon/regulonpaad.adj
    Deleted:    output/regulon/regulonpcpg.adj
    Deleted:    output/regulon/regulonprad.adj
    Deleted:    output/regulon/regulonread.adj
    Deleted:    output/regulon/regulonsarc.adj
    Deleted:    output/regulon/regulonstad.adj
    Deleted:    output/regulon/regulontgct.adj
    Deleted:    output/regulon/regulonthca.adj
    Deleted:    output/regulon/regulonthym.adj
    Deleted:    output/regulon/regulonucec.adj
    Deleted:    p/ContextSpecificNetworks.Rmd
    Deleted:    p/Differentially_Gene.Rmd
    Deleted:    p/Differentially_Phosphorylated_Site.Rmd
    Deleted:    p/Differentially_Protein.Rmd
    Deleted:    p/Identify_Kinase_Regulators.Rmd
    Deleted:    p/KSEA.Rmd
    Deleted:    p/about.Rmd
    Deleted:    p/index.Rmd
    Deleted:    p/license.Rmd

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.


There are no past versions. Publish this analysis with wflow_publish() to start tracking its development.


Load packages

library(viper)
library(EnsDb.Hsapiens.v86)
library(foreach)
library(doParallel)
cluster <- makeCluster(5)
registerDoParallel(cluster)
dir.create("output/regulon/",showWarnings = FALSE)
set.seed(0)

Generating the regulon object for Gene Expression

set.seed(0)
for (name in c("kirc", "hnsc", "lusc", "luad", "paad")) {
    adjfile <- paste("output/regulon/regulon",name,".adj",sep = "")
    exp_normal <- readRDS(paste("output/expr/count_matrix_", name, "_normal.RDS",
        sep = ""))
    prot_normal <- readRDS(paste("output/prot/count_matrix_", name, "_normal.RDS",
        sep = ""))
    
    exp_tumor <- readRDS(paste("output/expr/count_matrix_", name, "_tumor.RDS",
        sep = ""))
    prot_tumor <- readRDS(paste("output/prot/count_matrix_", name, "_tumor.RDS",
        sep = ""))
    
    exp <- merge(exp_normal, exp_tumor, by = "row.names", all = FALSE)
    nor_sam <- colnames(exp)[1:ncol(exp_normal)]
    tur_sam <- colnames(exp)[(ncol(exp_normal)+1):ncol(exp)]
    prot <- merge(prot_normal, prot_tumor, by = "row.names", all = FALSE)
    
    rownames(exp) <- exp$Row.names
    exp$Row.names <- NULL
    
    rownames(prot) <- paste(prot$Row.names,"_P",sep="")
    prot$Row.names <- NULL
    
    common_ind <- intersect(colnames(exp),colnames(prot))
    expr <- rbind(prot[,common_ind],exp[,common_ind])

    signature <- c(rep("normal", sum(common_ind %in% nor_sam)), rep("tumor", sum(common_ind %in% tur_sam)))
    dset <- ExpressionSet(assayData = as.matrix(expr))
    dset$description <- factor(signature)
    regul <- aracne2regulon(adjfile, dset, verbose = TRUE)
    saveRDS(dset, paste("output/expr/dset_", name, ".RDS", sep = ""))
    saveRDS(regul, paste("output/expr/regul_", name, ".RDS", sep = ""))
}

Run Viper on Gene Expression Data

foreach(name = c("kirc", "hnsc", "lusc", "luad", "paad")) %dopar% {
    library(viper)
    dset <- readRDS(paste("output/expr/dset_", name, ".RDS",
        sep = ""))
    regulon <- readRDS(paste("output/expr/regul_", name, ".RDS", sep = ""))
    signature <- rowTtest(dset, "description", "tumor", "normal")
    signature <- (qnorm(signature$p.value/2, lower.tail = FALSE) * sign(signature$statistic))[,
        1]

    # NULL model by sample permutations
    nullmodel <- ttestNull(dset, "description", "tumor", "normal", per = 1000,
        repos = TRUE, verbose = FALSE)
    ## Normalized Enrichment Score (NES)
    mrs <- msviper(signature, regulon, nullmodel, verbose = FALSE)
    temp <- summary(mrs, length(mrs$regulon))
    temp$Sign <- ifelse(temp$NES > 0, "+", "-")
    temp <- temp[temp$FDR < 0.2, ]
    temp <- temp[, c("Regulon", "NES", "Sign")]
    temp$NES <- abs(temp$NES)
    dir.create(paste("output/expr/",
        name, "/", sep = ""),showWarnings = F)
    write.table(temp, paste("output/expr/",
        name, "/transcription_regulators.txt", sep = ""), quote = F, sep = "\t", row.names = F,
        col.names = F)
}
[[1]]
NULL

[[2]]
NULL

[[3]]
NULL

[[4]]
NULL

[[5]]
NULL

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] parallel  stats4    stats     graphics  grDevices utils     datasets 
[8] methods   base     

other attached packages:
 [1] doParallel_1.0.17         iterators_1.0.14         
 [3] foreach_1.5.2             EnsDb.Hsapiens.v86_2.99.0
 [5] ensembldb_2.28.0          AnnotationFilter_1.28.0  
 [7] GenomicFeatures_1.56.0    AnnotationDbi_1.66.0     
 [9] GenomicRanges_1.56.0      GenomeInfoDb_1.40.0      
[11] IRanges_2.38.0            S4Vectors_0.42.0         
[13] viper_1.38.0              Biobase_2.64.0           
[15] BiocGenerics_0.50.0      

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