cytoscape

Cytoskape xgmml edge.color and edge weight is not getting applied, how should I change this?


I made an .xgmml file to load into cytoscape. In the .xgmml I have different weights and colours for the edges (See bottom for the .xgmml file). However, when I load the .xgmml file into cytoscape and apply layout, the edges have the same weights and colour.

How can I apply the .xgmml edge weights and colours to the network?

enter image description here

<?xml version="1.0" encoding="UTF-8" ?>
<graph label="Depression" directed="0" xmlns="http://www.cs.rpi.edu/XGMML" schemaLocation="http://www.cs.rpi.edu/~puninj/XGMML/xgmml.xsd">
    <node id="A" label="A">
        <graphics type="rectangle" fill="#F8FF00"/>
        <att name="description" value="A"/>
    </node>
    <node id="B" label="B">
        <graphics type="triangle" fill="#CC51FF"/>
        <att name="description" value="B"/>
    </node>
    <node id="C" label="C">
        <graphics type="triangle" fill="#CC51FF"/>
        <att name="description" value="C"/>
    </node>
    <edge id="rs2" label="TRANS" source="A" target="B" weight="10">
        <att name="edge.shape" value="circle"/>
        <att name="edge.color" value="51,153,25"/>
    </edge>
    <edge id="rs1" label="CIS" source="A" target="C" weight="1">
        <att name="edge.shape" value="circle"/>
        <att name="edge.color" value="0,153,0"/>
    </edge>
</graph>

Solution

  • We don't use those properties. For color and width, we encode them as attributes in the graphic line:

    <edge id="732" label="YDR412W (pp) YPR119W" source="386" target="382" cy:directed="1">
        <att name="shared name" value="YDR412W (pp) YPR119W" type="string" cy:type="String"/>
        <att name="shared interaction" value="pp" type="string" cy:type="String"/>
        <att name="name" value="YDR412W (pp) YPR119W" type="string" cy:type="String"/>
        <att name="selected" value="1" type="boolean" cy:type="Boolean"/>
        <att name="interaction" value="pp" type="string" cy:type="String"/>
        <att name="EdgeBetweenness" value="18040.0" type="real" cy:type="Double"/>
        <att name="isInPath" value="0" type="boolean" cy:type="Boolean" cy:hidden="1"/>
        <graphics width="5.0" fill="#FF00FF">
          <att name="EDGE_STROKE_SELECTED_PAINT" value="#FF0000" type="string" cy:type="String"/>
          <att name="EDGE_SELECTED" value="true" type="string" cy:type="String"/>
          <att name="EDGE_TOOLTIP" value="" type="string" cy:type="String"/>
          <att name="EDGE_LABEL_COLOR" value="#000000" type="string" cy:type="String"/>
          <att name="EDGE_BEND" value="" type="string" cy:type="String"/>
          <att name="EDGE_TARGET_ARROW_UNSELECTED_PAINT" value="#000000" type="string" cy:type="String"/>
          <att name="EDGE_TARGET_ARROW_SELECTED_PAINT" value="#FFFF00" type="string" cy:type="String"/>
          <att name="EDGE_LABEL" value="" type="string" cy:type="String"/>
          <att name="EDGE_TARGET_ARROW_SIZE" value="6.0" type="string" cy:type="String"/>
          <att name="EDGE_SOURCE_ARROW_SIZE" value="6.0" type="string" cy:type="String"/>
          <att name="EDGE_CURVED" value="true" type="string" cy:type="String"/>
          <att name="EDGE_VISIBLE" value="true" type="string" cy:type="String"/>
          <att name="EDGE_SOURCE_ARROW_SELECTED_PAINT" value="#FFFF00" type="string" cy:type="String"/>
          <att name="EDGE_SOURCE_ARROW_SHAPE" value="NONE" type="string" cy:type="String"/>
          <att name="EDGE_LABEL_TRANSPARENCY" value="255" type="string" cy:type="String"/>
          <att name="EDGE_TRANSPARENCY" value="170" type="string" cy:type="String"/>
          <att name="EDGE_LINE_TYPE" value="SOLID" type="string" cy:type="String"/>
          <att name="EDGE_SOURCE_ARROW_UNSELECTED_PAINT" value="#000000" type="string" cy:type="String"/>
          <att name="EDGE_LABEL_FONT_FACE" value="Dialog.plain,plain,10" type="string" cy:type="String"/>
          <att name="EDGE_LABEL_FONT_SIZE" value="10" type="string" cy:type="String"/>
          <att name="EDGE_TARGET_ARROW_SHAPE" value="NONE" type="string" cy:type="String"/>
          <att name="EDGE_LABEL_WIDTH" value="200.0" type="string" cy:type="String"/>
        </graphics>
      </edge>
    

    This results in a magenta edge of width 5.