Questions tagged [ete3]

Use for questions related to the ETE toolkit version 3, a Python framework to work with trees.

36 questions
14
votes
4 answers

expected str, bytes or os.PathLike object, not InMemoryUploadedFile

I have a method to read a Newick file and return a String in Django framework which is the following: def handle_uploaded_file(f): output = " " for chunk in f.chunks(): output += chunk.decode('ascii') return output.replace("\n",…
user8577141
7
votes
0 answers

How to remove duplicates in list of objects without __hash__

I have a list of custom objects from which I want to remove the duplicates. Normally, you would do this by defining both __eq__ and __hash__ for your objects and then taking the set of the list of objects. I have defined __eq__, but I can't figure…
BioGeek
  • 21,897
  • 23
  • 83
  • 145
3
votes
1 answer

Adding labels to heatmaps in ete3

I read the whole documentation on profile face heatmap generation but I could not find any way to add labels to the heatmap produced by ete3. For example in the following code, the 7 columns of the heatmap have names 'Marker1' to 'Marker7'. Is there…
Masih
  • 920
  • 2
  • 19
  • 36
3
votes
1 answer

How to color leaves on `ete3` Tree? (Python 3)

I just started using ete3 and it is awesome. How can I color the leaves of an ete3 Tree object using a color dictionary? I made "c":None because I don't want the of c to show up. I want to have better control of the tree render but I can't figure…
O.rka
  • 29,847
  • 68
  • 194
  • 309
2
votes
0 answers

Cannot import name 'TextFace' error while using ETE3 for Phylogeny Tree

I am trying to install ETE3 for phylogeny analysis but while installing it is showing error:cannot import name 'TextFace' I tried all the available options but could not succeed. Any help will be appreciated. PS: I am trying to build Phylogeny tree…
shivam
  • 596
  • 2
  • 9
2
votes
0 answers

Python scripting with ete3 to query NCBI's Taxonomy: "sqlite3 Warning (can only execute one statement at a time)"

I am using this script: import csv import time import sys from ete3 import NCBITaxa ncbi = NCBITaxa() def get_desired_ranks(taxid, desired_ranks): lineage = ncbi.get_lineage(taxid) names = ncbi.get_taxid_translator(lineage) …
ljs
  • 315
  • 2
  • 10
2
votes
2 answers

How to convert from NetworkX graph to ete3 Tree object?

I'm trying to figure out how to build an ete3.Tree object from a networkx directed graph? I added each child in the way I thought would produce the desired result but I am having trouble. edges = [('lvl-1', 'lvl-2.1'), ('lvl-1', 'lvl-2.2'),…
O.rka
  • 29,847
  • 68
  • 194
  • 309
2
votes
1 answer

ete3: How to get taxonomic rank names from taxonomy id?

I want to use this to convert a bunch of identifiers but I need to know exactly which taxonomic rank is assigned to each taxonomy code. Shown below is an example of conversion that makes sense but I don't know what to label some of the taxonomy…
O.rka
  • 29,847
  • 68
  • 194
  • 309
2
votes
0 answers

error using render function ete3 in python

I try to render a tree using ete3 in python. This is my basic code: from ete3 import Tree, TreeStyle t = Tree( "((a,b),c);" ) circular_style = TreeStyle() circular_style.mode = "c" # draw tree in circular mode circular_style.scale =…
K Mdy
  • 33
  • 3
2
votes
0 answers

ete3.TextFace: Leaf label size (fsize) not changing on circular dendrogram (Python 3)

I've been working on a wrapper for ete3 where I can customize the leaf labels (i.e. which leaves have labels shown) and node presence (i.e. which leaf nodes are shown). One part I'm having trouble with is defining a label size. When I try to…
O.rka
  • 29,847
  • 68
  • 194
  • 309
2
votes
1 answer

Using python 3.x how can I pass a Tree object from ete3 to DendroPy without writing to file

I'm using the ete3 package in python to build phylogenetic trees from data I've generated with a stochastic model and it works well. I have previously written these trees to newick format and then used another script, with the package Dendropy, to…
cancerconnector
  • 1,225
  • 2
  • 14
  • 21
1
vote
0 answers

problem generating graphics (argument 1 has unexpected type 'float')

I am trying to generate a phylogenetic tree using this code #!/bin/python3 import re from PIL import Image from PyQt5.QtGui import QImage import sys import ete3 from ete3 import Tree from ete3.treeview import NodeStyle from ete3 import…
1
vote
1 answer

Get ancestor node number with ete3

I would need to get the node number within a tree in ete3. Here is an example of a tree: rooted_tree = Tree( "((A,B),(C,D));" ) print rooted_tree # # /-A # /---| # | \-B #----| # | /-C # \---| # \-D then I…
chippycentra
  • 3,396
  • 1
  • 6
  • 24
1
vote
2 answers

Python / ete3: Target most closely related leaf to a specific species in a phylogenetic tree

I am using the Python package ete3. I have trees such as: ((Species1_order1,(Species2_order2,Species3_order2)),Species4_order3,Species5_order5); I would like to see the most closely related leaf to a specific node in the tree (here the tree is…
Grendel
  • 783
  • 4
  • 12
1
vote
3 answers

Get a table from a print output (pandas)

I ran a programme called codeml implemented in the python package ete3. Here is the print of the model generated by codeml : >>> print(model) Evolutionary Model fb.cluster_03502: log likelihood : -35570.938479 number of…
chippycentra
  • 879
  • 1
  • 6
  • 15
1
2 3