Difference between revisions of "KeyNodes hub"

From BioUML platform
Jump to: navigation, search
(First draft)
 
Line 5: Line 5:
  
 
=== Nodes representation ===
 
=== Nodes representation ===
Hub node (molecule or gene) can be represented by any type. Sometimes it's ok to use {{Class|java.lang.Integer}}, {{Class|java.lang.String}}, sometimes it's better to create your own class. The {{Method|java.lang.Object.toString()}} of this class should produce stable accession number for the molecule or gene which belongs to the registered [[reference type]].
+
Hub node (molecule or gene) can be represented by any type. Sometimes it's ok to use {{Class|java.lang.Integer}}, {{Class|java.lang.String}}, sometimes it's better to create your own class. The {{Method|java.lang.Object.toString()}} of this class should produce stable accession number for the molecule or gene which belongs to the registered [[reference type]]. The {{Method|java.lang.Object.equals(Object)}} and {{Method|java.lang.Object.hashCode()}} methods must be redefined for node type. Nodes with the same string representation must be equal and have the same hashCode.
  
 
To support hub nodes you should override the following methods:
 
To support hub nodes you should override the following methods:
Line 11: Line 11:
 
* {{Method|biouml.plugins.keynodes.biohub.KeyNodesHub.getElementConverter()}}: return an {{Class|biouml.plugins.keynodes.graph.ElementConverter}} object which is capable to convert internal nodes from/to {{Class|ru.biosoft.access.biohub.Element}} objects:
 
* {{Method|biouml.plugins.keynodes.biohub.KeyNodesHub.getElementConverter()}}: return an {{Class|biouml.plugins.keynodes.graph.ElementConverter}} object which is capable to convert internal nodes from/to {{Class|ru.biosoft.access.biohub.Element}} objects:
 
** {{Method|biouml.plugins.keynodes.graph.ElementConverter.toNode(Element)}} method should create a hub node object using {{Class|ru.biosoft.access.biohub.Element}}. The toString() method of the resulting node should produce the same string as {{Method|ru.biosoft.access.biohub.Element.getAccession()}}.
 
** {{Method|biouml.plugins.keynodes.graph.ElementConverter.toNode(Element)}} method should create a hub node object using {{Class|ru.biosoft.access.biohub.Element}}. The toString() method of the resulting node should produce the same string as {{Method|ru.biosoft.access.biohub.Element.getAccession()}}.
** {{Method|biouml.plugins.keynodes.graph.ElementConverter.fromNode(N)}} method should create a new {{Class|ru.biosoft.access.biohub.Element}} object by existing node. It must have the full path set, preferably linked to the existing element in the [[repository]].
+
** {{Method|biouml.plugins.keynodes.graph.ElementConverter.fromNode(N)}} method must create a new {{Class|ru.biosoft.access.biohub.Element}} object by existing node. It must have the full path set, preferably linked to the existing element (substance/protein/gene/etc.) in the [[repository]].
 +
 
 +
=== Edges representation ===
 +
Hub edge must implement the {{Class|biouml.plugins.keynodes.graph.HubEdge}} interface. It has the following methods:
 +
* {{Method|biouml.plugins.keynodes.graph.HubEdge.createElement(KeyNodesHub)}} method must create a new
 +
{{Class|ru.biosoft.access.biohub.Element}} object by existing edge. It must have the full path set, preferably linked to the existing element (reaction/semantic relation) in the [[repository]].
 +
* {{Method|biouml.plugins.keynodes.graph.HubEdge.getRelationType(boolean)}} method must return relation type string (see the constants in {{Class|ru.biosoft.access.biohub.RelationType}} class).
 +
 
 +
Additionally a toString() method must return an accession number for given relation.
 +
 
 +
To spare memory it's recommended to make both node and edge objects as simple as possible. They should not be linked to each other or to the graph.
 +
 
 +
=== Graph represenation ===
 +
The graph is represented by {{Class|biouml.plugins.keynodes.graph.HubGraph}} interface. It has the following methods:
 +
* {{Method|biouml.plugins.keynodes.graph.HubGraph.nodes()}} method must return the stream of all nodes in the graph
 +
* {{Method|biouml.plugins.keynodes.graph.HubGraph.hasNode(N)}} method must return true if given node appears in the graph
 +
* {{Method|biouml.plugins.keynodes.graph.HubGraph.visitEdges(N, boolean, HubEdgeVisitor<N>)}} method must call given visitor for all the nodes directly adjacent to supplied start node in either upstream or downstream direction.

Revision as of 16:16, 22 May 2015

KeyNodes hub is a BioHub which can be used in Regulator search and Effector search analyses as well as several helper analyses. Its main purpose is provide abilities to traverse through gene/molecules network represented as directed weighted graph.

Contents

Implementation details

All the KeyNodes hubs must extends the KeyNodesHub class. If the hub is based on MySQL database, it's better to extend KeyNodesSqlHub class as it provides additional support for handling SQL connection. Both classes are parametrized by type which represents hub node.

Nodes representation

Hub node (molecule or gene) can be represented by any type. Sometimes it's ok to use Integer, String, sometimes it's better to create your own class. The Object.toString() of this class should produce stable accession number for the molecule or gene which belongs to the registered reference type. The Object.equals(Object) and Object.hashCode() methods must be redefined for node type. Nodes with the same string representation must be equal and have the same hashCode.

To support hub nodes you should override the following methods:

  • BioHubSupport.getSupportedInputTypes(): return an array of possible reference types which can be converted to internal node type. Usually it's only one type.
  • KeyNodesHub.getElementConverter(): return an ElementConverter object which is capable to convert internal nodes from/to Element objects:
    • ElementConverter.toNode(Element) method should create a hub node object using Element. The toString() method of the resulting node should produce the same string as Element.getAccession().
    • ElementConverter.fromNode(N) method must create a new Element object by existing node. It must have the full path set, preferably linked to the existing element (substance/protein/gene/etc.) in the repository.

Edges representation

Hub edge must implement the HubEdge interface. It has the following methods:

  • HubEdge.createElement(KeyNodesHub) method must create a new

Element object by existing edge. It must have the full path set, preferably linked to the existing element (reaction/semantic relation) in the repository.

  • HubEdge.getRelationType(boolean) method must return relation type string (see the constants in RelationType class).

Additionally a toString() method must return an accession number for given relation.

To spare memory it's recommended to make both node and edge objects as simple as possible. They should not be linked to each other or to the graph.

Graph represenation

The graph is represented by HubGraph interface. It has the following methods:

  • HubGraph.nodes() method must return the stream of all nodes in the graph
  • HubGraph.hasNode(N) method must return true if given node appears in the graph
  • <code title="biouml.plugins.keynodes.graph.HubGraph.visitEdges(N, boolean, HubEdgeVisitor<N>)" style="border-bottom: 1px dotted black">HubGraph.visitEdges(N, boolean, HubEdgeVisitor<N>)</code> method must call given visitor for all the nodes directly adjacent to supplied start node in either upstream or downstream direction.
Personal tools
Namespaces

Variants
Actions
BioUML platform
Community
Modelling
Analysis & Workflows
Collaborative research
Development
Virtual biology
Wiki
Toolbox