PianaGraphExpansions
index
../../../../piana/code/Graph/PianaGraph/PianaGraphExpansions.py

File     : PianaGraphExpansion.py
Author   : Ramon Aragues
Creation : 04.03.2004
Contents : class that implements expansions that can be applied to PianaGraph
Comments :
 
=======================================================================================================
 
These classes specify how Expansions are carried out with piana graphs
 
An expansion can either be a node or and edge expansion and must contain methods specific to the PianaGraph

 
Modules
       
Bio
GOApi
MySQLdb
PianaGlobals
copy
numarray
os
piana_configuration_parameters
re
sys
time
types
utilities

 
Classes
       
Expansion.EdgeExpansion(Expansion.Expansion)
PianaEdgeExpansion
Expansion.NodeExpansion(Expansion.Expansion)
PianaNodeExpansion
ExpansionSameCog
ExpansionSameEC
ExpansionSameInterpro
ExpansionSameScop

 
class ExpansionSameCog(PianaNodeExpansion)
    This class is used to propagate interactions from protein A to protein B if protein A and protein B share the same COG code
 
methods have the same name (to make trasparent kind of expansion) but are different from other expansions to use COG as expansion characteristic
 
 
Method resolution order:
ExpansionSameCog
PianaNodeExpansion
Expansion.NodeExpansion
Expansion.Expansion

Methods defined here:
__init__(self, piana_access_object, use_self_ints='yes', list_source_dbs='all', inverse_dbs='no', list_source_methods='all', inverse_methods='no')
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)
returns a list of nodes that share cog with node_id (node_id == proteinPiana in PianaGraph networks)
 
returns empty list if nothing found

Methods inherited from PianaNodeExpansion:
class_test(self, node_id=None, class_name=None)
tests whether the node_id belongs to class_name or not
 
returns 1 if class test is passed, 0 otherwise
 
In Piana this means, testing if proteinPiana node_id is of tax_id 'class_name'
 
'class_name' must be an integer (unless it is set to 'all')
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)
returns attribute of type PianaGraphEdgeAttribute with given characteristics
 
expansion_type, propagated_from_node, propagated_from_edge are mandatory when defining a propagation
 
expansion_type, extended_from_node are mandatory when defining an extension
 
if edge_db_id is not None, it means we are creating an attribute for a given interactionPiana. In propagations edge_db_id will be None
because propagated edges do not exist as such in the database. Extensions will have an edge_db_id
create_new_node_attribute(self, node_id=None)
returns an attribute of type PianaGraphNodeAttribute with given characteristics
get_db_edge_ids_from_node(self, node_id)
Returns a list of interactionPiana (which is the db_edge_id describing interactions between node_id and all its partners
 
returns empty list if nothing is found
get_edges_attributes_from_node(self, node_id)
Returns a list of PianaGraphEdgeAttribute objects describing interactions between node_id and all its partners
 
returns empty list if nothing was found
get_expansion_name(self)
returns the name of the expansion
get_external_code(self, node_id=None, id_type=None, alternative_id_types=[])
returns the external code for node_id, first trying with id_type and then with alternative_id_types
 
if no code of id_type is found, string returned with alternative id type will follow the format "type_of_code_found:protein_code_value"
get_partner_ids(self, node_id)
Returns a list of partners (proteinPiana) of node_id
 
returns empty list if nothing is found
get_partner_node_id(self, db_edge_id=None, node_id=None)
Returns the partner node (a protein) of "node_id" in pianaDB interaction described by PianaGraphEdgeAttribute edge_attribute

 
class ExpansionSameEC(PianaNodeExpansion)
    This class is used to propagate interactions from protein A to protein B if protein A and protein B share the same EC code
 
methods have the same name (to make trasparent kind of expansion) but are different from other expansions to use EC as expansion characteristic
 
 
Method resolution order:
ExpansionSameEC
PianaNodeExpansion
Expansion.NodeExpansion
Expansion.Expansion

Methods defined here:
__init__(self, piana_access_object, use_self_ints='yes', list_source_dbs='all', inverse_dbs='no', list_source_methods='all', inverse_methods='no')
get_sharing_nodes(self, node_id)
returns a list of nodes that share ec with node_id (node_id == proteinPiana in PianaGraph networks)
 
returns empty list if nothing found

Methods inherited from PianaNodeExpansion:
class_test(self, node_id=None, class_name=None)
tests whether the node_id belongs to class_name or not
 
returns 1 if class test is passed, 0 otherwise
 
In Piana this means, testing if proteinPiana node_id is of tax_id 'class_name'
 
'class_name' must be an integer (unless it is set to 'all')
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)
returns attribute of type PianaGraphEdgeAttribute with given characteristics
 
expansion_type, propagated_from_node, propagated_from_edge are mandatory when defining a propagation
 
expansion_type, extended_from_node are mandatory when defining an extension
 
