-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathimmune_escape.R
More file actions
47 lines (43 loc) · 1.94 KB
/
Copy pathimmune_escape.R
File metadata and controls
47 lines (43 loc) · 1.94 KB
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
library(tidyr)
####apm
apm_gene <- readRDS("data/ap_pathway.rds")
non_slient_mutation <- data.table::fread("~/data/mc3.v0.2.8.PUBLIC.nonsilentGene.xena",data.table = F)
apm_gene <- apm_gene$V1
which(!(apm_gene %in% non_slient_mutation$sample))
non_slient_mutation <- non_slient_mutation %>%
dplyr::filter(sample %in% apm_gene)
check <- apply(non_slient_mutation[,2:ncol(non_slient_mutation)],2,function(x){any(x==1)}) %>% as.data.frame()
colnames(check) <- "apm_mut"
check$sample <- rownames(check)
saveRDS(check,file = "data/apm_mut_sample.rds")
###checkpoint over expression CD274 CTLA-4
tpm_gene <- readRDS("~/data/tpm_trans.rds")
CD274 <- tpm_gene %>% filter(gene == "CD274") %>%
select(c(3:ncol(tpm_gene))) %>% t() %>% as.data.frame()
CD274$sample <- rownames(CD274)
colnames(CD274)[1] <- "PDL1"
CTLA4 <- tpm_gene %>% filter(gene == "CTLA4") %>%
select(c(3:ncol(tpm_gene))) %>% t() %>% as.data.frame()
CTLA4$sample <- rownames(CTLA4)
colnames(CTLA4)[1] <- "CTLA4"
check_point <- left_join(CD274,CTLA4,by="sample")
saveRDS(check_point,file = "data/checkpoint_exp.rds")
table(substr(check_point$sample,14,15))
normal <- data.frame(sample=colnames(tpm_gene)[which(substr(colnames(tpm_gene),14,15)==11)])
normal <- left_join(normal,check_point,by="sample")
normal$cancer <- EasyBioinfo::get_cancer_type(normal$sample)
normal %>%
group_by(cancer) %>%
summarise(mean_pdl1 = mean(PDL1),
sd_pdl1 = sd(PDL1),
mean_ctla4 = mean(CTLA4),
sd_ctla4 = sd(CTLA4)) -> mean_sd
cancer <- check_point %>%
filter(as.numeric(substr(sample,14,15)) < 11)
cancer$cancer <- EasyBioinfo::get_cancer_type(cancer$sample)
cancer <- left_join(cancer,mean_sd,by="cancer")
cancer <- na.omit(cancer)
cancer <- cancer %>%
mutate(PDL1_over = ifelse(PDL1 > (mean_pdl1+2*sd_pdl1),"yes","no"),
CTLA4_over = ifelse(CTLA4 > (mean_ctla4+2*sd_ctla4),"yes","no"))
saveRDS(cancer,file = "data/checkpoint_over.rds")