Skip to content

Instantly share code, notes, and snippets.

View dwinter's full-sized avatar
🐢
I may be slow to respond.

David Winter dwinter

🐢
I may be slow to respond.
View GitHub Profile
@dwinter
dwinter / add_to_bib.r
Created June 19, 2015 17:42
Add to bibliography from doi
library(rcrossref)
add_to_bib <- function(doi, bib="ms.bib", print_ref=TRUE){
ref <- cr_cn(doi)
cat("\n", ref, "\n\n", file=bib, append=TRUE)
if(print_ref){
cat(ref, "\n")
}
}
@dwinter
dwinter / rentrez.md
Created May 27, 2015 22:09
Genomic effort by animal class

#Demo for com call

library(XML)
load_all("~/src/rentrez")
@dwinter
dwinter / riffle.md
Last active August 29, 2015 14:19
Biostars riffle examples
```{r, echo=FALSE}
knitr::opts_knit$set(upload.fun = knitr::imgur_upload, base.url = NULL)
```
# and now, all animals and with nested taxonomic ranks
So, a few people liked [this example](https://gist.github.com/dwinter/8d7bde0579daf7466508)
of using `rentrez` to investigate the taxonomic distribution of sequences in
Genbank. I though it might be fun to extend it a little. Specifically:
@dwinter
dwinter / gist.md
Last active August 29, 2015 14:16
biostars example
 library(ape)
 data(woodmouse)
 #Just the third codon (assuming alignment is in-frame)
 woodmouse[, seq(1, ncol(woodmouse), by=3) ]
## 15 DNA sequences in binary format stored in a matrix.
## 
@dwinter
dwinter / Ipython_notebook_intro.md
Last active August 29, 2015 14:15
ipython intro

#Notes from ipython notebook lab talk

##Introduction

ipython is an alternative shell for python which is aimed at meeting the needs of interactive/scientific computing. One of it's coolest features is the ipython notebook , which allows users to combined styled text, fancy looking maths, code and the results of that codes execution.

Although it has "python" in the name, the notebook is not restricted to that programing language. "Magic" functions allow users to execute different languages in an "ipython" notebook, and other languages (including Julia, Haskell and Ruby...) can be the default language of a whole notebook. In fact, the notebook project recently changed its name to jupyter (from JUlia PYthon and R -- the "languages of open science"). The notebook is especially helpful for recording exploritory/interactive analyses and plots made in bioinformatics/computational biology.

##Install

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@dwinter
dwinter / scale_gradient.r
Last active August 29, 2015 14:14
multiple plots, each with there own scale_gradient()
library(ggplot2)
library(grid)
make_normal_cont <- function(Ea, n=100, steps=11){
Ut <- 0.2/Ea
x <- rma_normal(n, Ea, Ea/10, 1e-4, Ut)
effect_sizes <- seq(1e-4, Ea * 2, length.out=steps)
mus <- seq(Ut - Ut/1.2, Ut *3, length.out=steps)
res <- expand.grid(mean_effect = effect_sizes, Ut=mus)
res$Lik <- apply(res, 1, function(r) dma_normal(x, a=r[1], Va =r[1]/50,