Download Links

Simulate 3D | SBW (Win32) | Bifurcation Discovery | FluxBalance

Sunday, August 5, 2012

Updates to the LibSBML Layout Support

The libSBML 5.6.0 release contains changes to the Layout code as was discussed during HARMONY 2012. While the time between HARMONY and this release was not sufficient to fully update the specifications, we thought that it would be better to update the implementation so that people could test the changes. The changes include a modification of the GraphicalObject base class through adding of a “metaIdRef” attribute and the introduction of two now classes:

  • GeneralGlyph and
  • ReferenceGlyph

The new metaIdRef attribute means that now elements can be referenced by specifying the metaId of elements to reference elements that have no SId.

They are to be used analog to ReactionGlyphs and SpeciesReferenceGlyphs. However, they are not specific to a given SBML Class, and thus can address the use case of wanting to represent Events, Rules or even InitialAssignments visually. So how do these classes look? Obviously both are extending GraphicalObject, and so get their Ids and all the SBase goodness from there, additional elements are:

image

So the ReferenceGlyph References an SBML element via the “reference” attribute, and additionally allows to reference a Layout Glyph via the “glyph” attribute. For the time being we allow free form ‘role’ strings to be applied.

image

These ReferenceGlyphs are then used by the GeneralGlyph, that analog to the ReactionGlyph references an SBML element via the “reference” attribute and contains a list of these reference elements (in a listOfReferenceGlyphs), together with an optional Curve and optional additional glyphs to be rendered (that are kept in a listOfSubGlyphs). These additional glyphs can be any subclass of GraphicalObject.  The GeneralGlyphs can be found in the containing Layout in the listOfAdditionalGraphicalObjects. So how would it look in a full SBML model? Here a model represening a rule glyph as image:

image

and in SBML:

