Extract labels (names) from a Newick file.
Input:
- A Newick tree file.
Notes:
- By default, prints all non-empty labels in Newick order, one per line.
- Use
--rootto print only the root label. - Use
--tab/-tto print labels on a single line separated by tabs. - Use
-Ito exclude internal nodes and-Lto exclude leaf nodes. - Selection options (
-n,-l,-x) can be combined. - With
-D, descendants of selected internal nodes are also included. -Mverifies that the selected nodes form a clade with at least two nodes.- Duplicate node names may affect selection and clade checks.
- Extra columns (
-c/--column):dup: duplicate the node name.taxid::T=field from the comment.species::S=field from the comment.full: full comment.
Examples:
-
List all labels
necom nwk label tree.nwk -
Count leaves
necom nwk label tree.nwk -I | wc -l -
List specific nodes
necom nwk label tree.nwk -n Human -n Chimp -
List labels matching a regex
necom nwk label tree.nwk -x "^Homo" -
Check clade
necom nwk label tree.nwk -n Human -n Chimp -M