org.biojava.bio.seq.io.agave
Class AgaveWriter

java.lang.Object
  extended byorg.biojava.bio.seq.io.agave.AgaveWriter

public class AgaveWriter
extends java.lang.Object

Writes Sequence into AGAVE XML document. The AGAVE format is defined in agave.dtd which can be downloaded from http://www.agavexml.org.

Author:
Hanning Ni, Brian King

Nested Class Summary
protected  class AgaveWriter.Indent
          Implements indenting for elements.
 
Field Summary
static java.lang.String INDENT
          use a two space indent
protected  AGAVEAnnotFilter mAnnotFilter
          The AnnotationMap to use for getting AGAVE XML attributes from a Sequence Annotation.
protected  org.biojava.bio.seq.io.agave.PCDATAFilterWriter mFilter
          writes PCDATA replacing XML characters with escape entities
protected  AgaveWriter.Indent mIndent
          indent
protected  java.io.PrintWriter mOut
          Write to XML document
protected  boolean mWriteDocType
          write DOCTYPE if true
 
Constructor Summary
AgaveWriter()
          Default constructor uses generic annotation to attribute mapping.
AgaveWriter(AGAVEAnnotFilter filter)
          Construct with data source specific annotation to attribute mapping.
 
Method Summary
 void setWriteDocType(boolean writeDocType)
          Set flag that determines if XML DOCTYPE is written or not.
protected  void write(Sequence seq)
          Writing Sequence.
protected  void writeAnnotations(FeatureHolder f)
           
protected  void writeAssembly(Annotatable seq)
           
protected  void writeBioSequence(Annotatable seq)
           
protected  void writeClassification(Annotatable seq)
           
protected  void writeCompResult(Annotatable f)
           
protected  void writeContig(Annotatable seq)
           
protected  void writeFooter()
          Write </sciobj>
protected  void writeGene(Annotatable f)
           
protected  void writeHeader()
          Write <sciobj>
protected  void writeSeqFeature(Annotatable f)
          Write SeqFeature XML
 void writeSequence(Sequence seq, java.io.PrintStream os)
          Write sequence into AGAVE XML format.
protected  void writeSequenceMap(Annotatable seq)
          group sequence_map by getSource()
protected  void writeSequenceMap2(Annotatable f)
          Write SequenceMap XML
protected  void writeTranscript(Annotatable f)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INDENT

public static final java.lang.String INDENT
use a two space indent

See Also:
Constant Field Values

mOut

protected java.io.PrintWriter mOut
Write to XML document


mIndent

protected AgaveWriter.Indent mIndent
indent


mFilter

protected org.biojava.bio.seq.io.agave.PCDATAFilterWriter mFilter
writes PCDATA replacing XML characters with escape entities


mAnnotFilter

protected AGAVEAnnotFilter mAnnotFilter
The AnnotationMap to use for getting AGAVE XML attributes from a Sequence Annotation.


mWriteDocType

protected boolean mWriteDocType
write DOCTYPE if true

Constructor Detail

AgaveWriter

public AgaveWriter()
Default constructor uses generic annotation to attribute mapping.


AgaveWriter

public AgaveWriter(AGAVEAnnotFilter filter)
Construct with data source specific annotation to attribute mapping.

Method Detail

setWriteDocType

public void setWriteDocType(boolean writeDocType)
Set flag that determines if XML DOCTYPE is written or not. Default is true.


writeSequence

public void writeSequence(Sequence seq,
                          java.io.PrintStream os)
                   throws java.io.IOException
Write sequence into AGAVE XML format.

Parameters:
seq - maybe the or simple sequence
 if annotation of seq has chromosome information , generate  tag
 if seq is SimpleAssembly, generate  tag
 otherwise, generate  tag
 currently  each top-level sequence is wrapped into seperated sciobj xml file
 
Throws:
java.io.IOException

writeHeader

protected void writeHeader()
Write <sciobj>


writeFooter

protected void writeFooter()
Write </sciobj>


write

protected void write(Sequence seq)
              throws java.io.IOException
Writing Sequence.

Parameters:
seq - is simple sequence or simple assembly
Throws:
java.io.IOException

writeContig

protected void writeContig(Annotatable seq)
                    throws java.io.IOException
Throws:
java.io.IOException

writeAssembly

protected void writeAssembly(Annotatable seq)
                      throws java.io.IOException
Throws:
java.io.IOException

writeBioSequence

protected void writeBioSequence(Annotatable seq)
                         throws java.io.IOException
Throws:
java.io.IOException

writeSequenceMap

protected void writeSequenceMap(Annotatable seq)
                         throws java.io.IOException
group sequence_map by getSource()

Throws:
java.io.IOException

writeClassification

protected void writeClassification(Annotatable seq)
                            throws java.io.IOException
Throws:
java.io.IOException

writeSequenceMap2

protected void writeSequenceMap2(Annotatable f)
                          throws java.io.IOException
Write SequenceMap XML

Throws:
java.io.IOException

writeAnnotations

protected void writeAnnotations(FeatureHolder f)
                         throws java.io.IOException
Throws:
java.io.IOException

writeGene

protected void writeGene(Annotatable f)
                  throws java.io.IOException
Throws:
java.io.IOException

writeTranscript

protected void writeTranscript(Annotatable f)
                        throws java.io.IOException
Throws:
java.io.IOException

writeSeqFeature

protected void writeSeqFeature(Annotatable f)
                        throws java.io.IOException
Write SeqFeature XML

Throws:
java.io.IOException

writeCompResult

protected void writeCompResult(Annotatable f)
                        throws java.io.IOException
Throws:
java.io.IOException