# NOT RUN {
data("example.data")
comm=example.data$comm
env=example.data$env
tree=example.data$tree
# since big.memory need to specify a certain folder,
# the following code is set as 'not test'.
# but you may test the code on your computer
# after change the folder path for 'save.wd'.
# }
# NOT RUN {
wd0=getwd()
save.wd=paste0(tempdir(),"/pdbig.ps.bin")
# please change to the folder you want to save the big niche difference matrix.
nworker=2 # parallel computing thread number
pd.big=pdist.big(tree = tree, wd=save.wd, nworker = nworker)
niche.dif=dniche(env = env, comm = comm,
method = "niche.value", nworker = nworker,
out.dist=FALSE,bigmemo=TRUE,nd.wd = save.wd,
nd.spname.file="nd.names.csv")
ds = 0.2 # setting can be changed to explore the best choice
bin.size.limit = 5 # setting can be changed to explore the best choice.
# here, bin.size.limit is set as 5 just for the small example dataset.
# For real data, usually try 12 to 48.
phylobin=taxa.binphy.big(tree = tree, pd.desc = pd.big$pd.file,
pd.spname = pd.big$tip.label, pd.wd = pd.big$pd.wd,
ds = ds, bin.size.limit = bin.size.limit,
nworker = nworker)
sp.bin=phylobin$sp.bin[,3,drop=FALSE]
sp.ra=colMeans(comm/rowSums(comm))
abcut=3
# by abcut, you may remove some species,
# if they are too rare to perform reliable correlation test.
commc=comm[,colSums(comm)>=abcut,drop=FALSE]
dim(commc)
spname.use=colnames(commc)
binps=ps.bin(sp.bin = sp.bin,sp.ra = sp.ra,spname.use = spname.use,
pd.desc = pd.big$pd.file, pd.spname = pd.big$tip.label,
pd.wd = pd.big$pd.wd, nd.list = niche.dif$nd,
nd.spname = niche.dif$names, ndbig.wd = niche.dif$nd.wd,
cor.method = "pearson",r.cut = 0.1, p.cut = 0.05, min.spn = 5)
setwd(wd0)
# }
Run the code above in your browser using DataLab