Converting Taxonomic Lineages Into A Common Tree
1
3
Entering edit mode
11.6 years ago

I have a number of lineages like this:

Bacteria;Chlamydiae;Chlamydiae;Chlamydiales;Chlamydiaceae;Chlamydophila;
Bacteria;Firmicutes;Bacilli;Lactobacillales;Lactobacillaceae;Lactobacillus;
Bacteria;Firmicutes;Bacilli;Lactobacillales;Streptococcaceae;Streptococcus;
... (the list continues)

Is there any tool capable of converting these lineages into common tree in Nexus or Newick format?

tree • 4.1k views
ADD COMMENT
0
Entering edit mode
ADD REPLY
8
Entering edit mode
11.6 years ago

The following java program should work:

compile & run:

javac Biostar52895.java

$ echo "Bacteria;Chlamydiae;Chlamydiae;Chlamydiales;Chlamydiaceae;Chlamydophila;
Bacteria;Firmicutes;Bacilli;Lactobacillales;Lactobacillaceae;Lactobacillus;
Bacteria;Firmicutes;Bacilli;Lactobacillales;Streptococcaceae;Streptococcus;" | java Biostar52895

((((((Chlamydophila)Chlamydiaceae)Chlamydiales)Chlamydiae)Chlamydiae,((((Lactobacillus)Lactobacillaceae,(Streptococcus)Streptococcaceae)Lactobacillales)Bacilli)Firmicutes)Bacteria);
ADD COMMENT
7
Entering edit mode

Biostars classic :) "Is there a tool that ...?" Pierre's answer: "Yes, there is. Let me write it for you." Thank you very, very much Pierre.

ADD REPLY
0
Entering edit mode

hey pierre. thanks a lot for this solution. probably a stupid question but i'm a biochemist and this is my first java program ever. i've compiled your program on my mac os x 10.8 and want to run it now, but it just goes into an endless loop. how is the input (the list) specified. thx!

ADD REPLY
0
Entering edit mode

@Pierre, I tried the javascript but somehow it didn't work. Did my miss some dependencies of java packages or something in my installed java program? ( I have no knowledge in java)

echo "Bacteria;Chlamydiae;Chlamydiae;Chlamydiales;Chlamydiaceae;Chlamydophila;Bacteria;Firmicutes;Bacilli;Lactobacillales;Lactobacillaceae;Lactobacillus;Bacteria;Firmicutes;Bacilli;Lactobacillales;Streptococcaceae;Streptococcus;" | java Biostar52895

error message:

Exception in thread "main" java.lang.NoClassDefFoundError: Biostar52895
Caused by: java.lang.ClassNotFoundException: Biostar52895
        at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:323)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:268)
Could not find the main class: Biostar52895. Program will exit.
ADD REPLY
0
Entering edit mode

it's not javascript, it's java. It's compiled compiled with javac Biostar52895.java and executed with java Biostar52895

ADD REPLY
0
Entering edit mode

Now I see javac didn't compile the Biostart52895.java and the expected .class file was missing. can you point me why?

javac Biostar52895.java
Output:
Biostar52895.java:13: > expected
        Map<String,Node> children=new TreeMap<String, Biostar52895.Node="">();
                                                                       ^
Biostar52895.java:13: ';' expected
        Map<String,Node> children=new TreeMap<String, Biostar52895.Node="">();
                                                                        ^
Biostar52895.java:13: illegal start of type
        Map<String,Node> children=new TreeMap<String, Biostar52895.Node="">();
                                                                          ^
Biostar52895.java:13: <identifier> expected
        Map<String,Node> children=new TreeMap<String, Biostar52895.Node="">();
                                                                           ^
Biostar52895.java:13: ';' expected
        Map<String,Node> children=new TreeMap<String, Biostar52895.Node="">();
                                                                            ^
Biostar52895.java:70: '(' or '[' expected
        app.parse(new BufferedReader(new InputStreamReaderSystem.in)));
                                                                   ^
Biostar52895.java:70: ';' expected
        app.parse(new BufferedReader(new InputStreamReaderSystem.in)));
                                                                     ^
7 errors
ADD REPLY
0
Entering edit mode

Ah, I see, it's because the code has been changed by the new version of biostars. It thinks it's HTML.

Give me a few minutes....

ADD REPLY
0
Entering edit mode

It's now uploaded on github:

ADD REPLY
0
Entering edit mode

Thanks Pierre. It's working now..!! Excellent.

ADD REPLY

Login before adding your answer.

Traffic: 2750 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