4051
Comment: ID mapping service
|
8311
|
Deletions are marked like this. | Additions are marked like this. |
Line 42: | Line 42: |
1. Test request: test if the services are available. |
=== Test request === Test if the services are available. |
Line 45: | Line 46: |
String sender = pluginName; | |
Line 46: | Line 48: |
String type = Message.MSG_TYPE_TEST; // indicate what this message request for String id = receiver + System.currentTimeMillis(); Message msg = new Message(id, pluginName, receiver, type, null); |
String msgType = Message.MSG_TYPE_TEST; // indicate what this message requests for String msgId = receiver + System.currentTimeMillis(); Message msg = new Message(msgId , sender, receiver, msgType , null); |
Line 50: | Line 52: |
if (!response.isempty()) { | if (!response.isEmpty()) { |
Line 54: | Line 56: |
1. ID mapping request: request to mapping the IDs of source ID types in one attribute to the target ID types and save in the target attribute 1. ID mapping dialog request: request to bring out the ID mapping main dialog 1. ID mapping source config dialog request: request to bring out the ID mapping source configuration dialog 1. ID mapping supported ID types fetching request: request to fetch the supported source and target ID types |
=== ID mapping request === Request to mapping the IDs of source ID types in one attribute to the target ID types and save in the target attribute {{{ #!java String sender = pluginName; String receiver = "CyThesaurus"; String msgType = "REQUEST_MAPPING"; // request for ID mapping service String msgId = receiver + System.currentTimeMillis(); Map content = new HashMap(); content.put("NETWORK_ID", new String[]{"net1", "net2"}); // if NETWORK_ID is not specified, ID mapping will be performed on all networks in session // or content.put("NETWORK_ID", "net1"); content.put("SOURCE_ATTR", new String[]{"Attr1", "Attr2"}); // or content.put("SOURCE_ATTR", "ID"); content.put("SOURCE_ID_TYPE", new String[]{"Type1","Type2"}); // if SOURCE_ID_TYPE is not specified, all supported source id types will be used // or content.put("SOURCE_ID_TYPE", "Type1"); content.put("TARGET_ATTR", "tgtAttr"); // if TARGET_ATTR is not specified, a default one will be assigned content.put("TARGET_ID_TYPE", "tgtType"); Message msg = new Message(msgId , sender, receiver, msgType , content); List<ResponseMessage> response = PluginsCommunicationSupport.sendMessageAndGetResponses(msg); if (!response.isEmpty()) { Map responseContent = (Map)response.getContent(); boolean succ = (Boolean) responseContent.get("SUCCESS"); String report = (String) responseContent.get("REPORT"); String tgtAttr= (String) responseContent.get("TARGET_ATTR"); if (succ) { // successfully mapped // report contains statistics } else { // failed // report contains error message } } else { // the ID mapping services are unavailable } }}} === ID mapping dialog request === Request to bring out the ID mapping main dialog {{{ #!java String sender = pluginName; String receiver = "CyThesaurus"; String msgType = "MAPPING_DIALOG"; // request for ID mapping main dialog String msgId = receiver + System.currentTimeMillis(); Message msg = new Message(msgId , sender, receiver, msgType , null); List<ResponseMessage> response = PluginsCommunicationSupport.sendMessageAndGetResponses(msg); if (!response.isEmpty()) { Map content = (Map)response.get(0).getContent(); boolean succ = (Boolean) content.get("SUCCESS"); if (succ) { // ID mapping was performed successfully } else { // ID mapping was not performed or failed } } else { // the ID mapping services are unavailable } }}} === ID mapping source config dialog request === Request to bring out the ID mapping source configuration dialog {{{ #!java String sender = pluginName; String receiver = "CyThesaurus"; String msgType = "MAPPING_SRC_CONFIG_DIALOG"; // request for ID mapping source configuration dialog String msgId = receiver + System.currentTimeMillis(); Message msg = new Message(msgId , sender, receiver, msgType , null); List<ResponseMessage> response = PluginsCommunicationSupport.sendMessageAndGetResponses(msg); if (!response.isEmpty()) { Map content = (Map)response.get(0).getContent(); boolean succ = (Boolean) content.get("SUCCESS"); if (succ) { // ID mapping sources were configured successfully } else { // ID mapping sources were not configured or failed } } else { // the ID mapping services are unavailable } }}} === ID mapping supported ID types fetching request === Request to fetch the supported source and target ID types {{{ #!java String sender = pluginName; String receiver = "CyThesaurus"; String msgType = "REQUEST_SUPPORTED_ID_TYPE"; // request for fetching supported ID types String msgId = receiver + System.currentTimeMillis(); Message msg = new Message(msgId , sender, receiver, msgType , null); List<ResponseMessage> response = PluginsCommunicationSupport.sendMessageAndGetResponses(msg); if (!response.isEmpty()) { Map content = (Map)response.get(0).getContent(); boolean succ = (Boolean) content.get("SUCCESS"); String report = (String) content.get("REPORT"); if (succ) { // successfully fetched // report contains statistics String[] supportedSrcIDTypes = (String[]) content.get("SRC_ID_TYPE"); String[] supportedTgtIDTypes = (String[]) content.get("Tgt_ID_TYPE"); // do more things here ... } else { // failed // report contains error message } } else { // the ID mapping services are unavailable } }}} |
[UNDER CONSTRUCTION]
Contents
Introduction
CyThesaurus is a Cytoscape plugin providing identifier mapping services based on various resources. Currently the plugin support ID mapping resources from delimited text, PGDB file and BioMart web service. This plugin utilized BridgeDb API.
Use Cases
5 related use cases have been identified on Bader Lab ID Mapping page. 2 of them are closely related to this project:
Unification during dataset merging: During a merge operation e.g. of two protein-protein interaction datasets from independently created databases, it is vital to recognize that two protein objects, one from each data source, represent the same protein molecule, even if the protein objects don’t share any database accession numbers. Unification requires knowledge of record type e.g. you cannot reliably use a gene ID to unify proteins (mostly because splice variants exist).
Identifier translation: Some analysis methods require specific translations from one set of identifiers to another. For instance, our 'activity centers' analysis requires translation from protein or gene identifiers in a pathway database to Affymetrix probe set identifiers or other gene expression array platform identifiers.
Supported ID Mapping Resources
File- based
Delimited text file
File format (e.g. http://tinyurl.com/mergesvn/testData/yeast_id_mapping.txt):
- Each column for one ID type
- Each row except the first one represents IDs of different types mapping to each other
- First row contains ID types
- Multiple IDs are allowed to be contained in one cell (One to many mapping, or IDs of the same type maps to each other). Use special character (e.g., ';', '/', etc, or user defined) to separate IDs.
RDB based
PGDB file
Gene database schema: http://www.bridgedb.org/wiki/GeneDatabaseLayout
Gene databases are available at http://bridgedb.org/data/gene_database/
Web service based
BioMart web service
BioMart web service has been utilized to provide ID mapping service in this plugin.
BridgeDb web service
Being developed.
PICR web service
Being developed.
Code Base
Currently the plugin is based on Cytoscape 2.6. Porting to Cytoscape 3.0 is in plan.
ID mapping service for other plugin
An inter-plugin communication module was developed to support CyThesaurus plugin providing ID mapping services to other plugins. It is recommended that other plugins, who need to request ID mapping services from CyThesaurus, include the package cytoscape-plugins-comm (.jar, javadoc, src). The following services are supported.
Test request
Test if the services are available.
1 String sender = pluginName;
2 String receiver = "CyThesaurus"; // plugin name when passing messages
3 String msgType = Message.MSG_TYPE_TEST; // indicate what this message requests for
4 String msgId = receiver + System.currentTimeMillis();
5 Message msg = new Message(msgId , sender, receiver, msgType , null);
6 List<ResponseMessage> response = PluginsCommunicationSupport.sendMessageAndGetResponses(msg);
7 if (!response.isEmpty()) {
8 // the ID mapping services are available
9 }
10
ID mapping request
Request to mapping the IDs of source ID types in one attribute to the target ID types and save in the target attribute
1 String sender = pluginName;
2 String receiver = "CyThesaurus";
3 String msgType = "REQUEST_MAPPING"; // request for ID mapping service
4 String msgId = receiver + System.currentTimeMillis();
5 Map content = new HashMap();
6 content.put("NETWORK_ID", new String[]{"net1", "net2"}); // if NETWORK_ID is not specified, ID mapping will be performed on all networks in session
7 // or content.put("NETWORK_ID", "net1");
8 content.put("SOURCE_ATTR", new String[]{"Attr1", "Attr2"});
9 // or content.put("SOURCE_ATTR", "ID");
10 content.put("SOURCE_ID_TYPE", new String[]{"Type1","Type2"}); // if SOURCE_ID_TYPE is not specified, all supported source id types will be used
11 // or content.put("SOURCE_ID_TYPE", "Type1");
12 content.put("TARGET_ATTR", "tgtAttr"); // if TARGET_ATTR is not specified, a default one will be assigned
13 content.put("TARGET_ID_TYPE", "tgtType");
14
15 Message msg = new Message(msgId , sender, receiver, msgType , content);
16 List<ResponseMessage> response = PluginsCommunicationSupport.sendMessageAndGetResponses(msg);
17 if (!response.isEmpty()) {
18 Map responseContent = (Map)response.getContent();
19 boolean succ = (Boolean) responseContent.get("SUCCESS");
20 String report = (String) responseContent.get("REPORT");
21 String tgtAttr= (String) responseContent.get("TARGET_ATTR");
22 if (succ) {
23 // successfully mapped
24 // report contains statistics
25 } else {
26 // failed
27 // report contains error message
28 }
29 } else {
30 // the ID mapping services are unavailable
31 }
32
ID mapping dialog request
Request to bring out the ID mapping main dialog
1 String sender = pluginName;
2 String receiver = "CyThesaurus";
3 String msgType = "MAPPING_DIALOG"; // request for ID mapping main dialog
4 String msgId = receiver + System.currentTimeMillis();
5 Message msg = new Message(msgId , sender, receiver, msgType , null);
6 List<ResponseMessage> response = PluginsCommunicationSupport.sendMessageAndGetResponses(msg);
7 if (!response.isEmpty()) {
8 Map content = (Map)response.get(0).getContent();
9 boolean succ = (Boolean) content.get("SUCCESS");
10 if (succ) {
11 // ID mapping was performed successfully
12 } else {
13 // ID mapping was not performed or failed
14 }
15 } else {
16 // the ID mapping services are unavailable
17 }
18
ID mapping source config dialog request
Request to bring out the ID mapping source configuration dialog
1 String sender = pluginName;
2 String receiver = "CyThesaurus";
3 String msgType = "MAPPING_SRC_CONFIG_DIALOG"; // request for ID mapping source configuration dialog
4 String msgId = receiver + System.currentTimeMillis();
5 Message msg = new Message(msgId , sender, receiver, msgType , null);
6 List<ResponseMessage> response = PluginsCommunicationSupport.sendMessageAndGetResponses(msg);
7 if (!response.isEmpty()) {
8 Map content = (Map)response.get(0).getContent();
9 boolean succ = (Boolean) content.get("SUCCESS");
10 if (succ) {
11 // ID mapping sources were configured successfully
12 } else {
13 // ID mapping sources were not configured or failed
14 }
15 } else {
16 // the ID mapping services are unavailable
17 }
18
ID mapping supported ID types fetching request
Request to fetch the supported source and target ID types
1 String sender = pluginName;
2 String receiver = "CyThesaurus";
3 String msgType = "REQUEST_SUPPORTED_ID_TYPE"; // request for fetching supported ID types
4 String msgId = receiver + System.currentTimeMillis();
5 Message msg = new Message(msgId , sender, receiver, msgType , null);
6 List<ResponseMessage> response = PluginsCommunicationSupport.sendMessageAndGetResponses(msg);
7 if (!response.isEmpty()) {
8 Map content = (Map)response.get(0).getContent();
9 boolean succ = (Boolean) content.get("SUCCESS");
10 String report = (String) content.get("REPORT");
11 if (succ) {
12 // successfully fetched
13 // report contains statistics
14
15 String[] supportedSrcIDTypes = (String[]) content.get("SRC_ID_TYPE");
16 String[] supportedTgtIDTypes = (String[]) content.get("Tgt_ID_TYPE");
17 // do more things here ...
18 } else {
19 // failed
20 // report contains error message
21 }
22 } else {
23 // the ID mapping services are unavailable
24 }
25