- xcode
- iterm2
- source code pro / fire mono
- homebrew
- zsh
- git
- emacs & ESS
- R & Rstudio
- mactex
- ispell
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
accession2url <- function(x) { | |
prefix <- "ftp://ftp.sra.ebi.ac.uk/vol1/fastq" | |
dir1 <- paste0("/",substr(x,1,6)) | |
dir2 <- ifelse(nchar(x) == 9, "", | |
ifelse(nchar(x) == 10, paste0("/00",substr(x,10,10)), | |
ifelse(nchar(x) == 11, paste0("/0",substr(x,10,11)), | |
paste0("/",substr(x,10,12))))) | |
paste0(prefix,dir1,dir2,"/",x) | |
} |
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
nrep <- 100 | |
d <- expand.grid(n=c(3,5,10,20), sd=c(1,2,3)) | |
d <- d[rep(seq_len(nrow(d)),each=nrep),] | |
simulate <- function(n, sd) { | |
rnorm(n=n, mean=0, sd=sd) | |
} | |
library(purrr) | |
library(dplyr) |
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
n <- 50 | |
m <- 40 | |
m_inform <- 10 | |
set.seed(1) | |
niter <- 200 | |
intradist <- numeric(niter) | |
interdist <- numeric(niter) | |
mus <- seq(from=0, to=3, length=niter) | |
library(Rtsne) | |
cols <- rep(1:2, each=n/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
perl -pe 's|\\Robject{(.+?)}|`\1`|g' | | |
perl -pe 's|\\Rcode{(.+?)}|`\1`|g' | | |
perl -pe 's|\\Rclass{(.+?)}|*\1*|g' | | |
perl -pe 's|\\Rfunction{(.+?)}|*\1*|g' | | |
perl -pe 's|\\texttt{(.+?)}|`\1`|g' | | |
perl -pe 's|\\textit{(.+?)}|*\1*|g' | | |
perl -pe 's|\\textbf{(.+?)}|**\1**|g' | | |
perl -pe 's|\\emph{(.+?)}|*\1*|g' | | |
perl -pe 's|<<|```{r |g' | | |
perl -pe 's|>>=|}|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
library(BSgenome.Hsapiens.UCSC.hg38) | |
library(TxDb.Hsapiens.UCSC.hg38.knownGene) | |
txs <- extractTranscriptSeqs(Hsapiens, TxDb.Hsapiens.UCSC.hg38.knownGene) | |
z <- txs[sample(length(txs), 10000)] | |
z <- z[width(z) > 100] | |
starts <- round(runif(length(z),1,width(z)-99)) | |
gc <- as.vector(letterFrequency(subseq(z,start=starts,width=100),"GC")) | |
with(hist(gc), plot(mids, density, type="b", lwd=2)) | |
abline(h=0) |
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
get_deps <- function(what="Suggests") { | |
deps <- desc::desc_get_deps() | |
suggests <- deps$package[deps$type==what] | |
setdiff(suggests, sub(".*/","",find.package(suggests, quiet=TRUE))) | |
} |
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
# suspend, foreground, background | |
Ctrl-z, fg, jobs, bg | |
example in R: sapply(1:100, function(i) {Sys.sleep(1);print(i)}) | |
# list size of directories | |
du -sh * |
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
--- | |
title: "Using RNA-seq DE methods to detect allele-specific expression" | |
author: "Michael Love" | |
date: "`r format(Sys.time(), '%d %B, %Y')`" | |
output: html_document | |
--- | |
The question has come up a few times on the Bioconductor support site how to use | |
methods like DESeq2 or edgeR to detect allele-specific expression, | |
and how to see if the allelic ratio differs across condition. Aaron Lun has written up |
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
library(rvest) | |
org <- "Takifugu_rubripes" | |
getdetails <- function(org) { | |
readit <- function(org, prefix) { | |
read_html(paste0("http://",prefix,".ensembl.org/", | |
org, "/Info/Annotation")) | |
} | |
page <- tryCatch(readit(org, "www"), |