Skip to content

Commit 2699fa7

Browse files
UniverseUniverse
authored andcommitted
add license
1 parent 3edba9e commit 2699fa7

File tree

3 files changed

+106
-0
lines changed

3 files changed

+106
-0
lines changed

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2018 BioLin
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

bin/plot_ISnum_vs_CTnum.R

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
setwd('/gpfs/group/yzz2/default/legacy/group/projects/vision/snapshot18_reproduce_0_16lim_all_NB88')
2+
3+
d=read.table('atac_20cell.index.matrix.txt', header=F, sep='\t')
4+
dis = d[,-c(1:4)]
5+
set.seed(2019)
6+
#dis = dis[sample(dim(dis)[1], 100000),]
7+
8+
9+
10+
IS_count_vec = c(2)
11+
IS_min_vec = c(min(table(dis[,1])))
12+
for (i in c(2:dim(dis)[2])){
13+
IS_mat = dis[,1:i]
14+
IS_table = apply(IS_mat, 1, function(x) paste(x, collapse='_'))
15+
IS_count = length(unique(IS_table))
16+
IS_min = median(table(IS_table))
17+
print(IS_count)
18+
IS_count_vec = c(IS_count_vec, IS_count)
19+
IS_min_vec = c(IS_min_vec, IS_min)
20+
}
21+
22+
### get background
23+
num_ccREs = dim(dis)[1]
24+
set.seed(2019)
25+
IS_count_mat_shuf = c()
26+
27+
for (j in c(1:5)){
28+
print(j)
29+
dis_shuffle = c()
30+
for (i in c(1:dim(dis)[2])){
31+
dis_shuffle = cbind(dis_shuffle, dis[sample(num_ccREs),i])
32+
}
33+
IS_count_vec_shuf = c(2)
34+
IS_min_vec_shuf = c(min(table(dis[,1])))
35+
for (i in c(2:dim(dis)[2])){
36+
IS_mat = dis_shuffle[,1:i]
37+
IS_table = apply(IS_mat, 1, function(x) paste(x, collapse='_'))
38+
IS_count = length(unique(IS_table))
39+
IS_min = median(table(IS_table))
40+
print(IS_count)
41+
IS_count_vec_shuf = c(IS_count_vec_shuf, IS_count)
42+
IS_min_vec_shuf = c(IS_min_vec_shuf, IS_min)
43+
}
44+
IS_count_mat_shuf = cbind(IS_count_mat_shuf, IS_count_vec_shuf)
45+
IS_min_mat_shuf = cbind(IS_min_mat_shuf, IS_min_vec_shuf)
46+
}
47+
48+
49+
50+
51+
pdf('IS_n_vs_CT_n.pdf', width=4.5, height=4.5)
52+
par(mfrow=c(1,1))
53+
plot(1:length(IS_count_vec), IS_count_vec, log='', ylim=c(1, max(cbind(IS_count_vec, IS_count_mat_shuf))), xlab='', ylab='')
54+
lines(1:length(IS_count_vec), IS_count_vec, lwd=1.5)
55+
points(1:length(IS_count_vec), rowMeans(IS_count_mat_shuf), col='gray')
56+
lines(1:length(IS_count_vec), rowMeans(IS_count_mat_shuf), lwd=1.5, col='gray')
57+
CI_h = rowMeans(IS_count_mat_shuf) + apply(IS_count_mat_shuf, 1, sd)/sqrt(dim(IS_count_mat_shuf)[2]) * 1.960
58+
CI_l = rowMeans(IS_count_mat_shuf) - apply(IS_count_mat_shuf, 1, sd)/sqrt(dim(IS_count_mat_shuf)[2]) * 1.960
59+
#lines(1:length(IS_count_vec), CI_h, lwd=1, col='gray')
60+
#lines(1:length(IS_count_vec), CI_l, lwd=1, col='gray')
61+
#plot(1:length(IS_count_vec), IS_min_vec, log='')
62+
#lines(1:length(IS_count_vec), IS_min_vec, lwd=1.5)
63+
#for (i in 1:50){
64+
#points(1:length(IS_count_vec), IS_min_mat_shuf[,i], col='gray')
65+
#lines(1:length(IS_count_vec), IS_min_mat_shuf[,i], lwd=1.5, col='gray')
66+
#}
67+
dev.off()
68+
69+
IS_table = apply(IS_mat, 1, function(x) paste(x, collapse='_'))
70+
IS_ccRE_count = table(IS_table)
71+
72+
library(ggplot2)
73+
pdf('ccRE_count_hist.10k.pdf', width=3.5, height=3.)
74+
#mydata_hist = hist((IS_ccRE_count), breaks=50, xlab='', ylab='', main='')
75+
#plot(mydata_hist$count, log="y", type='h', lwd=10, lend=2)
76+
#box()
77+
IS_ccRE_count = as.data.frame(IS_ccRE_count)
78+
ggplot(as.data.frame(IS_ccRE_count), aes(x = Freq)) + geom_histogram() + scale_x_log10() + theme_bw() + theme(panel.grid.major = element_blank(),
79+
panel.grid.minor = element_blank(), axis.line = element_line(colour = "black"))
80+
dev.off()
81+
82+
83+
84+
85+

test_data/.DS_Store

0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)