Intro
Here we’re doing an analysis to identify CNV using normalised reads counts across genomic windows.
library("cobs")
library("quantreg")
library("parallel")
library("gplots")
library("dplyr")
library("kableExtra")
interpolate_points<-function(row,dat,curve){
MY_X=dat[row,1]
MY_Y=dat[row,2]
VAL1=tail(which(curve[,1]<MY_X),1)
VAL2=VAL1+1
X <- curve[c(VAL1,VAL2),1]
Y <- curve[c(VAL1,VAL2),2]
INTERP_Y=approx(X,Y,xout=MY_X)$y
INTERP_Y
}
1 Mbp bins
x <- read.table("SRP199233.1e6_fmt.tsv",header=T,row.names=1)
x <- x[which(rowSums(x)>=10),]
x <- sweep(x, 2, colSums(x), FUN="/")*1000000
mysd <- apply(x,1,sd)
mean <- apply(x,1,mean)
y <- data.frame(log10(mean),mysd/mean)
colnames(y) <- c("logMean","cv")
Rbs.9 <- cobs(y$logMean,y$cv, nknots=10,constraint="none",tau=0.99)
## qbsks2():
## Performing general knot selection ...
##
## WARNING! Since the number of 10 knots selected by AIC reached the
## upper bound during general knot selection, you might want to rerun
## cobs with a larger number of knots.
##
## Deleting unnecessary knots ...
##
## WARNING! Since the number of 10 knots selected by AIC reached the
## upper bound during general knot selection, you might want to rerun
## cobs with a larger number of knots.
Rbs.median <- cobs(y$logMean,y$cv,nknots=10,constraint="none",tau=0.5)
## qbsks2():
## Performing general knot selection ...
##
## Deleting unnecessary knots ...
pred <- data.frame(predict(Rbs.9))
res <- mclapply(X=1:nrow(y),function(row) {
interpolate_points(row,y,pred)
},mc.cores=8)
y$interpolated <- unlist(res)
y$diff <- y$cv-y$interpolated
yy <- y[order(-y$diff),]
yy <- head(yy,50)
write.table(yy,file="SRP199233.1e6_regions.tsv")
yy %>% kbl() %>% kable_paper("hover", full_width = F)
|
logMean
|
cv
|
interpolated
|
diff
|
9:124000000-124359700
|
2.0390327
|
0.1537191
|
0.1289709
|
0.0247482
|
MT:0-16299
|
1.6161335
|
0.2641279
|
0.2498461
|
0.0142818
|
MU069435.1:0-31129
|
2.6658399
|
0.0527445
|
0.0401313
|
0.0126132
|
8:97000000-98000000
|
2.4801782
|
0.0573864
|
0.0455562
|
0.0118302
|
4:72000000-73000000
|
2.4445720
|
0.0585978
|
0.0479873
|
0.0106105
|
7:28000000-29000000
|
2.7692493
|
0.0494709
|
0.0411905
|
0.0082804
|
13:10000000-11000000
|
2.5285473
|
0.0501536
|
0.0424944
|
0.0076592
|
7:16000000-17000000
|
2.7012987
|
0.0424617
|
0.0371710
|
0.0052907
|
12:103000000-104000000
|
2.6786553
|
0.0429386
|
0.0390614
|
0.0038772
|
6:69000000-70000000
|
2.3974372
|
0.0561423
|
0.0522785
|
0.0038638
|
12:21000000-22000000
|
2.5931705
|
0.0424735
|
0.0387579
|
0.0037156
|
1:25000000-26000000
|
2.4790582
|
0.0488686
|
0.0456327
|
0.0032359
|
10:10000000-11000000
|
2.5362313
|
0.0451568
|
0.0420142
|
0.0031426
|
14:87000000-88000000
|
2.5542879
|
0.0433995
|
0.0409641
|
0.0024353
|
5:29000000-30000000
|
2.6494743
|
0.0430374
|
0.0414976
|
0.0015399
|
7:128000000-129000000
|
2.6682400
|
0.0413924
|
0.0399309
|
0.0014615
|
12:87000000-88000000
|
2.5838581
|
0.0404949
|
0.0392863
|
0.0012087
|
19:13000000-14000000
|
2.4366662
|
0.0489904
|
0.0485271
|
0.0004633
|
13:65000000-66000000
|
2.3691627
|
0.0559565
|
0.0555834
|
0.0003730
|
9:14000000-15000000
|
2.6974083
|
0.0378582
|
0.0374958
|
0.0003624
|
2:129000000-130000000
|
2.6828381
|
0.0390324
|
0.0387122
|
0.0003202
|
1:171000000-172000000
|
2.6712769
|
0.0399403
|
0.0396774
|
0.0002629
|
6:89000000-90000000
|
2.7063029
|
0.0374171
|
0.0373648
|
0.0000523
|
5:118000000-119000000
|
2.7828105
|
0.0423867
|
0.0423475
|
0.0000391
|
5:36000000-37000000
|
2.8122551
|
0.0448508
|
0.0448427
|
0.0000081
|
2:98000000-99000000
|
4.0988731
|
0.0607716
|
0.0607716
|
0.0000000
|
12:115000000-116000000
|
2.5875864
|
0.0390576
|
0.0390747
|
-0.0000171
|
14:106000000-107000000
|
2.4730892
|
0.0460103
|
0.0460402
|
-0.0000300
|
7:32000000-33000000
|
1.5875071
|
0.2588853
|
0.2589236
|
-0.0000383
|
Y:63000000-64000000
|
-0.9195701
|
1.4904793
|
1.4905269
|
-0.0000476
|
7:31000000-32000000
|
2.2427005
|
0.0794817
|
0.0795310
|
-0.0000492
|
6:18000000-19000000
|
2.5083986
|
0.0435255
|
0.0437536
|
-0.0002281
|
19:7000000-8000000
|
2.6751590
|
0.0389104
|
0.0393533
|
-0.0004429
|
9:46000000-47000000
|
2.7608327
|
0.0400178
|
0.0404724
|
-0.0004546
|
2:131000000-132000000
|
2.7015040
|
0.0366087
|
0.0371538
|
-0.0005452
|
9:11000000-12000000
|
2.4240253
|
0.0490762
|
0.0496653
|
-0.0005891
|
11:23000000-24000000
|
2.6061537
|
0.0386018
|
0.0393283
|
-0.0007265
|
17:20000000-21000000
|
2.4177928
|
0.0494872
|
0.0502779
|
-0.0007907
|
10:80000000-81000000
|
2.8392920
|
0.0461949
|
0.0469921
|
-0.0007972
|
5:111000000-112000000
|
2.7785040
|
0.0411075
|
0.0419801
|
-0.0008726
|
5:131000000-132000000
|
2.6877342
|
0.0372334
|
0.0383034
|
-0.0010700
|
10:19000000-20000000
|
2.6166163
|
0.0388218
|
0.0398973
|
-0.0010755
|
16:57000000-58000000
|
2.5703680
|
0.0389255
|
0.0400517
|
-0.0011262
|
2:152000000-153000000
|
2.7423586
|
0.0381674
|
0.0393108
|
-0.0011434
|
2:63000000-64000000
|
2.4474712
|
0.0466174
|
0.0477894
|
-0.0011720
|
12:16000000-17000000
|
2.6833722
|
0.0373490
|
0.0386676
|
-0.0013186
|
19:41000000-42000000
|
2.7235121
|
0.0369366
|
0.0382936
|
-0.0013570
|
14:60000000-61000000
|
2.6857272
|
0.0369226
|
0.0384710
|
-0.0015484
|
9:37000000-38000000
|
2.6114010
|
0.0380065
|
0.0396137
|
-0.0016071
|
9:122000000-123000000
|
2.7099953
|
0.0358955
|
0.0375640
|
-0.0016686
|
plot(y$logMean,y$cv,pch=18,cex=0.5,xlab="log10(mean)",ylab="CV")
lines(predict(Rbs.9), col = "red", lwd = 1.0)
lines(predict(Rbs.median), col = "blue", lwd = 1.0)
points(yy$logMean,yy$cv)
text(yy$logMean,yy$cv+0.02,labels=rownames(yy),cex=0.8)
my_palette <- colorRampPalette(c("blue", "white", "red"))(n = 25)
zz <- x[which(rownames(x) %in% rownames(yy)),]
heatmap.2(as.matrix(zz),margin=c(8, 22),cexRow=0.65,trace="none",
cexCol=0.8,col=my_palette,scale="row")
heatmap.2(cor(t(zz)),trace="none",scale="none",margins=c(12,12),
cexRow=0.8, cexCol=0.8)
Now fixed up a bit.
x <- read.table("SRP199233.1e6_fmt.tsv",header=T,row.names=1)
x <- x[grep("X",rownames(x),invert=TRUE),]
x <- x[grep("Y",rownames(x),invert=TRUE),]
x <- x[grep("M",rownames(x),invert=TRUE),]
x <- x[grep("J",rownames(x),invert=TRUE),]
x <- x[grep("G",rownames(x),invert=TRUE),]
x <- x[which(rowSums(x)>=10),]
x <- sweep(x, 2, colSums(x), FUN="/")*1000000
mysd <- apply(x,1,sd)
mean <- apply(x,1,mean)
y <- data.frame(log10(mean),mysd/mean)
colnames(y) <- c("logMean","cv")
Rbs.9 <- cobs(y$logMean,y$cv, nknots=10,constraint="none",tau=0.99)
## qbsks2():
## Performing general knot selection ...
##
## WARNING! Since the number of 10 knots selected by AIC reached the
## upper bound during general knot selection, you might want to rerun
## cobs with a larger number of knots.
##
## Deleting unnecessary knots ...
##
## WARNING! Since the number of 10 knots selected by AIC reached the
## upper bound during general knot selection, you might want to rerun
## cobs with a larger number of knots.
Rbs.median <- cobs(y$logMean,y$cv,nknots=10,constraint="none",tau=0.5)
## qbsks2():
## Performing general knot selection ...
##
## Deleting unnecessary knots ...
pred <- data.frame(predict(Rbs.9))
res <- mclapply(X=1:nrow(y),function(row) {
interpolate_points(row,y,pred)
},mc.cores=8)
y$interpolated <- unlist(res)
y$diff <- y$cv-y$interpolated
yy <- y[order(-y$diff),]
yy <- head(yy,50)
write.table(yy,file="SRP199233.1e6_regions.tsv")
yy %>% kbl() %>% kable_paper("hover", full_width = F)
|
logMean
|
cv
|
interpolated
|
diff
|
8:97000000-98000000
|
2.491946
|
0.0576254
|
0.0444597
|
0.0131656
|
4:72000000-73000000
|
2.456341
|
0.0588557
|
0.0480012
|
0.0108545
|
7:28000000-29000000
|
2.781010
|
0.0493569
|
0.0406575
|
0.0086994
|
13:10000000-11000000
|
2.540312
|
0.0502447
|
0.0421066
|
0.0081381
|
7:16000000-17000000
|
2.713062
|
0.0424653
|
0.0372215
|
0.0052438
|
1:25000000-26000000
|
2.490826
|
0.0491547
|
0.0444808
|
0.0046739
|
10:10000000-11000000
|
2.547997
|
0.0453420
|
0.0415737
|
0.0037683
|
5:29000000-30000000
|
2.661236
|
0.0429821
|
0.0393844
|
0.0035977
|
12:103000000-104000000
|
2.690415
|
0.0427163
|
0.0392618
|
0.0034545
|
12:21000000-22000000
|
2.604930
|
0.0422757
|
0.0389109
|
0.0033648
|
14:87000000-88000000
|
2.566054
|
0.0436054
|
0.0404302
|
0.0031751
|
14:106000000-107000000
|
2.484854
|
0.0461552
|
0.0445930
|
0.0015622
|
7:128000000-129000000
|
2.679999
|
0.0411291
|
0.0395942
|
0.0015349
|
12:87000000-88000000
|
2.595620
|
0.0404222
|
0.0391221
|
0.0013001
|
6:89000000-90000000
|
2.718062
|
0.0371048
|
0.0367711
|
0.0003337
|
5:118000000-119000000
|
2.794570
|
0.0421634
|
0.0418907
|
0.0002727
|
1:171000000-172000000
|
2.683038
|
0.0398373
|
0.0396282
|
0.0002091
|
6:18000000-19000000
|
2.520165
|
0.0437202
|
0.0435219
|
0.0001982
|
10:19000000-20000000
|
2.628382
|
0.0389898
|
0.0388623
|
0.0001275
|
12:115000000-116000000
|
2.599351
|
0.0391572
|
0.0390374
|
0.0001198
|
15:93000000-94000000
|
2.645251
|
0.0392038
|
0.0391652
|
0.0000386
|
9:124000000-124359700
|
2.050790
|
0.1535983
|
0.1535894
|
0.0000089
|
7:32000000-33000000
|
1.599280
|
0.2589433
|
0.2589344
|
0.0000088
|
5:36000000-37000000
|
2.824012
|
0.0444906
|
0.0444888
|
0.0000019
|
2:98000000-99000000
|
4.110644
|
0.0611200
|
0.0611200
|
0.0000000
|
14:50000000-51000000
|
2.477492
|
0.0447314
|
0.0447316
|
-0.0000002
|
9:14000000-15000000
|
2.709167
|
0.0375699
|
0.0375724
|
-0.0000025
|
19:13000000-14000000
|
2.448433
|
0.0492152
|
0.0492235
|
-0.0000083
|
11:23000000-24000000
|
2.617917
|
0.0386465
|
0.0386744
|
-0.0000279
|
2:129000000-130000000
|
2.694598
|
0.0388437
|
0.0388849
|
-0.0000412
|
9:46000000-47000000
|
2.772592
|
0.0397672
|
0.0398812
|
-0.0001140
|
16:57000000-58000000
|
2.582134
|
0.0391847
|
0.0394280
|
-0.0002433
|
2:152000000-153000000
|
2.754117
|
0.0378567
|
0.0382337
|
-0.0003770
|
13:30000000-31000000
|
2.644148
|
0.0387629
|
0.0391454
|
-0.0003825
|
19:7000000-8000000
|
2.686924
|
0.0390917
|
0.0395762
|
-0.0004846
|
9:37000000-38000000
|
2.623167
|
0.0382618
|
0.0387687
|
-0.0005069
|
10:80000000-81000000
|
2.851055
|
0.0462224
|
0.0467717
|
-0.0005494
|
5:111000000-112000000
|
2.790265
|
0.0409462
|
0.0415107
|
-0.0005646
|
2:63000000-64000000
|
2.459239
|
0.0469329
|
0.0475531
|
-0.0006202
|
19:41000000-42000000
|
2.735271
|
0.0366452
|
0.0372724
|
-0.0006272
|
18:86000000-87000000
|
2.465841
|
0.0457070
|
0.0465327
|
-0.0008257
|
2:131000000-132000000
|
2.713264
|
0.0363743
|
0.0372033
|
-0.0008290
|
9:122000000-123000000
|
2.721756
|
0.0356884
|
0.0365830
|
-0.0008946
|
8:23000000-24000000
|
2.720346
|
0.0355879
|
0.0365653
|
-0.0009774
|
7:46000000-47000000
|
2.728042
|
0.0358622
|
0.0369037
|
-0.0010415
|
8:3000000-4000000
|
2.630171
|
0.0375803
|
0.0388944
|
-0.0013141
|
13:118000000-119000000
|
2.484165
|
0.0431665
|
0.0446059
|
-0.0014394
|
19:58000000-59000000
|
2.739115
|
0.0359795
|
0.0374685
|
-0.0014890
|
5:131000000-132000000
|
2.699493
|
0.0369483
|
0.0384439
|
-0.0014956
|
10:122000000-123000000
|
2.619504
|
0.0371110
|
0.0387029
|
-0.0015918
|
plot(y$logMean,y$cv,pch=18,cex=0.5,xlab="log10(mean)",ylab="CV")
lines(predict(Rbs.9), col = "red", lwd = 1.0)
lines(predict(Rbs.median), col = "blue", lwd = 1.0)
points(yy$logMean,yy$cv)
#text(yy$logMean,yy$cv+0.02,labels=rownames(yy),cex=0.8)
plot(y$logMean,y$cv,pch=18,cex=0.5,xlab="log10(mean)",ylab="CV",xlim=c(1,4.5),ylim=c(0,0.3))
#lines(predict(Rbs.9), col = "red", lwd = 1.0)
#lines(predict(Rbs.median), col = "blue", lwd = 1.0)
points(yy$logMean,yy$cv)
text(yy$logMean,yy$cv+0.02,labels=rownames(yy),cex=0.8)
my_palette <- colorRampPalette(c("blue", "white", "red"))(n = 25)
zz <- x[which(rownames(x) %in% rownames(yy)),]
heatmap.2(as.matrix(zz),margin=c(8, 22),cexRow=0.65,trace="none",
cexCol=0.8,col=my_palette,scale="row")
heatmap.2(cor(t(zz)),trace="none",scale="none",margins=c(12,12),
cexRow=0.8, cexCol=0.8)
for (i in 1:19){
mychr=as.character(i)
regex=paste("^",mychr,":",sep="")
chr <- x[grep(regex,rownames(x)),]
mymax = max(chr)
plot(chr[,1], xaxt = "n", pch=19, col="gray",
ylim=c(0,mymax),ylab="RPM of 1Mbp bins of chr",main=mychr)
axis(1, at=chr[,1], labels=rownames(chr), xlab="chr", las=1)
points( chr[,1], xaxt = "n", las=1, pch=19, col="gray" )
points( chr[,2], xaxt = "n", las=1, pch=19, col="lightblue" )
points( chr[,3], xaxt = "n", las=1, pch=19, col="lightgreen" )
points( chr[,4], xaxt = "n", las=1, pch=19, col="pink" )
points( chr[,5], xaxt = "n", las=1, pch=19, col="orange" )
points( chr[,6], xaxt = "n", las=1, pch=19, col="black" )
grid()
}
lapply(1:19,function(i){
mychr=as.character(i)
regex=paste("^",mychr,":",sep="")
chr <- x[grep(regex,rownames(x)),]
mymedian <- median(rowMeans(chr))
mymax <- max(rowMeans(chr))
rat <- mymax / mymedian
return(c(mymax,mymedian,rat))
})
## [[1]]
## [1] 700.467728 384.117157 1.823578
##
## [[2]]
## [1] 12901.60683 413.41352 31.20751
##
## [[3]]
## [1] 576.258958 369.878762 1.557967
##
## [[4]]
## [1] 716.842941 385.712263 1.858491
##
## [[5]]
## [1] 736.167517 429.930486 1.712294
##
## [[6]]
## [1] 1066.954018 387.482317 2.753555
##
## [[7]]
## [1] 666.247660 447.651643 1.488317
##
## [[8]]
## [1] 701.537192 418.892094 1.674744
##
## [[9]]
## [1] 968.765313 460.571348 2.103399
##
## [[10]]
## [1] 709.66815 391.16988 1.81422
##
## [[11]]
## [1] 782.248865 487.291608 1.605299
##
## [[12]]
## [1] 707.150783 397.787995 1.777708
##
## [[13]]
## [1] 599.085444 394.550092 1.518401
##
## [[14]]
## [1] 710.758402 369.484692 1.923648
##
## [[15]]
## [1] 693.714336 388.136775 1.787294
##
## [[16]]
## [1] 622.386018 374.072480 1.663811
##
## [[17]]
## [1] 692.022110 430.531079 1.607369
##
## [[18]]
## [1] 603.882543 394.316248 1.531468
##
## [[19]]
## [1] 637.478821 444.900515 1.432857
lapply(1:19,function(i){
mychr=as.character(i)
regex=paste("^",mychr,":",sep="")
chr <- x[grep(regex,rownames(x)),]
top <- head(chr[order(-rowMeans(chr)),])
return(top)
})
## [[1]]
## SRX5884275.bam SRX5884276.bam SRX5884277.bam
## 1:88000000-89000000 702.1750 680.7719 717.2025
## 1:92000000-93000000 613.2773 586.3729 621.3214
## 1:135000000-136000000 615.3736 604.0265 613.5023
## 1:91000000-92000000 608.2308 624.1114 610.7657
## 1:132000000-133000000 614.2867 590.7070 628.7495
## 1:133000000-134000000 586.5692 566.4995 600.4054
## SRX5884278.bam SRX5884279.bam SRX5884280.bam
## 1:88000000-89000000 709.7236 701.4596 691.4738
## 1:92000000-93000000 626.6750 637.8441 620.7884
## 1:135000000-136000000 615.7014 644.5243 601.6941
## 1:91000000-92000000 613.1871 628.2461 598.1013
## 1:132000000-133000000 609.0753 607.9367 602.7033
## 1:133000000-134000000 587.3638 604.2511 587.6862
##
## [[2]]
## SRX5884275.bam SRX5884276.bam SRX5884277.bam
## 2:98000000-99000000 13985.8136 13197.7780 11944.7740
## 2:27000000-28000000 717.6253 714.4934 755.6136
## 2:31000000-32000000 671.8178 680.3491 704.3988
## 2:179000000-180000000 642.1594 685.3174 718.6686
## 2:25000000-26000000 671.0414 679.6091 673.2203
## 2:167000000-168000000 659.2402 681.5119 690.8132
## SRX5884278.bam SRX5884279.bam SRX5884280.bam
## 2:98000000-99000000 13129.7418 11998.7555 13152.7780
## 2:27000000-28000000 730.7018 759.9689 723.3247
## 2:31000000-32000000 670.0457 695.2785 680.1303
## 2:179000000-180000000 673.0313 681.1118 656.3128
## 2:25000000-26000000 675.0218 697.3132 656.3128
## 2:167000000-168000000 662.2410 683.9144 669.4730
##
## [[3]]
## SRX5884275.bam SRX5884276.bam SRX5884277.bam
## 3:89000000-90000000 571.5071 559.0998 586.4289
## 3:107000000-108000000 559.2400 549.9030 568.9337
## 3:101000000-102000000 542.3921 535.7379 546.0630
## 3:88000000-89000000 506.2120 539.2263 502.2763
## 3:153000000-154000000 502.9511 534.1522 518.9895
## 3:87000000-88000000 500.6219 525.6954 513.3207
## SRX5884278.bam SRX5884279.bam SRX5884280.bam
## 3:89000000-90000000 590.2185 578.7205 571.5791
## 3:107000000-108000000 558.7119 560.8298 551.4755
## 3:101000000-102000000 544.3335 549.6577 525.0745
## 3:88000000-89000000 512.6174 516.0264 514.1749
## 3:153000000-154000000 513.0103 511.3426 487.7739
## 3:87000000-88000000 503.4247 511.1506 511.9547
##
## [[4]]
## SRX5884275.bam SRX5884276.bam SRX5884277.bam
## 4:154000000-155000000 700.7775 702.1253 725.2170
## 4:140000000-141000000 695.2651 696.2055 713.1952
## 4:152000000-153000000 686.6470 699.0597 732.3519
## 4:139000000-140000000 670.2650 697.0512 682.9941
## 4:125000000-126000000 657.5321 636.9023 671.4610
## 4:138000000-139000000 640.8395 650.0103 668.7244
## SRX5884278.bam SRX5884279.bam SRX5884280.bam
## 4:154000000-155000000 718.4972 751.1388 703.3018
## 4:140000000-141000000 696.7857 720.8091 676.1741
## 4:152000000-153000000 677.9551 684.5671 683.7634
## 4:139000000-140000000 698.3571 707.5255 677.4659
## 4:125000000-126000000 668.1076 684.0680 667.0508
## 4:138000000-139000000 655.5888 675.2379 643.1930
##
## [[5]]
## SRX5884275.bam SRX5884276.bam SRX5884277.bam
## 5:35000000-36000000 731.1347 707.1994 760.3050
## 5:139000000-140000000 694.6439 698.8483 717.3980
## 5:140000000-141000000 681.6781 659.8413 676.1525
## 5:36000000-37000000 636.3364 644.0906 707.8196
## 5:113000000-114000000 651.8644 640.3907 689.9336
## 5:112000000-113000000 659.7836 658.5728 679.4756
## SRX5884278.bam SRX5884279.bam SRX5884280.bam
## 5:35000000-36000000 733.4255 761.6966 723.2439
## 5:139000000-140000000 695.5809 707.1800 678.8385
## 5:140000000-141000000 690.7096 721.6537 690.5050
## 5:36000000-37000000 668.8933 696.5838 647.2299
## 5:113000000-114000000 641.5771 651.4732 627.6915
## 5:112000000-113000000 625.4964 651.3581 619.7792
##
## [[6]]
## SRX5884275.bam SRX5884276.bam SRX5884277.bam
## 6:103000000-104000000 1103.0297 1084.9009 1074.7286
## 6:91000000-92000000 646.8954 649.7989 668.1380
## 6:88000000-89000000 609.8612 625.6970 618.2915
## 6:113000000-114000000 579.8146 589.0157 619.4644
## 6:127000000-128000000 578.8829 575.6962 580.1736
## 6:90000000-91000000 587.1904 560.6854 570.3998
## SRX5884278.bam SRX5884279.bam SRX5884280.bam
## 6:103000000-104000000 1048.5439 1035.1241 1055.3968
## 6:91000000-92000000 660.8530 691.7464 646.9473
## 6:88000000-89000000 622.3012 632.8531 598.1820
## 6:113000000-114000000 592.3399 601.1798 585.9099
## 6:127000000-128000000 602.6849 611.2768 570.6506
## 6:90000000-91000000 580.7639 594.6531 567.1385
##
## [[7]]
## SRX5884275.bam SRX5884276.bam SRX5884277.bam
## 7:141000000-142000000 658.2308 653.3930 687.3924
## 7:143000000-144000000 657.1439 645.1477 643.8989
## 7:125000000-126000000 642.0817 625.5913 657.0935
## 7:144000000-144995196 618.5569 620.7287 629.8246
## 7:45000000-46000000 638.2774 659.5242 633.5386
## 7:44000000-45000000 647.9824 660.3699 647.6129
## SRX5884278.bam SRX5884279.bam SRX5884280.bam
## 7:141000000-142000000 667.0338 682.9546 648.4813
## 7:143000000-144000000 671.9837 683.6457 642.1838
## 7:125000000-126000000 655.8769 657.4240 634.7560
## 7:144000000-144995196 629.8702 677.0807 629.9925
## 7:45000000-46000000 628.3773 640.9538 603.9951
## 7:44000000-45000000 619.2894 626.9024 602.5014
##
## [[8]]
## SRX5884275.bam SRX5884276.bam SRX5884277.bam
## 8:122000000-123000000 696.7402 685.8460 721.9917
## 8:121000000-122000000 694.5663 686.5859 727.0741
## 8:123000000-124000000 680.5911 665.1268 724.9238
## 8:120000000-121000000 667.3147 639.3336 687.8811
## 8:12000000-13000000 647.9824 617.8745 621.6146
## 8:125000000-126000000 616.4606 608.3606 625.1332
## SRX5884278.bam SRX5884279.bam SRX5884280.bam
## 8:122000000-123000000 699.9023 725.3394 679.4036
## 8:121000000-122000000 683.9788 708.1014 675.0035
## 8:123000000-124000000 702.3904 707.0264 681.1799
## 8:120000000-121000000 675.8337 685.9876 669.7959
## 8:12000000-13000000 604.4920 643.8716 614.5313
## 8:125000000-126000000 618.4251 645.0618 609.0008
##
## [[9]]
## SRX5884275.bam SRX5884276.bam SRX5884277.bam SRX5884278.bam
## 9:3000000-4000000 1011.2593 986.8021 906.7168 976.1809
## 9:35000000-36000000 707.2216 684.0489 677.6186 697.1262
## 9:45000000-46000000 630.1252 630.1368 626.5015 643.6723
## 9:61000000-62000000 595.1096 619.1430 626.5992 640.4771
## 9:43000000-44000000 602.8736 629.6083 627.5766 630.8130
## 9:21000000-22000000 619.3333 610.5805 630.0201 599.9088
## SRX5884279.bam SRX5884280.bam
## 9:3000000-4000000 930.0069 1001.6258
## 9:35000000-36000000 675.8521 691.1913
## 9:45000000-46000000 658.9597 634.1101
## 9:61000000-62000000 656.3874 651.0649
## 9:43000000-44000000 654.0839 624.0179
## 9:21000000-22000000 616.3446 588.4532
##
## [[10]]
## SRX5884275.bam SRX5884276.bam SRX5884277.bam
## 10:80000000-81000000 730.2806 737.2210 741.0506
## 10:60000000-61000000 647.0507 669.7781 674.4909
## 10:77000000-78000000 614.2867 617.7688 640.1848
## 10:61000000-62000000 616.8488 594.6183 638.6210
## 10:76000000-77000000 591.3829 595.1469 604.6082
## 10:79000000-80000000 577.2524 575.5905 575.0912
## SRX5884278.bam SRX5884279.bam SRX5884280.bam
## 10:80000000-81000000 669.2076 710.2513 669.9977
## 10:60000000-61000000 673.2932 685.2965 670.4014
## 10:77000000-78000000 620.1537 645.1769 604.1566
## 10:61000000-62000000 622.6679 634.2736 609.6063
## 10:76000000-77000000 607.0587 623.2935 583.6897
## 10:79000000-80000000 550.5668 565.0145 534.6418
##
## [[11]]
## SRX5884275.bam SRX5884276.bam SRX5884277.bam
## 11:3000000-4000000 773.6813 784.6847 805.6555
## 11:119000000-120000000 708.3862 727.2843 736.7501
## 11:118000000-119000000 694.8769 693.5628 735.9682
## 11:117000000-118000000 665.9948 687.5373 691.3019
## 11:120000000-121000000 628.1842 669.0381 683.0919
## 11:115000000-116000000 639.1314 643.7734 638.8165
## SRX5884278.bam SRX5884279.bam SRX5884280.bam
## 11:3000000-4000000 779.3367 781.3148 768.8201
## 11:119000000-120000000 715.0139 729.0634 700.4760
## 11:118000000-119000000 712.1330 734.0927 704.9166
## 11:117000000-118000000 677.2217 705.3755 673.5906
## 11:120000000-121000000 628.3511 667.0220 632.7779
## 11:115000000-116000000 636.3653 644.1788 622.9280
##
## [[12]]
## SRX5884275.bam SRX5884276.bam SRX5884277.bam
## 12:112000000-113000000 693.4793 692.0829 723.2623
## 12:108000000-109000000 593.3239 612.0604 620.4417
## 12:110000000-111000000 579.8922 604.5550 616.5322
## 12:111000000-112000000 593.1686 610.7919 620.0508
## 12:86000000-87000000 593.4015 582.7788 587.3085
## 12:105000000-106000000 586.4916 575.5905 580.8578
## SRX5884278.bam SRX5884279.bam SRX5884280.bam
## 12:112000000-113000000 706.3189 738.5078 689.2536
## 12:108000000-109000000 617.8489 638.2664 604.8428
## 12:110000000-111000000 609.6777 628.2077 601.2904
## 12:111000000-112000000 601.4278 616.1142 586.5558
## 12:86000000-87000000 590.7161 611.7375 582.0346
## 12:105000000-106000000 586.9971 595.4977 583.7300
##
## [[13]]
## SRX5884275.bam SRX5884276.bam SRX5884277.bam
## 13:48000000-49000000 594.8767 622.9486 604.7059
## 13:56000000-57000000 583.4636 593.3498 601.4805
## 13:73000000-74000000 573.0599 602.0180 562.0921
## 13:52000000-53000000 552.5630 575.1677 566.7835
## 13:55000000-56000000 553.8828 569.8822 580.3691
## 13:49000000-50000000 543.4791 558.2541 540.9806
## SRX5884278.bam SRX5884279.bam SRX5884280.bam
## 13:48000000-49000000 586.6042 602.2931 583.0841
## 13:56000000-57000000 583.8019 589.5470 573.0727
## 13:73000000-74000000 574.6354 579.7186 576.7463
## 13:52000000-53000000 569.9212 561.5976 557.1675
## 13:55000000-56000000 555.2024 546.1641 546.8735
## 13:49000000-50000000 539.9074 555.8388 536.8621
##
## [[14]]
## SRX5884275.bam SRX5884276.bam SRX5884277.bam
## 14:25000000-26000000 707.4545 684.3660 725.8035
## 14:70000000-71000000 555.5909 603.0751 579.6849
## 14:64000000-65000000 555.8238 571.6793 560.6260
## 14:32000000-33000000 545.8083 559.5226 578.1211
## 14:55000000-56000000 557.6096 546.9431 556.1300
## 14:24000000-25000000 535.5598 549.4802 560.5283
## SRX5884278.bam SRX5884279.bam SRX5884280.bam
## 14:25000000-26000000 703.7260 731.0982 712.1022
## 14:70000000-71000000 566.3332 583.0204 564.2320
## 14:64000000-65000000 565.8094 583.6730 568.6725
## 14:32000000-33000000 556.5119 570.9653 532.5023
## 14:55000000-56000000 549.0477 557.7968 547.8020
## 14:24000000-25000000 541.8455 558.9870 565.4431
##
## [[15]]
## SRX5884275.bam SRX5884276.bam SRX5884277.bam
## 15:78000000-79000000 699.3800 673.0551 713.1952
## 15:83000000-84000000 647.7495 651.2788 663.1533
## 15:84000000-85000000 634.1625 665.7611 657.8754
## 15:74000000-75000000 635.0165 632.9910 656.7026
## 15:79000000-80000000 646.6625 617.9802 645.9514
## 15:85000000-86000000 630.3581 633.8367 648.2971
## SRX5884278.bam SRX5884279.bam SRX5884280.bam
## 15:78000000-79000000 684.6073 700.6149 691.4335
## 15:83000000-84000000 660.1458 680.0752 652.3163
## 15:84000000-85000000 662.1625 672.0513 647.2702
## 15:74000000-75000000 653.3626 664.2194 642.2241
## 15:79000000-80000000 647.1556 655.3508 610.0907
## 15:85000000-86000000 628.8488 648.5938 632.6164
##
## [[16]]
## SRX5884275.bam SRX5884276.bam SRX5884277.bam
## 16:10000000-11000000 609.2401 618.9316 622.8852
## 16:17000000-18000000 570.4201 593.2441 607.1493
## 16:4000000-5000000 571.4295 570.3050 571.0840
## 16:92000000-93000000 564.6748 562.3768 578.6098
## 16:95000000-96000000 552.0195 566.7109 541.2738
## 16:18000000-19000000 558.9294 552.9686 568.1518
## SRX5884278.bam SRX5884279.bam SRX5884280.bam
## 16:10000000-11000000 619.8918 637.6137 625.7538
## 16:17000000-18000000 590.0875 604.9422 585.1026
## 16:4000000-5000000 560.8856 579.8722 566.2101
## 16:92000000-93000000 574.8711 567.3564 559.2667
## 16:95000000-96000000 549.8073 550.1184 560.3162
## 16:18000000-19000000 543.0240 544.4748 546.8331
##
## [[17]]
## SRX5884275.bam SRX5884276.bam SRX5884277.bam
## 17:25000000-26000000 667.2371 688.2773 726.9763
## 17:27000000-28000000 682.0663 671.7866 691.2042
## 17:31000000-32000000 623.6811 637.0080 628.8472
## 17:26000000-27000000 621.0413 636.0566 629.8246
## 17:28000000-29000000 616.3829 637.4308 630.8020
## 17:46000000-47000000 618.0134 608.0435 634.5160
## SRX5884278.bam SRX5884279.bam SRX5884280.bam
## 17:25000000-26000000 697.1523 704.1470 668.3426
## 17:27000000-28000000 655.4316 666.9068 644.3637
## 17:31000000-32000000 643.5152 645.1002 641.9416
## 17:26000000-27000000 633.0392 651.1661 614.7735
## 17:28000000-29000000 621.3846 642.7583 606.6594
## 17:46000000-47000000 626.7797 628.0541 609.8082
##
## [[18]]
## SRX5884275.bam SRX5884276.bam SRX5884277.bam
## 18:61000000-62000000 595.4978 603.1808 605.0968
## 18:75000000-76000000 584.9388 587.2186 589.7520
## 18:38000000-39000000 543.6344 552.4400 560.7237
## 18:80000000-81000000 563.7431 539.9663 540.7852
## 18:12000000-13000000 520.2648 551.0658 555.0549
## 18:76000000-77000000 519.7213 520.6214 531.2068
## SRX5884278.bam SRX5884279.bam SRX5884280.bam
## 18:61000000-62000000 607.6086 613.0429 598.8683
## 18:75000000-76000000 583.6710 602.1012 566.2101
## 18:38000000-39000000 553.8929 547.0471 552.3233
## 18:80000000-81000000 545.7740 556.2995 534.7226
## 18:12000000-13000000 542.7883 545.5498 534.1170
## 18:76000000-77000000 524.9267 525.5476 509.5325
##
## [[19]]
## SRX5884275.bam SRX5884276.bam SRX5884277.bam
## 19:10000000-11000000 614.4419 634.7881 641.8464
## 19:6000000-7000000 624.3022 640.8135 616.7277
## 19:5000000-6000000 615.1407 637.6422 632.9522
## 19:4000000-5000000 589.9854 605.0836 580.6623
## 19:56000000-57000000 562.5785 561.4254 588.8723
## 19:47000000-48000000 562.8114 566.1823 574.0161
## SRX5884278.bam SRX5884279.bam SRX5884280.bam
## 19:10000000-11000000 634.1653 658.5373 641.0938
## 19:6000000-7000000 619.7870 631.7781 582.5997
## 19:5000000-6000000 602.1611 618.6865 587.7669
## 19:4000000-5000000 603.3659 610.4706 591.6423
## 19:56000000-57000000 575.3425 579.9106 568.1881
## 19:47000000-48000000 556.7738 562.4807 558.8630
100 kbp bins
x<-read.table("SRP199233.1e5_fmt.tsv",header=T,row.names=1)
x <- x[grep("X",rownames(x),invert=TRUE),]
x <- x[grep("Y",rownames(x),invert=TRUE),]
x <- x[grep("M",rownames(x),invert=TRUE),]
x <- x[grep("J",rownames(x),invert=TRUE),]
x <- x[grep("G",rownames(x),invert=TRUE),]
x <- x[which(rowSums(x)>=10),]
x <- sweep(x, 2, colSums(x), FUN="/")*1000000
mysd <- apply(x,1,sd)
mean <- apply(x,1,mean)
y <- data.frame(log10(mean),mysd/mean)
colnames(y) <- c("logMean","cv")
Rbs.9 <- cobs(y$logMean,y$cv, nknots=10,constraint="none",tau=0.99)
## qbsks2():
## Performing general knot selection ...
##
## WARNING! Since the number of 10 knots selected by AIC reached the
## upper bound during general knot selection, you might want to rerun
## cobs with a larger number of knots.
##
## Deleting unnecessary knots ...
##
## WARNING! Since the number of 10 knots selected by AIC reached the
## upper bound during general knot selection, you might want to rerun
## cobs with a larger number of knots.
Rbs.median <- cobs(y$logMean,y$cv,nknots=10,constraint="none",tau=0.5)
## qbsks2():
## Performing general knot selection ...
##
## Deleting unnecessary knots ...
pred <- data.frame(predict(Rbs.9))
res <- mclapply(X=1:nrow(y),function(row) {
interpolate_points(row,y,pred)
},mc.cores=8)
y$interpolated <- unlist(res)
y$diff <- y$cv-y$interpolated
yy1 <- y[order(-y$diff),]
yy1 <- head(yy,50)
yy2 <- subset(y,logMean>2 & cv>0.05)
yy <- rbind(yy1,yy2)
write.table(yy,file="SRP199233.1e5_regions.tsv")
yy %>% kbl() %>% kable_paper("hover", full_width = F)
|
logMean
|
cv
|
interpolated
|
diff
|
8:97000000-98000000
|
2.491946
|
0.0576254
|
0.0444597
|
0.0131656
|
4:72000000-73000000
|
2.456341
|
0.0588557
|
0.0480012
|
0.0108545
|
7:28000000-29000000
|
2.781010
|
0.0493569
|
0.0406575
|
0.0086994
|
13:10000000-11000000
|
2.540312
|
0.0502447
|
0.0421066
|
0.0081381
|
7:16000000-17000000
|
2.713062
|
0.0424653
|
0.0372215
|
0.0052438
|
1:25000000-26000000
|
2.490826
|
0.0491547
|
0.0444808
|
0.0046739
|
10:10000000-11000000
|
2.547997
|
0.0453420
|
0.0415737
|
0.0037683
|
5:29000000-30000000
|
2.661236
|
0.0429821
|
0.0393844
|
0.0035977
|
12:103000000-104000000
|
2.690415
|
0.0427163
|
0.0392618
|
0.0034545
|
12:21000000-22000000
|
2.604930
|
0.0422757
|
0.0389109
|
0.0033648
|
14:87000000-88000000
|
2.566054
|
0.0436054
|
0.0404302
|
0.0031751
|
14:106000000-107000000
|
2.484854
|
0.0461552
|
0.0445930
|
0.0015622
|
7:128000000-129000000
|
2.679999
|
0.0411291
|
0.0395942
|
0.0015349
|
12:87000000-88000000
|
2.595620
|
0.0404222
|
0.0391221
|
0.0013001
|
6:89000000-90000000
|
2.718062
|
0.0371048
|
0.0367711
|
0.0003337
|
5:118000000-119000000
|
2.794570
|
0.0421634
|
0.0418907
|
0.0002727
|
1:171000000-172000000
|
2.683038
|
0.0398373
|
0.0396282
|
0.0002091
|
6:18000000-19000000
|
2.520165
|
0.0437202
|
0.0435219
|
0.0001982
|
10:19000000-20000000
|
2.628382
|
0.0389898
|
0.0388623
|
0.0001275
|
12:115000000-116000000
|
2.599351
|
0.0391572
|
0.0390374
|
0.0001198
|
15:93000000-94000000
|
2.645251
|
0.0392038
|
0.0391652
|
0.0000386
|
9:124000000-124359700
|
2.050790
|
0.1535983
|
0.1535894
|
0.0000089
|
7:32000000-33000000
|
1.599280
|
0.2589433
|
0.2589344
|
0.0000088
|
5:36000000-37000000
|
2.824012
|
0.0444906
|
0.0444888
|
0.0000019
|
2:98000000-99000000
|
4.110644
|
0.0611200
|
0.0611200
|
0.0000000
|
14:50000000-51000000
|
2.477492
|
0.0447314
|
0.0447316
|
-0.0000002
|
9:14000000-15000000
|
2.709167
|
0.0375699
|
0.0375724
|
-0.0000025
|
19:13000000-14000000
|
2.448433
|
0.0492152
|
0.0492235
|
-0.0000083
|
11:23000000-24000000
|
2.617917
|
0.0386465
|
0.0386744
|
-0.0000279
|
2:129000000-130000000
|
2.694598
|
0.0388437
|
0.0388849
|
-0.0000412
|
9:46000000-47000000
|
2.772592
|
0.0397672
|
0.0398812
|
-0.0001140
|
16:57000000-58000000
|
2.582134
|
0.0391847
|
0.0394280
|
-0.0002433
|
2:152000000-153000000
|
2.754117
|
0.0378567
|
0.0382337
|
-0.0003770
|
13:30000000-31000000
|
2.644148
|
0.0387629
|
0.0391454
|
-0.0003825
|
19:7000000-8000000
|
2.686924
|
0.0390917
|
0.0395762
|
-0.0004846
|
9:37000000-38000000
|
2.623167
|
0.0382618
|
0.0387687
|
-0.0005069
|
10:80000000-81000000
|
2.851055
|
0.0462224
|
0.0467717
|
-0.0005494
|
5:111000000-112000000
|
2.790265
|
0.0409462
|
0.0415107
|
-0.0005646
|
2:63000000-64000000
|
2.459239
|
0.0469329
|
0.0475531
|
-0.0006202
|
19:41000000-42000000
|
2.735271
|
0.0366452
|
0.0372724
|
-0.0006272
|
18:86000000-87000000
|
2.465841
|
0.0457070
|
0.0465327
|
-0.0008257
|
2:131000000-132000000
|
2.713264
|
0.0363743
|
0.0372033
|
-0.0008290
|
9:122000000-123000000
|
2.721756
|
0.0356884
|
0.0365830
|
-0.0008946
|
8:23000000-24000000
|
2.720346
|
0.0355879
|
0.0365653
|
-0.0009774
|
7:46000000-47000000
|
2.728042
|
0.0358622
|
0.0369037
|
-0.0010415
|
8:3000000-4000000
|
2.630171
|
0.0375803
|
0.0388944
|
-0.0013141
|
13:118000000-119000000
|
2.484165
|
0.0431665
|
0.0446059
|
-0.0014394
|
19:58000000-59000000
|
2.739115
|
0.0359795
|
0.0374685
|
-0.0014890
|
5:131000000-132000000
|
2.699493
|
0.0369483
|
0.0384439
|
-0.0014956
|
10:122000000-123000000
|
2.619504
|
0.0371110
|
0.0387029
|
-0.0015918
|
2:98400000-98500000
|
4.103646
|
0.0616973
|
0.0616973
|
0.0000000
|
3:3000000-3100000
|
2.100321
|
0.0503498
|
0.1079735
|
-0.0576237
|
4:3000000-3100000
|
2.065077
|
0.1047348
|
0.1072179
|
-0.0024831
|
9:3000000-3100000
|
2.839527
|
0.0506325
|
0.1113817
|
-0.0607492
|
12:3100000-3200000
|
2.142286
|
0.0897696
|
0.1088047
|
-0.0190351
|
12:115500000-115600000
|
2.004164
|
0.0681790
|
0.1057779
|
-0.0375989
|
13:48400000-48500000
|
2.153410
|
0.0638206
|
0.1090170
|
-0.0451963
|
14:3000000-3100000
|
2.188414
|
0.0652794
|
0.1096344
|
-0.0443551
|
17:13700000-13800000
|
2.070077
|
0.0764565
|
0.1073251
|
-0.0308685
|
17:40100000-40200000
|
2.319788
|
0.0922489
|
0.1114911
|
-0.0192422
|
plot(y$logMean,y$cv,pch=18,cex=0.5,xlab="log10(mean)",ylab="CV")
lines(predict(Rbs.9), col = "red", lwd = 1.0)
lines(predict(Rbs.median), col = "blue", lwd = 1.0)
points(yy$logMean,yy$cv)
#text(yy$logMean,yy$cv+0.02,labels=rownames(yy),cex=0.8)
plot(y$logMean,y$cv,pch=18,cex=0.5,xlab="log10(mean)",ylab="CV",xlim=c(1,4.5),ylim=c(0,0.35))
lines(predict(Rbs.9), col = "red", lwd = 1.0)
lines(predict(Rbs.median), col = "blue", lwd = 1.0)
points(yy$logMean,yy$cv)
text(yy$logMean,yy$cv+0.02,labels=rownames(yy),cex=0.8)
my_palette <- colorRampPalette(c("blue", "white", "red"))(n = 25)
zz <- x[which(rownames(x) %in% rownames(yy)),]
heatmap.2(as.matrix(zz),margin=c(8, 22),cexRow=0.65,trace="none",
cexCol=0.8,col=my_palette,scale="row")
heatmap.2(cor(t(zz)),trace="none",scale="none",margins=c(12,12),
cexRow=0.8, cexCol=0.8)
for (i in 1:19){
mychr=as.character(i)
regex=paste("^",mychr,":",sep="")
chr <- x[grep(regex,rownames(x)),]
mymax = max(chr)
plot(chr[,1], xaxt = "n", pch=19, col="gray",
ylim=c(0,mymax),ylab="RPM of 100 kbp bins of chr",main=mychr)
axis(1, at=chr[,1], labels=rownames(chr), xlab="chr", las=1)
points( chr[,1], xaxt = "n", las=1, pch=19, col="gray" )
points( chr[,2], xaxt = "n", las=1, pch=19, col="lightblue" )
points( chr[,3], xaxt = "n", las=1, pch=19, col="lightgreen" )
points( chr[,4], xaxt = "n", las=1, pch=19, col="pink" )
points( chr[,5], xaxt = "n", las=1, pch=19, col="orange" )
points( chr[,6], xaxt = "n", las=1, pch=19, col="black" )
grid()
}
lapply(1:19,function(i){
mychr=as.character(i)
regex=paste("^",mychr,":",sep="")
chr <- x[grep(regex,rownames(x)),]
mymedian <- median(rowMeans(chr))
mymax <- max(rowMeans(chr))
rat <- mymax / mymedian
return(c(mymax,mymedian,rat))
})
## [[1]]
## [1] 189.354189 37.554372 5.042134
##
## [[2]]
## [1] 12695.38925 41.01708 309.51467
##
## [[3]]
## [1] 125.985681 35.260139 3.573034
##
## [[4]]
## [1] 116.165398 39.019478 2.977113
##
## [[5]]
## [1] 85.242743 42.380372 2.011373
##
## [[6]]
## [1] 788.10324 38.09023 20.69043
##
## [[7]]
## [1] 77.314277 43.897365 1.761251
##
## [[8]]
## [1] 81.805656 40.952229 1.997587
##
## [[9]]
## [1] 691.07779 45.04618 15.34154
##
## [[10]]
## [1] 75.544299 38.366680 1.969008
##
## [[11]]
## [1] 286.042322 48.370843 5.913528
##
## [[12]]
## [1] 138.766911 38.905723 3.566748
##
## [[13]]
## [1] 142.367188 39.901643 3.567953
##
## [[14]]
## [1] 154.31716 36.96556 4.17462
##
## [[15]]
## [1] 80.80260 39.38287 2.05172
##
## [[16]]
## [1] 84.968323 36.650925 2.318313
##
## [[17]]
## [1] 208.827507 42.808724 4.878153
##
## [[18]]
## [1] 72.580938 39.104282 1.856087
##
## [[19]]
## [1] 74.559400 43.902405 1.698299
lapply(1:19,function(i){
mychr=as.character(i)
regex=paste("^",mychr,":",sep="")
chr <- x[grep(regex,rownames(x)),]
top <- head(chr[order(-rowMeans(chr)),])
return(top)
})
## [[1]]
## SRX5884275.bam SRX5884276.bam SRX5884277.bam
## 1:88100000-88200000 195.74939 187.90813 193.69850
## 1:88200000-88300000 115.70895 103.68805 109.86031
## 1:93100000-93200000 74.52309 72.47583 71.51192
## 1:91200000-91300000 73.27974 74.16869 67.69665
## 1:92900000-93000000 71.57014 68.45527 72.58802
## 1:136000000-136100000 71.57014 75.96736 71.51192
## SRX5884278.bam SRX5884279.bam SRX5884280.bam
## 1:88100000-88200000 184.53991 193.05410 181.17510
## 1:88200000-88300000 115.12774 108.09339 110.66873
## 1:93100000-93200000 71.84999 70.58925 72.68823
## 1:91200000-91300000 72.29561 72.89483 69.81949
## 1:92900000-93000000 73.39656 72.08788 70.10232
## 1:136000000-136100000 69.15004 71.39620 68.16289
##
## [[2]]
## SRX5884275.bam SRX5884276.bam SRX5884277.bam
## 2:98400000-98500000 13774.49344 12996.87338 11747.91177
## 2:27600000-27700000 76.69895 75.86156 92.15353
## 2:31300000-31400000 80.42899 79.77631 74.44675
## 2:166400000-166500000 73.66829 72.89904 81.78381
## 2:25300000-25400000 80.19586 78.71827 76.59895
## 2:26400000-26500000 75.76644 75.86156 77.87071
## SRX5884278.bam SRX5884279.bam SRX5884280.bam
## 2:98400000-98500000 12917.32200 11797.47318 12938.26172
## 2:27600000-27700000 83.12160 81.11808 79.75906
## 2:31300000-31400000 78.84887 81.46391 76.52668
## 2:166400000-166500000 82.54491 79.81158 77.45599
## 2:25300000-25400000 77.38094 79.85000 75.19332
## 2:26400000-26500000 79.79254 80.31112 77.33478
##
## [[3]]
## SRX5884275.bam SRX5884276.bam SRX5884277.bam
## 3:3000000-3100000 127.13219 124.31985 133.24109
## 3:87600000-87700000 62.78901 68.03205 71.60975
## 3:93700000-93800000 58.67042 62.10702 66.13141
## 3:89200000-89300000 63.72152 65.17534 63.29441
## 3:89400000-89500000 65.27570 59.56772 56.54431
## 3:108300000-108400000 60.45773 64.75213 62.90310
## SRX5884278.bam SRX5884279.bam SRX5884280.bam
## 3:3000000-3100000 118.14224 132.95525 120.12345
## 3:87600000-87700000 63.59287 66.32392 66.58710
## 3:93700000-93800000 67.13164 68.12996 68.80937
## 3:89200000-89300000 64.51033 68.32209 65.53658
## 3:89400000-89500000 68.78306 62.78869 66.82953
## 3:108300000-108400000 61.52204 67.39986 60.40517
##
## [[4]]
## SRX5884275.bam SRX5884276.bam SRX5884277.bam
## 4:3000000-3100000 122.23652 115.32650 134.80633
## 4:146500000-146600000 105.99530 103.89965 107.51245
## 4:147600000-147700000 92.78474 85.27813 87.06650
## 4:154100000-154200000 77.55375 86.54778 85.01212
## 4:154300000-154400000 86.56801 75.01513 77.38157
## 4:140700000-140800000 79.65189 85.06652 84.62081
## SRX5884278.bam SRX5884279.bam SRX5884280.bam
## 4:3000000-3100000 105.14057 118.43008 101.05239
## 4:146500000-146600000 104.74737 99.94700 102.87061
## 4:147600000-147700000 83.04296 85.72924 86.46626
## 4:154100000-154200000 78.87508 82.53985 80.48635
## 4:154300000-154400000 80.21195 87.07416 79.31461
## 4:140700000-140800000 75.75573 80.73381 76.60749
##
## [[5]]
## SRX5884275.bam SRX5884276.bam SRX5884277.bam
## 5:125100000-125200000 87.42281 83.90267 81.39250
## 5:140000000-140100000 77.78687 79.24729 75.52285
## 5:35800000-35900000 81.75004 72.47583 79.63161
## 5:36200000-36300000 70.48221 83.58526 77.08809
## 5:35900000-36000000 73.97912 73.85128 88.24043
## 5:139700000-139800000 78.95251 76.49639 79.04464
## SRX5884278.bam SRX5884279.bam SRX5884280.bam
## 5:125100000-125200000 85.66427 87.49685 85.57736
## 5:140000000-140100000 81.28669 89.03391 82.95104
## 5:35800000-35900000 79.42556 89.14919 77.45599
## 5:36200000-36300000 76.17514 87.30472 74.30442
## 5:35900000-36000000 77.66928 79.23518 75.88020
## 5:139700000-139800000 78.53431 76.89117 76.93073
##
## [[6]]
## SRX5884275.bam SRX5884276.bam SRX5884277.bam
## 6:103600000-103700000 822.16296 808.55515 797.88129
## 6:89300000-89400000 74.67851 76.39058 83.93602
## 6:88200000-88300000 78.79709 70.88877 75.71850
## 6:115900000-116000000 75.14476 78.08345 80.80554
## 6:113800000-113900000 77.00978 66.76241 82.37078
## 6:127900000-128000000 74.05683 80.62275 72.78368
## SRX5884278.bam SRX5884279.bam SRX5884280.bam
## 6:103600000-103700000 771.47644 753.57962 774.96396
## 6:89300000-89400000 70.72282 80.04214 72.56701
## 6:88200000-88300000 75.96544 81.65604 73.77915
## 6:115900000-116000000 71.53543 75.73838 74.06199
## 6:113800000-113900000 73.39656 77.27544 77.86004
## 6:127900000-128000000 75.99165 76.85275 70.91041
##
## [[7]]
## SRX5884275.bam SRX5884276.bam SRX5884277.bam
## 7:144300000-144400000 73.59058 70.04233 75.42502
## 7:141300000-141400000 76.46582 71.41779 81.49033
## 7:144700000-144800000 68.07323 73.53387 76.50112
## 7:97700000-97800000 69.70512 75.75576 81.88164
## 7:144600000-144700000 67.99552 75.75576 81.29467
## 7:142600000-142700000 76.38811 73.53387 78.16419
## SRX5884278.bam SRX5884279.bam SRX5884280.bam
## 7:144300000-144400000 77.66928 87.03574 80.12271
## 7:141300000-141400000 76.59455 81.34863 72.93065
## 7:144700000-144800000 74.52372 82.38615 73.65794
## 7:97700000-97800000 71.98105 79.85000 68.52653
## 7:144600000-144700000 72.26939 78.31295 71.92053
## 7:142600000-142700000 74.31401 73.24067 71.51649
##
## [[8]]
## SRX5884275.bam SRX5884276.bam SRX5884277.bam
## 8:122900000-123000000 79.34106 74.16869 85.89257
## 8:121000000-121100000 75.68873 76.28478 93.32746
## 8:123000000-123100000 75.61102 75.43834 99.19711
## 8:123500000-123600000 79.18564 72.89904 75.71850
## 8:122800000-122900000 76.46582 76.39058 72.19671
## 8:123400000-123500000 75.37789 74.80352 77.47940
## SRX5884278.bam SRX5884279.bam SRX5884280.bam
## 8:122900000-123000000 83.01675 92.45386 75.96101
## 8:121000000-121100000 79.68769 84.69173 79.11259
## 8:123000000-123100000 81.26047 79.15833 77.57721
## 8:123500000-123600000 81.02456 78.27452 76.44587
## 8:122800000-122900000 78.27218 81.80975 72.80944
## 8:123400000-123500000 76.25378 80.77224 72.40539
##
## [[9]]
## SRX5884275.bam SRX5884276.bam SRX5884277.bam
## 9:3000000-3100000 729.14509 702.32781 637.44415
## 9:35200000-35300000 348.99186 338.99643 313.92853
## 9:56600000-56700000 74.21225 70.57135 77.18592
## 9:119300000-119400000 77.78687 75.22674 81.88164
## 9:107300000-107400000 74.52309 72.15842 72.39237
## 9:56500000-56600000 69.54970 78.18925 77.18592
## SRX5884278.bam SRX5884279.bam SRX5884280.bam
## 9:3000000-3100000 698.47308 661.16419 717.91239
## 9:35200000-35300000 338.69889 319.70743 333.13753
## 9:56600000-56700000 76.90911 81.65604 76.52668
## 9:119300000-119400000 74.65478 76.23793 66.06184
## 9:107300000-107400000 74.31401 78.88935 73.90037
## 9:56500000-56600000 73.63247 77.23701 70.34475
##
## [[10]]
## SRX5884275.bam SRX5884276.bam SRX5884277.bam
## 10:79900000-80000000 76.93207 78.92988 85.50126
## 10:60200000-60300000 74.75622 77.34282 74.54457
## 10:80100000-80200000 71.95869 81.89240 79.43595
## 10:80500000-80600000 73.04662 73.95709 85.10995
## 10:80700000-80800000 69.54970 78.92988 78.65333
## 10:80600000-80700000 79.10793 76.07317 69.65320
## SRX5884278.bam SRX5884279.bam SRX5884280.bam
## 10:79900000-80000000 69.43838 76.96803 65.49617
## 10:60200000-60300000 75.54603 78.19767 72.68823
## 10:80100000-80200000 67.18406 77.85183 70.50637
## 10:80500000-80600000 68.12773 72.31844 71.07203
## 10:80700000-80800000 65.21808 76.04579 74.02158
## 10:80600000-80700000 69.85779 72.31844 65.65779
##
## [[11]]
## SRX5884275.bam SRX5884276.bam SRX5884277.bam
## 11:3100000-3200000 292.26417 296.78058 293.87388
## 11:119800000-119900000 77.32062 85.59554 83.34905
## 11:118400000-118500000 81.75004 80.62275 81.00119
## 11:119900000-120000000 78.02000 81.68079 86.67519
## 11:58900000-59000000 77.55375 73.21646 85.79474
## 11:115700000-115800000 81.28379 77.13121 78.06636
## SRX5884278.bam SRX5884279.bam SRX5884280.bam
## 11:3100000-3200000 275.83998 280.35882 277.13649
## 11:119800000-119900000 76.69940 83.00097 77.21356
## 11:118400000-118500000 74.52372 83.76950 80.04190
## 11:119900000-120000000 80.15952 77.92869 75.27413
## 11:58900000-59000000 79.34692 80.69539 82.38538
## 11:115700000-115800000 77.01396 79.19676 76.16304
##
## [[12]]
## SRX5884275.bam SRX5884276.bam SRX5884277.bam
## 12:3100000-3200000 159.45921 148.12578 133.73023
## 12:115500000-115600000 100.78879 101.78357 87.55563
## 12:112100000-112200000 84.08132 81.99820 85.01212
## 12:113600000-113700000 71.10389 76.91960 79.43595
## 12:112400000-112500000 74.05683 73.74548 76.20764
## 12:112200000-112300000 79.03022 69.51331 81.58816
## SRX5884278.bam SRX5884279.bam SRX5884280.bam
## 12:3100000-3200000 132.16623 126.26906 132.85096
## 12:115500000-115600000 106.39879 104.44288 104.81004
## 12:112100000-112200000 76.33242 82.53985 72.12256
## 12:113600000-113700000 79.97603 80.73381 83.35509
## 12:112400000-112500000 74.75963 80.31112 73.37511
## 12:112200000-112300000 72.16454 74.96986 74.22361
##
## [[13]]
## SRX5884275.bam SRX5884276.bam SRX5884277.bam
## 13:48400000-48500000 146.55949 156.27270 145.56736
## 13:100400000-100500000 79.96273 75.54415 68.87058
## 13:49200000-49300000 70.94847 67.39723 76.79461
## 13:73900000-74000000 70.17138 72.05261 77.57723
## 13:56000000-56100000 69.16116 66.23338 71.90323
## 13:55100000-55200000 69.08345 66.33919 70.72930
## SRX5884278.bam SRX5884279.bam SRX5884280.bam
## 13:48400000-48500000 133.87008 140.29469 131.63882
## 13:100400000-100500000 74.26159 76.16107 74.58725
## 13:49200000-49300000 68.41608 78.46666 71.63770
## 13:73900000-74000000 67.26270 62.78869 64.84970
## 13:56000000-56100000 67.13164 66.36235 66.62751
## 13:55100000-55200000 66.16175 63.24981 69.41544
##
## [[14]]
## SRX5884275.bam SRX5884276.bam SRX5884277.bam
## 14:3000000-3100000 169.32827 162.30353 155.93707
## 14:25900000-26000000 94.57205 95.85854 98.21883
## 14:25800000-25900000 82.44942 77.87184 73.85978
## 14:25500000-25600000 73.43516 71.10037 77.77288
## 14:25600000-25700000 77.16520 68.98429 77.47940
## 14:64200000-64300000 69.70512 69.72492 69.65320
## SRX5884278.bam SRX5884279.bam SRX5884280.bam
## 14:3000000-3100000 145.22033 144.06048 149.05329
## 14:25900000-26000000 98.40381 99.48588 98.06244
## 14:25800000-25900000 73.84218 76.39163 77.17316
## 14:25500000-25600000 75.41496 76.81432 76.24385
## 14:25600000-25700000 68.12773 73.89392 70.34475
## 14:64200000-64300000 72.21697 72.89483 73.05187
##
## [[15]]
## SRX5884275.bam SRX5884276.bam SRX5884277.bam
## 15:74400000-74500000 84.85841 78.61247 82.95774
## 15:78500000-78600000 77.63146 83.05624 79.43595
## 15:85400000-85500000 72.81349 74.48611 83.25122
## 15:84300000-84400000 80.11815 74.48611 72.97933
## 15:79600000-79700000 74.83393 75.33254 78.94681
## 15:83700000-83800000 73.90142 73.00485 77.96854
## SRX5884278.bam SRX5884279.bam SRX5884280.bam
## 15:74400000-74500000 81.02456 83.46208 73.90037
## 15:78500000-78600000 79.16343 79.73473 79.75906
## 15:85400000-85500000 74.07810 76.19950 73.25389
## 15:84300000-84400000 72.66259 79.11990 73.98118
## 15:79600000-79700000 75.65088 76.16107 70.38515
## 15:83700000-83800000 73.47520 77.16016 72.24377
##
## [[16]]
## SRX5884275.bam SRX5884276.bam SRX5884277.bam
## 16:3100000-3200000 84.70299 86.33617 81.49033
## 16:17900000-18000000 74.44538 73.63967 75.13154
## 16:10700000-10800000 71.25930 72.15842 75.03371
## 16:10500000-10600000 74.28996 72.68744 72.00106
## 16:18200000-18300000 73.27974 71.52359 72.58802
## 16:10600000-10700000 65.35341 70.14814 70.53365
## SRX5884278.bam SRX5884279.bam SRX5884280.bam
## 16:3100000-3200000 82.02065 83.50051 91.75929
## 16:17900000-18000000 78.06248 74.04762 71.96094
## 16:10700000-10800000 71.56164 80.11899 74.78927
## 16:10500000-10600000 67.89181 72.35686 75.92061
## 16:18200000-18300000 68.99276 71.28092 69.17301
## 16:10600000-10700000 71.45679 71.70361 70.62758
##
## [[17]]
## SRX5884275.bam SRX5884276.bam SRX5884277.bam
## 17:40100000-40200000 216.26461 240.38698 216.00317
## 17:13700000-13800000 113.22225 116.70195 134.02371
## 17:13500000-13600000 95.97082 81.89240 92.74049
## 17:27600000-27700000 90.37576 84.00848 88.82739
## 17:3000000-3100000 81.67233 85.17232 94.50139
## 17:56600000-56700000 81.43920 78.50666 88.14260
## SRX5884278.bam SRX5884279.bam SRX5884280.bam
## 17:40100000-40200000 192.22034 198.51065 189.57930
## 17:13700000-13800000 112.66371 120.00557 108.44647
## 17:13500000-13600000 86.34581 96.71918 86.74909
## 17:27600000-27700000 80.36923 84.19219 77.81963
## 17:3000000-3100000 78.92751 81.80975 76.04182
## 17:56600000-56700000 83.72450 80.69539 82.38538
##
## [[18]]
## SRX5884275.bam SRX5884276.bam SRX5884277.bam
## 18:36100000-36200000 71.25930 76.81380 75.71850
## 18:61100000-61200000 66.82988 69.51331 66.71837
## 18:75700000-75800000 68.61719 64.85793 70.63147
## 18:80400000-80500000 73.43516 59.14451 72.00106
## 18:75600000-75700000 69.39428 66.02178 67.79447
## 18:61000000-61100000 62.94442 68.98429 72.49020
## SRX5884278.bam SRX5884279.bam SRX5884280.bam
## 18:36100000-36200000 70.98495 71.81889 68.89017
## 18:61100000-61200000 68.52093 71.66519 68.08208
## 18:75700000-75800000 68.73063 71.35778 66.70832
## 18:80400000-80500000 67.73454 69.16747 68.40532
## 18:75600000-75700000 66.55495 70.97351 67.71844
## 18:61000000-61100000 67.41998 67.70727 67.92046
##
## [[19]]
## SRX5884275.bam SRX5884276.bam SRX5884277.bam
## 19:6500000-6600000 77.94229 77.02541 72.97933
## 19:10200000-10300000 69.93825 77.13121 74.25109
## 19:6300000-6400000 76.23269 78.08345 72.49020
## 19:7100000-7200000 73.51287 72.26422 80.02292
## 19:5700000-5800000 75.92185 75.22674 70.04451
## 19:47200000-47300000 70.87076 71.84100 72.97933
## SRX5884278.bam SRX5884279.bam SRX5884280.bam
## 19:6500000-6600000 72.11212 75.69996 71.59730
## 19:10200000-10300000 74.05188 74.54717 69.13260
## 19:6300000-6400000 71.79756 73.20224 65.41536
## 19:7100000-7200000 65.76856 69.97443 72.00134
## 19:5700000-5800000 67.47241 72.16473 68.16289
## 19:47200000-47300000 70.04128 70.62768 72.52661
10 kbp bins
x<-read.table("SRP199233.1e4_fmt.tsv",header=T,row.names=1)
x <- x[grep("X",rownames(x),invert=TRUE),]
x <- x[grep("Y",rownames(x),invert=TRUE),]
x <- x[grep("M",rownames(x),invert=TRUE),]
x <- x[grep("J",rownames(x),invert=TRUE),]
x <- x[grep("G",rownames(x),invert=TRUE),]
x <- x[which(rowSums(x)>=10),]
x <- sweep(x, 2, colSums(x), FUN="/")*1000000
mysd <- apply(x,1,sd)
mean <- apply(x,1,mean)
y <- data.frame(log10(mean),mysd/mean)
colnames(y) <- c("logMean","cv")
Rbs.9 <- cobs(y$logMean,y$cv, nknots=10,constraint="none",tau=0.99)
## qbsks2():
## Performing general knot selection ...
##
## WARNING! Since the number of 10 knots selected by AIC reached the
## upper bound during general knot selection, you might want to rerun
## cobs with a larger number of knots.
##
## Deleting unnecessary knots ...
##
## WARNING! Since the number of 10 knots selected by AIC reached the
## upper bound during general knot selection, you might want to rerun
## cobs with a larger number of knots.
## Warning in cobs(y$logMean, y$cv, nknots = 10, constraint = "none", tau = 0.99):
## The algorithm has not converged after 100 iterations
Rbs.median <- cobs(y$logMean,y$cv,nknots=10,constraint="none",tau=0.5)
## qbsks2():
## Performing general knot selection ...
##
## WARNING! Since the number of 10 knots selected by AIC reached the
## upper bound during general knot selection, you might want to rerun
## cobs with a larger number of knots.
##
## Deleting unnecessary knots ...
##
## WARNING! Since the number of 10 knots selected by AIC reached the
## upper bound during general knot selection, you might want to rerun
## cobs with a larger number of knots.
pred <- data.frame(predict(Rbs.9))
res <- mclapply(X=1:nrow(y),function(row) {
interpolate_points(row,y,pred)
},mc.cores=8)
y$interpolated <- unlist(res)
y$diff <- y$cv-y$interpolated
yy <- y[order(-y$diff),]
yy1 <- head(yy,20)
yy2 <- subset(y,logMean>1 & cv>0.05)
yy <- rbind(yy1,yy2)
write.table(yy,file="SRP199233.1e4_regions.tsv")
yy %>% kbl() %>% kable_paper("hover", full_width = F)
|
logMean
|
cv
|
interpolated
|
diff
|
7:17030000-17040000
|
0.0360333
|
1.1039441
|
0.7133303
|
0.3906138
|
12:114200000-114210000
|
-0.4269408
|
1.6337781
|
1.2542452
|
0.3795330
|
7:31940000-31950000
|
-0.2426208
|
1.3898113
|
1.0115482
|
0.3782631
|
9:123730000-123740000
|
1.2423154
|
0.6424760
|
0.2739313
|
0.3685447
|
7:7750000-7760000
|
-0.3359095
|
1.3802584
|
1.1296459
|
0.2506126
|
7:25760000-25770000
|
-0.2793023
|
1.3064795
|
1.0566815
|
0.2497980
|
8:53410000-53420000
|
-0.5718049
|
1.7136275
|
1.4705958
|
0.2430317
|
16:5940000-5950000
|
0.3163343
|
0.7123142
|
0.4969240
|
0.2153902
|
2:71190000-71200000
|
0.4982121
|
0.6205733
|
0.4061030
|
0.2144702
|
10:54540000-54550000
|
0.5246533
|
0.5913321
|
0.3942044
|
0.1971277
|
13:120060000-120070000
|
0.8996092
|
0.4629984
|
0.2693580
|
0.1936404
|
9:35980000-35990000
|
0.3215532
|
0.6818176
|
0.4935818
|
0.1882358
|
2:50880000-50890000
|
-0.1283675
|
1.0622448
|
0.8792231
|
0.1830216
|
17:37760000-37770000
|
0.7208445
|
0.4891927
|
0.3164264
|
0.1727663
|
1:66680000-66690000
|
0.6877650
|
0.4937894
|
0.3287147
|
0.1650747
|
9:28820000-28830000
|
0.7154558
|
0.4827565
|
0.3185313
|
0.1642251
|
9:124010000-124020000
|
1.0831294
|
0.4153246
|
0.2571776
|
0.1581470
|
14:117600000-117610000
|
0.6073145
|
0.5148100
|
0.3580331
|
0.1567770
|
10:101910000-101920000
|
0.4385996
|
0.5863083
|
0.4296094
|
0.1566990
|
1:106620000-106630000
|
0.6905979
|
0.4828105
|
0.3276884
|
0.1551220
|
1:3050000-3060000
|
1.0343169
|
0.1415395
|
0.2569926
|
-0.1154531
|
1:26720000-26730000
|
1.0715981
|
0.0747760
|
0.2570761
|
-0.1823002
|
1:78580000-78590000
|
1.2786687
|
0.0866956
|
0.2813214
|
-0.1946258
|
1:88150000-88160000
|
1.4525347
|
0.1008891
|
0.3346333
|
-0.2337441
|
1:88160000-88170000
|
1.4842377
|
0.0512082
|
0.3473913
|
-0.2961830
|
1:88170000-88180000
|
1.4849623
|
0.0765758
|
0.3477135
|
-0.2711376
|
1:88180000-88190000
|
1.4813643
|
0.0811231
|
0.3461137
|
-0.2649905
|
1:88190000-88200000
|
1.3369583
|
0.0909673
|
0.2958560
|
-0.2048888
|
1:88200000-88210000
|
1.0819718
|
0.1049515
|
0.2571674
|
-0.1522159
|
1:88230000-88240000
|
1.3201181
|
0.1060148
|
0.2911207
|
-0.1851059
|
2:3050000-3060000
|
1.1155423
|
0.2149259
|
0.2586587
|
-0.0437328
|
2:27640000-27650000
|
1.0036270
|
0.0761909
|
0.2583944
|
-0.1822035
|
2:30900000-30910000
|
1.0115787
|
0.1320264
|
0.2580312
|
-0.1260048
|
2:98490000-98500000
|
4.1068263
|
0.0616907
|
4.8801484
|
-4.8184577
|
3:3000000-3010000
|
1.2630592
|
0.1309260
|
0.2777825
|
-0.1468564
|
3:3010000-3020000
|
1.2107340
|
0.0687979
|
0.2684919
|
-0.1996940
|
3:3030000-3040000
|
1.1425050
|
0.1062178
|
0.2603649
|
-0.1541471
|
3:3040000-3050000
|
1.2058171
|
0.0653495
|
0.2676450
|
-0.2022955
|
3:3050000-3060000
|
1.1171903
|
0.1103150
|
0.2587630
|
-0.1484480
|
3:3060000-3070000
|
1.0537419
|
0.1088068
|
0.2569190
|
-0.1481121
|
3:3070000-3080000
|
1.0035525
|
0.1378395
|
0.2583978
|
-0.1205583
|
3:93670000-93680000
|
1.0083418
|
0.1395589
|
0.2581790
|
-0.1186201
|
3:93700000-93710000
|
1.0253920
|
0.0698928
|
0.2574002
|
-0.1875075
|
3:93720000-93730000
|
1.0394782
|
0.1199016
|
0.2567934
|
-0.1368918
|
4:3050000-3060000
|
1.4034462
|
0.1424276
|
0.3165090
|
-0.1740814
|
4:3060000-3070000
|
1.4334730
|
0.1210423
|
0.3271963
|
-0.2061540
|
4:3080000-3090000
|
1.7249524
|
0.1273644
|
0.4785845
|
-0.3512202
|
4:3220000-3230000
|
1.1399841
|
0.0854510
|
0.2602054
|
-0.1747544
|
4:62420000-62430000
|
1.0405516
|
0.1278412
|
0.2568029
|
-0.1289616
|
4:62430000-62440000
|
1.0173284
|
0.1128875
|
0.2577685
|
-0.1448810
|
4:118400000-118410000
|
1.3255264
|
0.1585187
|
0.2926415
|
-0.1341228
|
4:136920000-136930000
|
1.0032893
|
0.1949385
|
0.2584098
|
-0.0634712
|
4:145130000-145140000
|
1.0127545
|
0.1569242
|
0.2579775
|
-0.1010532
|
4:145160000-145170000
|
1.2448074
|
0.0850306
|
0.2743605
|
-0.1893299
|
4:145170000-145180000
|
1.0732868
|
0.0772720
|
0.2570910
|
-0.1798190
|
4:145270000-145280000
|
1.0339035
|
0.0921447
|
0.2570114
|
-0.1648668
|
4:145280000-145290000
|
1.2004059
|
0.1018341
|
0.2668633
|
-0.1650292
|
4:145300000-145310000
|
1.0560702
|
0.1105148
|
0.2569395
|
-0.1464247
|
4:145990000-146000000
|
1.1110493
|
0.0857075
|
0.2583744
|
-0.1726669
|
4:146480000-146490000
|
1.2904871
|
0.1057822
|
0.2840008
|
-0.1782185
|
4:146530000-146540000
|
1.0702147
|
0.1129153
|
0.2570640
|
-0.1441487
|
4:146540000-146550000
|
1.1086665
|
0.0729052
|
0.2582236
|
-0.1853184
|
4:146560000-146570000
|
1.3294246
|
0.0595061
|
0.2937376
|
-0.2342315
|
4:146570000-146580000
|
1.2238242
|
0.0707822
|
0.2707465
|
-0.1999643
|
4:146600000-146610000
|
1.1302364
|
0.1051576
|
0.2595886
|
-0.1544310
|
4:146610000-146620000
|
1.0120942
|
0.0889889
|
0.2580076
|
-0.1690187
|
4:147420000-147430000
|
1.2501074
|
0.0942106
|
0.2752734
|
-0.1810628
|
4:147480000-147490000
|
1.3505965
|
0.0741320
|
0.2996910
|
-0.2255590
|
4:147600000-147610000
|
1.3238458
|
0.0882373
|
0.2921689
|
-0.2039316
|
4:147610000-147620000
|
1.0823340
|
0.1111105
|
0.2571706
|
-0.1460602
|
4:156560000-156570000
|
1.1302299
|
0.0913560
|
0.2595881
|
-0.1682322
|
5:26270000-26280000
|
1.0965269
|
0.0733018
|
0.2574554
|
-0.1841536
|
5:125110000-125120000
|
1.0070011
|
0.0873849
|
0.2582403
|
-0.1708554
|
5:145570000-145580000
|
1.1296581
|
0.1235072
|
0.2595520
|
-0.1360448
|
5:145580000-145590000
|
1.0090356
|
0.1191148
|
0.2581473
|
-0.1390325
|
5:146190000-146200000
|
1.0873939
|
0.1071621
|
0.2572152
|
-0.1500531
|
6:29740000-29750000
|
1.1482865
|
0.1750732
|
0.2607308
|
-0.0856576
|
7:11740000-11750000
|
1.1490924
|
0.1031862
|
0.2608207
|
-0.1576344
|
7:63720000-63730000
|
1.0750784
|
0.1609714
|
0.2571068
|
-0.0961353
|
7:63730000-63740000
|
1.1856495
|
0.1580365
|
0.2651256
|
-0.1070890
|
7:141540000-141550000
|
1.0051323
|
0.1220476
|
0.2583256
|
-0.1362780
|
8:19750000-19760000
|
1.0472848
|
0.0959122
|
0.2568621
|
-0.1609499
|
9:3000000-3010000
|
2.6624678
|
0.0594039
|
1.5379283
|
-1.4785244
|
9:3010000-3020000
|
1.1116462
|
0.1478245
|
0.2584122
|
-0.1105877
|
9:3030000-3040000
|
1.4304085
|
0.1104869
|
0.3260007
|
-0.2155138
|
9:24450000-24460000
|
1.0222399
|
0.1161994
|
0.2575442
|
-0.1413448
|
9:123720000-123730000
|
1.1930203
|
0.2659023
|
0.2659935
|
-0.0000912
|
9:123730000-1237400001
|
1.2423154
|
0.6424760
|
0.2739313
|
0.3685447
|
9:124010000-1240200001
|
1.0831294
|
0.4153246
|
0.2571776
|
0.1581470
|
9:124020000-124030000
|
1.0297864
|
0.4002630
|
0.2571995
|
0.1430635
|
10:3060000-3070000
|
1.2823173
|
0.1470487
|
0.2821486
|
-0.1350999
|
10:57980000-57990000
|
1.1576015
|
0.0916038
|
0.2618227
|
-0.1702189
|
10:58010000-58020000
|
1.0479631
|
0.0986515
|
0.2568681
|
-0.1582166
|
10:74770000-74780000
|
1.0070956
|
0.1204115
|
0.2582359
|
-0.1378244
|
10:81080000-81090000
|
1.0032012
|
0.1783618
|
0.2584138
|
-0.0800520
|
10:81320000-81330000
|
1.0020301
|
0.1424046
|
0.2584673
|
-0.1160628
|
10:128270000-128280000
|
1.0988986
|
0.0804620
|
0.2576055
|
-0.1771435
|
11:3050000-3060000
|
1.2375892
|
0.1083057
|
0.2731173
|
-0.1648116
|
11:3130000-3140000
|
1.9673648
|
0.0550096
|
0.6684278
|
-0.6134182
|
11:74270000-74280000
|
1.0073982
|
0.2633508
|
0.2582221
|
0.0051287
|
11:108900000-108910000
|
1.2633352
|
0.0849424
|
0.2778451
|
-0.1929027
|
11:115680000-115690000
|
1.0020469
|
0.1339694
|
0.2584665
|
-0.1244971
|
11:119390000-119400000
|
1.0357773
|
0.1108260
|
0.2569258
|
-0.1460999
|
12:3150000-3160000
|
1.3901469
|
0.1352009
|
0.3120448
|
-0.1768440
|
12:67100000-67110000
|
1.2827302
|
0.1025963
|
0.2822422
|
-0.1796459
|
12:74850000-74860000
|
1.0276929
|
0.1382781
|
0.2572951
|
-0.1190170
|
12:113650000-113660000
|
1.1060277
|
0.1150256
|
0.2580566
|
-0.1430311
|
12:114790000-114800000
|
1.0454694
|
0.1022528
|
0.2568462
|
-0.1545934
|
12:115570000-115580000
|
1.2545311
|
0.1163261
|
0.2760353
|
-0.1597092
|
12:115580000-115590000
|
1.3490399
|
0.1097615
|
0.2992533
|
-0.1894918
|
12:115600000-115610000
|
1.0811865
|
0.0982887
|
0.2571605
|
-0.1588718
|
12:115620000-115630000
|
1.0485069
|
0.0604939
|
0.2568729
|
-0.1963790
|
12:115770000-115780000
|
1.0599135
|
0.1361010
|
0.2569733
|
-0.1208723
|
12:115780000-115790000
|
1.1290625
|
0.1052790
|
0.2595143
|
-0.1542353
|
13:48400000-48410000
|
1.3158310
|
0.1244950
|
0.2899152
|
-0.1654201
|
13:48410000-48420000
|
1.7616365
|
0.0874533
|
0.5034673
|
-0.4160140
|
13:48420000-48430000
|
1.5138950
|
0.1137102
|
0.3605778
|
-0.2468675
|
13:100420000-100430000
|
1.0947174
|
0.0621705
|
0.2573409
|
-0.1951704
|
13:100430000-100440000
|
1.0600517
|
0.0978623
|
0.2569745
|
-0.1591122
|
13:100470000-100480000
|
1.0546832
|
0.0931536
|
0.2569273
|
-0.1637736
|
14:3050000-3060000
|
2.1517725
|
0.0720648
|
0.8524559
|
-0.7803912
|
14:25870000-25880000
|
1.0723757
|
0.0708794
|
0.2570830
|
-0.1862036
|
14:25880000-25890000
|
1.1239930
|
0.1048677
|
0.2591935
|
-0.1543258
|
14:25890000-25900000
|
1.0830837
|
0.0954227
|
0.2571772
|
-0.1617545
|
14:25930000-25940000
|
1.0449621
|
0.1231236
|
0.2568417
|
-0.1337181
|
14:25940000-25950000
|
1.0128926
|
0.0740166
|
0.2579711
|
-0.1839545
|
14:25970000-25980000
|
1.0163697
|
0.0882185
|
0.2578123
|
-0.1695938
|
14:26000000-26010000
|
1.0477955
|
0.1490382
|
0.2568666
|
-0.1078285
|
14:43130000-43140000
|
1.0539837
|
0.1025335
|
0.2569211
|
-0.1543876
|
15:60010000-60020000
|
1.0650194
|
0.1832882
|
0.2570182
|
-0.0737301
|
15:74950000-74960000
|
1.1349056
|
0.1642137
|
0.2598840
|
-0.0956703
|
16:3050000-3060000
|
1.4782379
|
0.0680361
|
0.3447236
|
-0.2766875
|
16:3060000-3070000
|
1.0780704
|
0.0546030
|
0.2571331
|
-0.2025301
|
16:3080000-3090000
|
1.0239264
|
0.0640420
|
0.2574672
|
-0.1934252
|
16:3140000-3150000
|
1.0946425
|
0.1593219
|
0.2573362
|
-0.0980143
|
16:3150000-3160000
|
1.1745218
|
0.0687724
|
0.2638152
|
-0.1950427
|
16:3160000-3170000
|
1.1470615
|
0.0939146
|
0.2606533
|
-0.1667387
|
16:3460000-3470000
|
1.0054017
|
0.1492220
|
0.2583133
|
-0.1090913
|
16:3470000-3480000
|
1.0120201
|
0.1324063
|
0.2580110
|
-0.1256047
|
16:10790000-10800000
|
1.0769525
|
0.0875950
|
0.2571233
|
-0.1695282
|
16:57210000-57220000
|
1.0534616
|
0.2817003
|
0.2569165
|
0.0247838
|
17:3050000-3060000
|
1.0540755
|
0.1063578
|
0.2569219
|
-0.1505641
|
17:3060000-3070000
|
1.2727091
|
0.1077770
|
0.2799703
|
-0.1721932
|
17:3070000-3080000
|
1.3841327
|
0.1371210
|
0.3100260
|
-0.1729050
|
17:3080000-3090000
|
1.3832268
|
0.1030983
|
0.3097220
|
-0.2066237
|
17:13410000-13420000
|
1.0055431
|
0.1102182
|
0.2583068
|
-0.1480887
|
17:13430000-13440000
|
1.1671447
|
0.0545381
|
0.2629465
|
-0.2084084
|
17:13440000-13450000
|
1.0975126
|
0.0967866
|
0.2575178
|
-0.1607312
|
17:13450000-13460000
|
1.0375367
|
0.1370844
|
0.2568455
|
-0.1197610
|
17:13520000-13530000
|
1.6751708
|
0.1124897
|
0.4467500
|
-0.3342602
|
17:13770000-13780000
|
1.8153491
|
0.1364580
|
0.5424999
|
-0.4060419
|
17:13810000-13820000
|
1.5061378
|
0.1011461
|
0.3571287
|
-0.2559826
|
17:23730000-23740000
|
1.0819914
|
0.1153672
|
0.2571676
|
-0.1418004
|
17:27600000-27610000
|
1.0064847
|
0.2396170
|
0.2582638
|
-0.0186469
|
17:36370000-36380000
|
1.0427116
|
0.1522192
|
0.2568219
|
-0.1046027
|
17:36540000-36550000
|
1.2622268
|
0.0970298
|
0.2775937
|
-0.1805639
|
17:40150000-40160000
|
2.2715814
|
0.1048310
|
0.9900289
|
-0.8851979
|
17:56690000-56700000
|
1.0204657
|
0.2672525
|
0.2576252
|
0.0096272
|
17:56700000-56710000
|
1.0243210
|
0.0603993
|
0.2574491
|
-0.1970499
|
19:3310000-3320000
|
1.0113073
|
0.2189505
|
0.2580436
|
-0.0390931
|
19:6790000-6800000
|
1.1135937
|
0.2192099
|
0.2585354
|
-0.0393255
|
19:58100000-58110000
|
1.3328593
|
0.1465127
|
0.2947034
|
-0.1481907
|
plot(y$logMean,y$cv,pch=18,cex=0.5,xlab="log10(mean)",ylab="CV")
lines(predict(Rbs.9), col = "red", lwd = 1.0)
lines(predict(Rbs.median), col = "blue", lwd = 1.0)
points(yy$logMean,yy$cv)
#text(yy$logMean,yy$cv+0.02,labels=rownames(yy),cex=0.8)
plot(y$logMean,y$cv,pch=18,cex=0.5,xlab="log10(mean)",ylab="CV",xlim=c(0,4.5),ylim=c(0,1))
lines(predict(Rbs.9), col = "red", lwd = 1.0)
lines(predict(Rbs.median), col = "blue", lwd = 1.0)
points(yy$logMean,yy$cv)
#text(yy$logMean,yy$cv+0.02,labels=rownames(yy),cex=0.8)
my_palette <- colorRampPalette(c("blue", "white", "red"))(n = 25)
zz <- x[which(rownames(x) %in% rownames(yy)),]
heatmap.2(as.matrix(zz),margin=c(8, 22),cexRow=0.65,trace="none",
cexCol=0.8,col=my_palette,scale="row")
heatmap.2(cor(t(zz)),trace="none",scale="none",margins=c(12,12),
cexRow=0.8, cexCol=0.8)
for (i in 1:19){
mychr=as.character(i)
regex=paste("^",mychr,":",sep="")
chr <- x[grep(regex,rownames(x)),]
mymax = max(chr)
plot(chr[,1], xaxt = "n", pch=19, col="gray",
ylim=c(0,mymax),ylab="RPM of 10 kbp bins of chr",main=mychr)
axis(1, at=chr[,1], labels=rownames(chr), xlab="chr", las=1)
points( chr[,1], xaxt = "n", las=1, pch=19, col="gray" )
points( chr[,2], xaxt = "n", las=1, pch=19, col="lightblue" )
points( chr[,3], xaxt = "n", las=1, pch=19, col="lightgreen" )
points( chr[,4], xaxt = "n", las=1, pch=19, col="pink" )
points( chr[,5], xaxt = "n", las=1, pch=19, col="orange" )
points( chr[,6], xaxt = "n", las=1, pch=19, col="black" )
grid()
}
lapply(1:19,function(i){
mychr=as.character(i)
regex=paste("^",mychr,":",sep="")
chr <- x[grep(regex,rownames(x)),]
mymedian <- median(rowMeans(chr))
mymax <- max(rowMeans(chr))
rat <- mymax / mymedian
return(c(mymax,mymedian,rat))
})
## [[1]]
## [1] 30.546557 3.791809 8.055932
##
## [[2]]
## [1] 12788.697944 4.101051 3118.395398
##
## [[3]]
## [1] 18.325642 3.585453 5.111109
##
## [[4]]
## [1] 53.082624 3.958825 13.408682
##
## [[5]]
## [1] 13.479013 4.219938 3.194126
##
## [[6]]
## [1] 769.705787 3.851269 199.857688
##
## [[7]]
## [1] 15.333788 4.385763 3.496265
##
## [[8]]
## [1] 11.150256 4.122314 2.704854
##
## [[9]]
## [1] 459.692947 4.440531 103.522062
##
## [[10]]
## [1] 19.156552 3.866809 4.954098
##
## [[11]]
## [1] 146.644265 4.741329 30.928939
##
## [[12]]
## [1] 24.555393 3.885207 6.320227
##
## [[13]]
## [1] 57.761239 3.987906 14.484101
##
## [[14]]
## [1] 141.831439 3.738383 37.939250
##
## [[15]]
## [1] 13.642865 3.976973 3.430464
##
## [[16]]
## [1] 30.077236 3.725684 8.072944
##
## [[17]]
## [1] 186.887993 4.207523 44.417585
##
## [[18]]
## [1] 8.923642 3.933637 2.268548
##
## [[19]]
## [1] 21.520843 4.349001 4.948456
lapply(1:19,function(i){
mychr=as.character(i)
regex=paste("^",mychr,":",sep="")
chr <- x[grep(regex,rownames(x)),]
top <- head(chr[order(-rowMeans(chr)),])
return(top)
})
## [[1]]
## SRX5884275.bam SRX5884276.bam SRX5884277.bam SRX5884278.bam
## 1:88170000-88180000 34.97514 30.53884 30.20736 29.09741
## 1:88160000-88170000 32.38730 31.82019 30.79967 28.83288
## 1:88180000-88190000 31.99520 28.61681 32.97144 28.33029
## 1:88150000-88160000 28.07422 23.70497 26.65356 29.67935
## 1:88140000-88150000 27.99580 26.80157 28.13431 25.63217
## 1:88210000-88220000 23.91798 24.34565 24.77794 24.60053
## SRX5884279.bam SRX5884280.bam
## 1:88170000-88180000 30.24641 28.21418
## 1:88160000-88170000 30.63418 28.49959
## 1:88180000-88190000 32.49550 27.35797
## 1:88150000-88160000 31.56484 30.41587
## 1:88140000-88150000 28.19120 28.54036
## 1:88210000-88220000 22.21948 22.66920
##
## [[2]]
## SRX5884275.bam SRX5884276.bam SRX5884277.bam
## 2:98490000-98500000 13874.54573 13093.686747 11833.192168
## 2:3050000-3060000 13.17449 18.045677 9.476820
## 2:30900000-30910000 10.42981 11.852486 11.846025
## 2:27640000-27650000 10.27297 8.969449 10.957573
## 2:179830000-179840000 10.27297 10.250799 12.142176
## 2:31270000-31280000 11.60610 10.357578 8.687085
## SRX5884278.bam SRX5884279.bam SRX5884280.bam
## 2:98490000-98500000 13014.449745 11884.743972 13031.569308
## 2:3050000-3060000 12.776407 12.990444 11.823864
## 2:30900000-30910000 8.993744 9.733139 8.765968
## 2:27640000-27650000 10.316353 9.345364 10.641477
## 2:179830000-179840000 9.152457 8.957590 7.991301
## 2:31270000-31280000 9.893118 10.237245 7.909757
##
## [[3]]
## SRX5884275.bam SRX5884276.bam SRX5884277.bam SRX5884278.bam
## 3:3000000-3010000 20.70278 20.28804 18.26262 16.08293
## 3:3010000-3020000 15.76234 17.93890 14.80753 15.63324
## 3:3040000-3050000 17.33073 16.12365 15.39983 14.36354
## 3:3030000-3040000 13.72343 12.06604 15.89342 13.94030
## 3:3050000-3060000 12.78240 12.92028 14.80753 12.08865
## 3:3060000-3070000 10.97874 10.14402 11.54987 10.44861
## SRX5884279.bam SRX5884280.bam
## 3:3000000-3010000 19.77650 14.84099
## 3:3010000-3020000 16.24775 17.08344
## 3:3040000-3050000 16.44164 16.71650
## 3:3030000-3040000 15.16198 12.51699
## 3:3050000-3060000 14.77421 11.21228
## 3:3060000-3070000 13.61088 11.17151
##
## [[4]]
## SRX5884275.bam SRX5884276.bam SRX5884277.bam
## 4:3080000-3090000 51.60010 57.66074 62.38907
## 4:3060000-3070000 31.13258 24.34565 30.20736
## 4:3050000-3060000 26.11373 24.55920 32.08299
## 4:147480000-147490000 24.54534 19.86092 21.61900
## 4:146560000-146570000 19.84016 22.74396 22.70488
## 4:118400000-118410000 20.78120 23.81175 25.86382
## SRX5884278.bam SRX5884279.bam SRX5884280.bam
## 4:3080000-3090000 47.87846 55.21908 43.74830
## 4:3060000-3070000 23.11921 28.50142 25.48246
## 4:3050000-3060000 23.06631 24.19713 21.89453
## 4:147480000-147490000 23.01340 23.61546 21.85376
## 4:146560000-146570000 21.74370 21.05615 20.01902
## 4:118400000-118410000 19.01912 21.05615 16.43109
##
## [[5]]
## SRX5884275.bam SRX5884276.bam SRX5884277.bam
## 5:145570000-145580000 14.899725 15.162640 12.339610
## 5:26270000-26280000 12.782396 13.240615 11.253724
## 5:146190000-146200000 14.272368 13.347394 11.056290
## 5:145580000-145590000 11.527682 9.396565 11.056290
## 5:125110000-125120000 9.959290 10.464357 8.588368
## 5:35230000-35240000 9.410353 10.891474 11.155007
## SRX5884278.bam SRX5884279.bam SRX5884280.bam
## 5:145570000-145580000 14.363538 10.857685 13.250882
## 5:26270000-26280000 12.406076 11.633233 13.617829
## 5:146190000-146200000 11.824128 11.865898 11.008425
## 5:145580000-145590000 11.109919 9.771916 8.399020
## 5:125110000-125120000 10.025379 11.051572 10.886109
## 5:35230000-35240000 8.782126 9.694361 9.948354
##
## [[6]]
## SRX5884275.bam SRX5884276.bam SRX5884277.bam
## 6:103620000-103630000 802.154155 791.340296 780.159487
## 6:29740000-29750000 17.017055 13.347394 17.374171
## 6:88880000-88890000 9.567192 11.959265 9.575537
## 6:113870000-113880000 6.665667 9.823682 13.326779
## 6:115900000-115910000 10.665066 9.396565 9.970405
## 6:100430000-100440000 9.567192 10.037240 9.180670
## SRX5884278.bam SRX5884279.bam SRX5884280.bam
## 6:103620000-103630000 753.252488 733.785590 757.542708
## 6:29740000-29750000 12.115102 12.292450 12.272355
## 6:88880000-88890000 8.491152 8.375928 8.317476
## 6:113870000-113880000 8.015013 9.655584 8.765968
## 6:115900000-115910000 7.697587 8.957590 9.459091
## 6:100430000-100440000 9.522787 9.267809 8.235933
##
## [[7]]
## SRX5884275.bam SRX5884276.bam SRX5884277.bam
## 7:63730000-63740000 16.232859 14.842302 16.090851
## 7:11740000-11750000 13.880270 16.977885 13.820363
## 7:63720000-63730000 10.900325 10.571136 15.695984
## 7:141540000-141550000 9.018255 10.144019 12.438327
## 7:34730000-34740000 10.351388 9.396565 9.772971
## 7:144660000-144670000 9.096674 10.784694 12.142176
## SRX5884278.bam SRX5884279.bam SRX5884280.bam
## 7:63730000-63740000 11.559606 18.884616 14.392496
## 7:11740000-11750000 13.702233 13.106776 13.087794
## 7:63720000-63730000 11.824128 11.323014 11.008425
## 7:141540000-141550000 10.263449 9.267809 9.581407
## 7:34730000-34740000 9.655048 11.284236 9.092143
## 7:144660000-144670000 8.808578 9.733139 8.929056
##
## [[8]]
## SRX5884275.bam SRX5884276.bam SRX5884277.bam
## 8:19750000-19760000 9.488772 12.599940 11.84603
## 8:121030000-121040000 7.841961 9.503345 11.05629
## 8:123040000-123050000 8.704576 10.677915 13.32678
## 8:123020000-123030000 10.508227 7.474541 10.95757
## 8:71160000-71170000 9.724031 9.183007 10.56271
## 8:122610000-122620000 9.410353 7.688099 11.45116
## SRX5884278.bam SRX5884279.bam SRX5884280.bam
## 8:19750000-19760000 10.924753 11.400569 10.641477
## 8:121030000-121040000 10.104736 11.982230 8.317476
## 8:123040000-123050000 9.707953 8.802480 6.931230
## 8:123020000-123030000 9.522787 9.616806 9.826038
## 8:71160000-71170000 10.104736 9.267809 8.113617
## 8:122610000-122620000 10.157640 9.422919 8.480564
##
## [[9]]
## SRX5884275.bam SRX5884276.bam SRX5884277.bam
## 9:3000000-3010000 478.75170 468.97404 415.79549
## 9:35210000-35220000 304.11123 290.22574 268.41119
## 9:3020000-3030000 179.73774 165.61446 158.93417
## 9:3030000-3040000 29.01525 31.92697 25.76511
## 9:123730000-123740000 30.26997 22.31684 29.51635
## 9:123720000-123730000 18.97754 18.79313 20.03953
## SRX5884278.bam SRX5884279.bam SRX5884280.bam
## 9:3000000-3010000 472.012832 436.866694 485.756933
## 9:35210000-35220000 291.608914 271.829889 289.073078
## 9:3020000-3030000 170.457896 163.757150 173.892338
## 9:3030000-3040000 23.912777 25.011452 26.012500
## 9:123730000-123740000 7.988561 6.049281 8.684424
## 9:123720000-123730000 13.490616 11.594456 10.682249
##
## [[10]]
## SRX5884275.bam SRX5884276.bam SRX5884277.bam
## 10:3060000-3070000 17.252313 18.152456 22.90232
## 10:57980000-57990000 13.488172 15.269419 14.11651
## 10:128270000-128280000 14.507627 11.959265 12.14218
## 10:58010000-58020000 10.900325 12.172823 10.76014
## 10:74770000-74780000 11.998200 9.183007 10.26656
## 10:81080000-81090000 7.685121 10.677915 12.83319
## SRX5884278.bam SRX5884279.bam SRX5884280.bam
## 10:3060000-3070000 15.289364 19.81527 21.527586
## 10:57980000-57990000 13.649329 16.59675 13.128566
## 10:128270000-128280000 12.273815 12.71900 11.742320
## 10:58010000-58020000 10.131188 10.19847 12.843162
## 10:74770000-74780000 9.364074 11.20668 8.969828
## 10:81080000-81090000 8.808578 10.85768 9.581407
##
## [[11]]
## SRX5884275.bam SRX5884276.bam SRX5884277.bam
## 11:3140000-3150000 152.212456 150.34505 148.47018
## 11:3130000-3140000 94.809304 97.91648 98.42073
## 11:108900000-108910000 19.369643 20.28804 17.57160
## 11:3050000-3060000 15.605502 15.37620 20.53311
## 11:119390000-119400000 9.959290 13.02706 11.35244
## 11:74270000-74280000 9.645612 14.94908 11.45116
## SRX5884278.bam SRX5884279.bam SRX5884280.bam
## 11:3140000-3150000 144.137969 141.30501 143.394925
## 11:3130000-3140000 85.837348 90.73922 88.842065
## 11:108900000-108910000 17.855226 15.89875 19.040498
## 11:3050000-3060000 17.299731 17.91518 16.961128
## 11:119390000-119400000 9.840214 10.78013 10.192986
## 11:74270000-74280000 7.538873 8.80248 8.643652
##
## [[12]]
## SRX5884275.bam SRX5884276.bam SRX5884277.bam
## 12:3150000-3160000 28.07422 29.36427 21.42156
## 12:115580000-115590000 25.95689 22.42362 18.26262
## 12:115560000-115570000 19.76174 21.14227 21.52028
## 12:67100000-67110000 17.48757 21.99651 16.78187
## 12:115570000-115580000 18.89913 14.84230 15.79470
## 12:115780000-115790000 10.74349 14.62874 14.31395
## SRX5884278.bam SRX5884279.bam SRX5884280.bam
## 12:3150000-3160000 23.25147 22.10314 23.11769
## 12:115580000-115590000 22.64307 22.72358 22.01685
## 12:115560000-115570000 22.27274 21.28882 22.26148
## 12:67100000-67110000 19.28364 20.78471 18.71432
## 12:115570000-115580000 19.41591 19.66016 19.20359
## 12:115780000-115790000 13.17319 13.95988 13.94400
##
## [[13]]
## SRX5884275.bam SRX5884276.bam SRX5884277.bam
## 13:48410000-48420000 59.59890 63.85393 63.080085
## 13:48420000-48430000 35.75934 34.38289 34.156040
## 13:48400000-48410000 22.74169 24.45243 17.078020
## 13:100420000-100430000 12.54714 13.88129 12.240893
## 13:100430000-100440000 11.76294 11.53215 9.476820
## 13:100470000-100480000 11.84136 11.42537 9.279387
## SRX5884278.bam SRX5884279.bam SRX5884280.bam
## 13:48410000-48420000 52.95728 53.70676 53.37047
## 13:48420000-48430000 30.65809 34.97726 25.97173
## 13:48400000-48410000 19.65398 19.97038 20.26366
## 13:100420000-100430000 11.58606 12.17612 12.19081
## 13:100430000-100440000 11.34799 12.91289 11.86464
## 13:100470000-100480000 11.42734 12.25367 11.82386
##
## [[14]]
## SRX5884275.bam SRX5884276.bam SRX5884277.bam
## 14:3050000-3060000 156.76079 148.74336 145.70611
## 14:25880000-25890000 13.25291 15.48298 13.32678
## 14:25890000-25900000 13.01765 10.46436 11.94474
## 14:25870000-25880000 12.62556 11.10503 12.83319
## 14:25960000-25970000 11.76294 11.74571 11.54987
## 14:43130000-43140000 12.07662 10.03724 12.83319
## SRX5884278.bam SRX5884279.bam SRX5884280.bam
## 14:3050000-3060000 131.46737 131.76576 136.54524
## 14:25880000-25890000 11.08347 13.18433 13.49551
## 14:25890000-25900000 11.03056 13.14555 13.04702
## 14:25870000-25880000 11.42734 10.78013 12.10927
## 14:25960000-25970000 11.69187 11.32301 11.94618
## 14:43130000-43140000 11.53315 11.59446 9.86681
##
## [[15]]
## SRX5884275.bam SRX5884276.bam SRX5884277.bam
## 15:74950000-74960000 14.037110 16.337210 16.189568
## 15:60010000-60020000 9.645612 15.589756 10.760140
## 15:83720000-83730000 10.037710 9.396565 10.463989
## 15:84830000-84840000 9.096674 10.464357 9.970405
## 15:101380000-101390000 9.488772 10.571136 8.193501
## 15:85410000-85420000 11.214004 7.367761 13.622929
## SRX5884278.bam SRX5884279.bam SRX5884280.bam
## 15:74950000-74960000 12.141554 12.021008 11.130741
## 15:60010000-60020000 12.062197 11.439346 10.192986
## 15:83720000-83730000 9.681501 9.539251 10.233758
## 15:84830000-84840000 10.316353 9.500474 9.459091
## 15:101380000-101390000 8.861483 10.663797 9.785266
## 15:85410000-85420000 8.570509 7.949376 8.276705
##
## [[16]]
## SRX5884275.bam SRX5884276.bam SRX5884277.bam
## 16:3050000-3060000 33.01465 30.96595 28.82533
## 16:3150000-3160000 13.64501 15.69654 14.41266
## 16:3160000-3170000 12.78240 14.20163 12.14218
## 16:3140000-3150000 15.68392 10.99825 11.54987
## 16:3060000-3070000 12.46872 10.89147 11.84603
## 16:10790000-10800000 10.42981 11.42537 11.74731
## SRX5884278.bam SRX5884279.bam SRX5884280.bam
## 16:3050000-3060000 28.88579 31.33218 27.43952
## 16:3150000-3160000 14.07256 15.74364 16.10492
## 16:3160000-3170000 15.63324 14.58032 14.84099
## 16:3140000-3150000 10.34281 12.25367 13.78092
## 16:3060000-3070000 11.61251 12.60267 12.39467
## 16:10790000-10800000 12.06220 13.57211 12.39467
##
## [[17]]
## SRX5884275.bam SRX5884276.bam SRX5884277.bam
## 17:40150000-40160000 194.24537 219.96505 192.00433
## 17:13770000-13780000 64.77459 64.28105 81.83629
## 17:13520000-13530000 51.28642 42.81844 55.18273
## 17:13810000-13820000 32.46572 26.90835 36.82140
## 17:3070000-3080000 25.01585 25.09310 28.92405
## 17:3080000-3090000 24.15324 23.27786 29.02276
## SRX5884278.bam SRX5884279.bam SRX5884280.bam
## 17:40150000-40160000 170.45790 177.36803 167.28728
## 17:13770000-13780000 58.19481 66.27065 56.83609
## 17:13520000-13530000 41.31832 48.58814 44.80837
## 17:13810000-13820000 30.71099 32.30161 33.22913
## 17:3070000-3080000 21.66434 25.28289 19.32590
## 17:3080000-3090000 21.87596 23.18891 23.48464
##
## [[18]]
## SRX5884275.bam SRX5884276.bam SRX5884277.bam
## 18:82200000-82210000 10.037710 8.755890 8.390935
## 18:3110000-3120000 11.292423 7.581320 8.588368
## 18:35970000-35980000 9.959290 9.610124 8.687085
## 18:32130000-32140000 7.293023 8.542332 12.635760
## 18:82230000-82240000 9.096674 7.794878 10.069122
## 18:36100000-36110000 7.998800 8.649111 10.167838
## SRX5884278.bam SRX5884279.bam SRX5884280.bam
## 18:82200000-82210000 8.253082 10.276023 7.828213
## 18:3110000-3120000 9.073100 8.569815 8.317476
## 18:35970000-35980000 7.221447 8.763703 7.502038
## 18:32130000-32140000 7.750491 8.220818 7.175862
## 18:82230000-82240000 8.729222 8.802480 6.808915
## 18:36100000-36110000 8.094369 8.143263 7.909757
##
## [[19]]
## SRX5884275.bam SRX5884276.bam SRX5884277.bam
## 19:58100000-58110000 26.584247 18.793131 22.803599
## 19:6790000-6800000 17.409153 12.813498 14.708815
## 19:3310000-3320000 9.645612 13.027057 13.030628
## 19:6360000-6370000 10.429808 11.532148 11.648592
## 19:10260000-10270000 8.312478 11.959265 11.451158
## 19:5910000-5920000 10.586647 8.115216 9.378103
## SRX5884278.bam SRX5884279.bam SRX5884280.bam
## 19:58100000-58110000 21.690794 21.599037 17.654251
## 19:6790000-6800000 10.633779 12.912889 9.459091
## 19:3310000-3320000 9.311170 7.639157 8.929056
## 19:6360000-6370000 8.596961 9.461697 6.931230
## 19:10260000-10270000 9.020196 7.794266 7.461266
## 19:5910000-5920000 10.263449 7.290160 9.703723
1 kbp bins
x <- read.table("SRP199233.1e3_fmt.tsv",header=T,row.names=1)
x <- x[grep("X",rownames(x),invert=TRUE),]
x <- x[grep("Y",rownames(x),invert=TRUE),]
x <- x[grep("M",rownames(x),invert=TRUE),]
x <- x[grep("J",rownames(x),invert=TRUE),]
x <- x[grep("G",rownames(x),invert=TRUE),]
x <- x[which(rowSums(x)>=6),]
x <- sweep(x, 2, colSums(x), FUN="/")*1000000
mysd <- apply(x,1,sd)
mean <- apply(x,1,mean)
y <- data.frame(log10(mean),mysd/mean)
colnames(y) <- c("logMean","cv")
yy <- subset(y,cv > 0.2 & logMean > 0.3)
write.table(yy,file="SRP199233.1e3_regions.tsv")
yy %>% kbl() %>% kable_paper("hover", full_width = F)
|
logMean
|
cv
|
1:26726000-26727000
|
0.5263386
|
0.2023906
|
1:26727000-26728000
|
0.3671018
|
0.2957206
|
1:85224000-85225000
|
0.3457924
|
0.4819187
|
1:88139000-88140000
|
0.4465684
|
0.2062768
|
1:88141000-88142000
|
0.5864733
|
0.2283613
|
1:88143000-88144000
|
0.3150223
|
0.4205346
|
1:88144000-88145000
|
0.3806144
|
0.3521415
|
1:88146000-88147000
|
0.3868203
|
0.2343544
|
1:88147000-88148000
|
0.3611945
|
0.2528010
|
1:88149000-88150000
|
0.3166738
|
0.2715215
|
1:88154000-88155000
|
0.4101979
|
0.2164641
|
1:88155000-88156000
|
0.3187685
|
0.2919325
|
1:88156000-88157000
|
0.3821539
|
0.3988284
|
1:88157000-88158000
|
0.5125009
|
0.3070781
|
1:88161000-88162000
|
0.4901084
|
0.2371089
|
1:88162000-88163000
|
0.5284901
|
0.2444235
|
1:88164000-88165000
|
0.4797259
|
0.3430917
|
1:88165000-88166000
|
0.5144885
|
0.2832921
|
1:88166000-88167000
|
0.5273474
|
0.2128523
|
1:88168000-88169000
|
0.4643874
|
0.2836218
|
1:88171000-88172000
|
0.3746606
|
0.4463203
|
1:88173000-88174000
|
0.4881784
|
0.2382137
|
1:88175000-88176000
|
0.4979420
|
0.3061693
|
1:88176000-88177000
|
0.4816976
|
0.3121596
|
1:88178000-88179000
|
0.5083114
|
0.2932264
|
1:88179000-88180000
|
0.3888516
|
0.3207755
|
1:88180000-88181000
|
0.5493392
|
0.2829513
|
1:88182000-88183000
|
0.4594894
|
0.3004601
|
1:88183000-88184000
|
0.6493227
|
0.2496315
|
1:88184000-88185000
|
0.3650176
|
0.2215592
|
1:88186000-88187000
|
0.3217339
|
0.2194689
|
1:88187000-88188000
|
0.5073230
|
0.3062946
|
1:88191000-88192000
|
0.4610506
|
0.2182192
|
1:88197000-88198000
|
0.4436081
|
0.2179953
|
1:88199000-88200000
|
0.4422926
|
0.3054943
|
1:88200000-88201000
|
0.3811872
|
0.3030465
|
1:88211000-88212000
|
0.3734144
|
0.2246811
|
1:88212000-88213000
|
0.5500500
|
0.2357880
|
1:88214000-88215000
|
0.4133140
|
0.2687079
|
1:88216000-88217000
|
0.4161368
|
0.3710509
|
1:88217000-88218000
|
0.3025685
|
0.3373660
|
1:88218000-88219000
|
0.4377933
|
0.2491022
|
1:88222000-88223000
|
0.3898524
|
0.2760664
|
1:88224000-88225000
|
0.3457363
|
0.2405953
|
1:88225000-88226000
|
0.4657256
|
0.5093220
|
1:88226000-88227000
|
0.4814122
|
0.2303979
|
1:88227000-88228000
|
0.3707642
|
0.3283760
|
1:88228000-88229000
|
0.4515803
|
0.2562027
|
1:88229000-88230000
|
0.4393862
|
0.2498316
|
1:88230000-88231000
|
0.3396387
|
0.2004791
|
1:88234000-88235000
|
0.3232487
|
0.2699256
|
1:88235000-88236000
|
0.3349042
|
0.3154197
|
1:88236000-88237000
|
0.3265340
|
0.3414923
|
1:88237000-88238000
|
0.3394314
|
0.3917285
|
1:133522000-133523000
|
0.4596481
|
0.3549663
|
2:3050000-3051000
|
0.8747341
|
0.2372579
|
3:3000000-3001000
|
0.3197739
|
0.3365244
|
3:3002000-3003000
|
0.4804411
|
0.2249042
|
3:3007000-3008000
|
0.4753203
|
0.2509223
|
3:3019000-3020000
|
0.3239539
|
0.3475607
|
3:3021000-3022000
|
0.3267699
|
0.2115578
|
3:3039000-3040000
|
0.6524386
|
0.2332658
|
3:3044000-3045000
|
0.3573411
|
0.2501687
|
3:3055000-3056000
|
0.4374936
|
0.2001870
|
3:56483000-56484000
|
0.5450615
|
0.2118596
|
3:106078000-106079000
|
0.3172701
|
0.4095553
|
4:3051000-3052000
|
0.3859916
|
0.3680367
|
4:3053000-3054000
|
0.4868701
|
0.2494278
|
4:3054000-3055000
|
0.3169470
|
0.3200785
|
4:3059000-3060000
|
0.3471502
|
0.2369251
|
4:3064000-3065000
|
0.5486090
|
0.2573194
|
4:3065000-3066000
|
0.4001479
|
0.3665894
|
4:3068000-3069000
|
0.4730580
|
0.2500114
|
4:3080000-3081000
|
0.7406716
|
0.2510327
|
4:3081000-3082000
|
0.9518313
|
0.2232120
|
4:3084000-3085000
|
0.7804400
|
0.2619006
|
4:3090000-3091000
|
0.4998002
|
0.3046484
|
4:3225000-3226000
|
0.3839216
|
0.3117556
|
4:3226000-3227000
|
0.3917323
|
0.2350098
|
4:3229000-3230000
|
0.3589275
|
0.2414284
|
4:20191000-20192000
|
0.4259404
|
0.2513050
|
4:118404000-118405000
|
0.3636487
|
0.4587762
|
4:131237000-131238000
|
0.3424938
|
0.3838720
|
4:145166000-145167000
|
0.4837666
|
0.2453238
|
4:145167000-145168000
|
0.3111625
|
0.2255648
|
4:145284000-145285000
|
0.3210452
|
0.3635893
|
4:145285000-145286000
|
0.3596831
|
0.3167893
|
4:145294000-145295000
|
0.3125393
|
0.2147276
|
4:145306000-145307000
|
0.3554331
|
0.3098261
|
4:146481000-146482000
|
0.3137706
|
0.2446398
|
4:146483000-146484000
|
0.4123668
|
0.2821324
|
4:146485000-146486000
|
0.4713829
|
0.2255121
|
4:146486000-146487000
|
0.3932375
|
0.2984916
|
4:146503000-146504000
|
0.3215382
|
0.4401590
|
4:146528000-146529000
|
0.3230428
|
0.2165852
|
4:146529000-146530000
|
0.3467389
|
0.2819931
|
4:146541000-146542000
|
0.3382787
|
0.3559217
|
4:146542000-146543000
|
0.5049007
|
0.3543995
|
4:146566000-146567000
|
0.3829520
|
0.2767458
|
4:146569000-146570000
|
0.5100686
|
0.2758507
|
4:146826000-146827000
|
0.3001363
|
0.2129272
|
4:147009000-147010000
|
0.3088220
|
0.3534610
|
4:147180000-147181000
|
0.5018582
|
0.2544044
|
4:147420000-147421000
|
0.4937913
|
0.3263862
|
4:147421000-147422000
|
0.3646795
|
0.2693492
|
4:147422000-147423000
|
0.4442932
|
0.3582010
|
4:147483000-147484000
|
0.3750634
|
0.2899344
|
4:147559000-147560000
|
0.3503436
|
0.2541490
|
4:147583000-147584000
|
0.3420081
|
0.3366127
|
4:147604000-147605000
|
0.5590267
|
0.2379178
|
4:147608000-147609000
|
0.3806338
|
0.2148367
|
4:156498000-156499000
|
0.3114972
|
0.2128097
|
5:26212000-26213000
|
0.3332640
|
0.2571975
|
5:104479000-104480000
|
0.3218380
|
0.4189062
|
5:145575000-145576000
|
0.3082802
|
0.3086627
|
5:146197000-146198000
|
0.7366872
|
0.2692930
|
5:146198000-146199000
|
0.4841519
|
0.2277245
|
6:29748000-29749000
|
0.9397913
|
0.2309727
|
6:87434000-87435000
|
0.4453065
|
0.3032236
|
6:121287000-121288000
|
0.3022131
|
0.4511161
|
7:59419000-59420000
|
0.5072052
|
0.3639164
|
7:63723000-63724000
|
0.4473893
|
0.2580819
|
7:63730000-63731000
|
0.3595487
|
0.2802548
|
8:14356000-14357000
|
0.5415129
|
0.2566198
|
8:21054000-21055000
|
0.3490336
|
0.4098645
|
8:21437000-21438000
|
0.3576661
|
0.2796699
|
8:74345000-74346000
|
0.4264573
|
0.3379868
|
9:3018000-3019000
|
0.4656034
|
0.2907182
|
9:3020000-3021000
|
0.5754353
|
0.2333341
|
9:3035000-3036000
|
0.3699246
|
0.3584200
|
9:107407000-107408000
|
0.3798817
|
0.2911331
|
9:123702000-123703000
|
0.9543044
|
0.3462669
|
9:123721000-123722000
|
0.7789825
|
0.2437707
|
9:123728000-123729000
|
0.4354049
|
0.7081383
|
9:123729000-123730000
|
0.3715297
|
0.6523717
|
9:123730000-123731000
|
0.4867688
|
0.7712962
|
9:123731000-123732000
|
0.3895955
|
0.7626817
|
9:123732000-123733000
|
0.4288805
|
0.7677095
|
9:123733000-123734000
|
0.4103963
|
0.5353838
|
9:123736000-123737000
|
0.4552633
|
0.8303799
|
9:124019000-124020000
|
0.9713213
|
0.5302002
|
9:124020000-124021000
|
0.8995141
|
0.5999564
|
10:3066000-3067000
|
0.5597303
|
0.3146165
|
10:57980000-57981000
|
0.3878843
|
0.2438369
|
11:3051000-3052000
|
0.5503324
|
0.2920643
|
11:3052000-3053000
|
0.4386169
|
0.2319910
|
11:3053000-3054000
|
0.3528213
|
0.2622936
|
11:3077000-3078000
|
0.3937139
|
0.3467826
|
11:3122000-3123000
|
0.3626074
|
0.3103051
|
11:5118000-5119000
|
0.3312702
|
0.4058122
|
11:20329000-20330000
|
0.3019849
|
0.3114479
|
11:105957000-105958000
|
0.3676806
|
0.3710582
|
12:55585000-55586000
|
0.3434316
|
0.2108226
|
12:105402000-105403000
|
0.4496502
|
0.3427045
|
12:113623000-113624000
|
0.3379417
|
0.3444453
|
12:113632000-113633000
|
0.3735360
|
0.3263238
|
12:113677000-113678000
|
0.3157709
|
0.2263731
|
12:113682000-113683000
|
0.3395115
|
0.2878012
|
12:113741000-113742000
|
0.4781619
|
0.2788916
|
12:114790000-114791000
|
0.3016608
|
0.3799773
|
12:115028000-115029000
|
0.3795644
|
0.4898224
|
12:115568000-115569000
|
0.4890586
|
0.3286808
|
12:115570000-115571000
|
0.4073457
|
0.2953227
|
12:115578000-115579000
|
0.5897693
|
0.2165716
|
12:115579000-115580000
|
0.3465052
|
0.2957641
|
12:115584000-115585000
|
0.4112218
|
0.2291257
|
12:115588000-115589000
|
0.3860118
|
0.2200045
|
12:115772000-115773000
|
0.4721239
|
0.2758600
|
12:115784000-115785000
|
0.3394347
|
0.3233559
|
12:115786000-115787000
|
0.4847051
|
0.2301149
|
13:9061000-9062000
|
0.5178549
|
0.4653214
|
13:45023000-45024000
|
0.5140563
|
0.4126249
|
13:48412000-48413000
|
0.7355344
|
0.3063239
|
13:48414000-48415000
|
0.6968362
|
0.2539953
|
13:48416000-48417000
|
0.8947746
|
0.3452178
|
13:48417000-48418000
|
0.5316108
|
0.2017636
|
13:48421000-48422000
|
0.8619118
|
0.2488569
|
13:100419000-100420000
|
0.3433883
|
0.2179959
|
13:100421000-100422000
|
0.3327397
|
0.2030761
|
13:100477000-100478000
|
0.3916319
|
0.3803050
|
13:100478000-100479000
|
0.3083588
|
0.4029012
|
13:120059000-120060000
|
0.4373825
|
0.3749182
|
13:120060000-120061000
|
0.6550080
|
0.4618200
|
13:120061000-120062000
|
0.4097712
|
0.5563000
|
13:120487000-120488000
|
0.3913565
|
0.3263754
|
14:15469000-15470000
|
0.3492126
|
0.4882167
|
14:18316000-18317000
|
0.3674816
|
0.3484549
|
14:25880000-25881000
|
0.3462215
|
0.3922358
|
14:122806000-122807000
|
0.4566111
|
0.2621270
|
15:21656000-21657000
|
0.4816046
|
0.3851019
|
15:83622000-83623000
|
0.3208542
|
0.3873723
|
16:3056000-3057000
|
0.3219073
|
0.3032661
|
16:3058000-3059000
|
0.3879135
|
0.2133975
|
16:3065000-3066000
|
0.3444538
|
0.3237271
|
16:3144000-3145000
|
0.3712380
|
0.3509514
|
16:3156000-3157000
|
0.3258096
|
0.3227946
|
16:3161000-3162000
|
0.3877128
|
0.2162309
|
16:3162000-3163000
|
0.3985442
|
0.2649061
|
16:17040000-17041000
|
0.4336138
|
0.2020359
|
16:57211000-57212000
|
0.7929593
|
0.3626401
|
17:3057000-3058000
|
0.4135265
|
0.2716128
|
17:3063000-3064000
|
0.4103832
|
0.2822227
|
17:3072000-3073000
|
0.6897618
|
0.3217266
|
17:3074000-3075000
|
0.3894668
|
0.3359431
|
17:3075000-3076000
|
0.3651646
|
0.2033785
|
17:3077000-3078000
|
0.4792289
|
0.3356187
|
17:3080000-3081000
|
0.9696840
|
0.2433070
|
17:3086000-3087000
|
0.3087418
|
0.2839404
|
17:13425000-13426000
|
0.3619291
|
0.2315976
|
17:13447000-13448000
|
0.3036552
|
0.2542737
|
17:13761000-13762000
|
0.4506390
|
0.2221712
|
17:13772000-13773000
|
1.1051892
|
0.2021514
|
17:13807000-13808000
|
0.3394806
|
0.2869085
|
18:73666000-73667000
|
0.5473445
|
0.3569516
|
18:82231000-82232000
|
0.3649288
|
0.2729084
|
19:6790000-6791000
|
0.8681514
|
0.3552265
|
plot(y$logMean,y$cv,pch=18,cex=0.5,xlab="log10(mean)",ylab="CV")
points(yy$logMean,yy$cv)
#text(yy$logMean,yy$cv+0.02,labels=rownames(yy),cex=0.8)
plot(y$logMean,y$cv,pch=18,cex=0.5,xlab="log10(mean)",ylab="CV",xlim=c(0,4.5),ylim=c(0,1))
points(yy$logMean,yy$cv)
text(yy$logMean,yy$cv+0.02,labels=rownames(yy),cex=0.8)
my_palette <- colorRampPalette(c("blue", "white", "red"))(n = 25)
zz <- x[which(rownames(x) %in% rownames(yy)),]
heatmap.2(as.matrix(zz),margin=c(8, 22),cexRow=0.65,trace="none",
cexCol=0.8,col=my_palette,scale="row")
heatmap.2(cor(t(zz)),trace="none",scale="none",margins=c(12,12),
cexRow=0.8, cexCol=0.8)
for (i in 1:19){
mychr=as.character(i)
regex=paste("^",mychr,":",sep="")
chr <- x[grep(regex,rownames(x)),]
mymax = max(chr)
plot(chr[,1], xaxt = "n", pch=19, col="gray",
ylim=c(0,mymax),ylab="RPM of 1 kbp bins of chr",main=mychr)
axis(1, at=chr[,1], labels=rownames(chr), xlab="chr", las=1)
points( chr[,1], xaxt = "n", las=1, pch=19, col="gray" )
points( chr[,2], xaxt = "n", las=1, pch=19, col="lightblue" )
points( chr[,3], xaxt = "n", las=1, pch=19, col="lightgreen" )
points( chr[,4], xaxt = "n", las=1, pch=19, col="pink" )
points( chr[,5], xaxt = "n", las=1, pch=19, col="orange" )
points( chr[,6], xaxt = "n", las=1, pch=19, col="black" )
grid()
}
lapply(1:19,function(i){
mychr=as.character(i)
regex=paste("^",mychr,":",sep="")
chr <- x[grep(regex,rownames(x)),]
mymedian <- median(rowMeans(chr))
mymax <- max(rowMeans(chr))
rat <- mymax / mymedian
return(c(mymax,mymedian,rat))
})
## [[1]]
## [1] 17.0669535 0.3801317 44.8974730
##
## [[2]]
## [1] 1.149764e+04 4.115003e-01 2.794078e+04
##
## [[3]]
## [1] 8.8609429 0.3584881 24.7175388
##
## [[4]]
## [1] 15.9841737 0.4034289 39.6207934
##
## [[5]]
## [1] 5.4536493 0.4195186 12.9997792
##
## [[6]]
## [1] 844.3785571 0.3884418 2173.7582043
##
## [[7]]
## [1] 7.6563507 0.4386527 17.4542427
##
## [[8]]
## [1] 3.4794687 0.4109625 8.4666325
##
## [[9]]
## [1] 309.1596439 0.4363281 708.5485891
##
## [[10]]
## [1] 6.8785538 0.3840956 17.9084435
##
## [[11]]
## [1] 27.0898822 0.4665522 58.0639915
##
## [[12]]
## [1] 23.2154726 0.3920841 59.2104479
##
## [[13]]
## [1] 8.9645277 0.3945575 22.7204568
##
## [[14]]
## [1] 43.1080695 0.3750425 114.9418139
##
## [[15]]
## [1] 9.2323142 0.4004437 23.0552097
##
## [[16]]
## [1] 6.2081080 0.3781252 16.4181284
##
## [[17]]
## [1] 40.1686635 0.4182026 96.0507245
##
## [[18]]
## [1] 3.5587554 0.3926506 9.0634152
##
## [[19]]
## [1] 9.0138576 0.4310443 20.9116717
lapply(1:19,function(i){
mychr=as.character(i)
regex=paste("^",mychr,":",sep="")
chr <- x[grep(regex,rownames(x)),]
top <- head(chr[order(-rowMeans(chr)),])
return(top)
})
## [[1]]
## SRX5884275.bam SRX5884276.bam SRX5884277.bam SRX5884278.bam
## 1:78585000-78586000 19.943879 18.924874 17.606571 15.315479
## 1:88183000-88184000 5.957263 3.996557 5.434127 3.668727
## 1:26725000-26726000 5.093891 3.643920 4.999397 3.610493
## 1:88151000-88152000 3.971508 3.408828 3.477841 4.658701
## 1:88141000-88142000 3.194474 5.524653 3.803889 3.057272
## 1:88177000-88178000 4.575868 4.114103 3.586524 2.649636
## SRX5884279.bam SRX5884280.bam
## 1:78585000-78586000 14.811623 15.799294
## 1:88183000-88184000 4.695327 3.007252
## 1:26725000-26726000 4.396534 3.545864
## 1:88151000-88152000 4.695327 4.892395
## 1:88141000-88142000 3.713577 3.860055
## 1:88177000-88178000 4.140425 3.545864
##
## [[2]]
## SRX5884275.bam SRX5884276.bam SRX5884277.bam SRX5884278.bam
## 2:98497000-98498000 12560.7587 11800.07057 10518.94826 11780.6027
## 2:98496000-98497000 639.4129 648.50020 622.85963 613.6674
## 2:98495000-98496000 515.7781 504.50659 494.72292 605.2235
## 2:98492000-98493000 428.3185 387.19588 360.82603 367.3968
## 2:98493000-98494000 209.7129 206.41043 189.97708 176.4483
## 2:98494000-98495000 12.0872 12.10722 11.52035 10.8606
## SRX5884279.bam SRX5884280.bam
## 2:98497000-98498000 10585.273823 11740.17685
## 2:98496000-98497000 592.891778 622.72557
## 2:98495000-98496000 588.196451 600.41804
## 2:98492000-98493000 346.472467 382.23518
## 2:98493000-98494000 182.989709 186.58427
## 2:98494000-98495000 8.921122 10.45806
##
## [[3]]
## SRX5884275.bam SRX5884276.bam SRX5884277.bam SRX5884278.bam
## 3:5925000-5926000 8.633714 11.049306 6.520952 8.880649
## 3:3041000-3042000 7.856680 6.700111 6.955683 7.861558
## 3:3005000-3006000 7.511331 7.052748 6.194905 5.910727
## 3:3010000-3011000 5.525577 6.229928 4.564667 5.124571
## 3:3039000-3040000 3.108137 5.054470 6.194905 4.454883
## 3:56483000-56484000 2.935463 4.701832 2.934429 2.853454
## SRX5884279.bam SRX5884280.bam
## 3:5925000-5926000 7.982056 10.098980
## 3:3041000-3042000 7.171045 7.361035
## 3:3005000-3006000 7.085676 6.149157
## 3:3010000-3011000 6.231980 6.328694
## 3:3039000-3040000 4.055055 4.084476
## 3:56483000-56484000 3.628207 3.994708
##
## [[4]]
## SRX5884275.bam SRX5884276.bam SRX5884277.bam
## 4:118405000-118406000 15.540685 18.337145 20.432317
## 4:3083000-3084000 12.432548 15.751138 16.519746
## 4:3081000-3082000 8.979062 11.049306 11.302984
## 4:3050000-3051000 9.497085 8.580844 11.846397
## 4:156423000-156424000 6.647960 7.052748 7.390413
## 4:3082000-3083000 7.079645 6.817657 7.716460
## SRX5884278.bam SRX5884279.bam SRX5884280.bam
## 4:118405000-118406000 15.082544 14.214036 12.298314
## 4:3083000-3084000 12.694960 15.281156 10.009212
## 4:3081000-3082000 7.250103 8.835752 6.283810
## 4:3050000-3051000 7.832441 7.768632 7.136613
## 4:156423000-156424000 7.162753 7.000306 7.271266
## 4:3082000-3083000 7.715973 6.402719 6.014504
##
## [[5]]
## SRX5884275.bam SRX5884276.bam SRX5884277.bam
## 5:146197000-146198000 6.388948 7.875569 5.325444
## 5:115060000-115061000 3.798834 3.761466 4.564667
## 5:146198000-146199000 4.230520 2.938645 2.173651
## 5:26273000-26274000 3.021800 2.468462 3.151794
## 5:26215000-26216000 2.417440 1.998279 2.173651
## 5:26212000-26213000 2.503777 2.115824 1.195508
## SRX5884278.bam SRX5884279.bam SRX5884280.bam
## 5:146197000-146198000 4.891636 3.841631 4.398667
## 5:115060000-115061000 2.911688 4.097740 3.994708
## 5:146198000-146199000 3.115506 2.603772 3.231674
## 5:26273000-26274000 3.115506 2.603772 3.860055
## 5:26215000-26216000 2.358467 1.622022 2.648177
## 5:26212000-26213000 2.620519 2.603772 1.885143
##
## [[6]]
## SRX5884275.bam SRX5884276.bam SRX5884277.bam
## 6:103626000-103627000 880.207133 868.0757587 855.874998
## 6:29748000-29749000 12.173537 7.5229314 10.107476
## 6:87434000-87435000 1.381394 3.0561909 3.912571
## 6:121287000-121288000 1.467731 0.7052748 1.847603
## 6:115999000-116000000 2.158428 0.9403664 2.608381
## 6:47630000-47631000 1.381394 2.9386451 1.738921
## SRX5884278.bam SRX5884279.bam SRX5884280.bam
## 6:103626000-103627000 826.657366 804.7364071 830.719680
## 6:29748000-29749000 7.483038 7.8540020 7.091728
## 6:87434000-87435000 2.387584 3.0733051 2.917483
## 6:121287000-121288000 3.377558 2.3903484 2.244218
## 6:115999000-116000000 1.688779 1.4939678 1.840259
## 6:47630000-47631000 1.252026 0.9817502 1.346531
##
## [[7]]
## SRX5884275.bam SRX5884276.bam SRX5884277.bam SRX5884278.bam
## 7:11744000-11745000 8.115691 9.521210 7.716460 7.395688
## 7:59419000-59420000 3.971508 1.645641 4.999397 2.562286
## 7:63723000-63724000 1.640406 2.703553 3.912571 2.824337
## 7:63730000-63731000 1.726743 2.938645 2.934429 1.368493
## 7:63728000-63729000 1.985754 1.645641 2.717063 2.474935
## 7:38099000-38100000 1.554069 1.645641 2.391016 2.649636
## SRX5884279.bam SRX5884280.bam
## 7:11744000-11745000 6.231980 6.957075
## 7:59419000-59420000 3.329414 2.782830
## 7:63723000-63724000 2.945251 2.782830
## 7:63730000-63731000 2.518403 2.244218
## 7:63728000-63729000 1.963500 1.885143
## 7:38099000-38100000 2.091555 1.436299
##
## [[8]]
## SRX5884275.bam SRX5884276.bam SRX5884277.bam SRX5884278.bam
## 8:14356000-14357000 3.798834 4.936924 3.803889 2.795221
## 8:74345000-74346000 3.194474 1.763187 4.021254 2.125532
## 8:21437000-21438000 2.072091 1.175458 2.825746 2.591402
## 8:21054000-21055000 1.208720 3.291282 3.369159 1.455844
## 8:75704000-75705000 1.899417 2.350916 2.282333 1.601428
## 8:94653000-94654000 1.036046 3.761466 2.173651 1.455844
## SRX5884279.bam SRX5884280.bam
## 8:14356000-14357000 3.073305 2.468640
## 8:74345000-74346000 3.073305 1.840259
## 8:21437000-21438000 2.134240 2.872599
## 8:21054000-21055000 1.878131 2.199333
## 8:75704000-75705000 1.707392 1.974912
## 8:94653000-94654000 1.323229 1.795374
##
## [[9]]
## SRX5884275.bam SRX5884276.bam SRX5884277.bam SRX5884278.bam
## 9:35216000-35217000 329.98055 311.96656 288.33478 316.09286
## 9:3000000-3001000 196.76234 188.77856 172.15314 200.26591
## 9:3001000-3002000 120.87199 127.41965 107.48703 121.09711
## 9:3002000-3003000 123.54845 114.95980 101.83554 104.47137
## 9:3024000-3025000 92.29440 91.09800 84.55502 91.42701
## 9:3006000-3007000 64.75285 69.82221 58.03648 73.54924
## SRX5884279.bam SRX5884280.bam
## 9:35216000-35217000 294.48239 314.10073
## 9:3000000-3001000 176.33088 215.93864
## 9:3001000-3002000 118.19419 127.96530
## 9:3002000-3003000 100.73611 105.34359
## 9:3024000-3025000 84.55858 94.66111
## 9:3006000-3007000 67.10049 65.39651
##
## [[10]]
## SRX5884275.bam SRX5884276.bam SRX5884277.bam
## 10:128277000-128278000 7.943017 5.877290 6.412270
## 10:3062000-3063000 4.575868 7.287840 6.194905
## 10:57982000-57983000 4.403194 4.701832 3.586524
## 10:57981000-57982000 4.575868 4.114103 5.108079
## 10:3063000-3064000 4.144183 3.996557 3.695206
## 10:3066000-3067000 3.367148 2.350916 5.108079
## SRX5884278.bam SRX5884279.bam SRX5884280.bam
## 10:128277000-128278000 7.686857 7.427154 5.924735
## 10:3062000-3063000 5.270155 7.469839 6.957075
## 10:57982000-57983000 4.542233 5.079490 4.174245
## 10:57981000-57982000 3.581376 4.609958 3.994708
## 10:3063000-3064000 3.028156 3.286729 4.398667
## 10:3066000-3067000 2.329350 4.396534 4.219130
##
## [[11]]
## SRX5884275.bam SRX5884276.bam SRX5884277.bam SRX5884278.bam
## 11:3143000-3144000 25.64213 29.38645 27.49668 26.20519
## 11:3135000-3136000 17.09475 19.15997 18.47603 16.30545
## 11:3146000-3147000 15.88603 17.63187 17.28052 17.79041
## 11:3139000-3140000 19.25318 14.92832 16.95448 15.92693
## 11:3134000-3135000 15.62702 14.45813 18.25867 14.23815
## 11:3144000-3145000 17.52644 17.51432 12.82454 14.70402
## SRX5884279.bam SRX5884280.bam
## 11:3143000-3144000 27.14753 26.66131
## 11:3135000-3136000 18.31178 16.96629
## 11:3146000-3147000 15.83606 17.41513
## 11:3139000-3140000 14.59820 14.85672
## 11:3134000-3135000 17.92761 14.22834
## 11:3144000-3145000 17.24466 14.72207
##
## [[12]]
## SRX5884275.bam SRX5884276.bam SRX5884277.bam
## 12:3159000-3160000 27.368873 27.153081 20.323635
## 12:67106000-67107000 14.936325 19.982787 15.758968
## 12:74851000-74852000 7.079645 6.582565 8.368556
## 12:3160000-3161000 6.043600 6.465019 4.782032
## 12:115580000-115581000 4.662206 4.936924 4.564667
## 12:115581000-115582000 5.352903 4.936924 4.021254
## SRX5884278.bam SRX5884279.bam SRX5884280.bam
## 12:3159000-3160000 22.157946 20.744810 21.544491
## 12:67106000-67107000 16.305453 18.397146 17.011171
## 12:74851000-74852000 6.667766 5.762447 7.450803
## 12:3160000-3161000 4.309298 4.866066 4.488436
## 12:115580000-115581000 4.775168 4.396534 4.578204
## 12:115581000-115582000 4.251065 4.012371 3.949823
##
## [[13]]
## SRX5884275.bam SRX5884276.bam SRX5884277.bam
## 13:48422000-48423000 9.151737 9.403664 9.564063
## 13:48416000-48417000 7.079645 12.342309 9.672746
## 13:48411000-48412000 7.079645 8.345752 6.629635
## 13:48415000-48416000 8.720051 7.875569 9.455381
## 13:48421000-48422000 10.792142 7.052748 5.868857
## 13:48407000-48408000 6.302611 8.110660 6.955683
## SRX5884278.bam SRX5884279.bam SRX5884280.bam
## 13:48422000-48423000 9.288285 9.646763 6.732654
## 13:48416000-48417000 5.619558 7.213730 5.161701
## 13:48411000-48412000 7.453922 7.256415 9.201293
## 13:48415000-48416000 6.842467 7.085676 5.475892
## 13:48421000-48422000 6.231013 7.384469 6.328694
## 13:48407000-48408000 7.715973 7.854002 6.642885
##
## [[14]]
## SRX5884275.bam SRX5884276.bam SRX5884277.bam
## 14:3052000-3053000 45.845021 46.900776 43.690381
## 14:3051000-3052000 48.521472 43.727039 41.951460
## 14:3050000-3051000 35.398227 32.560188 36.734698
## 14:3053000-3054000 35.657238 33.030371 30.539794
## 14:122806000-122807000 2.762788 1.880733 3.912571
## 14:18316000-18317000 1.985754 1.293004 1.738921
## SRX5884278.bam SRX5884279.bam SRX5884280.bam
## 14:3052000-3053000 38.521633 42.172576 41.518030
## 14:3051000-3052000 37.560776 36.367444 39.184044
## 14:3050000-3051000 31.242413 28.470757 30.117404
## 14:3053000-3054000 29.320699 30.391573 31.239512
## 14:122806000-122807000 2.824337 3.500153 2.289102
## 14:18316000-18317000 3.464909 2.987936 2.513524
##
## [[15]]
## SRX5884275.bam SRX5884276.bam SRX5884277.bam
## 15:74958000-74959000 9.410748 10.461577 11.411667
## 15:60013000-60014000 7.770343 10.931760 8.694603
## 15:21656000-21657000 4.403194 4.231649 1.304190
## 15:78637000-78638000 1.726743 1.645641 2.064968
## 15:83622000-83623000 1.122383 2.938645 3.043111
## 15:91670000-91671000 1.295057 1.410550 1.521556
## SRX5884278.bam SRX5884279.bam SRX5884280.bam
## 15:74958000-74959000 7.715973 8.494274 7.899647
## 15:60013000-60014000 10.190908 8.921122 8.303606
## 15:21656000-21657000 2.416701 2.689142 3.141905
## 15:78637000-78638000 2.736987 2.433033 2.109565
## 15:83622000-83623000 1.979948 2.219609 1.256762
## 15:91670000-91671000 1.193792 2.091555 2.109565
##
## [[16]]
## SRX5884275.bam SRX5884276.bam SRX5884277.bam
## 16:57211000-57212000 4.834880 10.226485 6.738317
## 16:91331000-91332000 4.921217 5.407107 4.673349
## 16:3050000-3051000 4.144183 4.819378 4.347302
## 16:3054000-3055000 4.403194 3.879012 3.912571
## 16:3052000-3053000 4.403194 3.643920 3.695206
## 16:3051000-3052000 3.626160 4.349195 2.825746
## SRX5884278.bam SRX5884279.bam SRX5884280.bam
## 16:57211000-57212000 6.347480 5.420969 3.680517
## 16:91331000-91332000 4.280181 4.140425 5.475892
## 16:3050000-3051000 3.756078 4.695327 3.366327
## 16:3054000-3055000 3.377558 4.609958 3.949823
## 16:3052000-3053000 3.814311 3.030620 3.456095
## 16:3051000-3052000 2.853454 4.055055 3.725402
##
## [[17]]
## SRX5884275.bam SRX5884276.bam SRX5884277.bam
## 17:40154000-40155000 40.66479 45.25513 43.58170
## 17:40155000-40156000 39.36974 46.19550 39.23440
## 17:40156000-40157000 36.26160 43.49195 35.64787
## 17:13525000-13526000 32.37643 28.21099 33.58290
## 17:40158000-40159000 27.19620 29.38645 32.49608
## 17:13773000-13774000 26.85085 32.91282 34.77841
## SRX5884278.bam SRX5884279.bam SRX5884280.bam
## 17:40154000-40155000 36.10493 38.33094 37.07448
## 17:40155000-40156000 35.31878 33.12340 31.59859
## 17:40156000-40157000 29.32070 29.87936 30.20717
## 17:13525000-13526000 23.17704 29.62325 27.06527
## 17:40158000-40159000 27.10782 29.58056 26.66131
## 17:13773000-13774000 23.90496 27.23290 22.53195
##
## [[18]]
## SRX5884275.bam SRX5884276.bam SRX5884277.bam
## 18:82205000-82206000 3.971508 3.0561909 3.369159
## 18:73666000-73667000 3.885171 3.6439199 5.760175
## 18:82231000-82232000 2.935463 1.4105496 1.956286
## 18:82211000-82212000 2.244766 1.6456412 2.173651
## 18:3118000-3119000 1.295057 1.0579122 2.064968
## 18:3115000-3116000 2.072091 0.7052748 1.521556
## SRX5884278.bam SRX5884279.bam SRX5884280.bam
## 18:82205000-82206000 3.581376 4.097740 3.276558
## 18:73666000-73667000 2.940805 2.774512 2.154449
## 18:82231000-82232000 2.329350 3.115990 2.154449
## 18:82211000-82212000 1.921714 1.152489 2.603293
## 18:3118000-3119000 1.921714 1.835446 1.885143
## 18:3115000-3116000 2.154649 1.323229 1.885143
##
## [[19]]
## SRX5884275.bam SRX5884276.bam SRX5884277.bam
## 19:58101000-58102000 11.828188 8.345752 9.129333
## 19:6790000-6791000 11.828188 7.522931 8.585921
## 19:10650000-10651000 2.849126 2.115824 2.391016
## 19:6739000-6740000 1.726743 2.586008 1.738921
## 19:3311000-3312000 2.072091 2.233370 1.738921
## 19:8570000-8571000 2.676451 1.410550 1.956286
## SRX5884278.bam SRX5884279.bam SRX5884280.bam
## 19:58101000-58102000 7.6286228 9.4760241 7.675225
## 19:6790000-6791000 5.0663373 6.5734582 4.712857
## 19:10650000-10651000 1.6596622 0.8110111 1.570952
## 19:6739000-6740000 1.6887791 1.1098046 1.705606
## 19:3311000-3312000 1.4849609 0.8110111 1.122109
## 19:8570000-8571000 0.8735064 1.1098046 1.346531