https://github.com/brentthorne/posterdown
https://github.com/rstudio/pagedown
https://github.com/GerkeLab/betterposter
polygonizer <- function(x, outshape=NULL, pypath=NULL, readpoly=TRUE, | |
fillholes=FALSE, aggregate=FALSE, | |
quietish=TRUE) { | |
# x: an R Raster layer, or the file path to a raster file recognised by GDAL | |
# outshape: the path to the output shapefile (if NULL, a temporary file will | |
# be created) | |
# pypath: the path to gdal_polygonize.py or OSGeo4W.bat (if NULL, the function | |
# will attempt to determine the location) | |
# readpoly: should the polygon shapefile be read back into R, and returned by | |
# this function? (logical) |
##Not my functions but slighly mod for my use | |
patchify2<-function(x, distance, p4s, givedist=TRUE) { | |
# x: a binary Raster layer (0 or NA for background, and 1 for areas to be clumped) | |
# distance: the neighbourhood distance. Patches that occur within this distance of | |
# one another will be clumped. This should be in the units of the CRS given | |
# in p4s. If this is zero, the function will identify patches defined by | |
# 8-connectivity (i.e. queen's case). | |
# p4s: an equal-area projection appropriate for the region. This will be used when |
set.seed(123) # make reproducible | |
M = 10000 # Number of posterior samples | |
N = 20 | |
# sample the IV | |
x = rnorm(N, 10, 5) | |
# regression model for DVs | |
y = 100 + 3*x + rnorm(N,0,10) | |
## Delete missing data (3 in each) |
#initialize | |
library(shiny) | |
library(ggplot2) | |
library(purrr) | |
library(dplyr) | |
#example data | |
data(iris) |
library(phytools) | |
# fullNew = path to tree files | |
trees<-lapply(seq_along(fullNew), function(x){ | |
cat(x,'_',fullNew[x], '\n') | |
k<-grep('#NEXUS', readLines(fullNew[x])) | |
#Fasttree tree constraint in R | |
#http://www.microbesonline.org/fasttree/constrained.html | |
#Packages | |
library(ape) | |
library(phylobase) | |
library(adephylo) | |
library(bio3d) | |
library(pbapply) |
annotate_rainbow_letters<-function(ggbasePlot, string, initialx, y, letterDistance, | |
wordDistance,uppcaseadditionalDistance){ | |
spup<-strsplit(string, split = "")[[1]] | |
uppLett<-grepl("^[[:upper:]]+$", spup) | |
dostanceVector<-ifelse(spup == " ", wordDistance, letterDistance) | |
if(any(uppLett)){ | |
for(i in 1:length(which(uppLett))){ |
Instructions from Brian (https://github.com/bomeara/phydocker/blob/master/Dockerfile) | |
cd /usr/local/ | |
sudo mkdir pathd8download | |
cd pathd8download | |
sudo wget http://www2.math.su.se/PATHd8/PATHd8.zip | |
sudo unzip PATHd8.zip | |
sudo cc PATHd8.c -O3 -lm -o PATHd8 | |
sudo cp PATHd8 /usr/local/bin/PATHd8 |
library(taxize) | |
library(ape) | |
gen<-unique(unlist(lapply(strsplit(GenBank_Accession_Table$Taxon,' '), function(x)x[[1]][1]))) | |
taxonomy<-do.call(rbind,pblapply(gen, function(x){ | |
tryCatch({ | |
tax_name(query = x, get = c('family',"superfamily"), db = "ncbi") | |
}, error=function(e){}) |