<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Notebook to get a quick estimate of the number of nodes that differ between two trees.
Step1:  Read in data.
Step2:  Calculate Robinson-Foulds distance, and tree length.
Step3:  Calculate RF score, pairwise over all trees in sample.
<ASSISTANT_TASK:>
Python Code:
import dendropy
from dendropy.utility.fileutils import find_files
import numpy as np
Explanation: Notebook to get a quick estimate of the number of nodes that differ between two trees.
End of explanation
taxa = dendropy.TaxonSet()
ours = dendropy.Tree.get_from_path('../best.phy', 'newick', taxon_set=taxa)
Explanation: Read in data.
End of explanation
non_ml = dendropy.Tree.get_from_path('../Trees/MLE/ExaML_result.SquamataPyron.MLE.2b', 'newick', taxon_set = taxa)
print ours.length()
print non_ml.length()
print ours.symmetric_difference(non_ml)
taxa = dendropy.TaxonSet()
pb = dendropy.Tree.get_from_path('../Trees/TotalOptimization/Ranked/2598364', 'nexus', taxon_set=taxa)
rfs = [tree.symmetric_difference(pb_o) for tree in uotrees]
rfs
olist = find_files(top='garli_opt/', filename_filter='*.tre')
print olist
otrees = [dendropy.Tree.get_from_path(filename, "nexus") for filename in olist]
Explanation: Calculate Robinson-Foulds distance, and tree length.
End of explanation
n = len(uotrees)
udiffarray = np.zeros((n,n))
for i, ele1 in enumerate(uotrees):
    for j, ele2 in enumerate(uotrees):
        if j >= i:
            break # Since the matrix is symmetrical we don't need to
                  # calculate everything
        difference = ele1.symmetric_difference(ele2) 
        udiffarray[i, j] = difference
        udiffarray[j, i] = difference
diffarray
diffarray
o_tl = [tree.length() for tree in otrees]
print o_tl
uo_tl = [mle.length() for mle in uotrees]
print uo_tl
Explanation: Calculate RF score, pairwise over all trees in sample.
End of explanation
<END_TASK>