-
Notifications
You must be signed in to change notification settings - Fork 0
/
loadsinglecelldata.R
122 lines (114 loc) · 3.48 KB
/
loadsinglecelldata.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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# process single cell expression datasets
# .rds objects/ datasets were obtained from: https://hemberg-lab.github.io/scRNA.seq.datasets/
if (dataset == 'camp1'){
library(SingleCellExperiment)
camp1 <- readRDS('C:/Users/chris/Desktop/singlecellcollection/camp1.rds')
td <- assay(camp1)
vars <- rowVars(td)
names(vars) <- rownames(camp1)
vars <- sort(vars, decreasing = TRUE)
sce_sub <- camp1[names(vars[1:100]),]
t <- assay(sce_sub)
t <- data.frame(t)
datalist <- list(t)
meta <- colData(camp1)
celltypes <- meta$cell_type1
length(unique(celltypes))
dim(t)
}
if (dataset == 'darmanis'){
library(SingleCellExperiment)
camp1 <- readRDS('C:/Users/chris/Desktop/singlecellcollection/darmanis.rds')
td <- assay(camp1,'logcounts')
vars <- rowVars(td)
names(vars) <- rownames(camp1)
vars <- sort(vars, decreasing = TRUE)
sce_sub <- camp1[names(vars[1:100]),]
t <- assay(sce_sub,'logcounts')
t <- data.frame(t)
datalist <- list(t)
meta <- colData(camp1)
celltypes <- meta$cell_type1
length(unique(celltypes))
dim(t)
}
if (dataset == 'li'){
library(SingleCellExperiment)
camp1 <- readRDS('C:/Users/chris/Desktop/singlecellcollection/li.rds')
td <- assay(camp1,'logcounts')
vars <- rowVars(td)
names(vars) <- rownames(camp1)
vars <- sort(vars, decreasing = TRUE)
sce_sub <- camp1[names(vars[1:100]),]
t <- assay(sce_sub,'logcounts')
t <- data.frame(t)
datalist <- list(t)
meta <- colData(camp1)
celltypes <- meta$cell_type1
length(unique(celltypes))
dim(t)
}
if (dataset == 'patel'){
library(SingleCellExperiment)
camp1 <- readRDS('C:/Users/chris/Desktop/singlecellcollection/patel.rds')
td <- assay(camp1,'logcounts')
vars <- rowVars(td)
names(vars) <- rownames(camp1)
vars <- sort(vars, decreasing = TRUE)
sce_sub <- camp1[names(vars[1:100]),]
t <- assay(sce_sub,'logcounts')
t <- data.frame(t)
datalist <- list(t)
meta <- colData(camp1)
celltypes <- meta$cell_type1
length(unique(celltypes))
dim(t)
}
if (dataset == 'pollen'){
library(SingleCellExperiment)
camp1 <- readRDS('C:/Users/chris/Desktop/singlecellcollection/pollen.rds')
td <- assay(camp1,'logcounts')
vars <- rowVars(td)
names(vars) <- rownames(camp1)
vars <- sort(vars, decreasing = TRUE)
sce_sub <- camp1[names(vars[1:100]),]
t <- assay(sce_sub,'logcounts')
t <- data.frame(t)
datalist <- list(t)
meta <- colData(camp1)
celltypes <- meta$cell_type1
length(unique(celltypes))
dim(t)
}
if (dataset == 'baron'){
library(SingleCellExperiment)
baron <- readRDS('C:/Users/chris/Desktop/singlecellcollection/baron-human.rds')
td <- assay(baron,'logcounts')+1
vars <- rowVars(td)
names(vars) <- rownames(baron)
vars <- sort(vars, decreasing = TRUE)
sce_sub <- baron[names(vars[1:100]),]
t <- log2(assay(sce_sub)+1)
t <- data.frame(t)
datalist <- list(t)
meta <- colData(baron)
celltypes <- meta$cell_type1
length(unique(celltypes))
dim(t)
}
if (dataset == 'muraro'){
library(SingleCellExperiment)
camp1 <- readRDS('C:/Users/chris/Desktop/singlecellcollection/muraro.rds')
td <- assay(camp1,'logcounts')
vars <- rowVars(td)
names(vars) <- rownames(camp1)
vars <- sort(vars, decreasing = TRUE)
sce_sub <- camp1[names(vars[1:100]),]
t <- assay(sce_sub,'logcounts')
t <- data.frame(t)
datalist <- list(t)
meta <- colData(camp1)
celltypes <- meta$cell_type1
length(unique(celltypes))
dim(t)
}