Package org.pathvisio.libgpml.model
Class GPML2013aFormatAbstract
java.lang.Object
org.pathvisio.libgpml.model.GPMLFormatAbstract
org.pathvisio.libgpml.model.GPML2013aFormatAbstract
- Direct Known Subclasses:
GPML2013aReader
,GPML2013aWriter
public abstract class GPML2013aFormatAbstract extends GPMLFormatAbstract
Abstract class for GPML2013a format. Contains static properties and methods
used in reading or writing GPML2013a.
- Author:
- finterly
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
GPML2013aFormatAbstract.AttributeInfo
Name of resource containing the gpml schema definition. -
Field Summary
Fields Modifier and Type Field Description private static java.util.Map<java.lang.String,GPML2013aFormatAbstract.AttributeInfo>
ATTRIBUTE_INFO
Attribute info map is initiated withinitAttributeInfo()
.static java.util.List<java.lang.String>
BINDING_LIST
static org.jdom2.Namespace
BIOPAX_NAMESPACE
static java.util.List<java.lang.String>
CATALYSIS_LIST
static java.lang.String
CELL_CMPNT_KEY
static java.util.Map<ShapeType,ShapeType>
CELL_CMPNT_MAP
This cellular componentMap
mapsShapeType
s.static java.util.List<java.lang.String>
CONVERSION_LIST
static org.apache.commons.collections4.BidiMap<java.lang.String,ShapeType>
DEPRECATED_MAP
ThisMap
maps deprecatedString
to the newShapeType
when reading GPML2013aGPML2013aReader.readShapeStyleProperty(org.pathvisio.libgpml.model.ShapedElement, org.jdom2.Element)
.static java.util.List<java.lang.String>
DIRECTED_LIST
static java.lang.String
DIRECTION
static java.lang.String
DOUBLE_LINE_KEY
In GPML2013a, Double LineStyleType, Cellular Component Shape Types, and State rotation were stored as a dynamic properties using the following String keys.static java.util.Set<java.lang.String>
GPML2013A_KEY_SET
ThisSet
stores the deprecated GPML2013a properties.static java.util.Map<ArrowHeadType,java.util.List<java.lang.String>>
IA_PANEL_MAP
ThisMap
maps new Interaction Panel arrow head types to the definedList
for corresponding GPML2013a arrowHead types.static java.lang.String
INFOBOX_CENTER_X
static java.lang.String
INFOBOX_CENTER_Y
static java.util.List<java.lang.String>
INHIBITION_LIST
static java.lang.String
LEGEND_CENTER_X
static java.lang.String
LEGEND_CENTER_Y
static org.apache.commons.collections4.BidiMap<java.lang.String,java.lang.String>
OCV_ONTOLOGY_MAP
ThisBidiMap
maps GPML2013a openControlledVocabulary Ontology types to theirDataSource
Prefix for readingGPML2013aReader.readOpenControlledVocabulary(org.pathvisio.libgpml.model.PathwayModel, org.jdom2.Element, java.util.Set<java.lang.String>)
and writingGPML2013aWriter.writeOpenControlledVocabulary(org.pathvisio.libgpml.model.PathwayModel, org.jdom2.Element)
.static org.jdom2.Namespace
OWL_NAMESPACE
static java.lang.String
PARENT
String values forDataNode.State
phosphositePathwayElement.Comment
information in GPML2013a.static java.lang.String
PARENTID
static java.lang.String
PARENTID_DB
static java.lang.String
PARENTSYMBOL
static java.lang.String
PARENTSYMBOL_DB
static java.lang.String
PATHWAY_AUTHOR
Some GPML2013a properties are removed from GPML2021 and therefore cannot be mapped to the Java model.static java.lang.String
PATHWAY_EMAIL
static java.lang.String
PATHWAY_LASTMODIFIED
static java.lang.String
PATHWAY_MAINTAINER
static java.lang.String
POSITION
static java.lang.String
PTM
static org.jdom2.Namespace
RDF_NAMESPACE
In GPML2013a, specificNamespace
are defined for Biopax elements.static java.lang.String
RDF_STRING
static org.jdom2.Namespace
RDFS_NAMESPACE
static org.apache.commons.collections4.BidiMap<java.lang.String,java.lang.String>
SHAPETYPE_TO_CAMELCASE
ThisBidiMap
is used for mappingShapeType
Strings to their new camelCase spelling for reading and writing GPML2013a.static java.lang.String
SITE
static java.lang.String
SITEGRPID
static java.lang.String
SITEGRPID_DB
static java.util.Map<java.lang.String,java.util.List<java.lang.String>>
STATE_DIRECTION_MAP
Map forDataNode.State
phosphositePathwayElement.Comment
direction character toAnnotation
andXref
information.static java.util.Map<java.lang.String,java.util.List<java.lang.String>>
STATE_PTM_MAP
ThisMap
forDataNode.State
phosphositePathwayElement.Comment
maps PTM character toAnnotation
andXref
information.(package private) java.util.Set<java.lang.String>
STATE_REF_LIST
ThisSet
contains known phosphosite related annotation types forDataNode.State
phosphositePathwayElement.Comment
in GPML2013a.static java.lang.String
STATE_ROTATION
static java.util.List<java.lang.String>
STIMULATION_LIST
static java.util.List<java.lang.String>
TRANSCRIPTION_TRANSLATION_LIST
static java.util.List<java.lang.String>
TRANSLOCATION_LIST
static java.util.List<java.lang.String>
UNDIRECTED_LIST
In GPML2013a, we introduce a new Interaction Panel ofArrowHeadType
.static java.lang.String
WP_DESCRIPTION
In GPML2013a,Pathway
description is written as aPathwayElement.Comment
with source="WikiPathways-description". -
Constructor Summary
Constructors Modifier Constructor Description protected
GPML2013aFormatAbstract(java.lang.String xsdFile, org.jdom2.Namespace nsGPML)
Constructor for GPML2013aFormat Abstract. -
Method Summary
Modifier and Type Method Description protected java.lang.String
fromCamelCase(java.lang.String str)
Converts shapeTypeString
from UpperCamelCase convention back to its original appearance in GPML2013a.protected java.lang.String
getArrowHeadTypeStr(ArrowHeadType arrowHead)
Returns the prioritized GPML2013a arrowHead type string for given GPML2021 Interaction Panel arrow head type.protected java.lang.String
getAttr(java.lang.String tag, java.lang.String name, org.jdom2.Element el)
Gets a certain attribute value, and replaces it with a suitable default under certain conditions.protected java.util.Map<java.lang.String,GPML2013aFormatAbstract.AttributeInfo>
getAttributeInfo()
ReturnsMap
ATTRIBUTE_INFO collection that containsString
as key andGPML2013aFormatAbstract.AttributeInfo
as value.protected ArrowHeadType
getInteractionPanelType(java.lang.String arrowHeadStr)
Returns the GPML2021 Interaction Panel arrow head type for given GPML2013a arrowHead type string.private static java.util.Map<java.lang.String,GPML2013aFormatAbstract.AttributeInfo>
initAttributeInfo()
private boolean
isEqualsColor(java.lang.String def, java.lang.String value)
Returns true if given value and default value are the same color object.private boolean
isEqualsNumber(java.lang.String def, java.lang.String value)
Returns true if given string value and default value are numerically equal.private boolean
isEqualsString(java.lang.String def, java.lang.String value)
Returns true if given string value and default value are equal.protected void
setAttr(java.lang.String tag, java.lang.String name, org.jdom2.Element el, java.lang.String value)
Sets a certain attribute value, performs a basic check for some types, and throws an exception if trying to set an invalid value.protected java.lang.String
toCamelCase(java.lang.String str)
Converts shapeTypeString
to UpperCamelCase convention.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
-
Field Details
-
RDF_NAMESPACE
public static final org.jdom2.Namespace RDF_NAMESPACEIn GPML2013a, specificNamespace
are defined for Biopax elements. -
RDFS_NAMESPACE
public static final org.jdom2.Namespace RDFS_NAMESPACE -
BIOPAX_NAMESPACE
public static final org.jdom2.Namespace BIOPAX_NAMESPACE -
OWL_NAMESPACE
public static final org.jdom2.Namespace OWL_NAMESPACE -
RDF_STRING
public static final java.lang.String RDF_STRING- See Also:
- Constant Field Values
-
PATHWAY_AUTHOR
public static final java.lang.String PATHWAY_AUTHORSome GPML2013a properties are removed from GPML2021 and therefore cannot be mapped to the Java model. These deprecated properties are stored in dynamic properties with the following static strings as keys.- See Also:
- Constant Field Values
-
PATHWAY_MAINTAINER
public static final java.lang.String PATHWAY_MAINTAINER- See Also:
- Constant Field Values
-
PATHWAY_EMAIL
public static final java.lang.String PATHWAY_EMAIL- See Also:
- Constant Field Values
-
PATHWAY_LASTMODIFIED
public static final java.lang.String PATHWAY_LASTMODIFIED- See Also:
- Constant Field Values
-
INFOBOX_CENTER_X
public static final java.lang.String INFOBOX_CENTER_X- See Also:
- Constant Field Values
-
INFOBOX_CENTER_Y
public static final java.lang.String INFOBOX_CENTER_Y- See Also:
- Constant Field Values
-
LEGEND_CENTER_X
public static final java.lang.String LEGEND_CENTER_X- See Also:
- Constant Field Values
-
LEGEND_CENTER_Y
public static final java.lang.String LEGEND_CENTER_Y- See Also:
- Constant Field Values
-
GPML2013A_KEY_SET
public static final java.util.Set<java.lang.String> GPML2013A_KEY_SETThisSet
stores the deprecated GPML2013a properties. Dynamic properties with these keys are ignored when writing GPML2013aGPML2013aWriter.writePathwayDynamicProperties(org.pathvisio.libgpml.model.Pathway, org.jdom2.Element)
and GPML2021GPML2021Writer.writeDynamicProperties(java.util.Map<java.lang.String, java.lang.String>, org.jdom2.Element)
. -
WP_DESCRIPTION
public static final java.lang.String WP_DESCRIPTIONIn GPML2013a,Pathway
description is written as aPathwayElement.Comment
with source="WikiPathways-description".- See Also:
- Constant Field Values
-
DOUBLE_LINE_KEY
public static final java.lang.String DOUBLE_LINE_KEYIn GPML2013a, Double LineStyleType, Cellular Component Shape Types, and State rotation were stored as a dynamic properties using the following String keys.- See Also:
- Constant Field Values
-
CELL_CMPNT_KEY
public static final java.lang.String CELL_CMPNT_KEY- See Also:
- Constant Field Values
-
STATE_ROTATION
public static final java.lang.String STATE_ROTATION- See Also:
- Constant Field Values
-
SHAPETYPE_TO_CAMELCASE
public static final org.apache.commons.collections4.BidiMap<java.lang.String,java.lang.String> SHAPETYPE_TO_CAMELCASEThisBidiMap
is used for mappingShapeType
Strings to their new camelCase spelling for reading and writing GPML2013a. -
DEPRECATED_MAP
public static final org.apache.commons.collections4.BidiMap<java.lang.String,ShapeType> DEPRECATED_MAPThisMap
maps deprecatedString
to the newShapeType
when reading GPML2013aGPML2013aReader.readShapeStyleProperty(org.pathvisio.libgpml.model.ShapedElement, org.jdom2.Element)
. NB: for mim-degradation -
CELL_CMPNT_MAP
This cellular componentMap
mapsShapeType
s. In GPML2013a, cellular component shapeTypes are written as dynamic propertiesGPML2013aWriter.writeShapedOrStateDynamicProperties(java.util.Map<java.lang.String, java.lang.String>, org.pathvisio.libgpml.model.ShapedElement, org.jdom2.Element)
withCELL_CMPNT_KEY
key and a value (e.g. "Nucleus); and property shapeType in Graphics is written with a corresponding shapeType value (e.g. "Oval")GPML2013aWriter.writeShapeStyleProperty(org.pathvisio.libgpml.model.ShapedElement, org.jdom2.Element)
. -
OCV_ONTOLOGY_MAP
public static final org.apache.commons.collections4.BidiMap<java.lang.String,java.lang.String> OCV_ONTOLOGY_MAPThisBidiMap
maps GPML2013a openControlledVocabulary Ontology types to theirDataSource
Prefix for readingGPML2013aReader.readOpenControlledVocabulary(org.pathvisio.libgpml.model.PathwayModel, org.jdom2.Element, java.util.Set<java.lang.String>)
and writingGPML2013aWriter.writeOpenControlledVocabulary(org.pathvisio.libgpml.model.PathwayModel, org.jdom2.Element)
. -
PARENT
public static final java.lang.String PARENTString values forDataNode.State
phosphositePathwayElement.Comment
information in GPML2013a.- See Also:
- Constant Field Values
-
POSITION
public static final java.lang.String POSITION- See Also:
- Constant Field Values
-
PARENTID
public static final java.lang.String PARENTID- See Also:
- Constant Field Values
-
PARENTSYMBOL
public static final java.lang.String PARENTSYMBOL- See Also:
- Constant Field Values
-
PTM
public static final java.lang.String PTM- See Also:
- Constant Field Values
-
DIRECTION
public static final java.lang.String DIRECTION- See Also:
- Constant Field Values
-
SITE
public static final java.lang.String SITE- See Also:
- Constant Field Values
-
SITEGRPID
public static final java.lang.String SITEGRPID- See Also:
- Constant Field Values
-
PARENTID_DB
public static final java.lang.String PARENTID_DB- See Also:
- Constant Field Values
-
PARENTSYMBOL_DB
public static final java.lang.String PARENTSYMBOL_DB- See Also:
- Constant Field Values
-
SITEGRPID_DB
public static final java.lang.String SITEGRPID_DB- See Also:
- Constant Field Values
-
STATE_REF_LIST
java.util.Set<java.lang.String> STATE_REF_LISTThisSet
contains known phosphosite related annotation types forDataNode.State
phosphositePathwayElement.Comment
in GPML2013a. This set is used in determining whether a state comment should be written asAnnotation
s andXref
inGPML2013aReader.convertStateCommentToRefs(org.pathvisio.libgpml.model.DataNode.State, java.util.Set<java.lang.String>)
. -
STATE_PTM_MAP
public static final java.util.Map<java.lang.String,java.util.List<java.lang.String>> STATE_PTM_MAPThisMap
forDataNode.State
phosphositePathwayElement.Comment
maps PTM character toAnnotation
andXref
information. E.g. for ptm=p, Annotation value=Phosphorylation, Xref identifier=0000216, and dataSource = SBO. Used in writing state comments to annotations and xrefGPML2013aReader.convertStateCommentToRefs(org.pathvisio.libgpml.model.DataNode.State, java.util.Set<java.lang.String>)
. -
STATE_DIRECTION_MAP
public static final java.util.Map<java.lang.String,java.util.List<java.lang.String>> STATE_DIRECTION_MAPMap forDataNode.State
phosphositePathwayElement.Comment
direction character toAnnotation
andXref
information. "u" for up-regulated and "d" for down-regulated. Used in writing state comments to annotations and xrefGPML2013aReader.convertStateCommentToRefs(org.pathvisio.libgpml.model.DataNode.State, java.util.Set<java.lang.String>)
. -
UNDIRECTED_LIST
public static final java.util.List<java.lang.String> UNDIRECTED_LISTIn GPML2013a, we introduce a new Interaction Panel ofArrowHeadType
. For each new arrowHead type we define aList
of the old arrowHead types from GPML2013a which correspond to it. The first GPML2013a arrow head type string in the list is prioritized when writing from GPML2021 to GPML2013a. -
DIRECTED_LIST
public static final java.util.List<java.lang.String> DIRECTED_LIST -
CONVERSION_LIST
public static final java.util.List<java.lang.String> CONVERSION_LIST -
INHIBITION_LIST
public static final java.util.List<java.lang.String> INHIBITION_LIST -
CATALYSIS_LIST
public static final java.util.List<java.lang.String> CATALYSIS_LIST -
STIMULATION_LIST
public static final java.util.List<java.lang.String> STIMULATION_LIST -
BINDING_LIST
public static final java.util.List<java.lang.String> BINDING_LIST -
TRANSLOCATION_LIST
public static final java.util.List<java.lang.String> TRANSLOCATION_LIST -
TRANSCRIPTION_TRANSLATION_LIST
public static final java.util.List<java.lang.String> TRANSCRIPTION_TRANSLATION_LIST -
IA_PANEL_MAP
ThisMap
maps new Interaction Panel arrow head types to the definedList
for corresponding GPML2013a arrowHead types. -
ATTRIBUTE_INFO
private static final java.util.Map<java.lang.String,GPML2013aFormatAbstract.AttributeInfo> ATTRIBUTE_INFOAttribute info map is initiated withinitAttributeInfo()
.
-
-
Constructor Details
-
GPML2013aFormatAbstract
protected GPML2013aFormatAbstract(java.lang.String xsdFile, org.jdom2.Namespace nsGPML)Constructor for GPML2013aFormat Abstract.- Parameters:
xsdFile
- the schema file.nsGPML
- the GPML namespace.
-
-
Method Details
-
toCamelCase
Converts shapeTypeString
to UpperCamelCase convention. In GPML2013a, naming convention was inconsistent. Moving forward, enum types strings are all in UpperCamelCase.- Parameters:
str
- the string.- Returns:
- the string in camelCase format, or string as it was.
- Throws:
ConverterException
-
fromCamelCase
Converts shapeTypeString
from UpperCamelCase convention back to its original appearance in GPML2013a.- Parameters:
str
- the string.- Returns:
- the string in its original format.
- Throws:
ConverterException
-
getInteractionPanelType
protected ArrowHeadType getInteractionPanelType(java.lang.String arrowHeadStr) throws ConverterExceptionReturns the GPML2021 Interaction Panel arrow head type for given GPML2013a arrowHead type string.- Parameters:
arrowHeadStr
- the string for GPML2013a arrow head type.- Returns:
- arrowHead the interaction panel arrow head type which corresponds to arrowHeadStr, or null if no corresponding type exists.
- Throws:
ConverterException
-
getArrowHeadTypeStr
Returns the prioritized GPML2013a arrowHead type string for given GPML2021 Interaction Panel arrow head type.- Parameters:
arrowHead
- the interaction panel arrow head type for GPML2021e.- Returns:
- the first GPML2013a arrow head which corresponds to the interaction panel arrow head type, or null if no corresponding type exists.
- Throws:
ConverterException
-
initAttributeInfo
private static java.util.Map<java.lang.String,GPML2013aFormatAbstract.AttributeInfo> initAttributeInfo()TheMap
initAttributeInfo mapsString
tag toGPML2013aFormatAbstract.AttributeInfo
. For GPML2013a reading/writing, we often usegetAttr(java.lang.String, java.lang.String, org.jdom2.Element)
andsetAttr(java.lang.String, java.lang.String, org.jdom2.Element, java.lang.String)
in place of standard jdom methodsElement.getAttributeValue(java.lang.String)
andElement.setAttribute(java.lang.String, java.lang.String)
respectively. If an attribute is null when reading, its default value is fetched from this map. When writing, if trying to set a default value or an optional value to null, the attribute is omitted which results in a leaner xml output. This map defines custom default values not in the GPML2013a schema such as default "Label.Graphics@FillColor" as "Transparent". We do not do this for GPML2021 as it can be confusing to have custom reading/writing resulting in xml which do not adhere to the schema.- Returns:
-
getAttributeInfo
ReturnsMap
ATTRIBUTE_INFO collection that containsString
as key andGPML2013aFormatAbstract.AttributeInfo
as value. -
isEqualsString
private boolean isEqualsString(java.lang.String def, java.lang.String value)Returns true if given string value and default value are equal.- Parameters:
def
- the default string.value
- the given string.- Returns:
- true if the specified arguments are equal, or both null.
-
isEqualsNumber
private boolean isEqualsNumber(java.lang.String def, java.lang.String value)Returns true if given string value and default value are numerically equal.- Parameters:
def
- the string for default number value.value
- the string for given number value.- Returns:
- true if absolute value of difference between def and value is less than 1e-6, and false otherwise.
-
isEqualsColor
private boolean isEqualsColor(java.lang.String def, java.lang.String value)Returns true if given value and default value are the same color object.- Parameters:
def
- the string for default color object.value
- the string for given color object.- Returns:
- true if color is equal, false otherwise.
-
setAttr
protected void setAttr(java.lang.String tag, java.lang.String name, org.jdom2.Element el, java.lang.String value) throws ConverterExceptionSets a certain attribute value, performs a basic check for some types, and throws an exception if trying to set an invalid value. If trying to set a default value or an optional value to null, the attribute is omitted, which results in a leaner xml output. This customized method is often used in place ofElement.setAttribute(java.lang.String, java.lang.String)
for writing GPML2013a.- Parameters:
tag
- used for lookup in the defaults table.name
- used for lookup in the defaults table.el
- jdom element where this attribute belongs in.value
- value you want to check and set.- Throws:
ConverterException
- if value invalid.
-
getAttr
protected java.lang.String getAttr(java.lang.String tag, java.lang.String name, org.jdom2.Element el) throws ConverterExceptionGets a certain attribute value, and replaces it with a suitable default under certain conditions. This customized method is often used in place ofElement.getAttributeValue(java.lang.String)
for reading GPML2013a.- Parameters:
tag
- used for lookup in the defaults table.name
- used for lookup in the defaults table.el
- jdom element to get the attribute from.- Throws:
ConverterException
- ifgetAttributeInfo()
does not contain a mapping for the specified key.
-