Last updated: 2021-07-28

Checks: 7 0

Knit directory: Multispectral HCC/

This reproducible R Markdown analysis was created with workflowr (version 1.6.2). 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(20210728) 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 dcab1bf. 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:    .Rproj.user/
    Ignored:    code/
    Ignored:    data/
    Ignored:    old/
    Ignored:    output/

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/tcga.Rmd) and HTML (docs/tcga.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 dcab1bf Jovan Tanevski 2021-07-28 set figure output to svg
html 33e71a0 Jovan Tanevski 2021-07-28 Build site.
Rmd bb998b8 Jovan Tanevski 2021-07-28 hclust with factoextra
html 1cb80af Jovan Tanevski 2021-07-28 Build site.
Rmd d0b6e0f Jovan Tanevski 2021-07-28 add pca to tcga analysis
html d73f586 Jovan Tanevski 2021-07-28 Build site.
Rmd c4324f5 Jovan Tanevski 2021-07-28 add umap
html 0bfae68 Jovan Tanevski 2021-07-28 Build site.
Rmd 82e3712 Jovan Tanevski 2021-07-28 add basic hclust

Setup

Load required libraries.

library(tidyverse)
── Attaching packages ─────────────────────────────────────── tidyverse 1.3.1 ──
✓ ggplot2 3.3.5     ✓ purrr   0.3.4
✓ tibble  3.1.3     ✓ dplyr   1.0.7
✓ tidyr   1.1.3     ✓ stringr 1.4.0
✓ readr   2.0.0     ✓ forcats 0.5.1
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
x dplyr::filter() masks stats::filter()
x dplyr::lag()    masks stats::lag()
library(skimr)
library(uwot)
Loading required package: Matrix

Attaching package: 'Matrix'
The following objects are masked from 'package:tidyr':

    expand, pack, unpack
library(factoextra)
Welcome! Want to learn more? See two factoextra-related books at https://goo.gl/ve3WBa

Read filtered TCGA RRPA data and display summary statistics.

tcga <- read_csv("data/TCGA-RPPA-LIHC_selected.csv", col_types = cols()) %>%
  select(-TumorType) %>%
  column_to_rownames("SampleID")
skim(tcga)
Data summary
Name tcga
Number of rows 184
Number of columns 12
_______________________
Column type frequency:
numeric 12
________________________
Group variables None

Variable type: numeric

skim_variable n_missing complete_rate mean sd p0 p25 p50 p75 p100 hist
P53 0 1 -1.13 0.46 -2.54 -1.40 -0.96 -0.76 -0.51 ▁▂▂▅▇
AKT_pS473 0 1 -0.63 0.71 -2.76 -1.02 -0.41 -0.15 0.96 ▁▂▃▇▁
AKT_pT308 0 1 0.07 0.42 -1.16 -0.07 0.09 0.22 1.72 ▁▃▇▁▁
BETACATENIN 0 1 1.50 0.72 -1.30 1.08 1.51 1.87 3.70 ▁▁▇▅▁
JNK_pT183Y185 0 1 -0.21 0.29 -1.14 -0.36 -0.17 -0.04 0.48 ▁▂▇▇▂
MEK1_pS217S221 0 1 -0.17 0.36 -0.82 -0.35 -0.23 -0.10 2.58 ▇▃▁▁▁
P38_pT180Y182 0 1 0.49 0.57 -1.45 0.31 0.50 0.72 2.95 ▁▂▇▁▁
P70S6K_pT389 0 1 -1.21 0.75 -3.22 -1.58 -0.95 -0.65 1.09 ▂▃▇▃▁
PDK1_pS241 0 1 0.40 0.31 -0.56 0.23 0.37 0.55 1.62 ▁▇▇▂▁
S6_pS235S236 0 1 -0.72 0.75 -3.53 -1.06 -0.67 -0.36 1.12 ▁▁▅▇▂
YAP_pS127 0 1 2.21 0.61 0.68 1.78 2.10 2.54 4.05 ▁▇▇▂▁
TRANSGLUTAMINASE 0 1 -0.42 0.56 -1.24 -0.83 -0.59 -0.20 2.72 ▇▃▁▁▁

Unsupervised analysis

Perform hierarchical clustering of the data and plot the resulting dendrogram

tcga.hclust <- eclust(tcga, "hclust", k = 4)
Warning: `guides(<scale> = FALSE)` is deprecated. Please use `guides(<scale> =
"none")` instead.
fviz_dend(tcga.hclust, rect = TRUE)
Warning: `guides(<scale> = FALSE)` is deprecated. Please use `guides(<scale> =
"none")` instead.

fviz_silhouette(tcga.hclust) +
  theme_classic() +
  theme(axis.text.x = element_text(angle = 90, hjust = 1))
  cluster size ave.sil.width
1       1   72          0.05
2       2   15          0.23
3       3   29         -0.04
4       4   68          0.25

Project to 2D with PCA and UMAP and plot

tcga.pca <- prcomp(tcga)
summary(tcga.pca)
Importance of components:
                          PC1    PC2    PC3     PC4     PC5     PC6     PC7
Standard deviation     1.2123 0.8248 0.6607 0.56514 0.52805 0.47568 0.43431
Proportion of Variance 0.3831 0.1773 0.1138 0.08325 0.07268 0.05898 0.04917
Cumulative Proportion  0.3831 0.5604 0.6742 0.75746 0.83014 0.88912 0.93829
                           PC8     PC9   PC10    PC11    PC12
Standard deviation     0.31055 0.24392 0.2216 0.14622 0.10156
Proportion of Variance 0.02514 0.01551 0.0128 0.00557 0.00269
Cumulative Proportion  0.96343 0.97894 0.9917 0.99731 1.00000
fviz_pca_biplot(tcga.pca, label = "var", col.ind = as.factor(tcga.hclust$cluster)) +
  theme_classic()

tcga.umap <- umap(tcga, n_neighbors = 5, n_epochs = 1000) %>%
  cbind(tcga.hclust$cluster) %>%
  `colnames<-`(c("U1", "U2", "Cluster")) %>%
  as_tibble() %>%
  mutate_at("Cluster", as.factor)

ggplot(tcga.umap, aes(x = U1, y = U2, color = Cluster, shape = Cluster)) +
  geom_point() +
  theme_classic()


sessionInfo()
R version 4.1.0 (2021-05-18)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Big Sur 10.16

Matrix products: default
BLAS:   /Library/Frameworks/R.framework/Versions/4.1/Resources/lib/libRblas.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.1/Resources/lib/libRlapack.dylib

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

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

other attached packages:
 [1] factoextra_1.0.7 uwot_0.1.10      Matrix_1.3-4     skimr_2.1.3     
 [5] forcats_0.5.1    stringr_1.4.0    dplyr_1.0.7      purrr_0.3.4     
 [9] readr_2.0.0      tidyr_1.1.3      tibble_3.1.3     ggplot2_3.3.5   
[13] tidyverse_1.3.1  workflowr_1.6.2 

loaded via a namespace (and not attached):
 [1] fs_1.5.0          lubridate_1.7.10  bit64_4.0.5       httr_1.4.2       
 [5] rprojroot_2.0.2   repr_1.1.3        tools_4.1.0       backports_1.2.1  
 [9] bslib_0.2.5.1     utf8_1.2.2        R6_2.5.0          DBI_1.1.1        
[13] colorspace_2.0-2  withr_2.4.2       tidyselect_1.1.1  gridExtra_2.3    
[17] curl_4.3.2        bit_4.0.4         compiler_4.1.0    git2r_0.28.0     
[21] cli_3.0.1         rvest_1.0.0       xml2_1.3.2        labeling_0.4.2   
[25] sass_0.4.0        scales_1.1.1      digest_0.6.27     foreign_0.8-81   
[29] rmarkdown_2.9     rio_0.5.27        base64enc_0.1-3   pkgconfig_2.0.3  
[33] htmltools_0.5.1.1 dbplyr_2.1.1      highr_0.9         rlang_0.4.11     
[37] readxl_1.3.1      rstudioapi_0.13   FNN_1.1.3         farver_2.1.0     
[41] jquerylib_0.1.4   generics_0.1.0    jsonlite_1.7.2    vroom_1.5.3      
[45] zip_2.2.0         dendextend_1.15.1 car_3.0-11        magrittr_2.0.1   
[49] Rcpp_1.0.7        munsell_0.5.0     fansi_0.5.0       abind_1.4-5      
[53] viridis_0.6.1     lifecycle_1.0.0   stringi_1.7.3     whisker_0.4      
[57] yaml_2.2.1        carData_3.0-4     grid_4.1.0        parallel_4.1.0   
[61] promises_1.2.0.1  ggrepel_0.9.1     crayon_1.4.1      lattice_0.20-44  
[65] haven_2.4.1       hms_1.1.0         knitr_1.33        pillar_1.6.1     
[69] ggpubr_0.4.0      ggsignif_0.6.2    reprex_2.0.0      glue_1.4.2       
[73] evaluate_0.14     data.table_1.14.0 modelr_0.1.8      vctrs_0.3.8      
[77] tzdb_0.1.2        httpuv_1.6.1      cellranger_1.1.0  gtable_0.3.0     
[81] assertthat_0.2.1  openxlsx_4.2.4    xfun_0.24         broom_0.7.8      
[85] RSpectra_0.16-0   rstatix_0.7.0     later_1.2.0       viridisLite_0.4.0
[89] cluster_2.1.2     ellipsis_0.3.2