Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

clean cache

  • Loading branch information...
commit e3b67f8bd1e7725254e5e5cc6a685e82b42f20bb 2 parents 09cb478 + a58a0d8
@cboettig cboettig authored
View
3  .Rbuildignore
@@ -3,3 +3,6 @@
LICENSE
inst/doc/treebase/*
inst/doc/treebase/fancyvrb.sty
+vignettes/cache
+vignettes/figure
+vignettes/out_yule2rate.txt
View
12 .travis.yml
@@ -0,0 +1,12 @@
+language: c
+script: ./travis-tool.sh run_tests
+before_script:
+- curl -OL http://raw.github.com/craigcitro/r-travis/master/scripts/travis-tool.sh
+- chmod 755 ./travis-tool.sh
+- ./travis-tool.sh bootstrap
+- ./travis-tool.sh install_deps
+- ./travis-tool.sh github_package assertthat
+notifications:
+ hipchat:
+ rooms:
+ secure: xTz1s2YyDmdGevYqBpnyjUQJ6fVBKVlJEMTurOBC9icTLpH0N92EPB8PyMK/BgsuIDYeM91wVcmS9A/FXhGw1HQu1+bGb18iU+abMEZ/Damse/aCmNwrIZslGKKikVopkPqth21hRDExXYLip0WgpnHMth9h25qsNgZ9Arzm3To=
View
12 DESCRIPTION
@@ -8,10 +8,15 @@ Maintainer: Carl Boettiger <cboettig@gmail.com>
Authors@R: c(person("Carl", "Boettiger", role = c("aut", "cre"),
email = "cboettig@gmail.com"),
person("Duncan", "Temple Lang", role = "aut"))
-Description: Interface to the API for TreeBASE
+Description: Interface to the API for TreeBASE. TreeBASE is a repository of
+ user-submitted phylogenetic trees (of species, population, or genes) and the
+ data used to create them.
License: CC0
-URL: http://www.github.com/ropensci/treebase
+URL: https://github.com/ropensci/treebase
BugReports: http://www.github.com/ropensci/treebase/issues
+Depends:
+ R (>= 2.15),
+ ape
Imports:
XML,
RCurl,
@@ -19,9 +24,6 @@ Imports:
utils,
reshape2,
data.table
-Depends:
- R (>= 2.15),
- ape
Suggests:
TreePar,
testthat
View
32 R/metadata.R
@@ -51,6 +51,7 @@ metadata <- function(phylo.md = NULL, oai.md=NULL){
#' @param ... additional arguments to \code{search_treebase}
#' @return a list of the values matching the query
#' @keywords internal
+<<<<<<< HEAD
# @examples
# \dontrun{
# # calls will work without a metadata object, but requires longer to download data
@@ -64,6 +65,21 @@ metadata <- function(phylo.md = NULL, oai.md=NULL){
# type <- phylo_metadata("type", metadata=treebase)
# table(kind, type)
#
+=======
+#' @examples
+#' \dontrun{
+#' # calls will work without a metadata object, but require longer to download data
+#' kind <- treebase:::phylo_metadata("kind")
+#' type <- phylo_metadata("type")
+#' table(kind, type)
+#'
+#' # but are much faster if the data object is provided, see cache_treebase():
+#' data(treebase)
+#' kind <- treebase:::phylo_metadata("kind", metadata=treebase)
+#' type <- treebase:::phylo_metadata("type", metadata=treebase)
+#' table(kind, type)
+#' }
+>>>>>>> a58a0d8694bfd6db833d7eece8794ba95b2f9526
phylo_metadata <- function(x = c("Study.id", "Tree.id", "kind", "type", "quality", "ntaxa"), metadata=NULL, ...){
x = match.arg(x)
# Aliases
@@ -85,6 +101,7 @@ phylo_metadata <- function(x = c("Study.id", "Tree.id", "kind", "type", "qualit
#' @param ... additional arguments to \code{download_metadata}
#' @return a list of values matching the query
#' @keywords internal
+<<<<<<< HEAD
# @examples
# \dontrun{
# # automatically search each time (note: this calls internal function now)
@@ -97,6 +114,21 @@ phylo_metadata <- function(x = c("Study.id", "Tree.id", "kind", "type", "qualit
# dates <- oai_metadata("date", metadata=metadata)
# pub <- oai_metadata("publisher", metadata=metadata)
# table(dates, pub)
+=======
+#' @examples
+#' \dontrun{
+#' # automatically search each time (note: this calls internal function now)
+#' dates <- treebase:::oai_metadata("date")
+#' pub <- treebase:::oai_metadata("publisher")
+#' table(dates, pub)
+#'
+#' # Using cached data from an earlier download
+#' data(metadata)
+#' dates <- treebase:::oai_metadata("date", metadata=metadata)
+#' pub <- treebase:::oai_metadata("publisher", metadata=metadata)
+#' table(dates, pub)
+#' }
+>>>>>>> a58a0d8694bfd6db833d7eece8794ba95b2f9526
oai_metadata <- function(x = c("date", "publisher", "author", "title", "Study.id", "attributes"), metadata=NULL, ...){
x = match.arg(x)
# Aliases
View
2  README.md
@@ -1,6 +1,8 @@
treebase
========
+[![Build Status](https://api.travis-ci.org/ropensci/treeBASE.png)](https://travis-ci.org/ropensci/treeBASE)
+
_An R package for discovery, access and manipulation of online phylogenies_
- [Publication in Methods in Ecology and Evolution](http://dx.doi.org/10.1111/j.2041-210X.2012.00247.x)
View
19 man/oai_metadata.Rd
@@ -21,8 +21,27 @@ oai_metadata(x = c("date", "publisher", "author", "title", "Study.id",
a list of values matching the query
}
\description{
+<<<<<<< HEAD
Search the OAI-PMH metadata by date, publisher, or
identifier
+=======
+ Search the OAI-PMH metadata by date, publisher, or
+ identifier
+}
+\examples{
+\dontrun{
+ # automatically search each time (note: this calls internal function now)
+ dates <- treebase:::oai_metadata("date")
+ pub <- treebase:::oai_metadata("publisher")
+ table(dates, pub)
+
+ # Using cached data from an earlier download
+ data(metadata)
+ dates <- treebase:::oai_metadata("date", metadata=metadata)
+ pub <- treebase:::oai_metadata("publisher", metadata=metadata)
+ table(dates, pub)
+>>>>>>> a58a0d8694bfd6db833d7eece8794ba95b2f9526
+}
}
\keyword{internal}
View
18 man/phylo_metadata.Rd
@@ -22,7 +22,25 @@ phylo_metadata(x = c("Study.id", "Tree.id", "kind", "type", "quality",
a list of the values matching the query
}
\description{
+<<<<<<< HEAD
Search the PhyloWS metadata
+=======
+ Search the PhyloWS metadata
+}
+\examples{
+\dontrun{
+ # calls will work without a metadata object, but require longer to download data
+ kind <- treebase:::phylo_metadata("kind")
+ type <- phylo_metadata("type")
+ table(kind, type)
+
+ # but are much faster if the data object is provided, see cache_treebase():
+ data(treebase)
+ kind <- treebase:::phylo_metadata("kind", metadata=treebase)
+ type <- treebase:::phylo_metadata("type", metadata=treebase)
+ table(kind, type)
+>>>>>>> a58a0d8694bfd6db833d7eece8794ba95b2f9526
+}
}
\keyword{internal}
View
4 tests/test-all.R
@@ -1,2 +1,6 @@
library(testthat)
+<<<<<<< HEAD
test_package("treebase")
+=======
+test_package("treebase")
+>>>>>>> a58a0d8694bfd6db833d7eece8794ba95b2f9526
View
0  inst/tests/metadata.R → tests/testthat/metadata.R
File renamed without changes
View
0  inst/tests/treebase.R → tests/testthat/treebase.R
File renamed without changes
View
BIN  vignettes/figure/unnamed-chunk-2.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
292 vignettes/out_yule2rate.txt
@@ -0,0 +1,292 @@
+1 494.5 0.2272 0.1292 54.97 0
+2 495 0.06974 0.1307 46.41 0
+3 499.7 0.03622 0.1343 32.93 0
+4 499.7 0.04445 0.134 32.59 0
+5 499.7 0.04465 0.1349 29.46 0
+6 499.7 0.04735 0.1353 27.78 0
+7 500.1 0.04862 0.1359 25.92 0
+8 500.1 0.05225 0.1359 25.15 0
+9 500.1 0.05309 0.1365 23.68 0
+10 500.1 0.05765 0.1361 23.48 0
+11 500.1 0.06107 0.136 23.04 0
+12 500.1 0.06475 0.1358 22.74 0
+13 500.1 0.06463 0.1364 21.68 0
+14 500.1 0.06746 0.1363 21.32 0
+15 500.1 0.07169 0.1359 21.27 0
+16 500.1 0.07439 0.1357 20.98 0
+17 500.1 0.0718 0.1367 19.81 0
+18 500.1 0.07575 0.1362 19.81 0
+19 500.1 0.07562 0.1367 19.16 0
+20 500.1 0.07865 0.1363 19.04 0
+21 500.1 0.08113 0.1361 18.86 0
+22 500.1 0.08046 0.1366 18.25 0
+23 500.1 0.07894 0.1374 17.52 0
+24 500.1 0.07898 0.1377 17.04 0
+25 500.1 0.08047 0.1377 16.8 0
+26 500.1 0.07939 0.1384 16.19 0
+27 500.1 0.08057 0.1384 15.93 0
+28 500.1 0.08268 0.1381 15.83 0
+29 500.1 0.08222 0.1386 15.37 0
+30 500.1 0.08389 0.1384 15.22 0
+31 500.1 0.08594 0.1381 15.14 0
+32 500.1 0.08653 0.1382 14.87 0
+33 500.1 0.08827 0.138 14.76 0
+34 500.1 0.09056 0.1375 14.73 0
+35 500.1 0.09176 0.1374 14.57 0
+36 500.1 0.0925 0.1375 14.37 0
+37 500.1 0.09367 0.1374 14.22 0
+38 500.1 0.09465 0.1373 14.06 0
+39 500.1 0.09694 0.1368 14.05 0
+40 500.1 0.0967 0.1371 13.78 0
+41 500.1 0.0965 0.1374 13.52 0
+42 500.1 0.09802 0.1371 13.44 0
+43 500.1 0.09845 0.1372 13.26 0
+44 500.1 0.09962 0.137 13.15 0
+45 500.1 0.09789 0.1378 12.76 0
+46 500.1 0.09838 0.1378 12.6 0
+47 500.1 0.09895 0.1379 12.45 0
+48 500.1 0.1004 0.1375 12.39 0
+49 500.1 0.1012 0.1374 12.27 0
+50 500.1 0.103 0.137 12.25 0
+51 500.1 0.1046 0.1365 12.21 0
+52 500.1 0.1065 0.136 12.21 0
+53 500.1 0.1067 0.1361 12.05 0
+54 500.1 0.1043 0.1372 11.68 0
+55 500.1 0.1058 0.1368 11.64 0
+56 500.1 0.1052 0.1372 11.42 0
+57 500.1 0.1057 0.1371 11.31 0
+58 500.1 0.105 0.1376 11.09 0
+59 500.1 0.1065 0.1371 11.06 0
+60 500.1 0.1069 0.1372 10.94 0
+61 500.1 0.1076 0.137 10.86 0
+62 500.1 0.1086 0.1367 10.79 0
+63 500.1 0.1101 0.1362 10.78 0
+64 500.1 0.1107 0.1361 10.69 0
+65 500.1 0.11 0.1366 10.5 0
+66 500.1 0.1117 0.136 10.5 0
+67 500.1 0.1132 0.1354 10.49 0
+68 500.1 0.1125 0.1358 10.31 0
+69 500.1 0.1124 0.136 10.18 0
+70 500.1 0.1135 0.1357 10.13 0
+71 500.1 0.1128 0.1361 9.961 0
+72 500.1 0.1131 0.1361 9.861 0
+73 500.1 0.1122 0.1367 9.675 0
+74 500.1 0.1101 0.1379 9.394 0
+75 500.1 0.111 0.1375 9.348 0
+76 500.1 0.1109 0.1377 9.224 0
+77 500.1 0.1111 0.1378 9.122 0
+78 500.1 0.1116 0.1377 9.055 0
+79 500.1 0.111 0.1382 8.892 0
+80 500.1 0.1119 0.1378 8.852 0
+81 500.1 0.1093 0.1395 8.538 0
+82 500.1 0.1103 0.1391 8.514 0
+83 500.1 0.1115 0.1385 8.5 0
+84 500.1 0.1121 0.1383 8.441 0
+85 500.1 0.1122 0.1384 8.346 0
+86 500.1 0.1119 0.1387 8.223 0
+87 500.1 0.1126 0.1385 8.175 0
+88 500.1 0.1115 0.1393 7.995 0
+89 500.1 0.1111 0.1397 7.864 0
+90 500.1 0.1115 0.1397 7.793 0
+91 500.1 0.1116 0.1398 7.707 0
+92 500.1 0.1127 0.1392 7.698 0
+93 500.1 0.1136 0.1387 7.679 0
+94 500.1 0.1141 0.1385 7.62 0
+95 500.1 0.1147 0.1382 7.576 0
+96 500.1 0.1158 0.1376 7.569 0
+97 500.1 0.1168 0.137 7.553 0
+98 500.1 0.1169 0.137 7.48 0
+99 500.1 0.1174 0.1368 7.431 0
+100 500.1 0.1175 0.1369 7.356 0
+101 500.1 0.1186 0.1362 7.35 0
+102 500.1 0.1197 0.1356 7.341 0
+103 500.1 0.1206 0.135 7.328 0
+104 500.1 0.1218 0.1343 7.327 0
+105 500.1 0.1209 0.135 7.191 0
+106 500.1 0.1218 0.1344 7.177 0
+107 500.1 0.1216 0.1346 7.088 0
+108 500.1 0.1225 0.1341 7.07 0
+109 500.1 0.1226 0.1341 7.007 0
+110 500.1 0.1236 0.1335 6.994 0
+111 500.1 0.1222 0.1345 6.833 0
+112 500.1 0.119 0.1371 6.547 0
+113 500.1 0.1199 0.1365 6.53 0
+114 500.1 0.1165 0.1396 6.222 0
+115 500.1 0.1174 0.1389 6.215 0
+116 500.1 0.1176 0.1389 6.155 0
+117 500.1 0.1181 0.1385 6.118 0
+118 500.1 0.119 0.1379 6.108 0
+119 500.1 0.1199 0.1371 6.106 0
+120 500.1 0.1206 0.1366 6.085 0
+121 500.1 0.1185 0.1387 5.874 0
+122 500.1 0.1187 0.1387 5.814 0
+123 500.1 0.1188 0.1387 5.756 0
+124 500.1 0.1197 0.138 5.751 0
+125 500.1 0.1205 0.1373 5.742 0
+126 500.1 0.1214 0.1365 5.739 0
+127 500.1 0.1214 0.1366 5.675 0
+128 500.1 0.1217 0.1364 5.63 0
+129 500.1 0.1225 0.1357 5.624 0
+130 500.1 0.123 0.1353 5.595 0
+131 500.1 0.1228 0.1356 5.518 0
+132 500.1 0.1226 0.1359 5.444 0
+133 500.1 0.1233 0.1353 5.43 0
+134 500.1 0.1239 0.1348 5.408 0
+135 500.1 0.1238 0.135 5.342 0
+136 500.1 0.1222 0.1367 5.179 0
+137 500.1 0.1224 0.1366 5.136 0
+138 500.1 0.1225 0.1366 5.085 0
+139 500.1 0.1213 0.1381 4.944 0
+140 500.1 0.1218 0.1376 4.919 0
+141 500.1 0.1219 0.1376 4.87 0
+142 500.1 0.1228 0.1367 4.87 0
+143 500.1 0.1236 0.1358 4.869 0
+144 500.1 0.1241 0.1353 4.848 0
+145 500.1 0.1219 0.1381 4.646 0
+146 500.1 0.1227 0.1372 4.645 0
+147 500.1 0.1234 0.1365 4.634 0
+148 500.1 0.1239 0.1359 4.615 0
+149 500.1 0.124 0.1359 4.567 0
+150 500.1 0.1247 0.1351 4.56 0
+151 500.1 0.125 0.1348 4.523 0
+152 500.1 0.1256 0.1341 4.513 0
+153 500.1 0.1261 0.1336 4.489 0
+154 500.1 0.1266 0.133 4.47 0
+155 500.1 0.1271 0.1325 4.45 0
+156 500.1 0.1277 0.1317 4.441 0
+157 500.1 0.1282 0.1312 4.42 0
+158 500.1 0.1279 0.1316 4.354 0
+159 500.1 0.1282 0.1313 4.321 0
+160 500.1 0.1289 0.1303 4.319 0
+161 500.1 0.1292 0.13 4.289 0
+162 500.1 0.1299 0.1292 4.281 0
+163 500.1 0.1288 0.1305 4.17 0
+164 500.1 0.1293 0.1299 4.154 0
+165 500.1 0.1288 0.1305 4.077 0
+166 500.1 0.1293 0.1299 4.062 0
+167 500.1 0.13 0.129 4.057 0
+168 500.1 0.1306 0.1282 4.047 0
+169 500.1 0.1314 0.1272 4.047 0
+170 500.1 0.1314 0.1271 4.004 0
+171 500.1 0.1321 0.1262 3.999 0
+172 500.1 0.1327 0.1253 3.991 0
+173 500.1 0.1325 0.1255 3.937 0
+174 500.1 0.1332 0.1246 3.933 0
+175 500.1 0.1319 0.1263 3.815 0
+176 500.1 0.1316 0.1266 3.757 0
+177 500.1 0.1323 0.1256 3.756 0
+178 500.1 0.133 0.1247 3.749 0
+179 500.1 0.1334 0.124 3.731 0
+180 500.1 0.1335 0.1238 3.694 0
+181 500.1 0.1335 0.1237 3.656 0
+182 500.1 0.1341 0.1228 3.646 0
+183 500.1 0.1345 0.1222 3.629 0
+184 500.1 0.1351 0.1212 3.623 0
+185 500.1 0.1351 0.1211 3.583 0
+186 500.1 0.1357 0.1202 3.574 0
+187 500.1 0.1362 0.1193 3.566 0
+188 500.1 0.1368 0.1184 3.558 0
+189 500.1 0.1375 0.1173 3.556 0
+190 500.1 0.1378 0.1167 3.535 0
+191 500.1 0.1385 0.1156 3.534 0
+192 500.1 0.1383 0.1158 3.484 0
+193 500.1 0.1388 0.1149 3.475 0
+194 500.1 0.1394 0.114 3.466 0
+195 500.1 0.1398 0.1132 3.45 0
+196 500.1 0.1403 0.1123 3.44 0
+197 500.1 0.1405 0.1118 3.415 0
+198 500.1 0.1407 0.1113 3.39 0
+199 500.1 0.1411 0.1105 3.377 0
+200 500.1 0.1418 0.1094 3.376 0
+201 500.1 0.1422 0.1086 3.362 0
+202 500.1 0.1425 0.108 3.339 0
+203 500.1 0.1429 0.1071 3.326 0
+204 500.1 0.1435 0.1061 3.32 0
+205 500.1 0.1426 0.1069 3.244 0
+206 500.1 0.1418 0.1077 3.17 0
+207 500.1 0.1413 0.1082 3.109 0
+208 500.1 0.1418 0.1071 3.105 0
+209 500.1 0.142 0.1065 3.081 0
+210 500.1 0.1415 0.1069 3.022 0
+211 500.1 0.1401 0.1087 2.918 0
+212 500.1 0.1407 0.1074 2.917 0
+213 500.1 0.1414 0.1062 2.914 0
+214 500.1 0.1416 0.1054 2.896 0
+215 500.1 0.1421 0.1044 2.886 0
+216 500.1 0.1426 0.1033 2.877 0
+217 500.1 0.1426 0.1029 2.847 0
+218 500.1 0.1416 0.1041 2.765 0
+219 500.1 0.1409 0.1049 2.696 0
+220 500.1 0.1411 0.1042 2.675 0
+221 500.1 0.1414 0.1034 2.657 0
+222 500.1 0.142 0.102 2.656 0
+223 500.1 0.1421 0.1013 2.632 0
+224 500.1 0.1426 0.1002 2.624 0
+225 500.1 0.1415 0.1015 2.54 0
+226 500.1 0.1412 0.1016 2.494 0
+227 500.1 0.1405 0.1024 2.429 0
+228 500.1 0.1397 0.1035 2.355 0
+229 500.1 0.1397 0.1031 2.325 0
+230 500.1 0.1397 0.1026 2.296 0
+231 500.1 0.1403 0.101 2.296 0
+232 500.1 0.1405 0.1003 2.271 0
+233 500.1 0.1409 0.09893 2.266 0
+234 500.1 0.141 0.09836 2.238 0
+235 500.1 0.1407 0.09836 2.195 0
+236 500.1 0.1413 0.09671 2.194 0
+237 500.1 0.1414 0.09607 2.167 0
+238 500.1 0.1416 0.09499 2.152 0
+239 500.1 0.1419 0.09397 2.134 0
+240 500.1 0.1419 0.09343 2.104 0
+241 500.1 0.1409 0.09485 2.025 0
+242 500.1 0.1406 0.0947 1.985 0
+243 500.1 0.1401 0.09538 1.927 0
+244 500.1 0.1406 0.09352 1.926 0
+245 500.1 0.1405 0.09328 1.888 0
+246 500.1 0.1409 0.09163 1.882 0
+247 500.1 0.1407 0.0913 1.846 0
+248 500.1 0.1413 0.0894 1.845 0
+249 500.1 0.1418 0.08757 1.842 0
+250 500.1 0.1422 0.08598 1.834 0
+251 500.1 0.1427 0.08418 1.83 0
+252 500.3 0.1429 0.08297 1.812 0
+253 500.3 0.1421 0.08371 1.748 0
+254 500.3 0.1425 0.082 1.74 0
+255 500.8 0.143 0.08007 1.737 0
+256 500.9 0.143 0.07923 1.708 0
+257 501.2 0.1432 0.07797 1.689 0
+258 501.5 0.1433 0.07659 1.671 0
+259 502.1 0.1438 0.07459 1.668 0
+260 502.7 0.1443 0.07263 1.664 0
+261 503.3 0.1447 0.07073 1.658 0
+262 503.3 0.1441 0.07077 1.604 0
+263 503.3 0.1441 0.06967 1.576 0
+264 503.3 0.1434 0.06999 1.515 0
+265 503.3 0.1435 0.06859 1.493 0
+266 503.6 0.1439 0.0664 1.489 0
+267 504.1 0.1442 0.06454 1.477 0
+268 504.7 0.1445 0.06268 1.463 0
+269 504.7 0.1437 0.06288 1.4 0
+270 504.7 0.1428 0.06327 1.333 0
+271 504.7 0.1429 0.06158 1.312 0
+272 504.7 0.1422 0.06154 1.253 0
+273 504.7 0.1424 0.05958 1.235 0
+274 504.7 0.1425 0.05757 1.216 0
+275 504.7 0.1423 0.05643 1.178 0
+276 505.1 0.1427 0.05372 1.172 0
+277 505.1 0.1415 0.05447 1.09 0
+278 505.1 0.1408 0.05419 1.029 0
+279 505.1 0.1383 0.05936 0.878 0
+280 505.1 0.1343 0.07557 0.6389 0
+281 505.1 0.1339 0.07602 0.5885 0
+282 505.1 0.1335 0.07628 0.5402 0
+283 505.1 0.1324 0.08341 0.451 0
+284 505.1 0.1317 0.08894 0.3831 0
+285 505.1 0.1321 0.08061 0.3803 0
+286 505.1 0.1322 0.07534 0.3613 0
+287 505.1 0.1318 0.07697 0.3086 0
+288 505.1 0.132 0.06864 0.2964 0
+289 505.1 0.132 0.06302 0.2687 0
+290 505.1 0.1315 0.06234 0.2167 0
+291 505.1 0.1318 0.04953 0.2044 0
+292 505.1 0.1319 0.03606 0.1871 0
View
119 vignettes/vignette.Rmd
@@ -0,0 +1,119 @@
+treebase tutorial
+==========
+
+Here are a few introductory examples to illustrate some of the functionality of the package. Thanks in part to new data deposition requirements at journals such as Evolution, Am Nat, and Sys Bio, and
+data management plan requirements from NSF, I hope the package will become increasingly useful for teaching by replicating results and for meta-analyses that can be automatically updated as the repository grows. Additional information and bug-reports welcome via the [treebase page](http://ropensci.org/packages/treebase.html#support).
+
+Basic tree and metadata queries
+==========
+
+Downloading trees by different queries: by author, taxa, & study. More options are described in the help file.
+
+```{r install, eval=FALSE}
+install.packages('treebase')
+```
+
+```{r loadpkg}
+library(treebase)
+```
+
+```{r search1, eval=FALSE, message=FALSE, warning=FALSE}
+both <- search_treebase("Ronquist or Hulesenbeck", by=c("author", "author"))
+dolphins <- search_treebase('"Delphinus"', by="taxon", max_trees=5)
+studies <- search_treebase("2377", by="id.study")
+```
+
+```{r search2, message=FALSE, warning=FALSE}
+Near <- search_treebase("Near", "author", branch_lengths=TRUE, max_trees=3)
+Near[1]
+```
+
+We can query the metadata record directly. For instance, plot the growth of Treebase submissions by publication date
+
+```{r metadata, eval=FALSE, message=FALSE, warning=FALSE}
+all <- download_metadata("", by="all")
+dates <- sapply(all, function(x) as.numeric(x$date))
+library(ggplot2)
+qplot(dates, main="Treebase growth", xlab="Year", binwidth=.5)
+```
+
+(The previous query could also take a date range)
+
+How do the weekly's do on submissions to Treebase? We construct this in a way that gives us back the indices of the matches, so we can then grab those trees directly. Run the scripts yourself to see if they've changed!
+
+```{r eval=FALSE, message=FALSE, warning=FALSE}
+nature <- sapply(all, function(x) length(grep("Nature", x$publisher))>0)
+science <- sapply(all, function(x) length(grep("^Science$", x$publisher))>0)
+sum(nature)
+sum(science)
+```
+
+Replicating results
+-------------------
+
+A nice paper by Derryberry et al. appeared in Evolution recently on [diversification in ovenbirds and woodcreepers, 0.1111/j.1558-5646.2011.01374.x](http://www.museum.lsu.edu/brumfield/pubs/furnphylogeny2011.pdf). The article mentions that the tree is on Treebase, so let's see if we can replicate their diversification rate analysis: Let's grab the trees by that author and make sure we have the right one:
+
+```{r message=FALSE, warning=FALSE}
+search_treebase("Derryberry", "author")[[1]] -> tree
+plot(tree)
+```
+
+They fit a variety of diversification rate models avialable in the `laser` R package, which they compare using AIC.
+
+```{r message=FALSE, warning=FALSE}
+library(laser)
+tt <- branching.times(tree)
+models <- list(pb = pureBirth(tt),
+ bdfit = bd(tt),
+ y2r = yule2rate(tt), # yule model with single shift pt
+ ddl = DDL(tt), # linear, diversity-dependent
+ ddx = DDX(tt), #exponential diversity-dendent
+ sv = fitSPVAR(tt), # vary speciation in time
+ ev = fitEXVAR(tt), # vary extinction in time
+ bv = fitBOTHVAR(tt)# vary both
+ )
+names(models[[3]])[5] <- "aic"
+aics <- sapply(models, "[[", "aic")
+# show the winning model
+models[which.min(aics)]
+```
+
+Yup, their result agrees with our analysis. Using the extensive toolset for diversification rates in R, we could now rather easily check if these results hold up in newer methods such as TreePar, etc.
+
+Meta-Analysis
+-------------
+
+Of course one of the more interesting challenges of having an automated interface is the ability to perform meta-analyses across the set of available phylogenies in treebase. As a simple proof-of-principle, let's check all the phylogenies in treebase to see if they fit a birth-death model or yule model better.
+
+We'll create two simple functions to help with this analysis. While these can be provided by the treebase package, I've included them here to illustrate that the real flexibility comes from being able to create custom functions(These are primarily illustrative; I hope users and developers will create their own. In a proper analysis we would want a few additional checks.)
+
+```{r eval=FALSE, message=FALSE, warning=FALSE}
+timetree <- function(tree){
+ check.na <- try(sum(is.na(tree$edge.length))>0)
+ if(is(check.na, "try-error") | check.na)
+ NULL
+ else
+ try( chronoMPL(multi2di(tree)) )
+}
+drop_errors <- function(tr){
+ tt <- tr[!sapply(tr, is.null)]
+ tt <- tt[!sapply(tt, function(x) is(x, "try-error"))]
+ print(paste("dropped", length(tr)-length(tt), "trees"))
+ tt
+}
+require(laser)
+pick_branching_model <- function(tree){
+ m1 <- try(pureBirth(branching.times(tree)))
+ m2 <- try(bd(branching.times(tree)))
+ as.logical(try(m2$aic < m1$aic))
+}
+```
+
+Return only treebase trees that have branch lengths. This has to download every tree in treebase, so this will take a while. Good thing we don't have to do that by hand.
+
+```{r eval=FALSE, message=FALSE, warning=FALSE}
+all <- search_treebase("Consensus", "type.tree", branch_lengths=TRUE)
+tt <- drop_errors(sapply(all, timetree))
+is_yule <- sapply(tt, pick_branching_model)
+table(is_yule)
+```
View
161 vignettes/vignette.md
@@ -0,0 +1,161 @@
+treebase tutorial
+==========
+
+Here are a few introductory examples to illustrate some of the functionality of the package. Thanks in part to new data deposition requirements at journals such as Evolution, Am Nat, and Sys Bio, and
+data management plan requirements from NSF, I hope the package will become increasingly useful for teaching by replicating results and for meta-analyses that can be automatically updated as the repository grows. Additional information and bug-reports welcome via the [treebase page](http://ropensci.org/packages/treebase.html#support).
+
+Basic tree and metadata queries
+==========
+
+Downloading trees by different queries: by author, taxa, & study. More options are described in the help file.
+
+
+```r
+install.packages("treebase")
+```
+
+
+
+```r
+library(treebase)
+```
+
+```
+## Loading required package: ape
+```
+
+
+
+```r
+both <- search_treebase("Ronquist or Hulesenbeck", by = c("author", "author"))
+dolphins <- search_treebase("\"Delphinus\"", by = "taxon", max_trees = 5)
+studies <- search_treebase("2377", by = "id.study")
+```
+
+
+
+```r
+Near <- search_treebase("Near", "author", branch_lengths = TRUE, max_trees = 3)
+Near[1]
+```
+
+```
+## [[1]]
+##
+## Phylogenetic tree with 102 tips and 21 internal nodes.
+##
+## Tip labels:
+## Etheostoma_barrenense_A, Etheostoma_rafinesquei_B, Etheostoma_atripinne_A, Etheostoma_atripinne_Y, Etheostoma_atripinne_B, Etheostoma_atripinne_C, ...
+##
+## Unrooted; includes branch lengths.
+```
+
+
+We can query the metadata record directly. For instance, plot the growth of Treebase submissions by publication date
+
+
+```r
+all <- download_metadata("", by = "all")
+dates <- sapply(all, function(x) as.numeric(x$date))
+library(ggplot2)
+qplot(dates, main = "Treebase growth", xlab = "Year", binwidth = 0.5)
+```
+
+
+(The previous query could also take a date range)
+
+How do the weekly's do on submissions to Treebase? We construct this in a way that gives us back the indices of the matches, so we can then grab those trees directly. Run the scripts yourself to see if they've changed!
+
+
+```r
+nature <- sapply(all, function(x) length(grep("Nature", x$publisher)) > 0)
+science <- sapply(all, function(x) length(grep("^Science$", x$publisher)) >
+ 0)
+sum(nature)
+sum(science)
+```
+
+
+Replicating results
+-------------------
+
+A nice paper by Derryberry et al. appeared in Evolution recently on [diversification in ovenbirds and woodcreepers, 0.1111/j.1558-5646.2011.01374.x](http://www.museum.lsu.edu/brumfield/pubs/furnphylogeny2011.pdf). The article mentions that the tree is on Treebase, so let's see if we can replicate their diversification rate analysis: Let's grab the trees by that author and make sure we have the right one:
+
+
+```r
+tree <- search_treebase("Derryberry", "author")[[1]]
+plot(tree)
+```
+
+![plot of chunk unnamed-chunk-2](figure/unnamed-chunk-2.png)
+
+
+They fit a variety of diversification rate models avialable in the `laser` R package, which they compare using AIC.
+
+
+```r
+library(laser)
+tt <- branching.times(tree)
+models <- list(pb = pureBirth(tt),
+ bdfit = bd(tt),
+ y2r = yule2rate(tt), # yule model with single shift pt
+ ddl = DDL(tt), # linear, diversity-dependent
+ ddx = DDX(tt), #exponential diversity-dendent
+ sv = fitSPVAR(tt), # vary speciation in time
+ ev = fitEXVAR(tt), # vary extinction in time
+ bv = fitBOTHVAR(tt)# vary both
+ )
+names(models[[3]])[5] <- "aic"
+aics <- sapply(models, "[[", "aic")
+# show the winning model
+models[which.min(aics)]
+```
+
+```
+## $y2r
+## LH r1 r2 st1 aic
+## 5.051e+02 1.319e-01 3.606e-02 1.871e-01 -1.004e+03
+```
+
+
+Yup, their result agrees with our analysis. Using the extensive toolset for diversification rates in R, we could now rather easily check if these results hold up in newer methods such as TreePar, etc.
+
+Meta-Analysis
+-------------
+
+Of course one of the more interesting challenges of having an automated interface is the ability to perform meta-analyses across the set of available phylogenies in treebase. As a simple proof-of-principle, let's check all the phylogenies in treebase to see if they fit a birth-death model or yule model better.
+
+We'll create two simple functions to help with this analysis. While these can be provided by the treebase package, I've included them here to illustrate that the real flexibility comes from being able to create custom functions(These are primarily illustrative; I hope users and developers will create their own. In a proper analysis we would want a few additional checks.)
+
+
+```r
+timetree <- function(tree) {
+ check.na <- try(sum(is.na(tree$edge.length)) > 0)
+ if (is(check.na, "try-error") | check.na)
+ NULL else try(chronoMPL(multi2di(tree)))
+}
+drop_errors <- function(tr) {
+ tt <- tr[!sapply(tr, is.null)]
+ tt <- tt[!sapply(tt, function(x) is(x, "try-error"))]
+ print(paste("dropped", length(tr) - length(tt), "trees"))
+ tt
+}
+require(laser)
+pick_branching_model <- function(tree) {
+ m1 <- try(pureBirth(branching.times(tree)))
+ m2 <- try(bd(branching.times(tree)))
+ as.logical(try(m2$aic < m1$aic))
+}
+```
+
+
+Return only treebase trees that have branch lengths. This has to download every tree in treebase, so this will take a while. Good thing we don't have to do that by hand.
+
+
+```r
+all <- search_treebase("Consensus", "type.tree", branch_lengths = TRUE)
+tt <- drop_errors(sapply(all, timetree))
+is_yule <- sapply(tt, pick_branching_model)
+table(is_yule)
+```
+
Please sign in to comment.
Something went wrong with that request. Please try again.