CoolMap RESTful API

Currently, CoolMap has two sets of APIs. They are data matrix related APIs and Ontology related APIs.

Note that only after CoolMap has been started can these APIs be called.


Data Matrix APIs

Data matrix APIs are mostly related to the data that CoolMap can import, export and visualize.


Loading Data


URL: http://localhost:10725/coolmap/matrix/load

Method: HTTP POST

HTTP Entity:

Set the media type to "applicationjson" and specify a Json object which contains the matrix data as the request entity following below format/

{
	"data": [ [row 0] ,
		     [row 1] ,
                     ….. ,
		     [row N - 1] ] ,
	"row_labels": [row label array] ,
	"column_labels": [column label array]
} 

Result: A Json object indicating the result.

The Json will be in following format if the operation succeeded:


{
"result" : "succeeded" 
}

If failed, the result will be "failed"


Retrieving Data

Data can’t be retrieved either from the whole matrix or the selected part of the matrix.


Retrieving The Whole Active Matrix


URL: http://localhost:10725/coolmap/matrix?data_scope={leaf | displayed}

Example URL: http://localhost:10725/coolmap/matrix?data_scope=leaf

Method: HTTP GET

Parameters:

data_scope: Specifying the data matrix scope to retrieve.

Specify ‘leaf’ for data_scope to get the underlying original data; ‘displayed’ to get the current displayed data in the view, which might have been aggregated.

Result: A Json object containing the matrix data.

The Json will be in following format:


{
	"data": [ [row 0] ,
		     [row 1] ,
                     ….. ,
		     [row N - 1] ] ,
	"row_labels": [row label array] ,
	"column_labels": [column label array] ,
	"aggregation_type" : Method used in number aggregation
} 

Retrieving Current Selected Portion of The Active Matrix


URL: http://localhost:10725/coolmap/matrix/selection?data_scope={leaf | displayed}

_Example URL: http://localhost:10725/coolmap/matrix/selection?data_scope=leaf

Method: HTTP GET

Parameters:

data_scope: Specifying the data matrix scope to retrieve. However, this parameter will only apply to the selected portion of the active matrix.

Specify ‘leaf’ for data_scope to get the underlying original data; ‘displayed’ to get the current displayed data in the view, which might have been aggregated.

Result: A Json object containing the matrix data.

The Json will be in following format:


{
	"data": [ [row 0] ,
		     [row 1] ,
                     ….. ,
		     [row N - 1] ] ,
	"row_labels": [row label array] ,
	"column_labels": [column label array] ,
	"aggregation_type" : Method used in number aggregation
} 

Selecting or Highlighting Data

Selecting API will actually mark the data selected in CoolMap view while highlighting API will only hover over the specified part. Therefore, selecting API is more used for a one time pass of the data while highlighting for a batch of data points or quick exploration needed.


Selecting Data


URL: http://localhost:10725/coolmap/matrix/selection/{data_scope}

Example URL: http://localhost:10725/coolmap/matrix/selection/displayed

Method: HTTP POST

Parameters:

data_scope: Specifying the data matrix scope to apply the selections.

Specify ‘leaf’ for data_scope to use specified row and column names to match original data node names; ‘displayed’ to match the current displayed data nodes in the view, which might have been aggregated and thus have different names.

HTTP Entity:

Set the media type to "applicationjson" and specify a Json object which contains the column and row names need to be selected as the request entity following below format/

{
	"row_labels": [row label array] ,
	"column_labels": [column label array]
} 
Result: A Json object indicating the result. The Json will be in following format if the operation succeeded:
{
"result" : "succeeded" 
}

If failed, the result will be "failed"


Highlighting Data


URL: http://localhost:10725/coolmap/matrix/hover?row_node={row-node-name}&column_node={column-node-name}

Example URL: http://localhost:10725/coolmap/matrix/hover?row_node=Michigan&column_node=Male

Method: HTTP GET

Parameters:

row_node: Specifying the row node name.

column_node: Specifying the column node name.

Row and column node names will be used to find an intersection cell.

Result: A Json object indicating the result.

The Json will be in following format if the operation succeeded:


{
"result" : "succeeded" 
}

If failed, the result will be "failed"



Ontology APIs

Ontology APIs are used to retrieve the current Ontology applied to the data or apply a new Ontology to the data view.


Retrieving an Ontology


URL: http://localhost:10725/coolmap/Ontology?Ontology_id={id}&direction={row | column | both}&node_name={node_name}&format={obo | pairwise}

Example URL: http://localhost:10725/coolmap/Ontology?direction=row&node_name=Male&format=obo

Method: HTTP GET

Parameters:

Ontology_id: Specifying id of the Ontology to be retrieved. If this parameter is specified, parameters direction and node_name will be ignored.

direction: On which direction should the node name be looked up.

node_name: Specifying name of the node with which the Ontology is associated.

format: Specifying the output format for the retrieved Ontologies.

Result: A Json array containing the retrieved Ontologies.

The Json will be in following format:


[
	{
		"ontology_id": ontology-id ,
		"name": ontology-name , 
		"format": ontology-format ,
		"ontology": ontology-string
	} ,
	.....
	{
		"ontology_id": ontology-id-1 ,
		"name": ontology-name-1 , 
		"format": ontology-format-1 ,
		"ontology": ontology-string-1
	}
] 

The Ontology string will be a single string containing either [obo]( The OBO Flat File Format Specification, version 1.2 ) or two column format. Two column format is a simple format we used in CoolMap to represent Ontologies. It only has two column separated by a tab and the left column is a parent and the right column is a child, thus every row of this format denotes a single parent-child relationship.