This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Biojava And Blast+

Dear all,

i´m currently trying to parse several blast output files in order to show the results in my software. Since i have to carry out many blast searches from time to time, i decided to install the newest version of blast, blast+ 2.2.24+. It´s working fine.

Now i was just running into a big problem. Since i am programming mainly in Java i decided to use BioJava, parsing FastaFiles and Blast output files should be easy i thought. Unfortunately, BioJava3, the most recent version, contains a parser which is working for my files, but it does not create Java beans in order to make it easy to present e.g. scores and alignments. So i downloaded BioJava 1.7.1 which does contain this feature. But unfortunately, this does not support the new Blast+ output, the APIDoc just mentions it works with NCBI Blast version 2.2.3 . Did anybody run into this problem and was abloe to solve it? I currently just see the opportunity to use an older blast version in order to circumvent this non-compability. This solution is the least time-consuming one i guess.

I´m looking forward to suggestions!

Cheers,

Peter

biojava blast parsing java

1 answer

Do you just need a JAVA parser for blast ? XJC is your friend and will generate the code for you. (Note: it only parses the XML output of blast)

${JAVA_HOME}/bin/xjc  -p blast -dtd "http://www.ncbi.nlm.nih.gov/dtd/NCBI_BlastOutput.dtd"
parsing a schema...
compiling a schema...
blast/BlastOutput.java
blast/BlastOutputIterations.java
blast/BlastOutputMbstat.java
blast/BlastOutputParam.java
blast/Hit.java
blast/HitHsps.java
blast/Hsp.java
blast/Iteration.java
blast/IterationHits.java
blast/IterationStat.java
blast/ObjectFactory.java
blast/Parameters.java
blast/Statistics.java

See also this previous question on biostar. How To Perform A Blast Search From A Java Application?

Thanks! Well, it´s no issue to create XML blast output, but as far as i understood xjc, it only created the java objects needed and not the parser itself turning the blast xml output file into nice Java beans filled with all the information of the corresponding file, or does it? I don´t see a true parser in the list above.

Log in to answer this question.