## Access date: 2017-01-04
$ svn log -q |grep 'z.li'
r87229 | z.li | 2014-03-08 12:13:28 +0800 (Sat, 08 Mar 2014)
r85532 | z.li | 2014-01-15 13:00:43 +0800 (Wed, 15 Jan 2014)
r85454 | z.li | 2014-01-12 13:57:16 +0800 (Sun, 12 Jan 2014)
r72578 | z.li | 2013-01-16 15:11:20 +0800 (Wed, 16 Jan 2013)
r72577 | z.li | 2013-01-16 13:43:05 +0800 (Wed, 16 Jan 2013)
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
f <- function(a, b) function(y) a * y * log(y, base=10) -1/b * exp(-(b*y - b/exp(1))^4) | |
y <- seq(0, 1, length.out=100) | |
cols = colorspace::rainbow_hcl(5) | |
d1 <- data.frame(x = f(3, 30)(y), y=y, color=cols[1]) | |
d2 <- data.frame(x = f(2.8, 33)(y), y=y, color=cols[2]) | |
d3 <- data.frame(x = f(2.5, 36)(y), y=y, color=cols[3]) | |
d4 <- data.frame(x = f(2.2, 40)(y), y=y, color=cols[4]) | |
d5 <- data.frame(x = f(2, 50)(y), y=y, color=cols[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
require(TxDb.Hsapiens.UCSC.hg19.knownGene) | |
txdb <- TxDb.Hsapiens.UCSC.hg19.knownGene | |
library(ChIPseeker) | |
library(GenomicRanges) | |
# Hack chipseeker function to add annotaiton | |
getGenomicAnnoStat <- function(peakAnno) { | |
if ( class(peakAnno) == "GRanges" ) | |
peakAnno <- as.data.frame(peakAnno) | |
anno <- peakAnno$annotation | |
## anno <- sub(" \\(.+", "", anno) |
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
## http://ygc.name/2012/05/29/t-test/ | |
p1 <- rnorm(1000) | |
p2 <- rnorm(1000, sd=3) | |
hist(p2, col="green", xlab="", main="") | |
hist(p1, col="red", add=T) | |
legend(legend=c("sd=1", "sd=3"), fill=c("green", "red"), x="topright") |
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
x <- read.csv("/Volumes/YGC/Researches/ARCHIVE/Others/AL-1-by-GR.Yan/2D-data-and-analysis-result/2D.csv") | |
eg <- as.character(x[,1]) | |
require(clusterProfiler) | |
xx <- enrichGO(eg, ont="BP") | |
gg <- xx@geneInCategory | |
names(gg) <- clusterProfiler:::TERM2NAME.BP(names(gg)) | |
g <- gg[1:4] | |
require(gplots) | |
vm <- venn(g) |
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
# http://ygc.name/2012/04/29/bootstrap-for-enrichment-analysis/ | |
goboot <- cmpfun(function(goid, | |
sampleSize, | |
nboot=1000) { | |
ratio <- rep(0, nboot) | |
allgene <- unique(mappedkeys(org.Hs.egGO)) | |
allgeneInCategory <- unique(get(goid, org.Hs.egGO2ALLEGS)) |
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(123) | |
x <- rnorm(100) | |
y <- rnorm(100) | |
points.df <- data.frame(x=x,y=y) | |
center <- c(0.2, 0.3) | |
diameter <- 2 | |
d <- apply(points.df, 1, function(x) x-center) |
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
## http://ygc.name/2011/08/02/q-q-plots/ | |
qqplot <- function(y, distribution=qnorm) { | |
x <- distribution(ppoints(y)) | |
plot(x, sort(y), | |
xlab="Theoretical Quantiles", | |
ylab="Sample Quantiles", | |
main="Normal Q-Q Plot" | |
) | |
lines(y,y) |
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
fibonacci <- function(n) { | |
u <- (1+sqrt(5))/2 | |
(u^n - (1-u)^n) / sqrt(5) | |
} |