if edge_db_id is not None, it means we are creating an attribute for a given interactionPiana. In propagations edge_db_id will be None
because propagated edges do not exist as such in the database. Extensions will have an edge_db_id
create_new_node_attribute(self, node_id=None)
returns an attribute of type PianaGraphNodeAttribute with given characteristics
get_db_edge_ids_from_node(self, node_id)
Returns a list of interactionPiana (which is the db_edge_id describing interactions between node_id and all its partners
 
returns empty list if nothing is found
get_edges_attributes_from_node(self, node_id)
Returns a list of PianaGraphEdgeAttribute objects describing interactions between node_id and all its partners
 
returns empty list if nothing was found
get_expansion_name(self)
returns the name of the expansion
get_external_code(self, node_id=None, id_type=None, alternative_id_types=[])
returns the external code for node_id, first trying with id_type and then with alternative_id_types
 
if no code of id_type is found, string returned with alternative id type will follow the format "type_of_code_found:protein_code_value"
get_partner_ids(self, node_id)
Returns a list of partners (proteinPiana) of node_id
 
returns empty list if nothing is found
get_partner_node_id(self, db_edge_id=None, node_id=None)
Returns the partner node (a protein) of "node_id" in pianaDB interaction described by PianaGraphEdgeAttribute edge_attribute

Methods inherited from Expansion.NodeExpansion:
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!!!

 
class ExpansionSameInterpro(PianaNodeExpansion)
    This class is used to propagate interactions from protein A to protein B if protein A and protein B share the same interpro code
 
methods have the same name (to make trasparent kind of expansion) but are different from other expansions to use interPro as expansion characteristic
 
 
Method resolution order:
ExpansionSameInterpro
PianaNodeExpansion
Expansion.NodeExpansion
Expansion.Expansion

Methods defined here:
__init__(self, piana_access_object, use_self_ints='yes', list_source_dbs='all', inverse_dbs='no', list_source_methods='all', inverse_methods='no')
get_sharing_nodes(self, node_id)
returns a list of nodes that share interpro code with node_id (node_id == proteinPiana in PianaGraph networks)
 
returns empty list if nothing found

Methods inherited from PianaNodeExpansion:
class_test(self, node_id=None, class_name=None)
tests whether the node_id belongs to class_name or not
 
returns 1 if class test is passed, 0 otherwise
 
In Piana this means, testing if proteinPiana node_id is of tax_id 'class_name'
 
'class_name' must be an integer (unless it is set to 'all')
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)
returns attribute of type PianaGraphEdgeAttribute with given characteristics
 
expansion_type, propagated_from_node, propagated_from_edge are mandatory when defining a propagation
 
expansion_type, extended_from_node are mandatory when defining an extension
 
if edge_db_id is not None, it means we are creating an attribute for a given interactionPiana. In propagations edge_db_id will be None
because propagated edges do not exist as such in the database. Extensions will have an edge_db_id
create_new_node_attribute(self, node_id=None)
returns an attribute of type PianaGraphNodeAttribute with given characteristics
get_db_edge_ids_from_node(self, node_id)
Returns a list of interactionPiana (which is the db_edge_id describing interactions between node_id and all its partners
 
returns empty list if nothing is found
get_edges_attributes_from_node(self, node_id)
Returns a list of PianaGraphEdgeAttribute objects describing interactions between node_id and all its partners
 
returns empty list if nothing was found
get_expansion_name(self)
returns the name of the expansion
get_external_code(self, node_id=None, id_type=None, alternative_id_types=[])
returns the external code for node_id, first trying with id_type and then with alternative_id_types
 
if no code of id_type is found, string returned with alternative id type will follow the format "type_of_code_found:protein_code_value"
get_partner_ids(self, node_id)
Returns a list of partners (proteinPiana) of node_id
 
returns empty list if nothing is found
get_partner_node_id(self, db_edge_id=None, node_id=None)
Returns the partner node (a protein) of "node_id" in pianaDB interaction described by PianaGraphEdgeAttribute edge_attribute

Methods inherited from Expansion.NodeExpansion:
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!!!

 
class ExpansionSameScop(PianaNodeExpansion)
    This class is used to propagate interactions from protein A to protein B if protein A and protein B share the same SCOP family code
 
methods have the same name (to make trasparent kind of expansion) but are different from other expansions to use SCOP as expansion characteristic
 
 
Method resolution order:
ExpansionSameScop
PianaNodeExpansion
Expansion.NodeExpansion
Expansion.Expansion

Methods defined here:
__init__(self, piana_access_object, use_self_ints='yes', list_source_dbs='all', inverse_dbs='no', list_source_methods='all', inverse_methods='no')
get_sharing_nodes(self, node_id)
returns a list of nodes that share scop family code with node_id (node_id == proteinPiana in PianaGraph networks)
 
returns empty list if nothing found

Methods inherited from PianaNodeExpansion:
class_test(self, node_id=None, class_name=None)
tests whether the node_id belongs to class_name or not
 
returns 1 if class test is passed, 0 otherwise
 
In Piana this means, testing if proteinPiana node_id is of tax_id 'class_name'
 
'class_name' must be an integer (unless it is set to 'all')
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)
returns attribute of type PianaGraphEdgeAttribute with given characteristics
 
