Skip to content
Snippets Groups Projects
Commit dfa125c8 authored by Lingling Jin (lij313)'s avatar Lingling Jin (lij313)
Browse files

revisions to work with self-median monoploid genome

parent d78a1cad
No related branches found
No related tags found
No related merge requests found
#genomeID genomeName ancestor numChr #genomeID genomeName ancestor numChr
64965 Vitis 1 19 64965 Vitis 6 19
64962 Prunus 1 8 64962 Prunus 6 8
64734 Quillaja 2 14 64734 Quillaja 5 14
64742 Cercis 3 7 64742 Cercis 4 7
64767 Sindora 4 12 64767 Sindora 3 12
64768 Senna 5 13 64768 Senna 2 13
64963 Phaseolus 6 11 64963 Phaseolus 1 11
64964 Medicago 6 8 64964 Medicago 1 8
...@@ -154,16 +154,21 @@ class GeneFamily: ...@@ -154,16 +154,21 @@ class GeneFamily:
[leaf1.replace("-", ","), leaf2.replace("-", ","), self.find_other_leaves(leaf1, leaf2, all_leaves)]) [leaf1.replace("-", ","), leaf2.replace("-", ","), self.find_other_leaves(leaf1, leaf2, all_leaves)])
newick_tree = newick_tree.replace(newick_tree[last_left: first_right + 1], leaf_pair) newick_tree = newick_tree.replace(newick_tree[last_left: first_right + 1], leaf_pair)
print("The order of ancestors: ")
print(median_structure[-1]) #print(median_structure)
# print(newick_tree) #print(newick_tree)
first_right = newick_tree.find(")") first_right = newick_tree.find(")")
last_left = newick_tree.rfind("(", 0, first_right) last_left = newick_tree.rfind("(", 0, first_right)
# print("FR "+str(first_right)) # print("FR "+str(first_right))
# print("LL "+str(last_left)) # print("LL "+str(last_left))
print("Confirm ancestors:")
for median in median_structure: print(median)
print()
try: try:
neighbours = newick_tree[last_left + 1: first_right].replace(" ", "") neighbours = newick_tree[last_left + 1: first_right].replace(" ", "")
leaf1, leaf2 = neighbours.split(",") leaf1, leaf2 = neighbours.split(",")
...@@ -200,9 +205,12 @@ class GeneFamily: ...@@ -200,9 +205,12 @@ class GeneFamily:
leaves_to_remove = leaves1 + leaves2 leaves_to_remove = leaves1 + leaves2
other_leaves = [leaf[0] for leaf in all_leaves if leaf[0] not in leaves_to_remove] other_leaves = [leaf[0] for leaf in all_leaves if leaf[0] not in leaves_to_remove]
#print("all leaves")
# print(leaves_to_remove) #print(all_leaves)
# print(other_leaves) #print("leaves to remove")
#print(leaves_to_remove)
#print("other leaves")
#print(other_leaves)
result = ','.join(other_leaves) result = ','.join(other_leaves)
......
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment