Expansion
index
../../../../piana/code/Graph/Expansion.py

File     : Expansions.py
Author   : Ramon Aragues
Creation : 04.03.2004
Contents : main class describing expansions that can be applied to Graph 
Comments :
=======================================================================================================
 
This is the template class for performing your own expansions to graph objects.
 
If you want to implement your own expansion class, you  must implement all methods described below.
 
You can follow the classes implemented in code/Graph/PianaGraph/PianaGraphExpansions.py

 
Classes
       
Expansion
EdgeExpansion
NodeExpansion

 
class EdgeExpansion(Expansion)
    The base class for expansion of nodes. All node expansions must be subclasses of this class.
 
TO CHECK!!! Does it make sense to expand an edge? What characteristics might share two edges that expands one to the other (interchange the nodes
that they join...)
 
  Methods defined here:
get_expanded_edges(self, edge)
This should be overridden with a method that returns a list of edges that pass the expansion test
 
In its current form this will return 1 if argument "edge" is a GraphNode object or 0 otherwise.

 
class Expansion
    The base expansion class used as a basis for EdgeExpansion and NodeExpansion
 
 

 
class NodeExpansion(Expansion)
    The base class for expansion of nodes. All node expansions must be subclasses of this class.
 
A node will borrow interactions from other nodes (even if they do not appear in the graph) if condition X is shared between the source node
and the other nodes existing in the database.
 
  Methods defined here:
__init__(self)
class_test(self, node_id=None, class_name=None)
This must be overridden with a method that tests whether the node_id belongs to class_name or not
 
returns 1 if class test is passed, 0 otherwise
create_new_edge_attribute(self, edge_db_id=None, expansion_type=None, propagated_from_node=None, propagated_from_edge_id=None, propagated_from_db_edge_id=None, extended_from_node=None)
This must be overridden with a method that creates and attribute of type PianaGraphEdgeAttribute with given characteristics
create_new_node_attribute(self, node_id=None)
This must be overridden with a method that creates an node attribute
get_db_edge_ids_from_node(self, node_id)
This must be overridden with a method that returns a list of database ids for node_id
get_edges_attributes_from_node(self, node_id)
This must be overridden with a method that returns from a database edges attributes of edges where "node_id" appears
get_expansion_name(self)
This must be overridden with a method that returns the name of the expansion
get_external_code(self, node_id, id_type=None, alternative_id_types=None)
This must be overridden with a method that returns the external database code for node_id
get_partner_ids(self, node_id)
This must be overridden with a method that returns a list of partner_ids of node_id
get_partner_node_id(self, edge_id, node_id)
This must be overridden with a method that returns from a database the partner node of "node_id" in edge "edge_id"
get_partners_of_nodes_sharing_characteristic(self, node_id)
Returns a list of partner proteins of proteins that share cog with proteinPiana node_id
 
returns empty list if nothing found
 
ATTENTION: currently not being used!!!
get_sharing_nodes(self, node_id)
This must be overridden with a method that returns a list of nodes that share a characteristic with node_id
 
This characteristic will determine the expansion: edges will be propagated between nodes that share that characteristic.
 
This method is the only one that is specific to this characteristic: all the other methods that have to be overridden
are specific to the external database, but not to the characteristic