Hello -

I suspect the problem is that you are using the BlastLikeSAXParser. This 
was written in the days before blast xml was available (and stable) and is 
an adapter that parses a non-xml blast report and produces SAX events.

The parser you want is org.biojava.bio.program.sax.blastxml.BlastXMLParser

Hope this helps,

- Mark




S�bastien PETIT <[EMAIL PROTECTED]>
Sent by: [EMAIL PROTECTED]
06/10/2005 10:18 PM

 
        To:     [email protected]
        cc:     (bcc: Mark Schreiber/GP/Novartis)
        Subject:        [Biojava-l] Parse a Blast


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
_______________________________________________
Biojava-l mailing list  -  [email protected]
http://biojava.org/mailman/listinfo/biojava-l




_______________________________________________
Biojava-l mailing list  -  [email protected]
http://biojava.org/mailman/listinfo/biojava-l

Reply via email to