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 023/** 024 * @author Hanning Ni Doubletwist Inc 025 */ 026public class AGAVEAnnotationsHandler 027 extends StAXPropertyHandler 028 029{ 030 public static final StAXHandlerFactory AGAVE_ANNOTATIONS_HANDLER_FACTORY 031 = new StAXHandlerFactory() { 032 public StAXContentHandler getHandler(StAXFeatureHandler staxenv) { 033 return new AGAVEAnnotationsHandler(staxenv); 034 } 035 }; 036 037 AGAVEAnnotationsHandler(StAXFeatureHandler staxenv) { 038 // setup up environment stuff 039 super( staxenv ); 040 featureListener = staxenv.featureListener; 041 setHandlerCharacteristics("annotations", true); 042 043 // setup handlers 044 // 045 super.addHandler(new ElementRecognizer.ByLocalName("seq_feature"), 046 AGAVESeqFeatureHandler.AGAVE_SEQ_FEATURE_HANDLER_FACTORY); 047 // 048 super.addHandler(new ElementRecognizer.ByLocalName("gene"), 049 AGAVEGeneHandler.AGAVE_GENE_HANDLER_FACTORY); 050 051 super.addHandler(new ElementRecognizer.ByLocalName("comp_result"), 052 AGAVECompResultHandler.AGAVE_COMP_RESULT_HANDLER_FACTORY); 053 054 } 055 /** 056 protected Feature.Template createTemplate() { 057 // create Gene Template for this 058 StrandedFeature.Template st = new StrandedFeature.Template(); 059 060 // assume feature set to describe a transcript 061 st.type = "annotations"; 062 st.strand = StrandedFeature.UNKNOWN; 063 // set up annotation bundle 064 st.annotation = new SmallAnnotation(); 065 st.location = new Location.EmptyLocation(); 066 067 068 if( staxenv != null ) 069 staxenv. subFeatures .add( this ) ; 070 071 return st; 072 }**/ 073 074 075 076} 077