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 / 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.
## 
```{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 / riffle.md
Last active August 29, 2015 14:19
Biostars riffle examples
@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 / 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 / plot_tree.r
Created August 10, 2015 16:13
Flag phylogeny
traits <- read.csv("flag_traits.csv")
dist_mat <- dist(traits, "manhattan")
tr <- ape::nj(dist_mat)
plot(tr)
##Rooting the tree (arbitrarily) will make a nicer plot
#rooted <- ape::root(tr, node=50)
#plot(rooted)
@dwinter
dwinter / rentrez_1.Rmd
Created September 23, 2015 02:26
rentrez release blog post
#Rentrez 1.0 released
A new version of `rentrez`, our package for the NCBI's EUtils API, is making
it's way around the CRAN mirrors. This release represents a substantial
mprovement to `rentrez`, including a [new vignette](https://cran.r-project.org/web/packages/rentrez/vignettes/rentrez_tutorial.html)
that documents the whole package.
This posts describes some of the new things in `rentrez`, and gives us a chance
to thank some of the people that have contriuted to this package's development.
def square_docs(f):
f.__doc__ = "Square it"
return(f)
@square_docs
def square(x):
return(x**2)
help(square)
#Type: function
@dwinter
dwinter / eg.Rmd
Last active February 6, 2016 00:16
TAXIDs and NCBI genome?
#Won't work by cross linking
```r
tax_search <- entrez_search(db="taxonomy", term="Acetobacter[ORGN] AND genus[RANK]")
linked_recs <- entrez_link(dbfrom="taxonomy", db="genome", id=tax_search$ids)
linked_recs$links$taxonomy_genome
```
```
#[1] "18005"
```