Clustering
index
../../../../piana/code/Clustering/Clustering.py

File        : Clustering.py
Author      : Pablo Boixeda & Ramon Aragues
Creation    : 5.2005
Contents    : Methods to cluterize Graphs using ClusteringStopCondition object and ClusteringSimilarityFunction object
Called from : Class to cluster graphs
 
=======================================================================================================

 
Modules
       
PianaGlobals
copy
getopt
numarray
piana_configuration_parameters
re
readline
sys

 
Classes
       
__builtin__.object
Clustering

 
class Clustering(__builtin__.object)
    Implements a class that cluterizes nodes of Graph objects
 
Methods to cluterize Graphs using ClusteringStopCondition object and ClusteringSimilarityFunction object
 
  Methods defined here:
__init__(self)
cluster_graph(self, graph_to_cluster=None, clustered_graph_generator=None, similarity_function=None, stop_condition=None, clustering_print_mode=None, output_dir=None, output_prefix=None, root_protein=None, original_graph=None, call_do_action=0)
Method that clusters a given Graph graph_to_cluster
 
Returns the clustered graph at the point where the stop condition has been met
 
"graph to cluster": a graph witch we want to cluster
 
"clustered_graph_generator" is a Class that returns an empty GraphCluster (or a child class) when called with get_new_graph_cluster()
   -> this allows the user to control which kind of GraphCluster is going to use
 
"similarity_function": a ClusteringSimilarityFunction object
 
"stop_condition": a ClusteringStopCondition object
 
"clustering_print_mode" is used to tell this method which results have to be printed out
 
   - "all"  : will print to files with output_prefix the network, clusters composition and their interactions at all levels
   - None: won't print anything to output_prefix files
   - "final": will print to files with output_prefix  the clusters composition and their interactions at the final level
             (ie. when stop condition met)
 
"output_dir": directory where results files will be created (must end with slash eg ./)
"output_prefix": prefix that will be appended to results files
"root_protein": when training, this is the protein for which the results are being generated
 
"original_graph" is a Graph (might be of use for some similarity functions: set it to None if not useful)
 
if "call_do_action" is 1, then the method do_action() of the GraphCluster being used is called
initialize_from_graph(self, graph_to_cluster=None, clustered_graph_generator=None)
Initializes the GraphCluster from a Graph object "graph"
 
Taking as input a graph, object, creates a cluster graph with
one node attribute per cluster. This cluster graph object is
then clusterized with method cluster_graph()
 
"graph_to_cluster": graph to transform to a GraphCluster object
print_similarity_matrix(self, output_target, similarity_function, similarity_matrix)
prints similarity matrix using node ids
(only prints terms which are different from 0

Data and other attributes defined here:
__dict__ = <dictproxy object>
dictionary for instance variables (if defined)
__weakref__ = <attribute '__weakref__' of 'Clustering' objects>
list of weak references to the object (if defined)

 
Data
        root_nodes = {}
verbose = 0
verbose_add_edge_detailed = 0
verbose_add_edge_shallow = 0
verbose_detailed = 0
verbose_expansion_detailed = 0
verbose_expansion_minimal = 1
verbose_expansion_shallow = 0
verbose_get_edge = 0
verbose_get_node = 0
verbose_has_edge = 0
verbose_join = 0
verbose_process = 0
verbose_propagate = 0
verbose_propagate_print = 0
verbose_shallow = 1