def mapVisualProperty(visualProperty,mappingType,mappingColumn,\
                      lower=None,center=None,upper=None,\
                      discrete=None,\
                      network="current",table="node",\
                      namespace="default",host=cytoscape_host,\
                      port=cytoscape_port, verbose=False):
    """"
    Generates a dictionary for a given visual property
    
    :param visualProperty: visualProperty
    :param mappingType: mappingType
    :param mappingColumn: mappingColumn
    :param lower: for "continuous" mappings a list of the form [value,rgb_string]
    :param center: for "continuous" mappings a list of the form [value,rgb_string]
    :param upper: for "continuous" mappings a list of the form [value,rgb_string]
    :param discrete: for discrete mappings, a list of lists of the form [ list_of_keys, list_of_values ]
    :param network: a network name or id, default="current"
    :param host: cytoscape host address, default=cytoscape_host
    :param port: cytoscape port, default=1234
    
    :retunrs: a dictionary for the respective visual property

    """
    if type(network) != int:
        networkID=cytoscape("network", "get attribute",\
                      {"network":network,\
                       "namespace":namespace,\
                       "columnList":"SUID"},host=host,port=port)
        networkname=cytoscape("network", "get attribute",\
                      {"network":network,\
                       "namespace":namespace,\
                       "columnList":"name"},host=host,port=port)
        
        network=networkID[0]["SUID"]
        networkname=networkname[0]["name"]

        URL="http://"+str(host)+":"+str(port)+"/v1/networks/"+str(network)+"/tables/"+namespace+table+"/columns/"
        if verbose:
            print(URL)
            sys.stdout.flush()
        response = urllib2.urlopen(URL)
        response = response.read()
        response = json.loads(response)

    mappingColumnType=None
    for r in response:
        if r["name"]==mappingColumn:
            mappingColumnType=r["type"]
            break
    if not mappingColumnType:
        print("For mappingType: "+mappingType+" it was not possible to find a  mappingColumnType.")
        sys.stdout.flush()
    
        
    PARAMS={"mappingType" : mappingType,\
            "mappingColumn" : mappingColumn,
            "mappingColumnType" : mappingColumnType,
            "visualProperty" : visualProperty}
    if mappingType == "continuous":
        PARAMS["points"]=[{"value" : lower[0],\
                           "lesser" : lower[1],\
                           "equal" : lower[1],\
                           "greater" : lower[1]},\
                          {"value" : center[0],
                           "lesser" : center[1],
                           "equal" : center[1],
                           "greater" : center[1] },\
                          {"value" : upper[0],\
                           "lesser" : upper[1],\
                           "equal" : upper[1],\
                           "greater" : upper[1]}]
        
    if discrete:
        PARAMS["map"]=[]
        for k,v in zip(discrete[0],discrete[1]):
            PARAMS["map"].append({ "key":k,"value":v})
    
    if not mappingColumnType:
        res=None
    else:
        res=PARAMS    

    return res
def mapVisualProperty ( visualProperty , mappingType , mappingColumn , lower = None , center = None , upper = None , discrete = None , network = "current" , table = "node" , namespace = "default" , host = cytoscape_host , port = cytoscape_port , verbose = False ) : if type ( network ) != int : networkID = cytoscape ( "network" , "get attribute" , { "network" : network , "namespace" : namespace , "columnList" : "SUID" } , host = host , port = port ) networkname = cytoscape ( "network" , "get attribute" , { "network" : network , "namespace" : namespace , "columnList" : "name" } , host = host , port = port ) network = networkID [ 0 ] [ "SUID" ] networkname = networkname [ 0 ] [ "name" ] URL = "http://" + str ( host ) + ":" + str ( port ) + "/v1/networks/" + str ( network ) + "/tables/" + namespace + table + "/columns/" if verbose : print ( URL ) sys . stdout . flush ( ) response = urllib2 . urlopen ( URL ) response = response . read ( ) response = json . loads ( response ) mappingColumnType = None for r in response : if r [ "name" ] == mappingColumn : mappingColumnType = r [ "type" ] break if not mappingColumnType : print ( "For mappingType: " + mappingType + " it was not possible to find a  mappingColumnType." ) sys . stdout . flush ( ) PARAMS = { "mappingType" : mappingType , "mappingColumn" : mappingColumn , "mappingColumnType" : mappingColumnType , "visualProperty" : visualProperty } if mappingType == "continuous" : PARAMS [ "points" ] = [ { "value" : lower [ 0 ] , "lesser" : lower [ 1 ] , "equal" : lower [ 1 ] , "greater" : lower [ 1 ] } , { "value" : center [ 0 ] , "lesser" : center [ 1 ] , "equal" : center [ 1 ] , "greater" : center [ 1 ] } , { "value" : upper [ 0 ] , "lesser" : upper [ 1 ] , "equal" : upper [ 1 ] , "greater" : upper [ 1 ] } ] if discrete : PARAMS [ "map" ] = [ ] for k , v in zip ( discrete [ 0 ] , discrete [ 1 ] ) : PARAMS [ "map" ] . append ( { "key" : k , "value" : v } ) if not mappingColumnType : res = None else : res = PARAMS return res
Generates a dictionary for a given visual property
    
    :param visualProperty: visualProperty
    :param mappingType: mappingType
    :param mappingColumn: mappingColumn
    :param lower: for "continuous" mappings a list of the form [value,rgb_string]
    :param center: for "continuous" mappings a list of the form [value,rgb_string]
    :param upper: for "continuous" mappings a list of the form [value,rgb_string]
    :param discrete: for discrete mappings, a list of lists of the form [ list_of_keys, list_of_values ]
    :param network: a network name or id, default="current"
    :param host: cytoscape host address, default=cytoscape_host
    :param port: cytoscape port, default=1234
    
    :retunrs: a dictionary for the respective visual property