sbc.orthoxml.io
Class OrthoXMLReader

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

public class OrthoXMLReader
extends java.lang.Object

Parser for OrthoXML(http://orthoXML.org). Supports OrthoXML versions 0.1 to 0.3. Global definitions are read into memory at construction time. Groups are read in a streaming fashion using the the next() method. It is possible to set a species filter in this case only groups contains containing genes from the given species are parsed. Filtering preserve the topology of the groups/trees but empty branches and groups containing genes from less then two species are removed.

 OrthoXMLReader reader = new OrthoXMLReader(new File("myFile.orthoXML"));
 
 Group group;
 while( (group = reader.next()) != null)
 {
 	group.getGeneMembers();
 }
 
 

Author:
Thomas Schmitt

Constructor Summary
OrthoXMLReader(java.io.File orthoXMLFile)
          Creates an OrthoXMLReader that reads OrthoXML from the given file.
OrthoXMLReader(java.io.File orthoXMLFile, java.util.List<java.lang.Integer> taxonomyIds)
          Creates an OrthoXMLReader that reads OrthoXML from the given file.
OrthoXMLReader(java.io.Reader orthoXMLStream)
          Creates an OrthoXMLReader that reads OrthoXML from the given stream.
OrthoXMLReader(java.io.Reader orthoXMLStream, java.util.List<java.lang.Integer> taxonomyIds)
          Creates an OrthoXMLReader that reads OrthoXML from the given stream.
 
Method Summary
 java.lang.String getOrigin()
          Returns the origin of the OrthoXML.
 java.lang.String getOriginVersion()
          Returns the version of the OrthoXML origin.
 java.util.Map<java.lang.String,ScoreDefinition> getScoreDefinitions()
          Returns a Map with scores defined in the OrthoXML file.
 java.util.List<Species> getSpecies()
          Returns a list of the species defined in the OrthoXML file.
 java.lang.Double getVersion()
          The OrthoXML version.
 Group next()
          Returns the next group top level ortholog group from the OrthoXML file/stream.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OrthoXMLReader

public OrthoXMLReader(java.io.Reader orthoXMLStream)
               throws javax.xml.stream.XMLStreamException,
                      javax.management.modelmbean.XMLParseException
Creates an OrthoXMLReader that reads OrthoXML from the given stream.

Parameters:
orthoXMLStream - the stream to read from.
Throws:
javax.xml.stream.XMLStreamException
javax.management.modelmbean.XMLParseException

OrthoXMLReader

public OrthoXMLReader(java.io.Reader orthoXMLStream,
                      java.util.List<java.lang.Integer> taxonomyIds)
               throws javax.xml.stream.XMLStreamException,
                      javax.management.modelmbean.XMLParseException
Creates an OrthoXMLReader that reads OrthoXML from the given stream. Only assignments for species with a NCBI taxonomy identifier in the taxonomyIds list are read. See next() for more details.

Parameters:
orthoXMLStream - the stream to read from.
taxonomyIds - list of NCBI taxonomy identifier to filter for.
Throws:
javax.xml.stream.XMLStreamException
javax.management.modelmbean.XMLParseException

OrthoXMLReader

public OrthoXMLReader(java.io.File orthoXMLFile,
                      java.util.List<java.lang.Integer> taxonomyIds)
               throws java.io.FileNotFoundException,
                      javax.xml.stream.XMLStreamException,
                      javax.management.modelmbean.XMLParseException
Creates an OrthoXMLReader that reads OrthoXML from the given file. Only assignments for species with a NCBI taxonomy identifier in the taxonomyIds list are read. See next() for more details.

Parameters:
orthoXMLFile - the orthoXML file to read from.
taxonomyIds - list of NCBI taxonomy identifier to filter for.
Throws:
java.io.FileNotFoundException
javax.xml.stream.XMLStreamException
javax.management.modelmbean.XMLParseException

OrthoXMLReader

public OrthoXMLReader(java.io.File orthoXMLFile)
               throws java.io.FileNotFoundException,
                      javax.xml.stream.XMLStreamException,
                      javax.management.modelmbean.XMLParseException
Creates an OrthoXMLReader that reads OrthoXML from the given file.

Parameters:
orthoXMLFile - the orthoXML file to read from.
Throws:
java.io.FileNotFoundException
javax.xml.stream.XMLStreamException
javax.management.modelmbean.XMLParseException
Method Detail

getSpecies

public java.util.List<Species> getSpecies()
Returns a list of the species defined in the OrthoXML file.

Returns:
the species defined in the OrthoXML file.

getScoreDefinitions

public java.util.Map<java.lang.String,ScoreDefinition> getScoreDefinitions()
Returns a Map with scores defined in the OrthoXML file. The key of the map is the score identifier and the Value is the score definition.

Returns:
the scores defined in OrthoXML file.
See Also:
ScoreDefinition

getOrigin

public java.lang.String getOrigin()
Returns the origin of the OrthoXML.

Returns:
the origin of the OrthoXML

getVersion

public java.lang.Double getVersion()
The OrthoXML version.

Returns:
the OrthoXML version.

getOriginVersion

public java.lang.String getOriginVersion()
Returns the version of the OrthoXML origin.

Returns:
the version of the OrthoXML origin

next

public Group next()
           throws javax.xml.stream.XMLStreamException
Returns the next group top level ortholog group from the OrthoXML file/stream. If the Reader was constructed with an NCBI taxonomy filter, only groups that contain genes from at least two of this species are returned. Empty groups are removed recursively from the tree.

Returns:
the next top level group read or null if finished.
Throws:
javax.xml.stream.XMLStreamException