#Dependencies
import(ape)
import(stats)

importFrom("ade4", "randtest", "as.randtest")
importFrom("castor", "get_subtree_with_tips", "get_all_pairwise_distances", "get_all_distances_to_root", "asr_mk_model")
importFrom("Claddis", "calculate_morphological_distances")
importFrom("ellipse", "ellipse")
importFrom("geometry", "convhulln", "dot")
importFrom("graphics", "abline", "axis", "boxplot", "hist", "image", "lines", "mtext", "par", "plot", "points", "polygon", "text", "layout", "legend", "barplot")
importFrom("grDevices", "colorRampPalette", "grey", "hcl", "heat.colors", "adjustcolor")
importFrom("MASS", "mvrnorm")
importFrom("methods", "hasArg", "formalArgs", "is")
importFrom("mnormt", "dmnorm", "rmnorm")
# importFrom("paleotree", "timeSliceTree")
importFrom("phangorn", "dist.hamming", "NJ", "RF.dist", "CI", "RI", "optim.parsimony", "parsimony")
importFrom("phyclust", "gen.seq.HKY")
importFrom("phylolm", "phylolm")
importFrom("utils", "combn", "data", "capture.output", "tail")
importFrom("vegan", "adonis2", "vegdist")
importFrom("scales", "rescale")
importFrom("GET", "create_curve_set", "rank_envelope")
importFrom("parallel", "parLapply", "detectCores", "makeCluster", "clusterExport", "stopCluster")
importFrom("zoo", "rollmean")
# importFrom("geomorph", "gpagen")
# importFrom("RCurl", "getURL", "url.exists")

##C libraries
useDynLib(dispRity, .registration = TRUE)

## Data utilities
export(Claddis.ordination)
export(geomorph.ordination)
export(select.axes)

##Functions
export(boot.matrix)
export(chrono.subsets)
export(custom.subsets)
export(covar.plot)
export(dispRity)
export(dispRity.fast)
export(dispRity.covar.projections)
export(dispRity.per.group)
export(dispRity.through.time)
export(MCMCglmm.subsets)
export(plot.dispRity)
export(print.dispRity)
export(summary.dispRity)
export(test.dispRity)
export(test.metric)

##disparity metrics
export(ancestral.dist)
export(angles)
export(centroids)
export(convhull.volume)
export(convhull.surface)
export(count.neighbours)
export(deviations)
export(diagonal)
export(dimension.level1.fun)
export(dimension.level2.fun)
export(dimension.level3.fun)
export(disalignment)
export(displacements)
export(ellipse.volume) # alias for ellipsoid.volume
export(ellipsoid.volume)
export(edge.length.tree)
export(func.div)
export(func.eve)
export(group.dist)
export(mode.val)
export(n.ball.volume)
export(neighbours)
export(pairwise.dist)
export(point.dist)
export(projections)
export(projections.between)
export(projections.tree)
export(quantiles)
export(radius)
export(ranges)
export(roundness)
export(span.tree.length)
export(variances)

##disparity tests
export(adonis.dispRity)
export(bhatt.coeff)
export(dtt.dispRity)
export(model.test)
export(model.test.sim)
export(model.test.wrapper)
export(null.test)
export(pgls.dispRity)
export(randtest.dispRity)
# export(sequential.test)

##dispRity object utilities
export(as.covar)
export(axis.covar)
export(combine.subsets)
export(extinction.subsets)
export(fill.dispRity)
export(get.disparity)
export(get.matrix)
export(get.subsets)
export(get.covar)
export(n.subsets)
export(make.dispRity)
export(name.subsets)
export(remove.dispRity)
export(rescale.dispRity) # alias for scale
export(scale.dispRity)
export(size.subsets)
export(sort.dispRity)
export(add.tree)
export(get.tree)
export(remove.tree)

##Package utilities
export(clean.data)
export(crown.stem)
export(get.bin.ages)
export(make.metric)
export(match.tip.edge)
export(MCMCglmm.traits)
export(MCMCglmm.levels)
export(MCMCglmm.sample)
export(MCMCglmm.covars)
export(MCMCglmm.variance)
export(pair.plot)
export(random.circle)
export(distance.randtest)
export(reduce.matrix)
export(reduce.space)
export(remove.zero.brlen)
export(set.root.time)
export(slice.tree)
export(slide.nodes)
export(space.maker)
export(tree.age)

##Morphological data analysis
export(apply.NA)
export(char.diff)
export(plot.char.diff)
export(check.morpho)
export(get.contrast.matrix)
export(sim.morpho)
export(multi.ace)

##S3
S3method(scale, dispRity)
S3method(matrix, dispRity)
S3method(plot, char.diff)
S3method(plot, dispRity)
S3method(print, dispRity)
S3method(sort, dispRity)
S3method(summary, dispRity)
