-
Notifications
You must be signed in to change notification settings - Fork 9
/
DMCFB-Ex.R
327 lines (263 loc) · 7.91 KB
/
DMCFB-Ex.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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
pkgname <- "DMCFB"
source(file.path(R.home("share"), "R", "examples-header.R"))
options(warn = 1)
options(pager = "console")
library('DMCFB')
base::assign(".oldSearch", base::search(), pos = 'CheckExEnv')
base::assign(".old_wd", base::getwd(), pos = 'CheckExEnv')
cleanEx()
nameEx("BSDMC-class")
### * BSDMC-class
flush(stderr()); flush(stdout())
### Name: BSDMC-class
### Title: BSDMC object
### Aliases: BSDMC-class BSDMC
### Keywords: object
### ** Examples
nr <- 500
nc <- 16
metht <- matrix(as.integer(runif(nr * nc, 0, nr)), nr)
methc <- matrix(rbinom(n = nr * nc, c(metht), prob = runif(nr * nc)), nr, nc)
meths <- matrix(as.integer(runif(nr * nc, 0, 10)), nr)
methl <- methc / metht
methv <- matrix((runif(nr * nc, 0.1, 0.5)), nr)
r1 <- GRanges(rep("chr1", nr), IRanges(1:nr, width = 1), strand = "*")
names(r1) <- 1:nr
cd1 <- DataFrame(Group = rep(c("G1", "G2"), each = nc / 2),
row.names = LETTERS[1:nc])
OBJ2 <- cBSDMC(
rowRanges = r1, methReads = methc, totalReads = metht,
methLevels = methl, methStates = meths, methVars = methv, colData = cd1
)
OBJ2
cleanEx()
nameEx("cBSDMC-method")
### * cBSDMC-method
flush(stderr()); flush(stdout())
### Name: cBSDMC-method
### Title: cBSDMC method
### Aliases: cBSDMC-method cBSDMC,matrix,matrix,matrix,GRanges-method
### cBSDMC
### ** Examples
set.seed(1980)
nr <- 150
nc <- 8
metht <- matrix(as.integer(runif(nr * nc, 0, 100)), nr)
methc <- matrix(rbinom(n = nr * nc, c(metht), prob = runif(nr * nc)), nr, nc)
meths <- matrix(as.integer(runif(nr * nc, 0, 10)), nr)
methl <- methc / metht
methv <- matrix((runif(nr * nc, 0.1, 0.5)), nr)
r1 <- GRanges(rep("chr1", nr), IRanges(1:nr, width = 1), strand = "*")
names(r1) <- 1:nr
cd1 <- DataFrame(
Group = rep(c("G1", "G2"), each = nc / 2),
row.names = LETTERS[1:nc]
)
OBJ2 <- cBSDMC(
rowRanges = r1, methReads = methc, totalReads = metht,
methLevels = methl, methStates = meths, methVars = methv, colData = cd1
)
OBJ2
cleanEx()
nameEx("combine-method")
### * combine-method
flush(stderr()); flush(stdout())
### Name: combine-method
### Title: combine method
### Aliases: combine-method combine,BSDMC,BSDMC-method combine
### ** Examples
set.seed(1980)
nr <- 150
nc <- 8
metht <- matrix(as.integer(runif(nr * nc * 2, 0, nr)), nr)
methc <- matrix(
rbinom(n = nr * nc, c(metht), prob = runif(nr * nc * 2)),
nr, nc * 2
)
methl <- methc / metht
r1 <- GRanges(rep("chr1", nr), IRanges(1:nr, width = 1), strand = "*")
names(r1) <- 1:nr
cd1 <- DataFrame(Group = rep("G1", each = nc), row.names = LETTERS[1:nc])
OBJ1 <- cBSDMC(
rowRanges = r1, methReads = methc[, 1:nc], totalReads = metht[, 1:nc],
methLevels = methl[, 1:nc], colData = cd1
)
cd2 <- DataFrame(
Group = rep("G2", each = nc),
row.names = LETTERS[nc + 1:nc]
)
OBJ2 <- cBSDMC(
rowRanges = r1, methReads = methc[, nc + 1:nc], totalReads =
metht[, nc + 1:nc], methLevels = methl[, nc + 1:nc], colData = cd2
)
OBJ3 <- combine(OBJ1, OBJ2)
OBJ3
cleanEx()
nameEx("findDMCFB-method")
### * findDMCFB-method
flush(stderr()); flush(stdout())
### Name: findDMCFB-method
### Title: findDMCFB method
### Aliases: findDMCFB-method findDMCFB,BSDMC-method findDMCFB
### ** Examples
set.seed(1980)
nr <- 1000
nc <- 4
metht <- matrix(as.integer(runif(nr * nc, 0, 100)), nr)
methc <- matrix(rbinom(n = nr * nc, c(metht), prob = runif(nr * nc)), nr, nc)
methl <- methc / metht
r1 <- GRanges(rep("chr1", nr), IRanges(1:nr, width = 1), strand = "*")
names(r1) <- 1:nr
cd1 <- DataFrame(
Group = rep(c("G1", "G2"), each = nc / 2),
row.names = LETTERS[1:nc]
)
OBJ1 <- cBSDMC(
rowRanges = r1, methReads = methc, totalReads = metht,
methLevels = methl, colData = cd1
)
OBJ2 <- findDMCFB(OBJ1,
bwa = 10, bwb = 10, nBurn = 50, nMC = 50, nThin = 1,
alpha = 0.05, nCores = 2, pSize = 500, sfiles = FALSE
)
OBJ2
cleanEx()
nameEx("methLevels-method")
### * methLevels-method
flush(stderr()); flush(stdout())
### Name: methLevels-method
### Title: methLevels method
### Aliases: methLevels-method methLevels,BSDMC-method methLevels
### methLevels<-,BSDMC,matrix-method methLevels<-
### ** Examples
nr <- 150
nc <- 8
metht <- matrix(as.integer(runif(nr * nc, 0, 100)), nr)
methc <- matrix(rbinom(n = nr * nc, c(metht), prob = runif(nr * nc)), nr, nc)
methl <- methc / metht
r1 <- GRanges(rep("chr1", nr), IRanges(1:nr, width = 1), strand = "*")
names(r1) <- 1:nr
cd1 <- DataFrame(
Group = rep(c("G1", "G2"), each = nc / 2),
row.names = LETTERS[1:nc]
)
OBJ1 <- cBSDMC(
rowRanges = r1, methReads = methc, totalReads = metht,
methLevels = methl, colData = cd1
)
methLevels(OBJ1)
methLevels(OBJ1) <- methl
cleanEx()
nameEx("methReads-method")
### * methReads-method
flush(stderr()); flush(stdout())
### Name: methReads-method
### Title: methReads method
### Aliases: methReads-method methReads,BSDMC-method methReads
### methReads<-,BSDMC,matrix-method methReads<-
### ** Examples
nr <- 150
nc <- 8
metht <- matrix(as.integer(runif(nr * nc, 0, 100)), nr)
methc <- matrix(rbinom(n = nr * nc, c(metht), prob = runif(nr * nc)), nr, nc)
methl <- methc / metht
r1 <- GRanges(rep("chr1", nr), IRanges(1:nr, width = 1), strand = "*")
names(r1) <- 1:nr
cd1 <- DataFrame(
Group = rep(c("G1", "G2"), each = nc / 2),
row.names = LETTERS[1:nc]
)
OBJ1 <- cBSDMC(
rowRanges = r1, methReads = methc, totalReads = metht,
methLevels = methl, colData = cd1
)
methReads(OBJ1)
methReads(OBJ1) <- methc
cleanEx()
nameEx("plotDMCFB-method")
### * plotDMCFB-method
flush(stderr()); flush(stdout())
### Name: plotDMCFB-method
### Title: plotDMCFB method
### Aliases: plotDMCFB-method plotDMCFB,BSDMC-method plotDMCFB
### ** Examples
set.seed(1980)
nr <- 1000
nc <- 4
metht <- matrix(as.integer(runif(nr * nc, 0, 100)), nr)
methc <- matrix(rbinom(n = nr * nc, c(metht), prob = runif(nr * nc)), nr, nc)
methl <- methc / metht
r1 <- GRanges(rep("chr1", nr), IRanges(1:nr, width = 1), strand = "*")
names(r1) <- 1:nr
cd1 <- DataFrame(
Group = rep(c("G1", "G2"), each = nc / 2),
row.names = LETTERS[1:nc]
)
OBJ1 <- cBSDMC(
rowRanges = r1, methReads = methc, totalReads = metht,
methLevels = methl, colData = cd1
)
OBJ2 <- findDMCFB(OBJ1,
bwa = 10, bwb = 10, nBurn = 50, nMC = 50, nThin = 1,
alpha = 0.05, nCores = 2, pSize = 500, sfiles = FALSE
)
plotDMCFB(OBJ2)
cleanEx()
nameEx("readBismark-method")
### * readBismark-method
flush(stderr()); flush(stdout())
### Name: readBismark-method
### Title: readBismark method
### Aliases: readBismark-method
### readBismark,character,DataFrame,numeric-method readBismark
### readBismark,character,data.frame,numeric-method
### readBismark,character,character,numeric-method
### ** Examples
fn <- list.files(system.file("extdata", package = "DMCFB"))
fn.f <- list.files(system.file("extdata", package = "DMCFB"),
full.names = TRUE
)
OBJ <- readBismark(fn.f, fn, mc.cores=1)
cdOBJ <- DataFrame(Cell = factor(c("BC", "TC", "Mono"),
labels = c("BC", "TC", "Mono")
), row.names = c("BCU1568", "BCU173", "BCU551"))
colData(OBJ) <- cdOBJ
OBJ
cleanEx()
nameEx("totalReads-method")
### * totalReads-method
flush(stderr()); flush(stdout())
### Name: totalReads-method
### Title: totalReads method
### Aliases: totalReads-method totalReads,BSDMC-method totalReads
### totalReads<-,BSDMC,matrix-method totalReads<-
### ** Examples
nr <- 150
nc <- 8
metht <- matrix(as.integer(runif(nr * nc, 0, 100)), nr)
methc <- matrix(rbinom(n = nr * nc, c(metht), prob = runif(nr * nc)), nr, nc)
methl <- methc / metht
r1 <- GRanges(rep("chr1", nr), IRanges(1:nr, width = 1), strand = "*")
names(r1) <- 1:nr
cd1 <- DataFrame(
Group = rep(c("G1", "G2"), each = nc / 2),
row.names = LETTERS[1:nc]
)
OBJ1 <- cBSDMC(
rowRanges = r1, methReads = methc, totalReads = metht,
methLevels = methl, colData = cd1
)
totalReads(OBJ1)
totalReads(OBJ1) <- metht
### * <FOOTER>
###
cleanEx()
options(digits = 7L)
base::cat("Time elapsed: ", proc.time() - base::get("ptime", pos = 'CheckExEnv'),"\n")
grDevices::dev.off()
###
### Local variables: ***
### mode: outline-minor ***
### outline-regexp: "\\(> \\)?### [*]+" ***
### End: ***
quit('no')