forked from labsyspharm/IMAAP
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.Rhistory
46 lines (46 loc) · 1.88 KB
/
.Rhistory
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
setwd("~/Dropbox (Partners HealthCare)/Data/Vignesh_Lymphoma_tma/cell_type_calling/full_dataset")
cell_id = read.table(file = "PTCLCycle1to13_CellId.csv", sep=',')
core_num = data.frame(t(read.table(file = "PTCLCycle1to13_CoreNum.csv", sep=',')))
cyt_exp = read.table(file = "PTCLCycle1to13_CytMedian_nonorm.csv", sep=',')
nuc_exp = read.table(file = "PTCLCycle1to13_NucMedian_nonorm.csv", sep=',')
# Create a unique cell_id
ucell_id <- paste(core_num[,1], cell_id[,1], sep = "_")
# Attach the cell_id to expression matrix
exp_c <- cbind(ucell_id, cyt_exp)
exp_n <- cbind(ucell_id, nuc_exp)
# Add column names to the expression matrix
markers <- c('ID','DAPI01', 'back', 'CD2', 'TCR',
'DAPI02', 'CD4', 'CD3D', 'CD7',
'DAPI03', 'CD43', 'ALK', 'CD45',
'DAPI04', 'CD10', 'Ki67', 'CD5',
'DAPI05', 'CD11B','FOXP3', 'CD8' ,
'DAPI06', 'CD57', 'CD68', 'CD20',
'DAPI07', 'CD163','PDL1', 'CD56',
'DAPI08', 'CD30', 'KER', 'PD1',
'DAPI09', 'CD206','GATA3', 'CD21',
'DAPI10', 'S6P', 'PERK','TBet',
'DAPI11', 'TDT', 'back1', 'BCL6',
'DAPI12', 'EBVLMP','back2', 'CD31',
'DAPI13', 'CD16', 'back3', 'PSTAT3')
colnames(exp_c) <- markers
colnames(exp_n) <- markers
# Remove DAPI and background channels
exp_c_new <- exp_c %>% select(-contains("DAPI"))
exp_c_new <- exp_c_new %>% select(-contains("back"))
library(tibble)
# Remove DAPI and background channels
exp_c_new <- exp_c %>% select(-contains("DAPI"))
library(dplyr)
# Remove DAPI and background channels
exp_c_new <- exp_c %>% select(-contains("DAPI"))
exp_c_new <- exp_c_new %>% select(-contains("back"))
exp_n_new <- exp_n %>% select(-contains("DAPI"))
exp_n_new <- exp_n_new %>% select(-contains("back"))
# Fix rownames
row.names(exp_c_new) <- exp_c_new[,1]
exp_c_new <- exp_c_new[,-1]
row.names(exp_n_new) <- exp_n_new[,1]
exp_n_new <- exp_n_new[,-1]
# Create meta data file
meta <- cbind(ucell_id,cell_id,core_num)
colnames(meta) <- c("universal_ID", "cell_ID", "core_ID")