![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
how to construct phylogenetic tree using SNPs | tianyub836 | Bioinformatics | 10 | 05-21-2013 07:27 AM |
Why is ML/NJ phylogeny different from SNP tree? | Salmon | Bioinformatics | 2 | 01-21-2013 10:38 PM |
How can I parse these reads | yksikaksi | Bioinformatics | 5 | 04-26-2012 11:24 AM |
phylogenetic tree | renesh | Bioinformatics | 7 | 03-20-2012 09:24 AM |
CREST/perl module Tree::Interval | flipwell | Bioinformatics | 2 | 08-15-2011 05:48 PM |
![]() |
|
Thread Tools |
![]() |
#1 |
Senior Member
Location: Stuttgart, Germany Join Date: Apr 2010
Posts: 192
|
![]()
Hey there,
I am searching for script which extract the node labels from a given newick String. Is there any tool available at the internet, or maybe someone of you guys can help me... Best, Phil |
![]() |
![]() |
![]() |
#2 |
Peter (Biopython etc)
Location: Dundee, Scotland, UK Join Date: Jul 2009
Posts: 1,543
|
![]()
There are several options available - which programing language are you happiest with? If Python, then Biopython includes a Newick parser.
Also it would help if you could clarify exactly what you want to get out - just a list of the node labels, throwing away the tree structure? |
![]() |
![]() |
![]() |
#3 |
Senior Member
Location: Stuttgart, Germany Join Date: Apr 2010
Posts: 192
|
![]()
I just want to have the labels. Tree structure can be thrown away... Python is fine...
|
![]() |
![]() |
![]() |
#4 |
Peter (Biopython etc)
Location: Dundee, Scotland, UK Join Date: Jul 2009
Posts: 1,543
|
![]()
If there are internal node labels, do you want the terminal (leaf) names only?
e.g. Using Biopython Code:
from Bio import Phylo tree = Phylo.read("int_node_labels.nwk", "newick") for leaf in tree.get_terminals(): print leaf.name Last edited by maubp; 05-24-2012 at 07:27 AM. Reason: Adding script |
![]() |
![]() |
![]() |
#5 |
Senior Member
Location: Stuttgart, Germany Join Date: Apr 2010
Posts: 192
|
![]()
Internal as well would be great...
|
![]() |
![]() |
![]() |
#6 |
Peter (Biopython etc)
Location: Dundee, Scotland, UK Join Date: Jul 2009
Posts: 1,543
|
![]()
For just the internal nodes,
Code:
from Bio import Phylo tree = Phylo.read("int_node_labels.nwk", "newick") for node in tree.get_nonterminals(): print node.name Code:
from Bio import Phylo tree = Phylo.read("int_node_labels.nwk", "newick") for node in tree.find_clades(): #Don't print anything if there is no name if node.name: print node.name |
![]() |
![]() |
![]() |
#7 |
Senior Member
Location: Stuttgart, Germany Join Date: Apr 2010
Posts: 192
|
![]()
thanks alot!
|
![]() |
![]() |
![]() |
Thread Tools | |
|
|