-
Notifications
You must be signed in to change notification settings - Fork 0
/
clustering.R
82 lines (65 loc) · 2.19 KB
/
clustering.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# Semi-supervised clustering of the tumor samples by the genes of interest
#
# The clusters are trained in the TCGA cohort and predicted for the remaining
# collectives with a kNN classifier. The following analyses are done for
# the lymphokine clusters
#
# 1) comparison of predicted immune infiltration levels (xCell and QuanTIseq)
#
# 2) comparison of overall and relapse-free survival
# (uni-variable/log-rank and multi-variate Ridge Cox)
#
# 3) comparison of clinical features (demographics, grade and stages)
#
# 4) Differences in expression of metabolic gene signatures (Recon2 subsystems)
# and Reactome biological process gene signatures
#
# 5) Differences in mutation burden and gene mutation frequency between
# the clusters
# tools -------
library(plyr)
library(tidyverse)
library(exda)
library(trafo)
library(soucer)
library(rlang)
library(microViz)
library(ggrepel)
library(ggtext)
library(furrr)
library(clustTools)
library(somKernels)
library(survival)
library(survminer)
library(glmnet)
library(coxExtensions)
extract <- clustTools::extract
nobs <- clustTools::nobs
reduce <- purrr::reduce
select <- dplyr::select
insert_head()
c('./tools/project_globals.R',
'./tools/project_tools.R') %>%
source_all(message = TRUE, crash = TRUE)
# clustering scripts ------
insert_msg('Clustering scripts')
## finding the optimal gene clustering algorithm
## working with cache - time costly
if(file.exists('./cache/gene_clusters.RData')) {
load('./cache/gene_clusters.RData')
} else {
source_all('./clustering scripts/cluster_development.R',
message = TRUE, crash = TRUE)
}
c('./clustering scripts/clustering.R',
'./clustering scripts/xcell.R',
'./clustering scripts/quantiseq.R',
'./clustering scripts/survival.R',
'./clustering scripts/multi_survival.R',
'./clustering scripts/clinics.R',
'./clustering scripts/recon.R',
'./clustering scripts/reactome.R',
'./clustering scripts/mutations.R') %>%
source_all(message = TRUE, crash = TRUE)
# END -------
insert_tail()