get species names from newick phylogenetic tree file
1
0
Entering edit mode
5.3 years ago
a.moner • 0

Hi I have a newick phylogeny file has more than 1000 species. I want to extract just species name in different file. I appreciate your help

next-gen alignment sequencing genome R • 3.8k views
ADD COMMENT
0
Entering edit mode
5.3 years ago
Joe 21k

What have you tried?

Look at the ape package for instance. It'd be as simple as:

> library(ape)
> tree <- read.tree(text = "(((A,B),(C,D)),E);")  # or read.tree(file='path/to/file.tree') if using a file
> tree$tip.label
[1] "A" "B" "C" "D" "E"

A similar approach in python:

python -c 'import sys; from ete3 import Tree; t = Tree(sys.argv[1]);print(t.get_leaf_names());' treefile.nwk
ADD COMMENT
0
Entering edit mode

I tried ape But the problem was importing the phylogenetic file it is too big for copy and paste and made error And I couldn't use it as import data

For python I got this error ete3 command not found

ADD REPLY
0
Entering edit mode

Then don't import it with copy and paste, read the file in directly. What I showed above was just an example of the functionality, you need to adapt it to what you are trying to do.

As for python, yes of course, ETE3 isn't a standard module - you need to install it.

ADD REPLY

Login before adding your answer.

Traffic: 2104 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6