expansion_type, propagated_from_node, propagated_from_edge are mandatory when defining a propagation
 
expansion_type, extended_from_node are mandatory when defining an extension
 
if edge_db_id is not None, it means we are creating an attribute for a given interactionPiana. In propagations edge_db_id will be None
because propagated edges do not exist as such in the database. Extensions will have an edge_db_id
create_new_node_attribute(self, node_id=None)
returns an attribute of type PianaGraphNodeAttribute with given characteristics
get_db_edge_ids_from_node(self, node_id)
Returns a list of interactionPiana (which is the db_edge_id describing interactions between node_id and all its partners
 
returns empty list if nothing is found
get_edges_attributes_from_node(self, node_id)
Returns a list of PianaGraphEdgeAttribute objects describing interactions between node_id and all its partners
 
returns empty list if nothing was found
get_expansion_name(self)
returns the name of the expansion
get_external_code(self, node_id=None, id_type=None, alternative_id_types=[])
returns the external code for node_id, first trying with id_type and then with alternative_id_types
 
if no code of id_type is found, string returned with alternative id type will follow the format "type_of_code_found:protein_code_value"
get_partner_ids(self, node_id)
Returns a list of partners (proteinPiana) of node_id
 
returns empty list if nothing is found
get_partner_node_id(self, db_edge_id=None, node_id=None)
Returns the partner node (a protein) of "node_id" in pianaDB interaction described by PianaGraphEdgeAttribute edge_attribute

Methods inherited from Expansion.NodeExpansion:
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!!!

 
class PianaEdgeExpansion(Expansion.EdgeExpansion)
    Not implemented: no edge expansions being carried out for Piana
 
 
Method resolution order:
PianaEdgeExpansion
Expansion.EdgeExpansion
Expansion.Expansion

Methods inherited from Expansion.EdgeExpansion:
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 PianaNodeExpansion(Expansion.NodeExpansion)
    Class that contains methods used for all kinds of Piana Node expansions
 
Specific piana expansions only need to implement the methods that return a list of nodes that share a node characteristic (method get_expanded_nodes() )
 
This is the class used for Node Expansions: propagating interactions of one node to another
 
 
Method resolution order:
PianaNodeExpansion
Expansion.NodeExpansion
Expansion.Expansion

Methods defined here:
__init__(self, piana_access_object=None, name='', use_self_ints='yes', list_source_dbs='all', inverse_dbs='no', list_source_methods='all', inverse_methods='no')
class_test(self, node_id=None, class_name=None)
tests whether the node_id belongs to class_name or not
 
returns 1 if class test is passed, 0 otherwise
 
In Piana this means, testing if proteinPiana node_id is of tax_id 'class_name'
 
'class_name' must be an integer (unless it is set to 'all')
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)
returns attribute of type PianaGraphEdgeAttribute with given characteristics
 
expansion_type, propagated_from_node, propagated_from_edge are mandatory when defining a propagation
 
expansion_type, extended_from_node are mandatory when defining an extension
 
if edge_db_id is not None, it means we are creating an attribute for a given interactionPiana. In propagations edge_db_id will be None
because propagated edges do not exist as such in the database. Extensions will have an edge_db_id
create_new_node_attribute(self, node_id=None)
returns an attribute of type PianaGraphNodeAttribute with given characteristics
get_db_edge_ids_from_node(self, node_id)
Returns a list of interactionPiana (which is the db_edge_id describing interactions between node_id and all its partners
 
returns empty list if nothing is found
get_edges_attributes_from_node(self, node_id)
Returns a list of PianaGraphEdgeAttribute objects describing interactions between node_id and all its partners
 
returns empty list if nothing was found
get_expansion_name(self)
returns the name of the expansion
get_external_code(self, node_id=None, id_type=None, alternative_id_types=[])
returns the external code for node_id, first trying with id_type and then with alternative_id_types
 
if no code of id_type is found, string returned with alternative id type will follow the format "type_of_code_found:protein_code_value"
get_partner_ids(self, node_id)
Returns a list of partners (proteinPiana) of node_id
 
returns empty list if nothing is found
get_partner_node_id(self, db_edge_id=None, node_id=None)
Returns the partner node (a protein) of "node_id" in pianaDB interaction described by PianaGraphEdgeAttribute edge_attribute

Methods inherited from Expansion.NodeExpansion:
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

 
Data
        root_nodes = {}
verbose = 0
verbose_add_edge_detailed = 0
verbose_add_edge_shallow = 0
verbose_expansion_detailed = 0
verbose_expansion_minimal = 0
verbose_expansion_shallow = 0
verbose_expression = 0
verbose_get_edge = 0
verbose_get_node = 0
verbose_insert_interaction = 0
verbose_join = 0
verbose_output_graph = 0
verbose_patches = 0
verbose_pathway = 0
verbose_propagate = 0
verbose_propagate_print = 0
verbose_species = 0
verbose_spots = 0