Seqanswers Leaderboard Ad

Collapse

Announcement

Collapse
No announcement yet.
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Parse Labels from newick tree

    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
    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?

    Comment


    • #3
      I just want to have the labels. Tree structure can be thrown away... Python is fine...

      Comment


      • #4
        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, 06:27 AM. Reason: Adding script

        Comment


        • #5
          Internal as well would be great...

          Comment


          • #6
            Originally posted by sphil View Post
            Internal as well would be great...
            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
            For everything try:
            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

            Comment


            • #7
              thanks alot!

              Comment

              Latest Articles

              Collapse

              • seqadmin
                Strategies for Sequencing Challenging Samples
                by seqadmin


                Despite advancements in sequencing platforms and related sample preparation technologies, certain sample types continue to present significant challenges that can compromise sequencing results. Pedro Echave, Senior Manager of the Global Business Segment at Revvity, explained that the success of a sequencing experiment ultimately depends on the amount and integrity of the nucleic acid template (RNA or DNA) obtained from a sample. “The better the quality of the nucleic acid isolated...
                03-22-2024, 06:39 AM
              • seqadmin
                Techniques and Challenges in Conservation Genomics
                by seqadmin



                The field of conservation genomics centers on applying genomics technologies in support of conservation efforts and the preservation of biodiversity. This article features interviews with two researchers who showcase their innovative work and highlight the current state and future of conservation genomics.

                Avian Conservation
                Matthew DeSaix, a recent doctoral graduate from Kristen Ruegg’s lab at The University of Colorado, shared that most of his research...
                03-08-2024, 10:41 AM

              ad_right_rmr

              Collapse

              News

              Collapse

              Topics Statistics Last Post
              Started by seqadmin, Yesterday, 06:37 PM
              0 responses
              11 views
              0 likes
              Last Post seqadmin  
              Started by seqadmin, Yesterday, 06:07 PM
              0 responses
              10 views
              0 likes
              Last Post seqadmin  
              Started by seqadmin, 03-22-2024, 10:03 AM
              0 responses
              51 views
              0 likes
              Last Post seqadmin  
              Started by seqadmin, 03-21-2024, 07:32 AM
              0 responses
              67 views
              0 likes
              Last Post seqadmin  
              Working...
              X