[Biojava-l] Parse a Blast

Sébastien PETIT great_fred at yahoo.com
Fri Jun 10 10:18:29 EDT 2005


Hello

First of all, sorry for my English (I'm French..)
Now, my problem...
I have Blast in XML format. I want to parse it because I want just the
alignment.
But, when I use a script found on the Net, the answer is :
--> org.xml.sax.SAXException: Could not recognise the format of this
file as one supported by the framework.

Does anybody have the same problem?
Or Does anybody have an idea to resolve my problem?

Here is the script (Sorry, the comment are in French..)

   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 {
   /**
   * args[0] est assumé être le nom du fichier de sortie BLAST */
       public static void main(String[] args) {
         try {
         //obtenir les entrées Blast sous la forme de Stream
            InputStream is = new FileInputStream(args[0]);
         
         //construire un BlastLikeSAXParser
            BlastLikeSAXParser parser = new BlastLikeSAXParser();
         
         //construire un adaptateur pour SAX event qui les passera a un
Handler.
            SeqSimilarityAdapter adapter = new SeqSimilarityAdapter();
         
         //initialiser l'adaptateur des SAX events  de l'objet parser
            parser.setContentHandler(adapter);
         
         //la liste qui contiendra les SeqSimilaritySearchResults
            List results = new ArrayList();
         
         //créer le SearchContentHandler qui construira les
SeqSimilaritySearchResults
         //dans la liste results
            SearchContentHandler builder = new
BlastLikeSearchBuilder(results,
               new DummySequenceDB("queries"), new
DummySequenceDBInstallation());
         
         //enregistrer builder aupres de adapter
            adapter.setSearchContentHandler(builder);
         
         //parcourir le fichier; après, la liste result contiendra
         //les SeqSimilaritySearchResults
         
            parser.parse(new InputSource(is));
            //formatResults(results);
         }
             catch (SAXException ex) {
            //probleme de XML
               ex.printStackTrace();
            }
             catch (IOException ex) {
            //probleme de IO, comme un fichier introuvable
               ex.printStackTrace();
            }
      }
   }

Thank you for any answer...

Great-Fred


	

	
		
___________________________________________________________________________ 
Appel audio GRATUIT partout dans le monde avec le nouveau Yahoo! Messenger 
Téléchargez cette version sur http://fr.messenger.yahoo.com


More information about the Biojava-l mailing list