evolbioinfo / gotree

Gotree is a set of command line tools and an API to manipulate phylogenetic trees. It is implemented in Go language.
GNU General Public License v2.0
118 stars 15 forks source link

Output list of taxon labels? #13

Closed tseemann closed 3 years ago

tseemann commented 3 years ago

I want to emulate nw_labels -I whicj prints each tip label (not internal nodes) labels one per line.

But I have looked many times over but can not see how to do this in gotree.

Hope you can point me in the right direction.

So ((A,B),C( woukld print

A
B
C
fredericlemoine commented 3 years ago

Hi,

Would gotree stats tips work? You should select the 4th column, and maybe remove the header : gotree stats tips -i <tree> | cut -f 4 | tail -n+2

tseemann commented 3 years ago

Yes, that does work, thank you.

I will use that in my script for now.

But I tjink listing all tap or internal labels is a standard/fundamental operation that deserves its own labels command perhaps.

fredericlemoine commented 3 years ago

I just added the "labels" command, it works like that:

$ echo "((Tip4,(Tip7,Tip2)),Tip0,((Tip8,(Tip9,Tip3)),((Tip6,Tip5),Tip1)));" | gotree labels
Tip4
Tip7
Tip2
Tip0
Tip8
Tip9
Tip3
Tip6
Tip5
Tip1