Package org.pathvisio.libgpml.model
Class GPML2021Reader
java.lang.Object
org.pathvisio.libgpml.model.GPMLFormatAbstract
org.pathvisio.libgpml.model.GPML2021FormatAbstract
org.pathvisio.libgpml.model.GPML2021Reader
- All Implemented Interfaces:
GPMLFormatReader
,GPMLFormatVersion
public class GPML2021Reader extends GPML2021FormatAbstract implements GPMLFormatReader
This class reads a PathwayModel from an input source (GPML 2021).
- Author:
- finterly
-
Field Summary
Fields Modifier and Type Field Description static GPML2021Reader
GPML2021READER
Fields inherited from class org.pathvisio.libgpml.model.GPML2021FormatAbstract
ANCHORSHAPETYPE_DEFAULT, ANNOTATIONTYPE_DEFAULT, ARROWHEAD_DEFAULT, BACKGROUNDCOLOR_DEFAULT, BORDERCOLOR_DEFAULT, BORDERSTYLE_DEFAULT, BORDERWIDTH_DEFAULT, CONNECTORTYPE_DEFAULT, DATANODETYPE_DEFAULT, FILLCOLOR_DEFAULT, FONTDECORATION_DEFAULT, FONTNAME_DEFAULT, FONTSIZE_DEFAULT, FONTSTRIKETHRU_DEFAULT, FONTSTYLE_DEFAULT, FONTWEIGHT_DEFAULT, GROUPTYPE_DEFAULT, HALIGN_DEFAULT, LINECOLOR_DEFAULT, LINESTYLE_DEFAULT, LINEWIDTH_DEFAULT, SHAPETYPE_DEFAULT, STATETYPE_DEFAULT, TEXTCOLOR_DEFAULT, VALIGN_DEFAULT
Fields inherited from class org.pathvisio.libgpml.model.GPMLFormatAbstract
BIOPAX_NAMESPACE, OWL_NAMESPACE, RDF_NAMESPACE, RDF_STRING, RDFS_NAMESPACE
-
Constructor Summary
Constructors Modifier Constructor Description protected
GPML2021Reader(java.lang.String xsdFile, org.jdom2.Namespace nsGPML)
Constructor for GPML reader. -
Method Summary
Modifier and Type Method Description protected void
readAnchors(LineElement lineElement, org.jdom2.Element wyps)
Reads anchorLineElement.Anchor
information for line element from jdom element.protected void
readAnnotationRefs(PathwayModel pathwayModel, Referenceable.Annotatable annotatable, org.jdom2.Element e, java.util.Map<java.lang.String,org.jdom2.Element> refIdToJdomElement)
protected void
readAuthors(Pathway pathway, org.jdom2.Element root)
Reads authorPathway.Author
information for pathway from root element.protected void
readCitationRefs(PathwayModel pathwayModel, Referenceable.Citable citable, org.jdom2.Element e, java.util.Map<java.lang.String,org.jdom2.Element> refIdToJdomElement)
protected void
readCommentGroup(PathwayModel pathwayModel, PathwayElement pathwayElement, org.jdom2.Element e, java.util.Map<java.lang.String,org.jdom2.Element> refIdToJdomElement)
Reads comment group (comment, dynamic property, annotationRef, citationRef, evidenceRef) information forPathwayElement
from jdom element.protected void
readComments(PathwayElement pathwayElement, org.jdom2.Element e)
Reads commentPathwayElement.Comment
information for pathway element from jdom element.protected void
readDataNodes(PathwayModel pathwayModel, org.jdom2.Element root, java.util.Map<java.lang.String,org.jdom2.Element> refIdToJdomElement)
Reads data nodeDataNode
information for pathway model from root element.protected void
readDynamicProperties(PathwayElement pathwayElement, org.jdom2.Element e)
Reads dynamic propertyPathwayElement.setDynamicProperty(java.lang.String, java.lang.String)
information for pathway element from jdom element.protected void
readEvidenceRefs(PathwayModel pathwayModel, Referenceable.Evidenceable evidenceable, org.jdom2.Element e, java.util.Map<java.lang.String,org.jdom2.Element> refIdToJdomElement)
protected void
readFontProperty(ShapedElement shapedElement, org.jdom2.Element gfx)
Reads font property information.void
readFromRoot(PathwayModel pathwayModel, org.jdom2.Element root)
Reads information from root element of Jdom documentDocument
to the pathway modelPathwayModel
.protected void
readGraphicalLines(PathwayModel pathwayModel, org.jdom2.Element root, java.util.Map<java.lang.String,org.jdom2.Element> refIdToJdomElement, java.util.Map<org.jdom2.Element,LineElement.LinePoint> elementToPoint)
Reads graphical lineGraphicalLine
information for pathway model from root element.protected void
readGroupRef(PathwayModel pathwayModel, ShapedElement shapedElement, org.jdom2.Element e)
protected void
readGroups(PathwayModel pathwayModel, org.jdom2.Element root, java.util.Map<java.lang.String,org.jdom2.Element> refIdToJdomElement)
Reads groupGroup
information for pathway model from root element.protected void
readInfoMap(org.jdom2.Element root, java.util.Map<java.lang.String,org.jdom2.Element> refIdToJdomElement)
Reads and maps ref (Annotation, Citation, and Evidence) elementId id to the corresponding jdom element inMap
refIdToJdomElement, to assist other reading methods:readAnnotationRefs(org.pathvisio.libgpml.model.PathwayModel, org.pathvisio.libgpml.model.Referenceable.Annotatable, org.jdom2.Element, java.util.Map<java.lang.String, org.jdom2.Element>)
,readCitationRefs(org.pathvisio.libgpml.model.PathwayModel, org.pathvisio.libgpml.model.Referenceable.Citable, org.jdom2.Element, java.util.Map<java.lang.String, org.jdom2.Element>)
, andreadEvidenceRefs(org.pathvisio.libgpml.model.PathwayModel, org.pathvisio.libgpml.model.Referenceable.Evidenceable, org.jdom2.Element, java.util.Map<java.lang.String, org.jdom2.Element>)
.protected void
readInteractions(PathwayModel pathwayModel, org.jdom2.Element root, java.util.Map<java.lang.String,org.jdom2.Element> refIdToJdomElement, java.util.Map<org.jdom2.Element,LineElement.LinePoint> elementToPoint)
Reads interactionInteraction
information for pathway model from root element.protected void
readLabels(PathwayModel pathwayModel, org.jdom2.Element root, java.util.Map<java.lang.String,org.jdom2.Element> refIdToJdomElement)
Reads labelLabel
information for pathway model from root element.protected void
readLineElement(PathwayModel pathwayModel, LineElement lineElement, org.jdom2.Element ln, java.util.Map<java.lang.String,org.jdom2.Element> refIdToJdomElement, java.util.Map<org.jdom2.Element,LineElement.LinePoint> elementToPoint)
Reads line elementLineElement
information for interaction or graphical line from jdom element.protected void
readLineStyleProperty(LineElement lineElement, org.jdom2.Element gfx)
Reads line style property information.protected Pathway
readPathway(Pathway pathway, org.jdom2.Element root)
Reads pathway information from jdom root element.protected void
readPointElementRefs(PathwayModel pathwayModel, java.util.Map<org.jdom2.Element,LineElement.LinePoint> elementToPoint)
Reads elementRefLineElement.LinePoint.setElementRef(org.pathvisio.libgpml.model.GraphLink.LinkableTo)
for pathway model points.protected void
readPoints(LineElement lineElement, org.jdom2.Element wyps, java.util.Map<org.jdom2.Element,LineElement.LinePoint> elementToPoint)
Reads pointLineElement.LinePoint
information for line element.protected void
readRectProperty(ShapedElement shapedElement, org.jdom2.Element gfx)
Reads rect property information.protected void
readShapedElement(PathwayModel pathwayModel, ShapedElement shapedElement, org.jdom2.Element se, java.util.Map<java.lang.String,org.jdom2.Element> refIdToJdomElement)
Reads common properties for shaped pathway elementsShapedElement
.protected void
readShapes(PathwayModel pathwayModel, org.jdom2.Element root, java.util.Map<java.lang.String,org.jdom2.Element> refIdToJdomElement)
Reads shapeShape
information for pathway model from root element.protected void
readShapeStyleProperty(ShapedElement shapedElement, org.jdom2.Element gfx)
Reads shape style property information.protected void
readStates(PathwayModel pathwayModel, DataNode dataNode, org.jdom2.Element dn, java.util.Map<java.lang.String,org.jdom2.Element> refIdToJdomElement)
Reads stateDataNode.State
information for data node from element.protected java.lang.String
readUrl(org.jdom2.Element e)
Reads Url link information from element.protected org.bridgedb.Xref
readXref(org.jdom2.Element e)
Reads xrefXref
information from jdom element.Methods inherited from class org.pathvisio.libgpml.model.GPMLFormatAbstract
getGpmlNamespace, getSchemaFile, refreshLineElements, updateGroups, validateDocument
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.pathvisio.libgpml.model.GPMLFormatVersion
getGpmlNamespace, getSchemaFile, validateDocument
-
Field Details
-
GPML2021READER
-
-
Constructor Details
-
GPML2021Reader
protected GPML2021Reader(java.lang.String xsdFile, org.jdom2.Namespace nsGPML)Constructor for GPML reader.- Parameters:
xsdFile
- the schema file.nsGPML
- the GPML namespace.
-
-
Method Details
-
readFromRoot
public void readFromRoot(PathwayModel pathwayModel, org.jdom2.Element root) throws ConverterExceptionReads information from root element of Jdom documentDocument
to the pathway modelPathwayModel
. NB: Order of reading is done in such as way that referenced elements are read first. Groups are read first as other pathway elements reference groupRef. Point and DataNode elementRef are read last to ensure the Pathway Elements referenced are already instantiated.- Specified by:
readFromRoot
in interfaceGPMLFormatReader
- Parameters:
pathwayModel
- the given pathway model.root
- the root element of given Jdom document.- Throws:
ConverterException
-
readPathway
Reads pathway information from jdom root element. Instantiates and returns the pathway objectPathway
.- Parameters:
root
- the jdom root element.- Throws:
ConverterException
-
readXref
Reads xrefXref
information from jdom element. Xref is optional for Pathway, DataNodes, States, Interactions, Groups, Annotations, and Evidences. Citations must have either Xref or Url, or both.- Parameters:
e
- the jdom element.- Returns:
- xref the new xref or null if no or invalid xref information.
- Throws:
ConverterException
-
readUrl
Reads Url link information from element. Url is optional for Annotations, Citations, and Evidences. Citations must have either Xref or Url, or both.- Parameters:
e
- the element.- Returns:
- urlLink the link for the url.
- Throws:
ConverterException
-
readAuthors
Reads authorPathway.Author
information for pathway from root element.- Parameters:
pathway
- the pathway.root
- the jdom root element.- Throws:
ConverterException
-
readInfoMap
protected void readInfoMap(org.jdom2.Element root, java.util.Map<java.lang.String,org.jdom2.Element> refIdToJdomElement) throws ConverterExceptionReads and maps ref (Annotation, Citation, and Evidence) elementId id to the corresponding jdom element inMap
refIdToJdomElement, to assist other reading methods:readAnnotationRefs(org.pathvisio.libgpml.model.PathwayModel, org.pathvisio.libgpml.model.Referenceable.Annotatable, org.jdom2.Element, java.util.Map<java.lang.String, org.jdom2.Element>)
,readCitationRefs(org.pathvisio.libgpml.model.PathwayModel, org.pathvisio.libgpml.model.Referenceable.Citable, org.jdom2.Element, java.util.Map<java.lang.String, org.jdom2.Element>)
, andreadEvidenceRefs(org.pathvisio.libgpml.model.PathwayModel, org.pathvisio.libgpml.model.Referenceable.Evidenceable, org.jdom2.Element, java.util.Map<java.lang.String, org.jdom2.Element>)
.- Parameters:
root
- the jdom root element.refIdToJdomElement
- the map of ref elementId to jdom element.- Throws:
ConverterException
-
readAnnotationRefs
protected void readAnnotationRefs(PathwayModel pathwayModel, Referenceable.Annotatable annotatable, org.jdom2.Element e, java.util.Map<java.lang.String,org.jdom2.Element> refIdToJdomElement) throws ConverterException- Parameters:
pathwayModel
- the pathway model.annotatable
- the pathway object which can have annotation.e
- the jdom element.refIdToJdomElement
- the map of ref elementId to jdom element.- Throws:
ConverterException
-
readCitationRefs
protected void readCitationRefs(PathwayModel pathwayModel, Referenceable.Citable citable, org.jdom2.Element e, java.util.Map<java.lang.String,org.jdom2.Element> refIdToJdomElement) throws ConverterException- Parameters:
pathwayModel
- the pathway model.citable
- the pathway object which can have citation.e
- the jdom element.refIdToJdomElement
- the map of ref elementId to jdom element.- Throws:
ConverterException
-
readEvidenceRefs
protected void readEvidenceRefs(PathwayModel pathwayModel, Referenceable.Evidenceable evidenceable, org.jdom2.Element e, java.util.Map<java.lang.String,org.jdom2.Element> refIdToJdomElement) throws ConverterException- Parameters:
pathwayModel
- the pathway model.evidenceable
- the pathway object which can have evidence.e
- the jdom element.refIdToJdomElement
- the map of ref elementId to jdom element.- Throws:
ConverterException
-
readCommentGroup
protected void readCommentGroup(PathwayModel pathwayModel, PathwayElement pathwayElement, org.jdom2.Element e, java.util.Map<java.lang.String,org.jdom2.Element> refIdToJdomElement) throws ConverterExceptionReads comment group (comment, dynamic property, annotationRef, citationRef, evidenceRef) information forPathwayElement
from jdom element.- Parameters:
pathwayElement
- the element info pathway element object.e
- the jdom element.refIdToJdomElement
- the map of ref elementId to jdom element.- Throws:
ConverterException
-
readComments
protected void readComments(PathwayElement pathwayElement, org.jdom2.Element e) throws ConverterExceptionReads commentPathwayElement.Comment
information for pathway element from jdom element.- Parameters:
pathwayElement
- the pathway element.e
- the jdom element.- Throws:
ConverterException
-
readDynamicProperties
protected void readDynamicProperties(PathwayElement pathwayElement, org.jdom2.Element e) throws ConverterExceptionReads dynamic propertyPathwayElement.setDynamicProperty(java.lang.String, java.lang.String)
information for pathway element from jdom element.- Parameters:
pathwayElement
- the the pathway element.e
- the jdom element.- Throws:
ConverterException
-
readGroups
protected void readGroups(PathwayModel pathwayModel, org.jdom2.Element root, java.util.Map<java.lang.String,org.jdom2.Element> refIdToJdomElement) throws ConverterExceptionReads groupGroup
information for pathway model from root element.- Parameters:
pathwayModel
- the pathway model.root
- the jdom root element.refIdToJdomElement
- the map of ref elementId to jdom element.- Throws:
ConverterException
-
readLabels
protected void readLabels(PathwayModel pathwayModel, org.jdom2.Element root, java.util.Map<java.lang.String,org.jdom2.Element> refIdToJdomElement) throws ConverterExceptionReads labelLabel
information for pathway model from root element.- Parameters:
pathwayModel
- the pathway model.root
- the jdom root element.refIdToJdomElement
- the map of ref elementId to jdom element.- Throws:
ConverterException
-
readShapes
protected void readShapes(PathwayModel pathwayModel, org.jdom2.Element root, java.util.Map<java.lang.String,org.jdom2.Element> refIdToJdomElement) throws ConverterExceptionReads shapeShape
information for pathway model from root element.- Parameters:
pathwayModel
- the pathway model.root
- the root element.refIdToJdomElement
- the map of ref elementId to jdom element.- Throws:
ConverterException
-
readDataNodes
protected void readDataNodes(PathwayModel pathwayModel, org.jdom2.Element root, java.util.Map<java.lang.String,org.jdom2.Element> refIdToJdomElement) throws ConverterExceptionReads data nodeDataNode
information for pathway model from root element.- Parameters:
pathwayModel
- the pathway model.root
- the jdom root element.refIdToJdomElement
- the map of ref elementId to jdom element.- Throws:
ConverterException
-
readStates
protected void readStates(PathwayModel pathwayModel, DataNode dataNode, org.jdom2.Element dn, java.util.Map<java.lang.String,org.jdom2.Element> refIdToJdomElement) throws ConverterExceptionReads stateDataNode.State
information for data node from element.- Parameters:
pathwayModel
- the pathway model.dataNode
- the data node objectDataNode
.dn
- the jdom data node element.refIdToJdomElement
- the map of ref elementId to jdom element.- Throws:
ConverterException
-
readShapedElement
protected void readShapedElement(PathwayModel pathwayModel, ShapedElement shapedElement, org.jdom2.Element se, java.util.Map<java.lang.String,org.jdom2.Element> refIdToJdomElement) throws ConverterExceptionReads common properties for shaped pathway elementsShapedElement
.- Parameters:
pathwayModel
- the pathway model.shapedElement
- the shaped pathway element.se
- the jdom (shaped) pathway element.refIdToJdomElement
- the map of ref elementId to jdom element.- Throws:
ConverterException
-
readGroupRef
protected void readGroupRef(PathwayModel pathwayModel, ShapedElement shapedElement, org.jdom2.Element e) throws ConverterException- Parameters:
pathwayModel
- the pathway model.shapedElement
- the shapedElement to read groupRef for.e
- the jdom shaped element.- Throws:
ConverterException
-
readInteractions
protected void readInteractions(PathwayModel pathwayModel, org.jdom2.Element root, java.util.Map<java.lang.String,org.jdom2.Element> refIdToJdomElement, java.util.Map<org.jdom2.Element,LineElement.LinePoint> elementToPoint) throws ConverterExceptionReads interactionInteraction
information for pathway model from root element.- Parameters:
pathwayModel
- the pathway model.root
- the jdom root element.refIdToJdomElement
- the map of ref elementId to jdom element.- Throws:
ConverterException
-
readGraphicalLines
protected void readGraphicalLines(PathwayModel pathwayModel, org.jdom2.Element root, java.util.Map<java.lang.String,org.jdom2.Element> refIdToJdomElement, java.util.Map<org.jdom2.Element,LineElement.LinePoint> elementToPoint) throws ConverterExceptionReads graphical lineGraphicalLine
information for pathway model from root element.- Parameters:
pathwayModel
- the pathway model.root
- the jdom root element.refIdToJdomElement
- the map of ref elementId to jdom element.elementToPoint
- the map of jdom element to line points.- Throws:
ConverterException
-
readPoints
protected void readPoints(LineElement lineElement, org.jdom2.Element wyps, java.util.Map<org.jdom2.Element,LineElement.LinePoint> elementToPoint) throws ConverterExceptionReads pointLineElement.LinePoint
information for line element.- Parameters:
lineElement
- the line element object.wyps
- the jdom waypoints element.elementToPoint
- the map of jdom element to line points.- Throws:
ConverterException
-
readLineElement
protected void readLineElement(PathwayModel pathwayModel, LineElement lineElement, org.jdom2.Element ln, java.util.Map<java.lang.String,org.jdom2.Element> refIdToJdomElement, java.util.Map<org.jdom2.Element,LineElement.LinePoint> elementToPoint) throws ConverterExceptionReads line elementLineElement
information for interaction or graphical line from jdom element.- Parameters:
lineElement
- the line element object.ln
- the jdom line element.refIdToJdomElement
- the map of ref elementId to jdom element.elementToPoint
- the map of jdom element to line points.- Throws:
ConverterException
-
readAnchors
protected void readAnchors(LineElement lineElement, org.jdom2.Element wyps) throws ConverterExceptionReads anchorLineElement.Anchor
information for line element from jdom element.- Parameters:
lineElement
- the line element object.wyps
- the jdom waypoints element.- Throws:
ConverterException
-
readPointElementRefs
protected void readPointElementRefs(PathwayModel pathwayModel, java.util.Map<org.jdom2.Element,LineElement.LinePoint> elementToPoint) throws ConverterExceptionReads elementRefLineElement.LinePoint.setElementRef(org.pathvisio.libgpml.model.GraphLink.LinkableTo)
for pathway model points.- Parameters:
pathwayModel
- the pathway model.elementToPoint
- the map of jdom element to line points.- Throws:
ConverterException
-
readRectProperty
protected void readRectProperty(ShapedElement shapedElement, org.jdom2.Element gfx) throws ConverterExceptionReads rect property information. Jdom handles schema default values.- Parameters:
shapedElement
- the shaped pathway element.gfx
- the jdom graphics element.- Throws:
ConverterException
-
readFontProperty
protected void readFontProperty(ShapedElement shapedElement, org.jdom2.Element gfx) throws ConverterExceptionReads font property information. Jdom handles schema default values.- Parameters:
shapedElement
- the shaped pathway element.gfx
- the jdom graphics element.- Throws:
ConverterException
-
readShapeStyleProperty
protected void readShapeStyleProperty(ShapedElement shapedElement, org.jdom2.Element gfx) throws ConverterExceptionReads shape style property information. Jdom handles schema default values.- Parameters:
shapedElement
- the shaped pathway element.gfx
- the jdom graphics element.- Throws:
ConverterException
-
readLineStyleProperty
protected void readLineStyleProperty(LineElement lineElement, org.jdom2.Element gfx) throws ConverterExceptionReads line style property information. Jdom handles schema default values.- Parameters:
lineElement
- the line pathway element.gfx
- the jdom graphics element.- Throws:
ConverterException
-