[Biojava-l] Added Blast-like SAX -> SeqSimilaritySearch objects
Keith James
kdj@sanger.ac.uk
13 Aug 2001 20:19:44 +0100
The package org.biojava.bio.program.ssbind now contains some classes
for converting Blast-like SAX events into SeqSimilaritySearch*
objects. This should work for Fasta and supported Blast versions. The
SeqSimilaritySearch* classes were not designed with HMMER in mind, so
it's not supported in this case.
Steps for using the package are pretty simple:
Create a SAX parser:
XMLReader parser = (XMLReader) new FastaSearchSAXParser();
or
XMLReader parser = (XMLReader) new BlastLikeSAXParser();
Create a SAX handler which converts SAX events into calls a
SearchContentHandler:
SeqSimilarityAdapter adapter = new SeqSimilarityAdapter();
Create the SearchContentHandler itself and a List for it to write the
SeqSimilaritySearchResults into:
List results = new ArrayList();
BlastLikeSearchBuilder builder = new BlastLikeSearchBuilder(results);
Set the builder's source of query sequences and databases:
builder.setQuerySeqHolder(queryDB);
builder.setSubjectDBInstallation(dbInstallation);
Set up the chain and start the parse:
adapter.setSearchContentHandler(builder);
parser.setContentHandler(adapter);
parser.parse(new InputSource(foo));
Making unit tests for all the delegate SAX handlers would have got
complex, so for now there are tests for the builder specific for each
supported Blast version + Fasta. If people are finding some of the
tests take a while, I could swap out the blast output files for some
smaller ones (esp. tblastn/x).
At some point I'll write a HomolgyFeatureAdapter to make
HomolgyFeatures from the same data sources (plus HMMER).
Keith
--
-= Keith James - kdj@sanger.ac.uk - http://www.sanger.ac.uk/Users/kdj =-
The Sanger Centre, Wellcome Trust Genome Campus, Hinxton, Cambs CB10 1SA