# Load the data
data(mycorrhizal_network)
network <- mycorrhizal_network[[1]] # interaction matrix
tree_orchids <- mycorrhizal_network[[2]] # phylogenetic tree (phylo object)
tree_fungi <- mycorrhizal_network[[3]] # phylogenetic tree (phylo object)
test = FALSE
if(test){
# Using Mantel tests:
# Step 1: Phylogenetic signal in species interactions
# (do closely related species interact with similar partners?)
phylosignal_network(network, tree_A = tree_orchids, tree_B = tree_fungi,
method = "GUniFrac", correlation = "Pearson", nperm = 10000) # measured for both guilds
# Step 2: Phylogenetic signal in species interactions when accouting
# for the signal in the number of partners
# Mantel test with permutations that keep constant the number of partners per species
phylosignal_network(network, tree_A = tree_orchids, tree_B = tree_fungi,
method = "GUniFrac", correlation = "Pearson", nperm = 1000, permutation = "nbpartners")
# Other: Phylogenetic signal in the number of partners
# (do closely related species interact with the same number of partners?)
phylosignal_network(network, tree_A = tree_orchids, method = "degree",
correlation = "Pearson", nperm = 10000) # for guild A
phylosignal_network(t(network), tree_A = tree_fungi, method = "degree",
correlation = "Pearson", nperm = 10000) # for guild B
# Alternative using PBLM (not recommended) - very slow
# phylosignal_network(network, tree_A = tree_orchids, tree_B = tree_fungi, method = "PBLM")
}
Run the code above in your browser using DataLab