#Script for analyses #Install phytools, Claddis and dispeRse library(devtools) devtools::install_github("liamrevell/phytools") devtools::install_github("graemetlloyd/Claddis") devtools::install_github("laurasoul/dispeRse") #Required libraries library(ape) library(paleotree) library(phytools) library(Claddis) library(dispeRse) library(cluster) #Clustering analyses of palaeocoordinate data coordinates<-read.table("palaeocoords.txt", header=TRUE) #Cluster analysis for k=5-15 porc.list<-rep(list(list()),15) fit.list<-rep(list(list()),15) for (j in 5:15) {fit=kmeans(coordinates, j, nstart = 10) porc=fit$betweenss/fit$totss for (k in 1:10000) { fit2=kmeans(coordinates, j, nstart = 10) porc2=fit2$betweenss/fit2$totss if (porc2>porc) { porc=porc2 fit2=fit } } porc->porc.list[[j]] fit2->fit.list[[j]] } #Input source tree complete.tree<-read.nexus("SD1.nexus") #Read in taxa and ages taxon.ages <- as.matrix(read.table("Taxon_occs.txt", header = TRUE, row.names=1, sep = "\t")) #Read in taxon-region matrices for each time bin lopingian<-as.matrix(read.table("lopingian.txt", header=TRUE, row.names=1, sep="\t")) earlyTriassic<-as.matrix(read.table("earlyTriassic.txt", header=TRUE, row.names=1, sep="\t")) anisian<-as.matrix(read.table("anisian.txt", header=TRUE, row.names=1, sep="\t")) ladinian<-as.matrix(read.table("ladinian.txt", header=TRUE, row.names=1, sep="\t")) earlyLateTriassic<-as.matrix(read.table("earlyLateTriassic.txt", header=TRUE, row.names=1, sep="\t")) lateLateTriassic<-as.matrix(read.table("lateLateTriassic.txt", header=TRUE, row.names=1, sep="\t")) earlyEarlyJurassic<-as.matrix(read.table("earlyEarlyJurassic.txt", header=TRUE, row.names=1, sep="\t")) lateEarlyJurassic<-as.matrix(read.table("lateEarlyJurassic.txt", header=TRUE, row.names=1, sep="\t")) #Produce trees isolating the taxa present in each time bin lopingian.tree <- drop.tip(dated.tree, setdiff(dated.tree$tip.label, rownames(lopingian))) earlyTriassic.tree <- drop.tip(dated.tree, setdiff(dated.tree$tip.label, rownames(earlyTriassic))) anisian.tree <- drop.tip(dated.tree, setdiff(dated.tree$tip.label, rownames(anisian))) ladinian.tree <- drop.tip(dated.tree, setdiff(dated.tree$tip.label, rownames(ladinian))) earlyLateTriassic.tree <- drop.tip(dated.tree, setdiff(dated.tree$tip.label, rownames(earlyLateTriassic))) lateLateTriassic.tree <- drop.tip(dated.tree, setdiff(dated.tree$tip.label, rownames(lateLateTriassic))) earlyEarlyJurassic.tree <- drop.tip(dated.tree, setdiff(dated.tree$tip.label, rownames(earlyEarlyJurassic))) lateEarlyJurassic.tree <- drop.tip(dated.tree, setdiff(dated.tree$tip.label, rownames(lateEarlyJurassic))) #Calculating phylogenetic biogeographical connectedness from these trees requires that each be ultrametric. Here is a function to ultrametricise trees (author: Graeme Lloyd): ultrametricise <- function(tree) { # Get maximum path length: max.path.length <- max(diag(vcv(tree))) # Add extra branch length to all tips in order to reach maximum path length: tree$edge.length[match(1:Ntip(tree), tree$edge[, 2])] <- tree$edge.length[match(1:Ntip(tree), tree$edge[, 2])] + (max.path.length - diag(vcv(tree))[tree$tip.label]) # Return re-scaled tree: return(tree) } #Ultrametricise the trees lopingian.tree <- ultrametricise(lopingian.tree) earlyTriassic.tree <- ultrametricise(earlyTriassic.tree) anisian.tree <- ultrametricise(anisian.tree) ladinian.tree <- ultrametricise(ladinian.tree) earlyLateTriassic.tree <- ultrametricise(earlyLateTriassic.tree) lateLateTriassic.tree <- ultrametricise(lateLateTriassic.tree) earlyEarlyJurassic.tree <- ultrametricise(earlyEarlyJurassic.tree) lateEarlyJurassic.tree <- ultrametricise(lateEarlyJurassic.tree) #Sensitivty analyses into maximum tree length cutoff #Generate time-calibrated supertree for these sensitvity analyses dated.tree <- timePaleoPhy(complete.tree, taxon.ages, "mbl", vartime=1) # Empty matrix to store phylogenetic BC values for k 1-100: phyloBC <- matrix(0, nrow = 9, ncol = 100) # For k values of 1 to 100: for(i in 1:100) { # Get Permian and Triassic phylogenetic BCs: phyloBC.lopingian <- BC(lopingian, lopingian.tree, jackknife = TRUE, k = i) phyloBC.earlyTriassic <- BC(earlyTriassic, earlyTriassic.tree, jackknife = TRUE, k = i) phyloBC.anisian <- BC(anisian, anisian.tree, jackknife = TRUE, k = i) phyloBC.ladinian <- BC(ladinian, ladinian.tree, jackknife = TRUE, k = i) phyloBC.earlyLateTriassic <- BC(earlyLateTriassic, earlyLateTriassic.tree, jackknife = TRUE, k = i) phyloBC.lateLateTriassic <- BC(lateLateTriassic, lateLateTriassic.tree, jackknife = TRUE, k = i) phyloBC.earlyEarlyJurassic <- BC(earlyEarlyJurassic, earlyEarlyJurassic.tree, jackknife = TRUE, k = i) phyloBC.lateEarlyJurassic <- BC(lateEarlyJurassic, lateEarlyJurassic.tree, jackknife = TRUE, k = i) # Store the BC value in the matrix: phyloBC[2, i] <- phyloBC.lopingian$BC_observed["Biogeographic_connectedness"] phyloBC[3, i] <- phyloBC.earlyTriassic$BC_observed["Biogeographic_connectedness"] phyloBC[4, i] <- phyloBC.anisian$BC_observed["Biogeographic_connectedness"] phyloBC[5, i] <- phyloBC.ladinian$BC_observed["Biogeographic_connectedness"] phyloBC[6, i] <- phyloBC.earlyLateTriassic$BC_observed["Biogeographic_connectedness"] phyloBC[7, i] <- phyloBC.lateLateTriassic$BC_observed["Biogeographic_connectedness"] phyloBC[8, i] <- phyloBC.earlyEarlyJurassic$BC_observed["Biogeographic_connectedness"] phyloBC[9, i] <- phyloBC.lateEarlyJurassic$BC_observed["Biogeographic_connectedness"] # Output loop position: cat(i, " ") } #Output results write.table(phyloBC, "k_outputs.txt") #Perform aphylogenetic analyses aphyloBC.lopingian<-BC(lopingian, jackknife = TRUE) aphyloBC.earlyTriassic<-BC(earlyTriassic, jackknife = TRUE) aphyloBC.anisian<-BC(anisian, jackknife = TRUE) aphyloBC.ladinian<-BC(ladinian, jackknife = TRUE) aphyloBC.earlyLateTriassic<-BC(earlyLateTriassic, jackknife = TRUE) aphyloBC.lateLateTriassic<-BC(lateLateTriassic, jackknife = TRUE) aphyloBC.earlyEarlyJurassic<-BC(earlyEarlyJurassic, jackknife = TRUE) aphyloBC.lateEarlyJurassic<-BC(lateEarlyJurassic, jackknife = TRUE) #Perform complete phylogenetic analyses on 100 dated trees #Generate 100 dated trees with random resolution of polytomies trees<-timePaleoPhy(tree=complete.tree, timeData=taxon.ages, type="mbl", ntrees=100, vartime=1, randres=TRUE) #Analyses across 100 trees for (i in 1:100) { phy<-trees[[i]] lopingian.tree <- ultrametricise(drop.tip(phy, setdiff(complete.tree$tip.label, rownames(lopingian)))) earlyTriassic.tree <- ultrametricise(drop.tip(phy, setdiff(complete.tree$tip.label, rownames(earlyTriassic)))) anisian.tree <- ultrametricise(drop.tip(phy, setdiff(complete.tree$tip.label, rownames(anisian)))) ladinian.tree <- ultrametricise(drop.tip(phy, setdiff(complete.tree$tip.label, rownames(ladinian)))) earlyLateTriassic.tree <- ultrametricise(drop.tip(phy, setdiff(complete.tree$tip.label, rownames(earlyLateTriassic)))) lateLateTriassic.tree <- ultrametricise(drop.tip(phy, setdiff(complete.tree$tip.label, rownames(lateLateTriassic)))) earlyEarlyJurassic.tree <- ultrametricise(drop.tip(phy, setdiff(complete.tree$tip.label, rownames(earlyEarlyJurassic)))) lateEarlyJurassic.tree <- ultrametricise(drop.tip(phy, setdiff(complete.tree$tip.label, rownames(lateEarlyJurassic)))) phyloBC.lopingian<-BC(lopingian, lopingian.tree, jackknife = TRUE, k=15) phyloBC.earlyTriassic<-BC(earlyTriassic, earlyTriassic.tree, jackknife = TRUE, k=15) phyloBC.anisian<-BC(anisian, anisian.tree, jackknife = TRUE, k=15) phyloBC.ladinian<-BC(ladinian, ladinian.tree, jackknife = TRUE, k=15) phyloBC.earlyLateTriassic<-BC(earlyLateTriassic, earlyLateTriassic.tree, jackknife = TRUE, k=15) phyloBC.lateLateTriassic<-BC(lateLateTriassic, lateLateTriassic.tree, jackknife = TRUE, k=15) phyloBC.earlyEarlyJurassic<-BC(earlyEarlyJurassic, earlyEarlyJurassic.tree, jackknife = TRUE, k=15) phyloBC.lateEarlyJurassic<-BC(lateEarlyJurassic, lateEarlyJurassic.tree, jackknife = TRUE, k=15) print(i) } #Analyses of Laurasian and Gondwanan BC separately #Read in Laurasian datasets lopingian.laurasia<-as.matrix(read.table("lopingianLaurasia.txt", header=TRUE, row.names=1, sep="\t")) earlyTriassic.laurasia<-as.matrix(read.table("earlyTriassicLaurasia.txt", header=TRUE, row.names=1, sep="\t")) anisian.laurasia<-as.matrix(read.table("anisianLaurasia.txt", header=TRUE, row.names=1, sep="\t")) ladinian.laurasia<-as.matrix(read.table("ladinianLaurasia.txt", header=TRUE, row.names=1, sep="\t")) earlyLateTriassic.laurasia<-as.matrix(read.table("earlyLateTriassicLaurasia.txt", header=TRUE, row.names=1, sep="\t")) lateLateTriassic.laurasia<-as.matrix(read.table("lateLateTriassicLaurasia.txt", header=TRUE, row.names=1, sep="\t")) earlyEarlyJurassic.laurasia<-as.matrix(read.table("earlyEarlyJurassicLaurasia.txt", header=TRUE, row.names=1, sep="\t")) lateEarlyJurassic.laurasia<-as.matrix(read.table("lateEarlyJurassicLaurasia.txt", header=TRUE, row.names=1, sep="\t")) #Read in Gondwanan datasets lopingian.gondwana<-as.matrix(read.table("lopingianGondwana.txt", header=TRUE, row.names=1, sep="\t")) earlyTriassic.gondwana<-as.matrix(read.table("earlyTriassicGondwana.txt", header=TRUE, row.names=1, sep="\t")) anisian.gondwana<-as.matrix(read.table("anisianGondwana.txt", header=TRUE, row.names=1, sep="\t")) ladinian.gondwana<-as.matrix(read.table("ladinianGondwana.txt", header=TRUE, row.names=1, sep="\t")) earlyLateTriassic.gondwana<-as.matrix(read.table("earlyLateTriassicGondwana.txt", header=TRUE, row.names=1, sep="\t")) lateLateTriassic.gondwana<-as.matrix(read.table("lateLateTriassicGondwana.txt", header=TRUE, row.names=1, sep="\t")) earlyEarlyJurassic.gondwana<-as.matrix(read.table("earlyEarlyJurassicGondwana.txt", header=TRUE, row.names=1, sep="\t")) lateEarlyJurassic.gondwana<-as.matrix(read.table("lateEarlyJurassicGondwana.txt", header=TRUE, row.names=1, sep="\t")) #Laurasia analyses for (i in 1:100) { phy<-trees[[i]] lopingian.tree_laurasia <- ultrametricise(drop.tip(phy, setdiff(complete.tree$tip.label, rownames(lopingian.laurasia)))) earlyTriassic.tree_laurasia <- ultrametricise(drop.tip(phy, setdiff(complete.tree$tip.label, rownames(earlyTriassic.laurasia)))) anisian.tree_laurasia <- ultrametricise(drop.tip(phy, setdiff(complete.tree$tip.label, rownames(anisian.laurasia)))) ladinian.tree_laurasia <- ultrametricise(drop.tip(phy, setdiff(complete.tree$tip.label, rownames(ladinian.laurasia)))) earlyLateTriassic.tree_laurasia <- ultrametricise(drop.tip(phy, setdiff(complete.tree$tip.label, rownames(earlyLateTriassic.laurasia)))) lateLateTriassic.tree_laurasia <- ultrametricise(drop.tip(phy, setdiff(complete.tree$tip.label, rownames(lateLateTriassic.laurasia)))) earlyEarlyJurassic.tree_laurasia <- ultrametricise(drop.tip(phy, setdiff(complete.tree$tip.label, rownames(earlyEarlyJurassic.laurasia)))) lateEarlyJurassic.tree_laurasia <- ultrametricise(drop.tip(phy, setdiff(complete.tree$tip.label, rownames(lateEarlyJurassic.laurasia)))) phyloBC.lopingian_laurasia<-BC(lopingian.laurasia, lopingian.tree_laurasia, jackknife = TRUE, k=15) phyloBC.earlyTriassic_laurasia<-BC(earlyTriassic.laurasia, earlyTriassic.tree_laurasia, jackknife = TRUE, k=15) phyloBC.anisian_laurasia<-BC(anisian.laurasia, anisian.tree_laurasia, jackknife = TRUE, k=15) phyloBC.ladinian_laurasia<-BC(ladinian.laurasia, ladinian.tree_laurasia, jackknife = TRUE, k=15) phyloBC.earlyLateTriassic_laurasia<-BC(earlyLateTriassic.laurasia, earlyLateTriassic.tree_laurasia, jackknife = TRUE, k=15) phyloBC.lateLateTriassic_laurasia<-BC(lateLateTriassic.laurasia, lateLateTriassic.tree_laurasia, jackknife = TRUE, k=15) phyloBC.earlyEarlyJurassic_laurasia<-BC(earlyEarlyJurassic.laurasia, earlyEarlyJurassic.tree_laurasia, jackknife = TRUE, k=15) phyloBC.lateEarlyJurassic_laurasia<-BC(lateEarlyJurassic.laurasia, lateEarlyJurassic.tree_laurasia, jackknife = TRUE, k=15) print(i) } #Gondwana analyses for (i in 1:100) { phy<-trees[[i]] lopingian.tree_gondwana <- ultrametricise(drop.tip(phy, setdiff(complete.tree$tip.label, rownames(lopingian.gondwana)))) earlyTriassic.tree_gondwana <- ultrametricise(drop.tip(phy, setdiff(complete.tree$tip.label, rownames(earlyTriassic.gondwana)))) anisian.tree_gondwana <- ultrametricise(drop.tip(phy, setdiff(complete.tree$tip.label, rownames(anisian.gondwana)))) ladinian.tree_gondwana <- ultrametricise(drop.tip(phy, setdiff(complete.tree$tip.label, rownames(ladinian.gondwana)))) earlyLateTriassic.tree_gondwana <- ultrametricise(drop.tip(phy, setdiff(complete.tree$tip.label, rownames(earlyLateTriassic.gondwana)))) lateLateTriassic.tree_gondwana <- ultrametricise(drop.tip(phy, setdiff(complete.tree$tip.label, rownames(lateLateTriassic.gondwana)))) earlyEarlyJurassic.tree_gondwana <- ultrametricise(drop.tip(phy, setdiff(complete.tree$tip.label, rownames(earlyEarlyJurassic.gondwana)))) lateEarlyJurassic.tree_gondwana <- ultrametricise(drop.tip(phy, setdiff(complete.tree$tip.label, rownames(lateEarlyJurassic.gondwana)))) phyloBC.lopingian_gondwana<-BC(lopingian.gondwana, lopingian.tree_gondwana, jackknife = TRUE, k=15) phyloBC.earlyTriassic_gondwana<-BC(earlyTriassic.gondwana, earlyTriassic.tree_gondwana, jackknife = TRUE, k=15) phyloBC.anisian_gondwana<-BC(anisian.gondwana, anisian.tree_gondwana, jackknife = TRUE, k=15) phyloBC.ladinian_gondwana<-BC(ladinian.gondwana, ladinian.tree_gondwana, jackknife = TRUE, k=15) phyloBC.earlyLateTriassic_gondwana<-BC(earlyLateTriassic.gondwana, earlyLateTriassic.tree_gondwana, jackknife = TRUE, k=15) phyloBC.lateLateTriassic_gondwana<-BC(lateLateTriassic.gondwana, lateLateTriassic.tree_gondwana, jackknife = TRUE, k=15) phyloBC.earlyEarlyJurassic_gondwana<-BC(earlyEarlyJurassic.gondwana, earlyEarlyJurassic.tree_gondwana, jackknife = TRUE, k=15) phyloBC.lateEarlyJurassic_gondwana<-BC(lateEarlyJurassic.gondwana, lateEarlyJurassic.tree_gondwana, jackknife = TRUE, k=15) print(i) } #Read in cross-extinction subset analyses #Minimum-size lower-level (~family) surviving clades lopingian.survivors_min<-as.matrix(read.table("lopingianSurvsMin.txt", header=TRUE, row.names=1, sep="\t")) earlyTriassic.survivors_min<-as.matrix(read.table("earlyTriassicSurvsMin.txt", header=TRUE, row.names=1, sep="\t")) lateLateTriassic.survivors_min<-as.matrix(read.table("lateLateTriassicSurvsMin.txt", header=TRUE, row.names=1, sep="\t")) earlyEarlyJurassic.survivors_min<-as.matrix(read.table("earlyJurassicSurvsMin.txt", header=TRUE, row.names=1, sep="\t")) #Maximum-size lower-level (~family) surviving clades - only difference is in pre-extinction plots, as taxon content for post-extinction time bins will equal the minimum estimate lopingian.survivors_max<-as.matrix(read.table("lopingianSurvsMax.txt", header=TRUE, row.names=1, sep="\t")) lateLateTriassic.survivors_max<-as.matrix(read.table("lateLateTriassicSurvsMax.txt", header=TRUE, row.names=1, sep="\t")) #Analysis of these subsets for (i in 1:100) { phy<-trees[[i]] lopingian.tree_min <- ultrametricise(drop.tip(phy, setdiff(complete.tree$tip.label, rownames(lopingian.survivors_min)))) earlyTriassic.tree_min <- ultrametricise(drop.tip(phy, setdiff(complete.tree$tip.label, rownames(earlyTriassic.survivors_min)))) lateLateTriassic.tree_min <- ultrametricise(drop.tip(phy, setdiff(complete.tree$tip.label, rownames(lateLateTriassic.survivors_min)))) earlyEarlyJurassic.tree_min <- ultrametricise(drop.tip(phy, setdiff(complete.tree$tip.label, rownames(earlyEarlyJurassic.survivors_min)))) lopingian.tree_max <- ultrametricise(drop.tip(phy, setdiff(complete.tree$tip.label, rownames(lopingian.survivors_max)))) lateLateTriassic.tree_max <- ultrametricise(drop.tip(phy, setdiff(complete.tree$tip.label, rownames(lateLateTriassic.survivors_max)))) phyloBC.lopingian_min<-BC(lopingian.survivors_min, lopingian.tree_min, jackknife = TRUE, k=15) phyloBC.earlyTriassic_min<-BC(earlyTriassic.survivors_min, earlyTriassic.tree_min, jackknife = TRUE, k=15) phyloBC.lateLateTriassic_min<-BC(lateLateTriassic.survivors_min, lateLateTriassic.tree_min, jackknife = TRUE, k=15) phyloBC.earlyEarlyJurassic_min<-BC(earlyEarlyJurassic.survivors_min, earlyEarlyJurassic.tree_min, jackknife = TRUE, k=15) phyloBC.lopingian_max<-BC(lopingian.survivors_max, lopingian.tree_max, jackknife = TRUE, k=15) phyloBC.lateLateTriassic_miax<-BC(lateLateTriassic.survivors_max, lateLateTriassic.tree_max, jackknife = TRUE, k=15) print(i) } #Perform analyss of youngest clades in all time bines #Analyses of only clades diverging <2Ma prior to and after the boundary #Read in matrices lopingian<-as.matrix(read.table("lopingianSurvs2.txt", header=TRUE, row.names=1, sep="\t")) earlyTriassic<-as.matrix(read.table("earlyTriassicSurvs2.txt", header=TRUE, row.names=1, sep="\t")) anisian<-as.matrix(read.table("anisianSurvs2.txt", header=TRUE, row.names=1, sep="\t")) ladinian<-as.matrix(read.table("ladinianSurvs2.txt", header=TRUE, row.names=1, sep="\t")) midTriassic<-as.matrix(read.table("middleTriassicSurvs2.txt", header=TRUE, row.names=1, sep="\t")) earlyLateTriassic<-as.matrix(read.table("earlyLateTriassicSurvs2.txt", header=TRUE, row.names=1, sep="\t")) lateLateTriassic<-as.matrix(read.table("lateLateTriassicSurvs2.txt", header=TRUE, row.names=1, sep="\t")) lateTriassic<-as.matrix(read.table("lateTriassicSurvs2.txt", header=TRUE, row.names=1, sep="\t")) earlyEarlyJurassic<-as.matrix(read.table("earlyEarlyJurassicSurvs2.txt", header=TRUE, row.names=1, sep="\t")) lateEarlyJurassic<-as.matrix(read.table("lateEarlyJurassicSurvs2.txt", header=TRUE, row.names=1, sep="\t")) earlyJurassic<-as.matrix(read.table("earlyJurassicSurvs2.txt", header=TRUE, row.names=1, sep="\t")) #Perform analyses for (i in 1:100) { phy<-trees[[i]] lopingian.tree <- ultrametricise(drop.tip(phy, setdiff(complete.tree$tip.label, rownames(lopingian)))) earlyTriassic.tree <- ultrametricise(drop.tip(phy, setdiff(complete.tree$tip.label, rownames(earlyTriassic)))) anisian.tree <- ultrametricise(drop.tip(phy, setdiff(complete.tree$tip.label, rownames(anisian)))) ladinian.tree <- ultrametricise(drop.tip(phy, setdiff(complete.tree$tip.label, rownames(ladinian)))) midTriassic.tree <- ultrametricise(drop.tip(phy, setdiff(complete.tree$tip.label, rownames(midTriassic)))) earlyLateTriassic.tree <- ultrametricise(drop.tip(phy, setdiff(complete.tree$tip.label, rownames(earlyLateTriassic)))) lateLateTriassic.tree <- ultrametricise(drop.tip(phy, setdiff(complete.tree$tip.label, rownames(lateLateTriassic)))) lateTriassic.tree <- ultrametricise(drop.tip(phy, setdiff(complete.tree$tip.label, rownames(lateTriassic)))) earlyEarlyJurassic.tree <- ultrametricise(drop.tip(phy, setdiff(complete.tree$tip.label, rownames(earlyEarlyJurassic)))) lateEarlyJurassic.tree <- ultrametricise(drop.tip(phy, setdiff(complete.tree$tip.label, rownames(lateEarlyJurassic)))) earlyJurassic.tree <- ultrametricise(drop.tip(phy, setdiff(complete.tree$tip.label, rownames(earlyJurassic)))) phyloBC.lopingian<-BC(lopingian, lopingian.tree, jackknife = TRUE, k=15) phyloBC.earlyTriassic<-BC(earlyTriassic, earlyTriassic.tree, jackknife = TRUE, k=15) phyloBC.anisian<-BC(anisian, anisian.tree, jackknife = TRUE, k=15) phyloBC.ladinian<-BC(ladinian, ladinian.tree, jackknife = TRUE, k=15) phyloBC.midTriassic<-BC(midTriassic, midTriassic.tree, jackknife = TRUE, k=15) phyloBC.earlyLateTriassic<-BC(earlyLateTriassic, earlyLateTriassic.tree, jackknife = TRUE, k=15) phyloBC.lateLateTriassic<-BC(lateLateTriassic, lateLateTriassic.tree, jackknife = TRUE, k=15) phyloBC.lateTriassic<-BC(lateTriassic, lateTriassic.tree, jackknife = TRUE, k=15) phyloBC.earlyEarlyJurassic<-BC(earlyEarlyJurassic, earlyEarlyJurassic.tree, jackknife = TRUE, k=15) phyloBC.lateEarlyJurassic<-BC(lateEarlyJurassic, lateEarlyJurassic.tree, jackknife = TRUE, k=15) phyloBC.earlyJurassic<-BC(earlyJurassic, earlyJurassic.tree, jackknife = TRUE, k=15) print(i) } #Perform pBC reanalysis of Sidor et al. (2013) datasets for comparison permianSidor<-as.matrix(read.table("permianSidor.txt", row.names=1, sep="\t")) triassicSidor<-as.matrix(read.table("triassicSidor.txt", row.names=1, sep="\t")) for (i in 1:100) { phy<-trees[[i]] permianSidor.tree <- ultrametricise(drop.tip(phy, setdiff(complete.tree$tip.label, rownames(permianSidor)))) triassicSidor.tree <- ultrametricise(drop.tip(phy, setdiff(complete.tree$tip.label, rownames(triassicSidor)))) phyloBC.lopingian<-BC(permianSidor, permianSidor.tree, jackknife = TRUE, k=15) phyloBC.earlyTriassic<-BC(triassicSidor, triassicSidor.tree, jackknife = TRUE, k=15) print(i) }