This file contains hidden or 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
killscreens () { | |
screen -ls | grep Detached | cut -d. -f1 | awk '{print $1}' | xargs kill | |
} |
This file contains hidden or 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
library(IlluminaHumanMethylation450kanno.ilmn12.hg19) | |
locations <- getLocations(IlluminaHumanMethylation450kanno.ilmn12.hg19) | |
This file contains hidden or 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
tar -zxvf |
This file contains hidden or 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
pair.lapply <- function(list1, list2, fun, list3=NULL){ | |
results <- list() | |
for (i in 1:length(list1)){ | |
if (is.null(list3)){ | |
results[[i]] <- do.call(fun, list(list1[[i]],list2[[i]])) | |
} else { | |
results[[i]] <- do.call(fun, list(list1[[i]][list3[[i]]],list2[[i]][list3[[i]]])) | |
} | |
} |
This file contains hidden or 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
D <- split(as.data.frame(M), A) | |
correlations <- llapply(D,D,getCorrelation) | |
llapply <- function(list1,list2, fun){ | |
temp <- unlist(lapply(list1, function(x){ | |
unlist(lapply(list2, function(y){ | |
do.call(fun, list(x,y)) | |
})) | |
})) |
This file contains hidden or 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
#Here is how to convert a bigWig file from hg18 to hg19: | |
bigWigToBedGraph file18.bw hg18.chrom.sizes chfile18.bed | |
liftOver file18.bed hg18ToHg19.over.chain file19.bed unmapped | |
bedGraphToBigWig file19.bed hg19.chrom.sizes file19.bw | |
This file contains hidden or 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
darken <- function(color, factor=1.4){ | |
col <- col2rgb(color) | |
col <- col/factor | |
col <- rgb(t(col), maxColorValue=255) | |
col | |
} | |
lighten <- function(color, factor=1.4){ | |
col <- col2rgb(color) |
This file contains hidden or 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
fastq-dump file.sra -Z | gzip > file.fastq.gz |
This file contains hidden or 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
getR2 <- function(Y,X){ | |
fitted <- t(solve(t(X)%*%X) %*% t(X) %*% t(Y)) %*% t(X) | |
res <- Y-fitted | |
Y.demeaned <- t(scale(t(Y), center=TRUE, scale=FALSE)) | |
ssres <- rowSums(res^2) | |
sstot <- rowSums(Y.demeaned^2) | |
1-ssres/sstot | |
} | |
This file contains hidden or 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
Reduce(intersect, list(a,b,c,d)) |