001/*
002 *                    BioJava development code
003 *
004 * This code may be freely distributed and modified under the
005 * terms of the GNU Lesser General Public Licence.  This should
006 * be distributed with the code.  If you do not have a copy,
007 * see:
008 *
009 *      http://www.gnu.org/copyleft/lesser.html
010 *
011 * Copyright for this code is held jointly by the individual
012 * authors.  These should be listed in @author doc comments.
013 *
014 * For more information on the BioJava project and its aims,
015 * or to join the biojava-l mailing list, visit the home page
016 * at:
017 *
018 *      http://www.biojava.org/
019 *
020 */
021package org.biojava.bio.seq.io.agave;
022//import org.biojava.utils.stax.*;
023import org.xml.sax.Attributes;
024import org.xml.sax.SAXException;
025
026/**
027 *
028 * Handles the AGAVE <predicted_protein> element
029 *
030 * @author Hanning Ni    Doubletwist Inc
031 */
032public class AGAVEPredictedProteinHandler
033               extends StAXFeatureHandler
034
035{
036  public static final StAXHandlerFactory AGAVE_PREDICTED_PROTEIN_HANDLER_FACTORY
037    = new StAXHandlerFactory() {
038    public StAXContentHandler getHandler(StAXFeatureHandler staxenv) {
039      return new AGAVEPredictedProteinHandler(staxenv);
040    }
041  };
042
043
044  AGAVEPredictedProteinHandler(StAXFeatureHandler staxenv) {
045    // setup up environment stuff
046    super( staxenv );
047    featureListener = staxenv.featureListener;
048    setHandlerCharacteristics("predicted_protein", true);
049
050         super.addHandler(new ElementRecognizer.ByLocalName("bio_sequence"),
051         AGAVEBioSequenceHandler.AGAVE_BIO_SEQUENCE_HANDLER_FACTORY);
052  }
053
054   public void startElementHandler(
055                String nsURI,
056                String localName,
057                String qName,
058                Attributes attrs)
059         throws SAXException
060  {
061      featureTemplate.type = "predicted_protein" ;
062  }
063
064  /**
065  protected Feature.Template createTemplate() {
066    // create Gene Template for this
067    StrandedFeature.Template st = new StrandedFeature.Template();
068
069    // assume feature set to describe a transcript
070    st.type = "predicted_protein";
071    st.strand = StrandedFeature.UNKNOWN;
072    // set up annotation bundle
073    st.annotation = new SmallAnnotation();
074    st.location = new  Location.EmptyLocation();
075    if( staxenv != null )
076        staxenv. subFeatures .add( this ) ;
077
078    return st;
079  }**/
080}