[Biojava-dev] Biojava.util package?

Hannes Brandstätter-Müller biojava at hannes.oib.com
Wed Mar 28 19:04:44 UTC 2012


Hi,

I browsed around in the sister projects Biopython and Bioperl a bit,
and noticed that many of the user interaction with the code goes
through classes like SeqIO, SearchIO, AlignIO...

So that got me thinking: how about we create similar "Interface"
classes in Biojava?

PROS:

 - easy change for programmers who switch languages
 - easy base interface that can be used in cookbook examples
 - makes code more readable if designed properly
 - easy access to features that are spread over the whole codebase but
are connected anyway, like all file parsers

CONS:

 - another thing to maintain
 - creates possible cross-dependencies (but if you don't want that,
just use the existing classes directly)


What are your thoughts?

python from http://biopython.org/wiki/SeqIO:

from Bio import SeqIO
handle = open("example.fasta", "rU")
for record in SeqIO.parse(handle, "fasta") :
    print record.id
handle.close()

possible equivalent in biojava (support for streaming API, Iterators, etc?):

import org.biojava3.util.SeqIO;

File file = new File("example.fasta");
SeqIO seqIO = new SeqIO(file, SeqIO.FASTA);
while (seqIO.hasNext()) {
    System.out.println(seqIO.next());
}
file.close();

Hannes



More information about the biojava-dev mailing list