sbc.orthoxml.io
Class OrthoXMLWriter

java.lang.Object
  extended by sbc.orthoxml.io.OrthoXMLWriter

public class OrthoXMLWriter
extends java.lang.Object

Writer for OrthoXML(http://orthoXML.org). Supports OrthoXML versions 0.1 to 0.3. Global definitions are extracted for the groups and stored in memory as they are feed into the writer. Groups are written in to a temporary file to minimize memory consumption. The close() method must be called after all groups have been written to create the OrthoXML file.

 OrthoXMLWriter writer = new OrthoXMLWriter(new File("myFile.orthxml"),"myDatabase","myVersion");
 
 for(Group group : myGroups)
 	writer.write(group);
 writer.close();
 
 

Author:
Thomas Schmitt

Constructor Summary
OrthoXMLWriter(java.io.File outputFile, java.lang.String origin, java.lang.String originVersion)
          Creates a OrthoXMLWriter that writes to a file.
OrthoXMLWriter(java.io.Writer outputWriter, java.lang.String origin, java.lang.String originVersion)
          Creates a OrthoXMLWriter that writes to a stream.
 
Method Summary
 void close()
          Must be called after all groups have been written.
 void write(Group group)
          Appends the group to the orthoXML output.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OrthoXMLWriter

public OrthoXMLWriter(java.io.Writer outputWriter,
                      java.lang.String origin,
                      java.lang.String originVersion)
               throws javax.xml.stream.XMLStreamException,
                      java.io.IOException
Creates a OrthoXMLWriter that writes to a stream.

Parameters:
outputWriter - the orthoXML stream to write to
origin - the origin of the orthology assignments
originVersion - the version of the origin
Throws:
javax.xml.stream.XMLStreamException
java.io.IOException

OrthoXMLWriter

public OrthoXMLWriter(java.io.File outputFile,
                      java.lang.String origin,
                      java.lang.String originVersion)
               throws javax.xml.stream.XMLStreamException,
                      java.io.IOException
Creates a OrthoXMLWriter that writes to a file.

Parameters:
outputFile - the orthoXML file that is created by the writer
origin - the origin of the orthology assignments
originVersion - the version of the origin
Throws:
javax.xml.stream.XMLStreamException
java.io.IOException
Method Detail

write

public void write(Group group)
           throws javax.xml.stream.XMLStreamException
Appends the group to the orthoXML output. Extracts the global definitions of scores, genes, species and database and stores them in memory. close() must be called after the last group is written to ensure that the output is generated.

Parameters:
group - the group to append to the OrthoXML file.
Throws:
javax.xml.stream.XMLStreamException

close

public void close()
           throws javax.xml.stream.XMLStreamException,
                  java.io.IOException
Must be called after all groups have been written. It is only in the close method where the content is actually written.

Throws:
javax.xml.stream.XMLStreamException
java.io.IOException