<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div><span></span></div><div><div dir="ltr"><div dir="auto"><div><span></span></div><div><div><span></span></div><div><div><span></span></div><div><span>Dear Biojava develpers,</span><br><span>Some times ago a debate came up about the opportunity of including in biojava a SearchIO module to define common data structures that model Hsp, Hits, Results making abstraction of the underlying search program. Andreas asked also for A) Ease of maintenance B) extensibility for BLAST variants C) general applicability for any database searches (potential to hook up BLAST alternatives)</span><br><span></span><br><span>I have uploaded a preview of the new adds in my biojava fork on GitHub, user paolopavan, SearchIO branch. Please give it a look. </span><br><span></span><br><span>Also note that this is a required part of another module I have written that can potentially be of community interest: a biojava-run module, to bless it similarly to something already listened. This latter aims to be a generic module used to run an analysis performed by an external program. In my case I needed ncbi blast search. So the API was written to declare a database of biojava Sequence objects, pass a collection of query sequences and retrieve in output Result objects of the SearchIO module. </span><br><span>I know from previous attempt echoed in the mailing list that the orientation of the project was to reimplement the blast algorithm in pure Java and I agree that it would be a great idea. But until now this project as far as I know is late and I solved the platform portability issue by including several binaries for all the platforms (well, the major) packaging all together in one jar file relying upon this great Java facility. </span><br><span>Anyway, all this came later. </span><br><span></span><br><span>Just to spend few technical comments on the SearchIO module:</span><br><span>- included in core module since it defines a new base data structure</span><br><span>- include a dependency from biojava-alignment. This is not compulsory, it is there since the alignment data structure is included in that package. In my opinion, moving this important data structure in core will solve this and avoid similar problems in the future. This is also the reason why I choose to add those new implemented Hits/Hsp etc directly in core, after all search is one of the most important tasks in bioinformatics.</span><br><span>- BlastXML parser is implemented in the BlastXMLQuery class. Maybe this name it is not so meaningful, it comes from the original class that is still there in biojava even if it seems not so much utilised, that I initially started to improve trying to remain tighter to the original project. From here also the use of the class XMLHelper and some deprecated tags I added. From the old thread I understood that there was not any "elective choice" of biojava for XML parsing, but anyway the job was already done with the XMLHelper module and so this class came to new life.</span></div><div><span>- it was designed to be easy to extend: </span>add support for a new file format a developer must just write a single class that implements the ResultFactory interface (<span style="background-color:rgba(255,255,255,0)">I have implemented also a blast tabular parser to show it)</span>. The Api for biojava user does not change, it is just:</div><div><span style="background-color:rgba(255,255,255,0)"> <span>SearchIO</span> reader <span>=</span> <span>new</span> <span>SearchIO</span>(<span>new</span> <span>File</span>(<span><span>"BlastReport.blastxml</span><span>"</span></span>), blastResultFactory);</span></div><div><br><span>- it is possible to auto recognise file formats relying upon standard file extension. Just try a different constructor:</span></div><div><span style="background-color:rgba(255,255,255,0)"> <span>SearchIO</span> reader <span>=</span> <span>new</span> <span>SearchIO</span>(<span>new</span> <span>File</span>("BlastReport.blastxml<span><span>"</span></span>));</span><br><span></span><br><span>- results are easily accessed through nested iterators that follow the concept that in a report there are one one or many results, every result contains one or many hits, one hit contains one or more hsp:</span></div><div><span><br></span></div><div><pre style="word-wrap:normal;margin-top:0px;margin-bottom:0px;overflow:scroll;padding:15px 0px"><div style="padding:0px 15px"><font face="UICTFontTextStyleBody"><span style="white-space:normal;background-color:rgba(255,255,255,0)"> <span>for</span> (<span>Result</span> result<span>:</span> reader){</span></font></div><div style="padding:0px 15px"><font face="UICTFontTextStyleBody"><span style="white-space:normal;background-color:rgba(255,255,255,0)"> <span>System</span><span>.</span>out<span>.</span>println(result<span>.</span>getQueryDef()<span>+</span><span><span>"</span>(<span>"</span></span><span>+</span> result<span>.</span>getQueryID()<span>+</span><span><span>"</span>)<span>"</span></span>);</span></font></div><div style="padding:0px 15px"><font face="UICTFontTextStyleBody"><span style="white-space:normal;background-color:rgba(255,255,255,0)"> <span>for</span> (<span>Hit</span> hit<span>:</span> result){</span></font></div><div style="padding:0px 15px"><font face="UICTFontTextStyleBody"><span style="white-space:normal;background-color:rgba(255,255,255,0)"> <span>System</span><span>.</span>out<span>.</span>print(hit<span>.</span>getHitDef());</span></font></div><div style="padding:0px 15px"><font face="UICTFontTextStyleBody"><span style="white-space:normal;background-color:rgba(255,255,255,0)"> <span>System</span><span>.</span>out<span>.</span>print(<span><span>"</span>(<span>"</span></span>);</span></font></div><div style="padding:0px 15px"><font face="UICTFontTextStyleBody"><span style="white-space:normal;background-color:rgba(255,255,255,0)"> <span>for</span> (<span>Hsp</span> hsp<span>:</span> hit){</span></font></div><div style="padding:0px 15px"><font face="UICTFontTextStyleBody"><span style="white-space:normal;background-color:rgba(255,255,255,0)"> <span>System</span><span>.</span>out<span>.</span>print(hsp<span>.</span>getHspEvalue()<span>+</span><span><span>"</span>,<span>"</span></span>);</span></font></div><div style="padding:0px 15px"><font face="UICTFontTextStyleBody"><span style="white-space:normal;background-color:rgba(255,255,255,0)"> }</span></font></div><div style="padding:0px 15px"><font face="UICTFontTextStyleBody"><span style="white-space:normal;background-color:rgba(255,255,255,0)"> <span>System</span><span>.</span>out<span>.</span>println(<span><span>"</span>)<span>"</span></span>);</span></font></div><div style="padding:0px 15px"><font face="UICTFontTextStyleBody"><span style="white-space:normal;background-color:rgba(255,255,255,0)"> }</span></font></div><div style="padding:0px 15px"><font face="UICTFontTextStyleBody"><span style="white-space:normal;background-color:rgba(255,255,255,0)"> </span></font></div><div style="padding:0px 15px"><font face="UICTFontTextStyleBody"><span style="white-space:normal;background-color:rgba(255,255,255,0)"> }</span></font></div></pre></div><div><span>- the use of common data structures allow the definition of common operations. For example I defined a retrieving of the hsp alignment as biojava alignment. </span></div><div><span><br></span></div><div><span><br></span></div><div><span>If you agree that this feature would be interesting for the project I can send a pull request for the SearchIO part and then push on my GitHub also the run module. </span><br><span>Just have a look to it!</span><br><span></span><br><span>Greetings!</span><br><span>Paolo</span></div><div><br></div></div></div></div></div></div></body></html>