<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 eXamine Automation Tutorial
This case study demonstrates how to use the REST API of eXamine to study a small, annotated graph in Cytoscape. The graph we study is Zachary's karate club.
Step1:  Importing network and node-specific annotation
We start by importing the graph directly from the eXamine repository on github.
Step2:  We then import node-specific annotation directly from the eXamine repository on github. The imported file contains set membership information for each node. Note that it is important to ensure that set-membership information is imported as List of String, as indicated by sl. Additionaly, note that the default list separator is a pipe character.
Step3:  Set-based visualization using eXamine
We now describe how to visualize the current selection. First, we set the visualization options.
Step4:  We then select six groups.
Step5:  There are two options
Step6:  The command below launches the eXamine window. If this window is blank, simply resize the window to force a redraw of the scene.
<ASSISTANT_TASK:>
Python Code:
# HTTP Client for Python
import requests
# Cytoscape port number
PORT_NUMBER = 1234
BASE_URL = "https://raw.githubusercontent.com/ls-cwi/eXamine/master/data/"
# The Base path for the CyRest API
BASE = 'http://localhost:' + str(PORT_NUMBER) + '/v1/'
#Helper command to call a command via HTTP POST
def executeRestCommand(namespace="", command="", args={}):
    postString = BASE + "commands/" + namespace + "/" + command
    res = requests.post(postString,json=args)
    return res
Explanation: eXamine Automation Tutorial
This case study demonstrates how to use the REST API of eXamine to study a small, annotated graph in Cytoscape. The graph we study is Zachary's karate club.
End of explanation
# First we import our demo network
executeRestCommand("network", "import url", {"indexColumnSourceInteraction":"1",
                                             "indexColumnTargetInteraction":"2",
                                             "url": BASE_URL + "edges_karate.gml"})
Explanation: Importing network and node-specific annotation
We start by importing the graph directly from the eXamine repository on github.
End of explanation
# Next we import node annotations
executeRestCommand("table", "import url",
                   {"firstRowAsColumnNames":"true",
                    "keyColumnIndex" : "1",
                    "startLoadRow" : "1",
                    "dataTypeList":"s,sl",
                    "url": BASE_URL + "nodes_karate.txt"})
executeRestCommand("network", "select", {"nodeList" : "all"})
executeRestCommand("examine", "generate groups",
                   {"selectedGroupColumns" : "Community"})
Explanation: We then import node-specific annotation directly from the eXamine repository on github. The imported file contains set membership information for each node. Note that it is important to ensure that set-membership information is imported as List of String, as indicated by sl. Additionaly, note that the default list separator is a pipe character.
End of explanation
# Adjust the visualization settings
executeRestCommand("examine", "update settings",
                   {"labelColumn" : "label",
                    "URL" : "label",
                    "showScore" : "false",
                    "selectedGroupColumns" : "Community"})
Explanation: Set-based visualization using eXamine
We now describe how to visualize the current selection. First, we set the visualization options.
End of explanation
# Select groups for demarcation in the visualization
executeRestCommand("examine", "select groups",
                   {"selectedGroups":"A,B,C,D,E,F"})
Explanation: We then select six groups.
End of explanation
# Launch the interactive eXamine visualization
executeRestCommand("examine", "interact", {})
Explanation: There are two options: either we launch the interactive eXamine visualization, or we directly generate an SVG.
End of explanation
# Export a graphic instead of interacting with it
# use absolute path; writes in Cytoscape directory if not changed 
executeRestCommand("examine", "export", {"path": "test.svg"})
Explanation: The command below launches the eXamine window. If this window is blank, simply resize the window to force a redraw of the scene.
End of explanation
<END_TASK>