#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("geiger", "dtt", "ratematrix", "sim.char", "treedata")
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("methods", "hasArg", "is", "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("utils", "combn", "data", "capture.output", "tail")
importFrom("vegan", "adonis", "vegdist")
importFrom("scales", "rescale")
importFrom("parallel", "parLapply", "detectCores", "makeCluster", "clusterExport", "stopCluster")
# importFrom("geomorph", "gpagen")
# importFrom("RCurl", "getURL", "url.exists")

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

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

##Functions
export(boot.matrix)
export(chrono.subsets)
export(custom.subsets)
export(dispRity)
export(dispRity.per.group)
export(dispRity.through.time)
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(deviations)
export(diagonal)
export(dimension.level1.fun)
export(dimension.level2.fun)
export(dimension.level3.fun)
export(displacements)
export(ellipse.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.tree)
export(quantiles)
export(radius)
export(ranges)
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(randtest.dispRity)
# export(sequential.test)

##dispRity object utilities
export(combine.subsets)
export(extinction.subsets)
export(extract.dispRity)
export(fill.dispRity)
export(get.subsets)
export(n.subsets)
export(make.dispRity)
export(matrix.dispRity)
export(rescale.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(pair.plot)
export(random.circle)
export(reduce.matrix)
export(reduce.space)
export(remove.zero.brlen)
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(adonis, dispRity)
S3method(dtt, dispRity)
S3method(matrix, dispRity)
S3method(plot, char.diff)
S3method(plot, dispRity)
S3method(print, dispRity)
S3method(sort, dispRity)
S3method(summary, dispRity)
