> sessionInfo()
R version 3.3.2 (2016-10-31)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Red Hat Enterprise Linux Server release 6.7 (Santiago)
locale:
[1] C
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# packages in environment at /project2/xinhe/yanyul/softwares/Anaconda2/envs/deepvarpred_test: | |
# | |
bedtools 2.25.0 2 bioconda | |
bzip2 1.0.6 1 conda-forge | |
ca-certificates 2017.1.23 0 conda-forge | |
cairo 1.14.8 0 | |
certifi 2017.1.23 py35_0 conda-forge | |
cffi 1.7.0 py35_0 conda-forge | |
cryptography 1.7.1 py35_0 | |
curl 7.52.1 0 conda-forge |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sapply(list.files('path-to-folder', '*.R', full.names = T), source) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import argparse | |
parser = argparse.ArgumentParser(description='generate script from template') | |
parser.add_argument('word', metavar='KEY=VALUE', type=str, nargs='+', | |
help='key-value pairs') | |
parser.add_argument('--template', metavar='input filename', type=str, | |
help='template file') | |
parser.add_argument('--output', metavar='output filename', type=str, | |
help='output') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
zval2pval = function(z) { | |
exp(pnorm(abs(z), log.p=T, low=F)) * 2 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
compute_auc = function(curve) { | |
# f = curve %>% filter(nTP > 0) %>% group_by(nTP) %>% summarize(y = mean(tpr), x = fpr[1] - fpr[2]) | |
o1 = rbind(c(1, 1), curve %>% select(tpr, fpr)) | |
o2 = rbind(curve %>% select(tpr, fpr), c(0, 0)) | |
# message('e') | |
y = data.frame(x1 = o1$fpr, x2 = o2$fpr, y1 = o1$tpr, y2 = o2$tpr) | |
e = y %>% mutate(s = (x1 - x2) * (y1 + y2) / 2) | |
data.frame(roc_auc = sum(e$s)) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
my_qqplot_by_group <- function(pval, group, ...) { | |
n <- length(pval) | |
pexp <- rank(pval) / n | |
df <- data.frame(p.val = pval, p.exp = pexp, grp = group) | |
p <- ggplot(df) + geom_point(aes(x = -log10(p.exp), y = -log10(p.val), color = grp), ...) + geom_hline(yintercept = -log10(0.05 / n)) + theme_bw() + geom_abline(slope = 1, intercept = 0, linetype = 2) | |
return(p) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set.seed(100) | |
# p1 = runif(1000) | |
# p2 = runif(5) | |
z = rep(rnorm(10000)) | |
z[sample(1:10000, size = 3, replace = F)] = rnorm(3, 7, sd = 1) | |
# plot(-log10(p)) | |
zobs = rep(0, 10000) | |
density = exp(c(-5:-1, 0, -1:-5)*0.5) | |
for(i in 6 : 9995) { | |
zobs[i] = sum(density * z[c(i-(5:1),i,i+(1:5))]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
th = theme(panel.border = element_blank(), panel.grid.major = element_blank(),panel.grid.minor = element_blank(), axis.line = element_line(colour = "#170a45", size = .5), axis.ticks = element_line(colour = "#170a45", size = .2), axis.text = element_text(color = '#170a45')) | |
th2 = th | |
th2$panel.border = element_rect(colour = th2$axis.line$colour) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mymixer = c( | |
'splicing observed' = rgb(200, 90, 40, maxColorValue = 255), | |
'expression observed' = rgb(42, 155, 204, maxColorValue = 255), | |
'splicing shuffled' = 'gray', | |
'expression shuffled' = 'gray' | |
) |
OlderNewer