tree with ete3

This commit is contained in:
manudiv16 2020-05-22 19:58:16 +02:00
parent bfb7c58342
commit 0627ef71c7
2 changed files with 6 additions and 11 deletions

View file

@ -67,7 +67,7 @@ class FastaMap:
sequences = filter(None, fasta.read().split('>'))
for seq in sequences:
rna_id, rna = self._get_rna(seq)
data[rna_id] = rna if len(rna) < 1000 else rna[:1000]
data[rna_id] = rna
return data
def _compare_all_samples(self):

View file

@ -17,20 +17,15 @@ class HierarchyTree:
self._show_tree(str(closest_pair))
def _show_tree(self, tuple_repr):
for key in self.__labels:
tuple_repr = tuple_repr.replace(key, self.__labels[key])
t = Tree(tuple_repr + ";")
ts = TreeStyle()
ts.show_leaf_name = True
ts.mode = "c"
ts.arc_start = -180 # 0 degrees = 3 o'clock
ts.arc_span = 180
t.render("hierarchy.png", tree_style=ts)
ts.branch_vertical_margin = 10
ts.scale = 120
t.show(tree_style=ts)
def __transform(self, value):
value = str(value).translate(
str.maketrans({'(': '', ')': '', "'": ''}))
if self.__labels is None:
return value
return ','.join(map(lambda x: self.__labels[x.strip()], value.split(',')))
@staticmethod
def find_closest_pair(table):