<?xml version="1.0" encoding="UTF-8"?>
<sbml xmlns="http://www.sbml.org/sbml/level3/version1/core" xmlns:layout="http://www.sbml.org/sbml/level3/version1/layout/version1" xmlns:render="http://www.sbml.org/sbml/level3/version1/render/version1" level="3" version="1" layout:required="false" render:required="false">
  <model timeUnits="time">
    <listOfUnitDefinitions>
      <unitDefinition id="volume">
        <listOfUnits>
          <unit kind="litre" exponent="1" scale="0" multiplier="1"/>
        </listOfUnits>
      </unitDefinition>
      <unitDefinition id="substance">
        <listOfUnits>
          <unit kind="mole" exponent="1" scale="0" multiplier="1"/>
        </listOfUnits>
      </unitDefinition>
      <unitDefinition id="time">
        <listOfUnits>
          <unit kind="second" exponent="1" scale="0" multiplier="1"/>
        </listOfUnits>
      </unitDefinition>
    </listOfUnitDefinitions>
    <listOfCompartments>
      <compartment id="compartment" spatialDimensions="3" size="1" units="volume" constant="true"/>
    </listOfCompartments>
    <listOfSpecies>
      <species id="species" compartment="compartment" initialConcentration="0" substanceUnits="substance" hasOnlySubstanceUnits="false" boundaryCondition="false" constant="false"/>
    </listOfSpecies>
    <listOfParameters>
      <parameter id="variable1" value="0.1" constant="true"/>
      <parameter id="variable2" value="0.1" constant="true"/>
    </listOfParameters>
    <listOfRules>
      <assignmentRule variable="species">
        <math xmlns="http://www.w3.org/1998/Math/MathML">
          <apply>
            <plus/>
            <ci> variable1 </ci>
            <ci> variable2 </ci>
          </apply>
        </math>
      </assignmentRule>
    </listOfRules>
    <layout:listOfLayouts xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <layout:layout layout:id="test">
        <layout:dimensions layout:width="837" layout:height="445.5"/>
        <layout:listOfSpeciesGlyphs>
          <layout:speciesGlyph layout:id="sGlyph_0" layout:species="species">
            <layout:boundingBox>
              <layout:position layout:x="298" layout:y="199"/>
              <layout:dimensions layout:width="62" layout:height="40"/>
            </layout:boundingBox>
          </layout:speciesGlyph>
        </layout:listOfSpeciesGlyphs>
        <layout:listOfTextGlyphs>
          <layout:textGlyph layout:id="tGlyph_0" layout:text="species" layout:graphicalObject="sGlyph_0">
            <layout:boundingBox>
              <layout:position layout:x="298" layout:y="199"/>
              <layout:dimensions layout:width="62" layout:height="40"/>
            </layout:boundingBox>
          </layout:textGlyph>
          <layout:textGlyph layout:id="tGlyph_1" layout:text="variable1" layout:graphicalObject="glyph_1">
            <layout:boundingBox>
              <layout:position layout:x="477" layout:y="116"/>
              <layout:dimensions layout:width="62" layout:height="40"/>
            </layout:boundingBox>
          </layout:textGlyph>
          <layout:textGlyph layout:id="tGlyph_2" layout:text="variable2" layout:graphicalObject="glyph_2">
            <layout:boundingBox>
              <layout:position layout:x="477" layout:y="289"/>
              <layout:dimensions layout:width="62" layout:height="40"/>
            </layout:boundingBox>
          </layout:textGlyph>
        </layout:listOfTextGlyphs>
        <layout:listOfAdditionalGraphicalObjects>
          <layout:generalGlyph layout:id="glyph_1" layout:reference="variable1">
            <layout:boundingBox>
              <layout:position layout:x="477" layout:y="116"/>
              <layout:dimensions layout:width="62" layout:height="40"/>
            </layout:boundingBox>
          </layout:generalGlyph>
          <layout:generalGlyph layout:id="glyph_2" layout:reference="variable2">
            <layout:boundingBox>
              <layout:position layout:x="477" layout:y="289"/>
              <layout:dimensions layout:width="62" layout:height="40"/>
            </layout:boundingBox>
          </layout:generalGlyph>
          <layout:generalGlyph layout:id="ruleGlyph">
            <layout:boundingBox>
              <layout:position layout:x="0" layout:y="0"/>
              <layout:dimensions layout:width="0" layout:height="0"/>
            </layout:boundingBox>
            <layout:listOfReferenceGlyphs>
              <layout:referenceGlyph layout:id="Reference_J0_0" layout:reference="species" layout:glyph="sGlyph_0" layout:role="product">
                <layout:curve>
                  <layout:listOfCurveSegments>
                    <layout:curveSegment xsi:type="CubicBezier">
                      <layout:start layout:x="425" layout:y="220"/>
                      <layout:end layout:x="367" layout:y="218.425925925926"/>
                      <layout:basePoint1 layout:x="383" layout:y="218"/>
                      <layout:basePoint2 layout:x="383" layout:y="218"/>
                    </layout:curveSegment>
                  </layout:listOfCurveSegments>
                </layout:curve>
              </layout:referenceGlyph>
              <layout:referenceGlyph layout:id="Reference_J0_2" layout:reference="variable1" layout:glyph="glyph_1" layout:role="substrate">
                <layout:curve>
                  <layout:listOfCurveSegments>
                    <layout:curveSegment xsi:type="CubicBezier">
                      <layout:start layout:x="495.46511627907" layout:y="163"/>
                      <layout:end layout:x="425" layout:y="220"/>
                      <layout:basePoint1 layout:x="467" layout:y="222"/>
                      <layout:basePoint2 layout:x="467" layout:y="222"/>
                    </layout:curveSegment>
                  </layout:listOfCurveSegments>
                </layout:curve>
              </layout:referenceGlyph>
              <layout:referenceGlyph layout:id="Reference_J0_3" layout:reference="variable2" layout:glyph="glyph_2" layout:role="substrate">
                <layout:curve>
                  <layout:listOfCurveSegments>
                    <layout:curveSegment xsi:type="CubicBezier">
                      <layout:start layout:x="495.574712643678" layout:y="282"/>
                      <layout:end layout:x="425" layout:y="220"/>
                      <layout:basePoint1 layout:x="467" layout:y="222"/>
                      <layout:basePoint2 layout:x="467" layout:y="222"/>
                    </layout:curveSegment>
                  </layout:listOfCurveSegments>
                </layout:curve>
              </layout:referenceGlyph>
            </layout:listOfReferenceGlyphs>
          </layout:generalGlyph>
        </layout:listOfAdditionalGraphicalObjects>
        <render:listOfRenderInformation render:versionMajor="1" render:versionMinor="0">
          <render:renderInformation render:id="ConvertedRenderStyle" render:programName="SBML Layout Viewer - SBW version" render:programVersion="2.7.4513.22555 Compiled on: 11.05.2012 12:31:50" render:backgroundColor="#FFFFFFFF">
            <render:listOfColorDefinitions>
              <render:colorDefinition render:id="Color_0" render:value="#ff9900"/>
              <render:colorDefinition render:id="Color_1" render:value="#008000"/>
              <render:colorDefinition render:id="Color_2" render:value="#000000"/>
            </render:listOfColorDefinitions>
            <render:listOfGradientDefinitions>
              <render:linearGradient render:id="LinearGradient_0" render:spreadMethod="reflect" render:x2="0">
                <render:stop render:offset="0" render:stop-color="#ffffff"/>
                <render:stop render:offset="100%" render:stop-color="#ffcc99"/>
              </render:linearGradient>
            </render:listOfGradientDefinitions>
            <render:listOfLineEndings>
              <render:lineEnding render:id="product">
                <layout:boundingBox>
                  <layout:position layout:x="-10" layout:y="-5"/>
                  <layout:dimensions layout:width="10" layout:height="10"/>
                </layout:boundingBox>
                <render:g render:stroke="Color_1" render:stroke-width="0.001" render:fill="Color_1" render:font-size="0" render:text-anchor="start" render:vtext-anchor="top">
                  <render:polygon render:fill="Color_1">
                    <render:listOfElements>
                      <render:element xsi:type="RenderPoint" render:x="0" render:y="0"/>
                      <render:element xsi:type="RenderPoint" render:x="100%" render:y="50%"/>
                      <render:element xsi:type="RenderPoint" render:x="0" render:y="100%"/>
                      <render:element xsi:type="RenderPoint" render:x="33%" render:y="50%"/>
                      <render:element xsi:type="RenderPoint" render:x="0" render:y="0"/>
                    </render:listOfElements>
                  </render:polygon>
                </render:g>
              </render:lineEnding>
            </render:listOfLineEndings>
            <render:listOfStyles>
              <render:style render:idList="sGlyph_0">
                <render:g render:stroke-width="0" render:fill-rule="nonzero" render:font-size="0" render:font-family="sans-serif" render:font-style="normal" render:font-weight="normal" render:text-anchor="start" render:vtext-anchor="top">
                  <render:curve render:stroke="Color_0" render:stroke-width="2">
                    <render:listOfElements>
                      <render:element xsi:type="RenderPoint" render:x="20" render:y="0"/>
                      <render:element xsi:type="RenderCubicBezier" render:x="0" render:y="20" render:basePoint1_x="8.95431" render:basePoint1_y="0" render:basePoint2_x="0" render:basePoint2_y="8.95431"/>
                      <render:element xsi:type="RenderCubicBezier" render:x="20" render:y="40" render:basePoint1_x="0" render:basePoint1_y="31.0457" render:basePoint2_x="8.95431" render:basePoint2_y="40"/>
                      <render:element xsi:type="RenderPoint" render:x="42" render:y="40"/>
                      <render:element xsi:type="RenderCubicBezier" render:x="62" render:y="20" render:basePoint1_x="53.0457" render:basePoint1_y="40" render:basePoint2_x="62" render:basePoint2_y="31.0457"/>
                      <render:element xsi:type="RenderCubicBezier" render:x="42" render:y="0" render:basePoint1_x="62" render:basePoint1_y="8.95431" render:basePoint2_x="53.0457" render:basePoint2_y="0"/>
                      <render:element xsi:type="RenderPoint" render:x="20" render:y="0"/>
                    </render:listOfElements>
                  </render:curve>
                </render:g>
              </render:style>
              <render:style render:idList="glyph_1">
                <render:g render:stroke-width="0" render:fill-rule="nonzero" render:font-size="0" render:font-family="sans-serif" render:font-style="normal" render:font-weight="normal" render:text-anchor="start" render:vtext-anchor="top">
                  <render:curve render:stroke="Color_0" render:stroke-width="2">
                    <render:listOfElements>
                      <render:element xsi:type="RenderPoint" render:x="20" render:y="0"/>
                      <render:element xsi:type="RenderCubicBezier" render:x="0" render:y="20" render:basePoint1_x="8.95431" render:basePoint1_y="0" render:basePoint2_x="0" render:basePoint2_y="8.95431"/>
                      <render:element xsi:type="RenderCubicBezier" render:x="20" render:y="40" render:basePoint1_x="0" render:basePoint1_y="31.0457" render:basePoint2_x="8.95431" render:basePoint2_y="40"/>
                      <render:element xsi:type="RenderPoint" render:x="42" render:y="40"/>
                      <render:element xsi:type="RenderCubicBezier" render:x="62" render:y="20" render:basePoint1_x="53.0457" render:basePoint1_y="40" render:basePoint2_x="62" render:basePoint2_y="31.0457"/>
                      <render:element xsi:type="RenderCubicBezier" render:x="42" render:y="0" render:basePoint1_x="62" render:basePoint1_y="8.95431" render:basePoint2_x="53.0457" render:basePoint2_y="0"/>
                      <render:element xsi:type="RenderPoint" render:x="20" render:y="0"/>
                    </render:listOfElements>
                  </render:curve>
                </render:g>
              </render:style>
              <render:style render:idList="glyph_2">
                <render:g render:stroke-width="0" render:fill-rule="nonzero" render:font-size="0" render:font-family="sans-serif" render:font-style="normal" render:font-weight="normal" render:text-anchor="start" render:vtext-anchor="top">
                  <render:curve render:stroke="Color_0" render:stroke-width="2">
                    <render:listOfElements>
                      <render:element xsi:type="RenderPoint" render:x="20" render:y="0"/>
                      <render:element xsi:type="RenderCubicBezier" render:x="0" render:y="20" render:basePoint1_x="8.95431" render:basePoint1_y="0" render:basePoint2_x="0" render:basePoint2_y="8.95431"/>
                      <render:element xsi:type="RenderCubicBezier" render:x="20" render:y="40" render:basePoint1_x="0" render:basePoint1_y="31.0457" render:basePoint2_x="8.95431" render:basePoint2_y="40"/>
                      <render:element xsi:type="RenderPoint" render:x="42" render:y="40"/>
                      <render:element xsi:type="RenderCubicBezier" render:x="62" render:y="20" render:basePoint1_x="53.0457" render:basePoint1_y="40" render:basePoint2_x="62" render:basePoint2_y="31.0457"/>
                      <render:element xsi:type="RenderCubicBezier" render:x="42" render:y="0" render:basePoint1_x="62" render:basePoint1_y="8.95431" render:basePoint2_x="53.0457" render:basePoint2_y="0"/>
                      <render:element xsi:type="RenderPoint" render:x="20" render:y="0"/>
                    </render:listOfElements>
                  </render:curve>
                </render:g>
              </render:style>
              <render:style render:roleList="sidesubstrate substrate" render:idList="ruleGlyph">
                <render:g render:stroke="Color_1" render:stroke-width="2" render:fill-rule="nonzero" render:font-size="0" render:font-family="sans-serif" render:font-style="normal" render:font-weight="normal" render:text-anchor="start" render:vtext-anchor="top"/>
              </render:style>
              <render:style render:roleList="product">
                <render:g render:stroke="Color_1" render:stroke-width="2" render:fill-rule="nonzero" render:font-size="0" render:font-family="sans-serif" render:font-style="normal" render:font-weight="normal" render:text-anchor="start" render:vtext-anchor="top" render:endHead="product"/>
              </render:style>
              <render:style render:idList="tGlyph_0">
                <render:g render:stroke="Color_2" render:stroke-width="0" render:fill-rule="nonzero" render:font-size="11" render:font-family="Arial" render:font-style="normal" render:font-weight="normal" render:text-anchor="middle" render:vtext-anchor="top"/>
              </render:style>
              <render:style render:idList="tGlyph_1">
                <render:g render:stroke="Color_2" render:stroke-width="0" render:fill-rule="nonzero" render:font-size="11" render:font-family="Arial" render:font-style="normal" render:font-weight="normal" render:text-anchor="middle" render:vtext-anchor="top"/>
              </render:style>
              <render:style render:idList="tGlyph_2">
                <render:g render:stroke="Color_2" render:stroke-width="0" render:fill-rule="nonzero" render:font-size="11" render:font-family="Arial" render:font-style="normal" render:font-weight="normal" render:text-anchor="middle" render:vtext-anchor="top"/>
              </render:style>
            </render:listOfStyles>
          </render:renderInformation>
        </render:listOfRenderInformation>
      </layout:layout>
    </layout:listOfLayouts>
  </model>
</sbml>

No comments: