BlastLikeToXMLConverter (BioJava-1.5-beta API)
Keywords: org.biojava.bio.program.BlastLikeToXMLConverter class

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.biojava.bio.program
Class BlastLikeToXMLConverter

    java.lang.Object
      org.biojava.bio.program.BlastLikeToXMLConverter

    public class BlastLikeToXMLConverter

extends Object

A class that converts the raw output from a variety of bioinformatics software and converts it to XML that will validate against the biojava:BlastLikeDataSetCollection DTD.

For applications supported, please the documentation for the BlastLikeSAXParser.

Examination of the source code of this application also serves as demonstration of the simplicity of using the biojava blast-like SAX2 parsing framework. The main functionality of the application is simply built from the following code, viz.:

          !**
           * The following code creates a parser for native output
           * from BlastLike programs. That is,
           * Create a SAX2 Parser that takes the native output
           * from blast-like bioinformatics software.
           *!

            XMLReader oParser =
           (XMLReader) new BlastLikeSAXParser();

         !**
           * Namespace support controls the way in which
           * XML elements are reported. In XML, when an element
           * looks something like  then,
           * the part before the colon, i.e. biojava is the namespace,
           * and the part after the colon i.e. Hit is the Local name.
           * The full "biojava:Hit" name is termed the Qualified Name (QNames).
           * By default SAX2 parsers report Local Names, in this
           * example, we decided we wanted to make the parser report QNames.
           *
           * If you don't want to change default namespace support, you
           * can ignore the next piece of code.
           *
           * Dynamically change configuration of the parser
           * in regard of Namespace support. Here,
           * the xml.org/features/namespaces feature is simply "reset"
           * to its default value for SAX2.
           * The xml.org/features/namespaces-prefixes feature is
           * also set to true.  This is to ensure that xmlns attributes
           * are reported by the parser. These are required because we want
           * to configure the XMLEmitter to output qualified names (see below).
           *!

          try {
          oParser.setFeature("http://xml.org/sax/features/namespaces",true);
          oParser.setFeature(
                  "http://xml.org/sax/features/namespace-prefixes",true);

          } catch (Exception e) {
          }

          !**
           * Having selected the parser, we now want to
           * choose an object to deal with the SAX2 events
           * that the parser produces. This is the class
           * that you would normally write yourself to deal
           * with particular events you are interested in.
           * This class implements the ContentHandler - usually,
           * you would inherit from a SAX2 helper class that
           * implements this interface for you.
           *
           * Create an XML ContentHandler. This
           * implementation of the DocumentHandler
           * interface simply outputs nicely formatted
           * XML. Passing a true value to the SimpleXMLEmitter
           * constructor instructs the ContentHandler
           * to take QNames from the SAXParser, rather
           * than LocalNames.
           *

          ContentHandler oHandler  =
          (ContentHandler) new SimpleXMLEmitter(true);

          !**
           * Now, link the Parser and the ContentHandler.
           *
           * Give the parser a reference to the ContentHandler
           * so that it can send SAX2 mesagges.
           *!

          oParser.setContentHandler(oHandler);

          !**
           * Finally, parse your Blast-like output.
           *
           * Now make the Parser parse the output from the
           * blast-like software and emit XML as specificed
           * by the ContentHandler.
           *!

          oParser.parse(oInput);

Copyright © 2000 Cambridge Antibody Technology. All Rights Reserved.

Primary author -

- Simon Brocklehurst (CAT)

Other authors -

- Tim Dilks (CAT)
- Colin Hardman (CAT)
- Stuart Johnston (CAT)
- Mathieu Wiepert (Mayo Foundation)

Version:
  1.0
Author:
  Cambridge Antibody Technology (CAT)
See Also:
  `BlastLikeSAXParser`, `SimpleXMLEmitter`

Constructor Summary
`BlastLikeToXMLConverter(String poInput)` Creates a new `BlastToXMLConverter` instance.

Method Summary
`void` | `convert()`
`void` | `setModeLazy()`
`void` | `setModeStrict()`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### BlastLikeToXMLConverter

    public BlastLikeToXMLConverter(String poInput)

  Creates a new `BlastToXMLConverter` instance.

Method Detail

### convert

    public void convert()
                 throws IOException,
                        SAXException

  Throws:
    `IOException`
    `SAXException`

### setModeStrict

    public void setModeStrict()

### setModeLazy

    public void setModeLazy()

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD