apollo.dataadapter.das2
Class DAS2FeatureSaxParser

java.lang.Object
  extended by org.xml.sax.helpers.DefaultHandler
      extended by apollo.dataadapter.das2.DAS2FeatureSaxParser
All Implemented Interfaces:
org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler

public class DAS2FeatureSaxParser
extends org.xml.sax.helpers.DefaultHandler

Parser that reads features from das2xml and stores them in Apollo datamodels (the top level of which is a CurationSet). Here's an example of das2xml as of 2/9/2006: Note that this class has a "main" so you can test DAS2XML parsing from the command line by specifying the name of a DAS2XML file, e.g. java -ms50M -Xmx500M -classpath /users/nomi/apollo/src/java/classfiles:/users/nomi/apollo/jars/jakarta-oro-2.0.6.jar:/users/nomi/apollo/jars/xerces.jar:/users/nomi/apollo/data -DAPOLLO_ROOT=/users/nomi/apollo apollo.dataadapter.das2.DAS2Adapter /users/nomi/apollo/data/features.das2xml 3/21/2006: Updated to handle (in a superficial way) simple v300 DAS2XML:


Field Summary
protected static org.apache.log4j.Logger logger
           
 
Constructor Summary
DAS2FeatureSaxParser()
           
 
Method Summary
protected  FeatureSet addChildren(SeqFeatureI parent_feat)
          Find all children of this parent and add them to the parent seqfeature
 void addFeature()
           
 void addSubject(java.lang.String feat_id, java.lang.String subject_id, java.lang.String subject_range)
          Add the subject id and range to the feature as properties.
 void characters(char[] ch, int start, int length)
          implementing sax handler interface
protected  boolean childrenReady(SeqFeatureI parent)
          Returns true if all children of this feature have already been read in
 void clearAll()
           
 void clearFeature()
           
 void endDocument()
          implementing sax content handler interface
 void endElement(java.lang.String uri, java.lang.String name, java.lang.String qname)
          implementing sax content handler interface
 void parse(java.io.BufferedInputStream isrc, CurationSet curation)
          Populates curation set
 void startDocument()
          implementing sax content handler interface
 void startElement(java.lang.String uri, java.lang.String name, java.lang.String qname, org.xml.sax.Attributes atts)
          implementing sax content handler interface
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startPrefixMapping, unparsedEntityDecl, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected static final org.apache.log4j.Logger logger
Constructor Detail

DAS2FeatureSaxParser

public DAS2FeatureSaxParser()
Method Detail

parse

public void parse(java.io.BufferedInputStream isrc,
                  CurationSet curation)
           throws java.lang.Exception
Populates curation set

Throws:
java.lang.Exception

startDocument

public void startDocument()
implementing sax content handler interface

Specified by:
startDocument in interface org.xml.sax.ContentHandler
Overrides:
startDocument in class org.xml.sax.helpers.DefaultHandler

endDocument

public void endDocument()
implementing sax content handler interface

Specified by:
endDocument in interface org.xml.sax.ContentHandler
Overrides:
endDocument in class org.xml.sax.helpers.DefaultHandler

startElement

public void startElement(java.lang.String uri,
                         java.lang.String name,
                         java.lang.String qname,
                         org.xml.sax.Attributes atts)
implementing sax content handler interface

Specified by:
startElement in interface org.xml.sax.ContentHandler
Overrides:
startElement in class org.xml.sax.helpers.DefaultHandler

clearAll

public void clearAll()

clearFeature

public void clearFeature()

endElement

public void endElement(java.lang.String uri,
                       java.lang.String name,
                       java.lang.String qname)
implementing sax content handler interface

Specified by:
endElement in interface org.xml.sax.ContentHandler
Overrides:
endElement in class org.xml.sax.helpers.DefaultHandler

characters

public void characters(char[] ch,
                       int start,
                       int length)
implementing sax handler interface

Specified by:
characters in interface org.xml.sax.ContentHandler
Overrides:
characters in class org.xml.sax.helpers.DefaultHandler

addFeature

public void addFeature()

childrenReady

protected boolean childrenReady(SeqFeatureI parent)
Returns true if all children of this feature have already been read in


addChildren

protected FeatureSet addChildren(SeqFeatureI parent_feat)
Find all children of this parent and add them to the parent seqfeature


addSubject

public void addSubject(java.lang.String feat_id,
                       java.lang.String subject_id,
                       java.lang.String subject_range)
Add the subject id and range to the feature as properties. Note that this probably isn't the right thing to do once we start making actual feature pairs for alignments.