very basic: how to run ete3 script on Linux terminal?

45 visualizzazioni
Passa al primo messaggio da leggere

Tatyana Livshultz

da leggere,
27 lug 2022, 13:14:5527/07/22
a The ETE toolkit
Hello:

I just installed ete3 on a Linux cluster. I give the following commands:

(base) $ conda activate ete3
(ete3) $ python ete3_example.py 

And I get a syntax error:

 File "ete3_example.py", line 8
    print t.write() # (A:1.000000,(B:1.000000,(E:1.000000,D:1.000000)1.000000:0.500000)1.000000:0.500000);
          ^
SyntaxError: invalid syntax

ete3_example.py is a script copied from the ete3 tutorial. (See below.)

I thought that ete3 is a python library?
 
If not, how do I run ete3 scripts?

Can I integrate ete3  functions into a python script?

Thank you very much for your help.

Tanya

ete3_example.py

from ete3 import Tree

# Loads a tree with internal node names
t = Tree("(A:1,(B:1,(E:1,D:1)Internal_1:0.5)Internal_2:0.5)Root;", format=1)

# And prints its newick using the default format

print t.write() # (A:1.000000,(B:1.000000,(E:1.000000,D:1.000000)1.000000:0.500000)1.000000:0.500000);

# To print the internal node names you need to change the format:

print t.write(format=1) # (A:1.000000,(B:1.000000,(E:1.000000,D:1.000000)Internal_1:0.500000)Internal_2:0.500000);

# We can also write into a file
t.write(format=1, outfile="new_tree.nw")

Tatyana Livshultz

da leggere,
28 lug 2022, 03:21:3128/07/22
a The ETE toolkit
A colleague explained to me that the example scripts on http://etetoolkit.org/docs/latest/tutorial/index.html are written in python 2 not python 3.  Are there example scripts in python 3 available?

Thanks,
Tanya

dengzi...@gmail.com

da leggere,
13 ago 2022, 14:47:5013/08/22
a The ETE toolkit
Hi Tanya!
our example code are mostly python 2 but ete3 is python 3 friendly.
so just change the print  into print(), it will show the content.

for example
print(t.write())

best,
Ziqi
Rispondi a tutti
Rispondi all'autore
Inoltra
0 nuovi messaggi