-
Notifications
You must be signed in to change notification settings - Fork 12
/
.Rhistory
executable file
·500 lines (500 loc) · 8.99 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
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
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
rm(tn.cnara.pairs)
gc()
ls()
qrun(dc.400.jb)
Flow::update(dc.400.jb, mc.cores = 50)
Flow::update(dc.400.jb, mc.cores = 50)
qrun(dc.400.jb)
Flow::update(dc.400.jb, mc.cores = 50)
sum.400
ls()
pairs
ls()
rm(sum.400)
rm(sum.600)
rm(dc.400.jb)
rm(pairs_tcga)
ls()
rm(tmp.pairs)
rm(tn.pairs)
ls()
rm(mat.dr)
ls()
c1.rle
rm(c1.rle)
rm(pairs)
rm(pairs.og)
ls()
gc()
pairs.og
names(pairs.og)
table(pairs.og$normal_sample_type_def)
ls()
pairs.og
readRDS('/gpfs/commons/home/twalradt/downloadTCGA/db/pairs_052818.rds')
pairs_28 = readRDS('/gpfs/commons/home/twalradt/downloadTCGA/db/pairs_052818.rds')
pairs_28
pairs_28[which(!is.na(path))]
pairs.og
pairs_28[which(!is.na(path))]
pairs.og
pair_28
pairs_28
pairs.og
pairs
pairs_28
pairs_28[, path := NULL]
pairs = merge(pairs_28, pairs.og, by = "pair", all.x = TRuE)
pairs = merge(pairs_28, pairs.og, by = "pair", all.x = TRUE)
pairs
saveRDS(pairs, "pairs_053018.rds")
pairs[1]
pairs$tumor_bam_path.x
pairs$tumor_bam_path.y
names(pairs.og)
names(pairs_28
)
setdiff(names(pairs.og), names(pairs_28))
pairs.og[setdiff(names(pairs.og), names(pairs_28))]
pairs.og[,setdiff(names(pairs.og), names(pairs_28))]
pairs.og[,.(setdiff(names(pairs.og), names(pairs_28)))]
pairs.og[CNARA_800]
pairs.og[,CNARA_800]
pairs.og[,.(CNARA_400,CNARA_800)]
setdiff(names(pairs.og), names(pairs_28))
class(setdiff(names(pairs.og), names(pairs_28)))
class(c(setdiff(names(pairs.og), names(pairs_28))))
.(CNARA_400,CNARA_800)
list(CNARA_400,CNARA_800)
pairs.og[,eval(setdiff(names(pairs.og), names(pairs_28)))]
names(pairs.og)
pairs.og[,eval(setdiff(names(pairs.og), names(pairs_28)))]
quote(setdiff(names(pairs.og), names(pairs_28)))
setdiff(names(pairs.og), names(pairs_28))
eval(setdiff(names(pairs.og), names(pairs_28)))
xx = setdiff(names(pairs.og), names(pairs_28))
xx
pairs.og[, .SD, .SDcols = xx]
xx = c("pair", setdiff(names(pairs.og), names(pairs_28)))
xx
pairs.og[, .SD, .SDcols = xx]
pairs.merge = pairs.og[, .SD, .SDcols = xx]
pairs.og
pairs = merge(pairs_28, pairs.merge, by = "pair", all.x = TRUE)
pairs
names(pairs)
pairs.og
names(pairs.og)
saveRDS(pairs, "pairs_053018.rds")
pairs
pairs$tumor_bam_path
sum(!is.na(pairs$tumor_bam_path))
pairs$tumor_filename
sum(!is.na(pairs$tumor_filename))
pairs_tcga = pairs
pairs_tcga
sum(!is.na(pairs_tcga$tumor_bam_path))
sum(!is.na(pairs_tcga$tumor_bam_path))
pairs = pairs_tcga
pairs
pairs_tcga
sum(!is.na(pairs_tcga$tumor_bam_path))
sum(!is.na(pairs_tcga$normal_bam_path))
saveRDS(pairs_tcga, "pairs_053018.rds")
pairs_tcga
saveRDS(pairs_tcga, "/gpfs/commons/home/twalradt/downloadTCGA/db/pairs_053018.rds")
ls()
ls()
ls()
x
xx
rm(xx)
ls()
rm(mat.r1)
rm(mat.r1.t)
rm(mat.blood)
rm(mat.solid)
gc()
ls()
rm(mat.blood.samp)
rm(mat.blood.samp.t)
rm(mat.buccal)
rm(mat.buccal.t)
rm(mat.solid.samp)
rm(mat.solid.samp.t)
ls()
rm(rpca.mat)
gc()
Flow::update(dryclean.jb, mc.cores = 50)
ls()
pairs
ls()
pairs.og
pairs
xx
xx = readRDS('~/downloadTCGA/db/pairs_053018_v2.rds')
xx
names(xx)
dryclean.jb
merge(xx, outputs(dryclean.jb))
merge(xx, outputs(dryclean.jb), all.x = t)
merge(xx, outputs(dryclean.jb), all.x = T)
pairs = merge(xx, outputs(dryclean.jb), all.x = T)
pairs
names(pairs)
setnames(pairs, "decomposed_cov", "decomposed_cov_50")
pairs
names(pairs)
saveRDS(pairs,'~/downloadTCGA/db/pairs_053118.rds')
Flow::update(CNARA_dc.jb, mc.cores = 100)
pairs
ls()
pairs
names(pairs)
pairs
saveRDS(pairs,'~/downloadTCGA/db/pairs_053118.rds')
pairs
pairs
sum.500
sum50
sum.50
ls()
rm(CNARA_dc.jb)
rm(dryclean.jb)
rm(mat.dr)
gc()
ls()
200.sum
sum.200
sum.200[order(variance.200)]
sum.TN2[order(variance.TN2)]
sum.TN2.log2[order(variance.TN2)]
sum.TN.log2
sum.TN.log2[order(variance.TN2)]
sum.200[order(variance.200)]
sum.200[-order(variance.200)]
sum.200[order(-variance.200)]
sum.200[order(-variance.200)][1]
sum.TN.log2[order(-variance.TN2)][1]
sum.600[order(-variance.600)][1]
sum.600[pairs == '4926_1']
sum.200[order(-variance.200)]
sum.200[order(-variance.200)][1:5]
sum.TN.log2[order(-variance.TN2)][1:5]
sum.200[order(-variance.200)][1:8]
sum.600[rating.600 == 'good']
sum.TN.log2[pairs == '3394_1']
pairs
pairs[pairs == '3394_1']
paiars
pairs
pairs[1]
pairs[pairs == '3394']
pairs
pairs[1]
pairs[pair == '3394_1']
sum.600[rating.600 == 'good']
ls()
pairs
ls()
pairs.og
names(pairs.og)
pairs.og[1]
clinical_data = fread("~/data/TCGA/PanCanAtlas/freeze_1.31/clinical_PANCAN_patient_with_followup.tsv")
names(clinical_data)
pairs.og
pairs.og[1]
pairs.og$normal_filename
sum(grep("Illumina.bam",pairs.og$normal_filename))
length(grep("Illumina.bam",pairs.og$normal_filename))
ls()
mat.r1 = readRDS('~/downloadTCGA/db/1000.wxs.master.rds')
s()
ls()
rm(mat.r1)
pairs.og
pairs.og$pairs
pairs.og$pair
ls()
library(skitools)
dt.pon
library(skitools0
)
library(skitools)
check
check()
install()
install.packages("NCmisc")
library(NCmisc)
getwd()
list.functions.in.file("./R/fragCounter.R", alphabetic = TRUE)
ls()
load_all()
document()
install()
list.functions.in.file("./R/fragCounter.R", alphabetic = TRUE)
check()
install()
getwd()
check()
check()
library(fragCounter)
PrepareCov
coco
as.data.table
document()
load_all
load_all()
check()
document()
load_al()
load_all()
check()
load <- all()
load_all()
check()
document()
load_all()
check()
document()
load_all()
check()
document()
load_all()
check()
as.data.table
gr2dt
document()
load_all()
check()
seqlengths
document()
check()
check()
check(cran = FLASE)
args(check)
check(cran = FALSE)
test()
bam.cov.tile
ls()
entities
file.exists('/gpfs/commons/groups/imielinski_lab/projects/reptime/BT-549-All_NextSeq_hg37.bam')
qrun(frag.jb)
qstat()
qstat()
Flow::update(frag.jb0
Flow::update(frag.jb)
outputs(frag.jb)
inputs(frag.jb)
entities
entities(frag.jb)
entities
purge(frag.jb)
qrun(frag.jb)
qstat()
qstat()
Flow::update(frag.jb)
more(err(frag.jb)
)
task(frag.jb)
entities
purge(frag.jb)
qrun(frag.jb)
qstat()
Flow::update(frag.jb)
more(err(frag.jb)
)
purge(frag.jb)
entities
qrun(frag.jb)
qstat()
Flow::update(frag.jb)
more(err(frag.jb))
inputs(frag.jb)
task(frag.jb)
entities
purge(frag.jb)
qrun(frag.jb)
qstat()
Flow::update(frag.jb)
Flow::update(frag.jb)
more(err(frag.jb))
task(frag.jb)
inputs(frag.jb)
entities
task(frag.jb)
purge(frag.jb)
inputs(frag.jb)
purge(frag.jb)
inputs(frag.jb)
qrun(frag.jb)
qstat()
Flow::update(frag.jb)
Flow::update(frag.jb)
Flow::update(frag.jb)
more(err(frag.jb))
PrepareCov
PrepareCov
library(fragCounter)
PrepareCov
bam
PrepareCov
PrepareCov
bam.cov.tile
file.exists('/gpfs/commons/datasets/controlled/TCGA/original-cghub/GBM/WGS/bam/TCGA-06-0124-01A-01D-0375-09.bam')
PrepareCov
cov
summary(cov$count)
cov
summary(cov$count)
bam.cov.tile
args(PrepareCov)
pc = PrepareCov(bam = bam, midpoint = TRUE, paired = FALSE)
library(fragCounter)
PrepareCov
library(skitools)
entities
library(Flow)
Flow::update(frag.jb)
Flow::update(frag.jb)
outputs(frag.jb)
outdir(frag.jb)
Flow::update(frag.jb)
more(err(frag.jb))
bamUtils::bam.cov.gr
bamUtils::bam.cov.tile
more(err(frag.jb))
q()
n
library(skitools)
library(Flow)
library(fragCounter)
PrepareCov
load_all()
library(fragCounter)
PrepareCov
PrepareCov
library(fragCounter)
PrepareCov
library(fragCounter)
PrepareCov
library(skitools)
library(Flow)
purge(frag.jb)
run(frag.jb, quiet = F)
install.packages("~/git/fragCounter", repos = NULL, type="source")
library(skitools
)
library(Flow)
ent = readRDS('/gpfs/commons/groups/imielinski_lab/projects/VariantEvolution/db/samples.rds')
ent
ent[1]
names(ent)
head(ent$bam)
class(ent)
setnames(ent, "tumor_bam_wgs", "bam")
names(ent)
ls()
rm(ent)
bam.cov.gr
bam.cov.tile
bamUtils::bam.cov.tile
gr.tile
tiles
n
keep
seqlevels(bam)
seqnames(internals)
seqnames(intervals)
length(keep)
n
ix = c(keep[c(seq(1, length(keep), chunksize))], keep[length(keep)] +
1)
ix
n
n
chunk.id
tail(chunk.id)
n
gr.chunk
keep
internals[keep]
intervals[keep]
chunk.id[keep]
intervals[keep]
gr.chunk
n
n
flag
length(gr.chunk)
n
library(skitools)
n
n
gr.chunk
gr.chunk[[1]]
gr.chunk[[2]]
as.data.table(countBam(bam, param = ScanBamParam(which = dt2gr(gr2dt(gr.chunk[[x]]),
seqlengths = seqlengths(bam)), flag = flag)))
)
))
)))
library(skitools)
countBam
flag
ScanBamParam
n
n
n
ls()
x
Q
Q
library(fragCounter)
bam.cov.skel
fragCounter
library(skitools)
library(Flow)
purge(frag.jb)
run(frag.jb, quiet = F)
outputs(frag.jb)
Flow::update(frag.jb)
outputs(frag.jb)
tmp = readRDS('/gpfs/commons/home/twalradt/fragCounter_TW/TEST_exome/cov.rds')
tmp
bam
bam = '/gpfs/commons/groups/imielinski_lab/home/mimielinski/Projects/Joanna/db/Exomes/PM790_1/Sample_PM790_Z1_1_Case_HALO.md.bam'
bam.cov.skel(bam, use.skel = FALSE)
reads.skel <- bam.cov.skel(bam, use.skel = FALSE)
read.skel
reads.skel
tmp
reads.skel$counts
tmp
identical(reads.skel$counts, tmp$counts)
tmp$counts
tmp
identical(reads.skel$counts, tmp$reads)
tmp$reads
tmp$reads[1:100]
reads.skel$counts[1:100]
reads.skel$counts[91]
tmp$reads[91]
reads.skel <- bam.cov.skel(bam, use.skel = FALSE, chunksize = 1e6)
reads.skel$counts[91]
reads.skel
bam
fragCounter
install.packages("~/git/fragCounter", repos = NULL, type="source")
library(data.table)
library(Flow)
qkill(frag.jb)
purge(frag.jb)
library(fragCounter)
PrepareCov
library(data.table)
library(Flow)
purge(frag.jb)
library(fragCounter)
PrepareCov
ls()