[Biojava-l] FASTA Parser problems

Richard HOLLAND hollandr at gis.a-star.edu.sg
Sun Jul 10 21:10:39 EDT 2005


Could you send me the input file you are using as an attachment
(directly, not via the mailing list as it will get removed), I can then
run the script and compare input to output.

Also, which BioJava version are you using?

cheers,
Richard

Richard Holland
Bioinformatics Specialist
GIS extension 8199
---------------------------------------------
This email is confidential and may be privileged. If you are not the
intended recipient, please delete it and notify us immediately. Please
do not copy or use it for any purpose, or disclose its content to any
other person. Thank you.
---------------------------------------------


> -----Original Message-----
> From: biojava-l-bounces at portal.open-bio.org 
> [mailto:biojava-l-bounces at portal.open-bio.org] On Behalf Of 
> Williamson, TC
> Sent: Friday, July 08, 2005 10:29 PM
> To: biojava-l at biojava.org
> Subject: [Biojava-l] FASTA Parser problems
> 
> 
> Hello all.
> 
> I'm having trouble with the FASTA Parser presented in BioJava 
> in Anger.
> 
> I just don't seem to be able to get any results from my file. 
>  Here is 
> the script:
> 
> import java.io.*;
> import java.util.*;
> 
> 
> import org.biojava.bio.program.sax.*;
> import org.biojava.bio.program.ssbind.*;
> import org.biojava.bio.search.*;
> import org.biojava.bio.seq.db.*;
> import org.xml.sax.*;
> import org.biojava.bio.*;
> 
> public class BlastParser {
>    /**
>     * String location is the full path of a FASTA output file
>     */
>    public static void main(String[] args) {
>      try {
>        //get the Blast input as a Stream
>        String location = "Full//path//of//file";
>        InputStream is = new FileInputStream(location);
> 
>        //make a FastaSearchSAXParser
>        FastaSearchSAXParser parser = new FastaSearchSAXParser();
> 
>        //make the SAX event adapter that will pass events to 
> a Handler.
>        SeqSimilarityAdapter adapter = new SeqSimilarityAdapter();
> 
>        //set the parsers SAX event adapter
>        parser.setContentHandler(adapter);
> 
>        //The list to hold the SeqSimilaritySearchResults
>        List results = new ArrayList();
> 
>        //create the SearchContentHandler that will build 
> SeqSimilaritySearchResults
>        //in the results List
>        SearchContentHandler builder = new 
> BlastLikeSearchBuilder(results,
>            new DummySequenceDB("queries"), new 
> DummySequenceDBInstallation());
> 
>        //register builder with adapter
>        adapter.setSearchContentHandler(builder);
> 
>        //parse the file, after this the result List will be 
> populated with
>        //SeqSimilaritySearchResults
>        parser.parse(new InputSource(is));
> 
>        //output some blast details
>        for (Iterator i = results.iterator(); i.hasNext(); ) {
>          SeqSimilaritySearchResult result =
>              (SeqSimilaritySearchResult)i.next();
> 
>          Annotation anno = result.getAnnotation();
> 
>          for (Iterator j = anno.keys().iterator(); j.hasNext(); ) {
>            Object key = j.next();
>            Object property = anno.getProperty(key);
>            System.out.println(key+" : "+property);
>          }
>          System.out.println("Hits: ");
> 
>          //list the hits
>          for (Iterator k = result.getHits().iterator(); 
> k.hasNext(); ) {
>            SeqSimilaritySearchHit hit =
>                (SeqSimilaritySearchHit)k.next();
>            System.out.print("\tmatch: "+hit.getSubjectID());
>            System.out.println("\te score: "+hit.getEValue());
>          }
> 
>          System.out.println("\n");
>        }
> 
>      }
>      catch (SAXException ex) {
>        //XML problem
>        ex.printStackTrace();
>      }catch (IOException ex) {
>        //IO problem, possibly file not found
>        ex.printStackTrace();
>      }
>    }
> }
> _______________________________________________
> Biojava-l mailing list  -  Biojava-l at biojava.org
> http://biojava.org/mailman/listinfo/biojava-l
> 



More information about the Biojava-l mailing list