[Biojava-dev] Parser backwards compatibility

Hannes Brandstätter-Müller biojava at hannes.oib.com
Sat Apr 14 14:27:23 UTC 2012


On Sat, Apr 14, 2012 at 15:50, David Felty <davfelty at gmail.com> wrote:
> Michael Heuer wrote:
>> Open source projects should projects should provide room for
>> both evolutionary and revolutionary changes
>
> Thanks for all the info, very useful!
>
> P. Troshin wrote:
>> I think you just need to make a common entry point for them.
>> E.g a factory class which would contain functions to
>> instantiate various parsers.
>
> So what you're looking for is something like this?
> FastaParser fasta = ParserFactory.fasta("example.fasta");
> FastqParser fastq = ParserFactory.fastq("example.fastq");
>
> Scooter Willis wrote:
>> Can you give some examples of what you are trying to do for
>> the common set of interfaces?
>
> I gave this example in my proposal at
> http://www.google-melange.com/gsoc/proposal/review/google/gsoc2012/dfelt/2001
>
> for (BasicSequence seq : SeqIO.parse(inStream, SeqFormat.FASTA) {
>    System.out.println(seq.getSequenceAsString());
> }
>
> But I think Troshin's idea would be easier to implement, given
> the current BioJava parsers.

I think that, once you have the ParserFactory, the step towards this
simple parse API would require minimal effort. I believe a simple,
consistent API should be the goal of the project, with a parse()
method that should be intelligent enough to choose the right parser
from the file extension (if possible, FASTQ being an exception) as
well as allowing additional parameters specifying the format.

Using the Factories as middle step would be a nice approach in my opinion.

Hannes




More information about the biojava-dev mailing list