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
                Essential Discoveries and Tools in Epitranscriptomics
                by seqadmin




                The field of epigenetics has traditionally concentrated more on DNA and how changes like methylation and phosphorylation of histones impact gene expression and regulation. However, our increased understanding of RNA modifications and their importance in cellular processes has led to a rise in epitranscriptomics research. “Epitranscriptomics brings together the concepts of epigenetics and gene expression,” explained Adrien Leger, PhD, Principal Research Scientist...
                04-22-2024, 07:01 AM
              • seqadmin
                Current Approaches to Protein Sequencing
                by seqadmin


                Proteins are often described as the workhorses of the cell, and identifying their sequences is key to understanding their role in biological processes and disease. Currently, the most common technique used to determine protein sequences is mass spectrometry. While still a valuable tool, mass spectrometry faces several limitations and requires a highly experienced scientist familiar with the equipment to operate it. Additionally, other proteomic methods, like affinity assays, are constrained...
                04-04-2024, 04:25 PM

              ad_right_rmr

              Collapse

              News

              Collapse

              Topics Statistics Last Post
              Started by seqadmin, Yesterday, 08:47 AM
              0 responses
              16 views
              0 likes
              Last Post seqadmin  
              Started by seqadmin, 04-11-2024, 12:08 PM
              0 responses
              60 views
              0 likes
              Last Post seqadmin  
              Started by seqadmin, 04-10-2024, 10:19 PM
              0 responses
              60 views
              0 likes
              Last Post seqadmin  
              Started by seqadmin, 04-10-2024, 09:21 AM
              0 responses
              54 views
              0 likes
              Last Post seqadmin  
              Working...
              X