-
Notifications
You must be signed in to change notification settings - Fork 2
/
rfdist.py
48 lines (36 loc) · 1.64 KB
/
rfdist.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import dendropy
import pandas as pd
## import ml tree and sample of trees to compare against it
ang_ml = dendropy.Tree.get_from_path('ang_ml.tre','nexus')
angtrees = dendropy.TreeList.get_from_path('subtrees/angtrees.tre','newick')
angrf = []
for tree in angtrees:
angrf.append(ang_ml.symmetric_difference(tree))
## repeat for other subtrees
gek_ml = dendropy.Tree.get_from_path('mltree/gek_ml.tre','nexus')
gektrees = dendropy.TreeList.get_from_path('subtrees/gektrees.tre','newick')
gekrf = []
for gek in gektrees:
gekrf.append(gek_ml.symmetric_difference(gek))
igu_ml = dendropy.Tree.get_from_path('mltree/igu_ml.tre','nexus')
igutrees = dendropy.TreeList.get_from_path('subtrees/igutrees.tre','newick')
igurf = []
for tree in igutrees:
igurf.append(igu_ml.symmetric_difference(tree))
lac_ml = dendropy.Tree.get_from_path('mltree/lac_ml.tre','nexus')
lactrees = dendropy.TreeList.get_from_path('subtrees/lactrees.tre','newick')
lacrf = []
for tree in lactrees:
lacrf.append(lac_ml.symmetric_difference(tree))
ser_ml = dendropy.Tree.get_from_path('mltree/ser_ml.tre','nexus')
sertrees = dendropy.TreeList.get_from_path('subtrees/sertrees.tre','newick')
serrf = []
for tree in sertrees:
serrf.append(ser_ml.symmetric_difference(tree))
sci_ml = dendropy.Tree.get_from_path('mltree/sci_ml.tre','nexus')
scitrees = dendropy.TreeList.get_from_path('subtrees/scitrees.tre','newick')
scirf = []
for tree in scitrees:
scirf.append(sci_ml.symmetric_difference(tree))
df = pd.DataFrame.from_items([('Total', total_rf), ('Anguimorphs', angrf), ('Gekkos', gekrf), ('Iguanids', igurf), ('Lacertids', lacrf), ('Snakes', serrf), ('Skinks', scirf)])
df.to_csv('all_data.csv')