Package org.pathvisio.libgpml.model
Class GPML2021Writer
java.lang.Object
org.pathvisio.libgpml.model.GPMLFormatAbstract
org.pathvisio.libgpml.model.GPML2021FormatAbstract
org.pathvisio.libgpml.model.GPML2021Writer
- All Implemented Interfaces:
GPMLFormatVersion,GPMLFormatWriter
public class GPML2021Writer extends GPML2021FormatAbstract implements GPMLFormatWriter
This class writes a PathwayModel to an output (GPML 2021).
NB:
- GPML2021 is the current gpml format.
- In the GUI, Pathways are saved/written in the GPML2021 format.
- Author:
- finterly
-
Field Summary
Fields Modifier and Type Field Description static GPML2021WriterGPML2021WRITERFields 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_DEFAULTFields inherited from class org.pathvisio.libgpml.model.GPMLFormatAbstract
BIOPAX_NAMESPACE, OWL_NAMESPACE, RDF_NAMESPACE, RDF_STRING, RDFS_NAMESPACE -
Constructor Summary
Constructors Modifier Constructor Description protectedGPML2021Writer(java.lang.String xsdFile, org.jdom2.Namespace nsGPML)Constructor for GPML writer. -
Method Summary
Modifier and Type Method Description org.jdom2.DocumentcreateJdom(PathwayModel pathwayModel)Creates and returns the JDOM documentDocumentwritten from given pathwayModelPathwayModeldata.protected voidwriteAliasRef(Group aliasRef, org.jdom2.Element e)Writes aliasRef property information for a data node.protected voidwriteAnchors(java.util.List<LineElement.Anchor> anchors, org.jdom2.Element wyps)Writes anchorLineElement.Anchorinformation.protected voidwriteAnnotationRefs(java.util.List<PathwayElement.AnnotationRef> annotationRefs, org.jdom2.Element e)Writes annotation reference information for pathway or pathway element.protected voidwriteAnnotations(java.util.List<Annotation> annotations, org.jdom2.Element root)Writes annotationAnnotationinformation.protected voidwriteAuthors(java.util.List<Pathway.Author> authors, org.jdom2.Element root)Writes authorPathway.Authorinformation.protected voidwriteCitationRefs(java.util.List<PathwayElement.CitationRef> citationRefs, org.jdom2.Element e)Writes citation reference information for pathway or pathway element.protected voidwriteCitations(java.util.List<Citation> citations, org.jdom2.Element root)Writes citationCitationinformation.protected voidwriteComments(java.util.List<PathwayElement.Comment> comments, org.jdom2.Element e)Writes commentsPathwayElement.Commentinformation for pathway or pathway element.protected voidwriteDataNodes(java.util.List<DataNode> dataNodes, org.jdom2.Element root)Writes datanodeDataNodeinformation.protected voidwriteDynamicProperties(java.util.Map<java.lang.String,java.lang.String> dynamicProperties, org.jdom2.Element e)Writes dynamic property information for pathway or pathway element.protected voidwriteElementId(java.lang.String elementId, org.jdom2.Element e)Writes elementIdPathwayObjectproperty information.protected voidwriteElementInfo(PathwayElement elementInfo, org.jdom2.Element e)Writes elementId, comment group {comment, dynamic property, annotationRef, citationRef) and evidenceRefPathwayElementinformation forprotected booleanwriteElementRef(GraphLink.LinkableTo elementRef, org.jdom2.Element e)Writes elementRef property information.protected voidwriteEvidenceRefs(java.util.List<PathwayElement.EvidenceRef> evidenceRefs, org.jdom2.Element e)Writes evidence reference information for pathway or pathway element, ElementInfo#getEvidenceRefs.protected voidwriteEvidences(java.util.List<Evidence> evidences, org.jdom2.Element root)Writes evidenceEvidenceinformation.protected voidwriteFontProperty(ShapedElement shapedElement, org.jdom2.Element gfx)Writes font property information.protected voidwriteGraphicalLines(java.util.List<GraphicalLine> graphicalLines, org.jdom2.Element root)Writes graphical lineGraphicalLineinformation.protected voidwriteGroupRef(Group groupRef, org.jdom2.Element e)Writes groupRef property information.protected voidwriteGroups(java.util.List<Group> groups, org.jdom2.Element root)Writes groupGroupinformation.protected voidwriteInteractions(java.util.List<Interaction> interactions, org.jdom2.Element root)Writes interactionInteractioninformation.protected voidwriteLabels(java.util.List<Label> labels, org.jdom2.Element root)Writes labelLabelinformation.protected voidwriteLineElement(LineElement lineElement, org.jdom2.Element ln)Writes line elementLineElementinformation for interactions or graphicalLines.protected voidwriteLineStyleProperty(LineElement lineElement, org.jdom2.Element gfx)Writes line style property information.protected voidwritePathwayInfo(PathwayModel pathwayModel, org.jdom2.Element root)Writes pathway objectPathwayinformation and authors list to root element.protected voidwritePoints(LineElement lineElement, org.jdom2.Element wyps)Writes pointLineElement.LinePointinformation.protected voidwriteRectProperty(ShapedElement shapedElement, org.jdom2.Element gfx)Writes rect property information.protected voidwriteShapedElement(ShapedElement shapedElement, org.jdom2.Element se)Writes shapedElementShapedElementinformation for datanodes, labels, shapes, or groups.protected voidwriteShapes(java.util.List<Shape> shapes, org.jdom2.Element root)Writes shapeShapeinformation.protected voidwriteShapeStyleProperty(ShapedElement shapedElement, org.jdom2.Element gfx)Writes shape style property information.protected voidwriteStates(java.util.List<DataNode.State> states, org.jdom2.Element dn)Writes stateDataNode.Stateinformation.voidwriteToXml(PathwayModel pathwayModel, java.io.File file, boolean validate)Writes the JDOM document to the file specified.voidwriteToXml(PathwayModel pathwayModel, java.io.OutputStream output, boolean validate)Writes the JDOMDocumentdocument to the outputstream specified.protected voidwriteUrl(java.lang.String urlLink, org.jdom2.Element e)Writes url link information to new element.protected voidwriteXref(org.bridgedb.Xref xref, org.jdom2.Element e, boolean required)Writes xrefXrefinformation to new element.Methods inherited from class org.pathvisio.libgpml.model.GPMLFormatAbstract
getGpmlNamespace, getSchemaFile, refreshLineElements, updateGroups, validateDocumentMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.pathvisio.libgpml.model.GPMLFormatVersion
getGpmlNamespace, getSchemaFile, validateDocument
-
Field Details
-
GPML2021WRITER
-
-
Constructor Details
-
GPML2021Writer
protected GPML2021Writer(java.lang.String xsdFile, org.jdom2.Namespace nsGPML)Constructor for GPML writer.- Parameters:
xsdFile- the schema file.nsGPML- the GPML namespace.
-
-
Method Details
-
writeToXml
public void writeToXml(PathwayModel pathwayModel, java.io.OutputStream output, boolean validate) throws ConverterExceptionWrites the JDOMDocumentdocument to the outputstream specified.- Specified by:
writeToXmlin interfaceGPMLFormatWriter- Parameters:
pathwayModel- the pathway model.output- the outputstream to which the JDOM document should be writtenvalidate- if true, validate the dom structure before writing. If there is a validation error, or the xsd is not in the classpath, an exception will be thrown.- Throws:
ConverterException
-
writeToXml
public void writeToXml(PathwayModel pathwayModel, java.io.File file, boolean validate) throws ConverterExceptionWrites the JDOM document to the file specified.- Specified by:
writeToXmlin interfaceGPMLFormatWriter- Parameters:
pathwayModel- the pathway model.file- the file to which the JDOM document should be saved.validate- if true, validate the dom structure before writing to file.- Throws:
ConverterException
-
createJdom
Creates and returns the JDOM documentDocumentwritten from given pathwayModelPathwayModeldata.- Specified by:
createJdomin interfaceGPMLFormatWriter- Parameters:
pathwayModel- the pathway model to be written.- Returns:
- Throws:
ConverterException
-
writePathwayInfo
protected void writePathwayInfo(PathwayModel pathwayModel, org.jdom2.Element root) throws ConverterExceptionWrites pathway objectPathwayinformation and authors list to root element.- Parameters:
pathwayModel- the pathway model.root- the root element.- Throws:
ConverterException
-
writeXref
protected void writeXref(org.bridgedb.Xref xref, org.jdom2.Element e, boolean required)Writes xrefXrefinformation to new element. Xref is required for Evidences. Xref is optional for the Pathway, DataNodes, States, Interactions, Groups, and Annotations. For Citations, either Xref and/or Url are required.- Parameters:
xref- the xref of the pathway or pathway element.e- the parent element.required- if true, xref is a required property.
-
writeUrl
protected void writeUrl(java.lang.String urlLink, org.jdom2.Element e)Writes url link information to new element. Url is optional for Annotations and Evidences. For Citations, either Xref and/or Url are required.- Parameters:
urlLink- the url link.e- the jdom element.
-
writeAuthors
protected void writeAuthors(java.util.List<Pathway.Author> authors, org.jdom2.Element root) throws ConverterExceptionWrites authorPathway.Authorinformation.- Parameters:
authors- the list of authors.root- the root element.- Throws:
ConverterException
-
writeComments
protected void writeComments(java.util.List<PathwayElement.Comment> comments, org.jdom2.Element e) throws ConverterExceptionWrites commentsPathwayElement.Commentinformation for pathway or pathway element.- Parameters:
comments- the list of comments of pathway or pathway element.e- the parent element.- Throws:
ConverterException
-
writeDynamicProperties
protected void writeDynamicProperties(java.util.Map<java.lang.String,java.lang.String> dynamicProperties, org.jdom2.Element e) throws ConverterExceptionWrites dynamic property information for pathway or pathway element.PathwayElement.getDynamicProperty(java.lang.String)- Parameters:
dynamicProperties- the list of dynamic properties.e- the parent element.- Throws:
ConverterException
-
writeAnnotationRefs
protected void writeAnnotationRefs(java.util.List<PathwayElement.AnnotationRef> annotationRefs, org.jdom2.Element e) throws ConverterExceptionWrites annotation reference information for pathway or pathway element., ElementInfo#getAnnotationRefs. In GPML2021, annotationRef can have citationRefs and/or evidenceRefs nested inside.- Parameters:
annotationRefs- the list of annotation references.e- the parent element.- Throws:
ConverterException
-
writeCitationRefs
protected void writeCitationRefs(java.util.List<PathwayElement.CitationRef> citationRefs, org.jdom2.Element e) throws ConverterExceptionWrites citation reference information for pathway or pathway element., ElementInfo#getCitationRefs.- Parameters:
citationRefs- the list of citation references.e- the parent element.- Throws:
ConverterException
-
writeEvidenceRefs
protected void writeEvidenceRefs(java.util.List<PathwayElement.EvidenceRef> evidenceRefs, org.jdom2.Element e) throws ConverterExceptionWrites evidence reference information for pathway or pathway element, ElementInfo#getEvidenceRefs.- Parameters:
evidenceRefs- the list of evidence references.e- the parent element.- Throws:
ConverterException
-
writeDataNodes
protected void writeDataNodes(java.util.List<DataNode> dataNodes, org.jdom2.Element root) throws ConverterExceptionWrites datanodeDataNodeinformation.- Parameters:
dataNodes- the list of datanodes.root- the root element.- Throws:
ConverterException
-
writeAliasRef
Writes aliasRef property information for a data node. Used inwriteDataNodes(java.util.List<org.pathvisio.libgpml.model.DataNode>, org.jdom2.Element).- Parameters:
aliasRef- the group for which data node is an alias.e- the parent jdom element.
-
writeStates
protected void writeStates(java.util.List<DataNode.State> states, org.jdom2.Element dn) throws ConverterExceptionWrites stateDataNode.Stateinformation.- Parameters:
states- the list of states.dn- the parent data node element.- Throws:
ConverterException
-
writeInteractions
protected void writeInteractions(java.util.List<Interaction> interactions, org.jdom2.Element root) throws ConverterExceptionWrites interactionInteractioninformation.- Parameters:
interactions- the list of interactions.root- the root element;- Throws:
ConverterException
-
writeGraphicalLines
protected void writeGraphicalLines(java.util.List<GraphicalLine> graphicalLines, org.jdom2.Element root) throws ConverterExceptionWrites graphical lineGraphicalLineinformation.- Parameters:
graphicalLines- the list of graphical lines.root- the root element.- Throws:
ConverterException
-
writeLineElement
protected void writeLineElement(LineElement lineElement, org.jdom2.Element ln) throws ConverterExceptionWrites line elementLineElementinformation for interactions or graphicalLines.- Parameters:
lineElement- the interaction or graphicalLine.ln- the line element.- Throws:
ConverterException
-
writePoints
protected void writePoints(LineElement lineElement, org.jdom2.Element wyps) throws ConverterExceptionWrites pointLineElement.LinePointinformation.- Parameters:
lineElement- the line element.wyps- the parent element.- Throws:
ConverterException
-
writeElementRef
Writes elementRef property information. Returns boolean if elementRef is written. Used inwritePoints(org.pathvisio.libgpml.model.LineElement, org.jdom2.Element).- Parameters:
elementRef- the elementRef.e- the parent jdom element.- Returns:
- true if elementRef exists and is successfully written.
-
writeAnchors
protected void writeAnchors(java.util.List<LineElement.Anchor> anchors, org.jdom2.Element wyps) throws ConverterExceptionWrites anchorLineElement.Anchorinformation.- Parameters:
anchors- the list of anchors.wyps- the parent element.- Throws:
ConverterException
-
writeLabels
protected void writeLabels(java.util.List<Label> labels, org.jdom2.Element root) throws ConverterExceptionWrites labelLabelinformation.- Parameters:
labels- the list of labels.root- the root element.- Throws:
ConverterException
-
writeShapes
protected void writeShapes(java.util.List<Shape> shapes, org.jdom2.Element root) throws ConverterExceptionWrites shapeShapeinformation.- Parameters:
shapes- the list of shapes.root- the root element.- Throws:
ConverterException
-
writeGroups
protected void writeGroups(java.util.List<Group> groups, org.jdom2.Element root) throws ConverterExceptionWrites groupGroupinformation.- Parameters:
groups- the list of groups.root- the root element.- Throws:
ConverterException
-
writeAnnotations
protected void writeAnnotations(java.util.List<Annotation> annotations, org.jdom2.Element root) throws ConverterExceptionWrites annotationAnnotationinformation.- Parameters:
annotations- the list of annotations.root- the root element.- Throws:
ConverterException
-
writeCitations
protected void writeCitations(java.util.List<Citation> citations, org.jdom2.Element root) throws ConverterExceptionWrites citationCitationinformation.- Parameters:
citations- the list of citations.root- the root element.- Throws:
ConverterException
-
writeEvidences
protected void writeEvidences(java.util.List<Evidence> evidences, org.jdom2.Element root) throws ConverterExceptionWrites evidenceEvidenceinformation.- Parameters:
evidences- the list of evidences.root- the root element.- Throws:
ConverterException
-
writeElementId
protected void writeElementId(java.lang.String elementId, org.jdom2.Element e)Writes elementIdPathwayObjectproperty information.- Parameters:
elementId- the elementId.e- the parent element.
-
writeGroupRef
Writes groupRef property information.- Parameters:
groupRef- the groupRef.e- the parent element.
-
writeShapedElement
protected void writeShapedElement(ShapedElement shapedElement, org.jdom2.Element se) throws ConverterExceptionWrites shapedElementShapedElementinformation for datanodes, labels, shapes, or groups.- Parameters:
shapedElement- the datanode, label, shape, or group.se- the shape jdom element.- Throws:
ConverterException
-
writeElementInfo
protected void writeElementInfo(PathwayElement elementInfo, org.jdom2.Element e) throws ConverterExceptionWrites elementId, comment group {comment, dynamic property, annotationRef, citationRef) and evidenceRefPathwayElementinformation for- Parameters:
elementInfo- the pathway element.e- the parent element.- Throws:
ConverterException
-
writeRectProperty
protected void writeRectProperty(ShapedElement shapedElement, org.jdom2.Element gfx) throws ConverterExceptionWrites rect property information.- Parameters:
shapedElement- the shaped pathway element.gfx- the parent graphics element.- Throws:
ConverterException
-
writeFontProperty
protected void writeFontProperty(ShapedElement shapedElement, org.jdom2.Element gfx) throws ConverterExceptionWrites font property information.- Parameters:
shapedElement- the shaped pathway element.gfx- the parent graphics element.- Throws:
ConverterException
-
writeShapeStyleProperty
protected void writeShapeStyleProperty(ShapedElement shapedElement, org.jdom2.Element gfx) throws ConverterExceptionWrites shape style property information.- Parameters:
shapedElement- the shaped pathway element.gfx- the parent graphics element.- Throws:
ConverterException
-
writeLineStyleProperty
protected void writeLineStyleProperty(LineElement lineElement, org.jdom2.Element gfx) throws ConverterExceptionWrites line style property information.- Parameters:
lineElement- the line pathway element.gfx- the parent graphics element.- Throws:
ConverterException
-