Structural Bioinformatics Library
Template C++ / Python API for developping structural bioinformatics applications.
MCI_solutions Class Reference

Constructor

def __init__ (self)
 init More...
 

Emulating a Container

def __len__ (self)
 len More...
 
def __contains__ (self, tuple)
 A solution is 'known' if it has the same contacts. More...
 
def __getitem__ (self, index)
 getitem More...
 
def __copy__ (self)
 copy More...
 

Printing

def pretty_print_solutions (self, in_filename='Unnamed instance', out_filename=None, G=None, algorithm=None, verbose=0)
 Print the results either in the standard output (default) or in the specified file (out_filename). More...
 

Serializaing Solutions

def append_solution_tuple (self, tuple, magic=True)
 Append a tuple to the list of known solution unless it is already known. More...
 
def add_known_solutions (self, solutions)
 A setter function to add the known solutions in empty attribute. More...
 
def get_set_of_solutions (self)
 Return set of solutions in a lexico ordering. More...
 
def get_union_of_contacts (self)
 Return union of contacts in all solutions. More...
 
def fill_contacts_to_counts_map (self)
 fill_contacts_to_counts_map More...
 
def get_contacts_to_counts_map (self)
 get_contacts_to_counts_map More...
 
def get_count_for_the_contact_from_the_map (self, contact)
 get_count_for_the_contact_from_the_map More...
 
def get_length_of_contacts_to_counts_map (self)
 get_length_of_contacts_to_counts_map More...
 
def does_contacts_to_counts_map_has_the_contact (self, contact)
 does_contacts_to_counts_map_has_the_contact More...
 
def compute_and_store_solution_scores (self)
 solution scores are computed and stored score of a solution is sum of counts for each contact in the solution More...
 
def compute_and_store_false_positive_counts (self, afile)
 compute_and_store_false_positive_counts More...
 
def compare_against_solution_set (self, other)
 Given two lists of pairs (cost, list of contacts) or triples (cost, list of contacts, time), returns True if the two lists contains the same solutions. More...
 
def store_solutions_to_file_as_dict (self, out_filename=None)
 Print all solutions in the specified file (out_filename) in the form of a dictionary. More...
 
def load_dict_of_solutions_from_file (self, in_filename=None)
 Load the dictionary of solutions from the specified file (in_filename). More...
 
def get_cost_components_average (self)
 dagarwal: temporary function return a tuple of average of components of cost over a solution set More...
 
def fill_up_protein_to_neighbors_in_union_of_solutions_map (self)
 fill_up_protein_to_neighbors_in_union_of_solutions_map More...
 
def get_protein_to_neighbors_in_union_of_solutions_map (self)
 get_protein_to_neighbors_in_union_of_solutions_map More...
 
def get_cost_and_runtime_pair_for_a_solution (self, soln)
 get_cost_and_runtime_pair_for_a_solution More...
 
def get_contact_score (self, p1, p2)
 Accessing Scores and Interesting Contacts / Solutions#. More...
 
def get_solution_score (self, solution)
 Return the score of a solution, that is the sum of the scores of its contacts. More...
 
def get_consensus_solutions (self)
 Return the consensus solutions, i.e the top scoring solutions. More...
 
def get_consensus_contacts (self)
 Return all the contacts of the consensus solutions. More...
 
def get_top_scoring_contacts (self)
 Return all the top scoring contacts of the solutions. More...
 
def get_top_scoring_consensus_contacts (self)
 Return all the top scoring contacts of the consensus solutions. More...
 

Detailed Description

A class to store solutions, each as a triple (cost, set of contacts, running time per solution)

A class to store solutions, each as a triple (cost, set of contacts, running time per solution).
In addition this class stores a dictionary attribute which is then used to compute solution score in the class MCI_set_of_contacts.
The value of the dictionary attribute is the contact count which is number of times a contact appears in the whole solution set – {key=contact, value=counts}

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self)

init

Member Function Documentation

◆ __contains__()

def __contains__ (   self,
  tuple 
)

A solution is 'known' if it has the same contacts.

The solution cost and the computation time are omitted in the test.

◆ __copy__()

def __copy__ (   self)

copy

◆ __getitem__()

def __getitem__ (   self,
  index 
)

getitem

◆ __len__()

def __len__ (   self)

len

◆ add_known_solutions()

def add_known_solutions (   self,
  solutions 
)

A setter function to add the known solutions in empty attribute.

◆ append_solution_tuple()

def append_solution_tuple (   self,
  tuple,
  magic = True 
)

Append a tuple to the list of known solution unless it is already known.

When 'magic' is True, we check if the input tuple is already known, in which case we don't add it, or if it is a subset of a known solution. In such case, we discard the known solution before adding the new one.

◆ compare_against_solution_set()

def compare_against_solution_set (   self,
  other 
)

Given two lists of pairs (cost, list of contacts) or triples (cost, list of contacts, time), returns True if the two lists contains the same solutions.

xfc: exploit the fact that a Set_of_contacts has a canonical representation

◆ compute_and_store_false_positive_counts()

def compute_and_store_false_positive_counts (   self,
  afile 
)

compute_and_store_false_positive_counts

◆ compute_and_store_solution_scores()

def compute_and_store_solution_scores (   self)

solution scores are computed and stored score of a solution is sum of counts for each contact in the solution

◆ does_contacts_to_counts_map_has_the_contact()

def does_contacts_to_counts_map_has_the_contact (   self,
  contact 
)

does_contacts_to_counts_map_has_the_contact

◆ fill_contacts_to_counts_map()

def fill_contacts_to_counts_map (   self)

fill_contacts_to_counts_map

◆ fill_up_protein_to_neighbors_in_union_of_solutions_map()

def fill_up_protein_to_neighbors_in_union_of_solutions_map (   self)

fill_up_protein_to_neighbors_in_union_of_solutions_map

◆ get_consensus_contacts()

def get_consensus_contacts (   self)

Return all the contacts of the consensus solutions.

◆ get_consensus_solutions()

def get_consensus_solutions (   self)

Return the consensus solutions, i.e the top scoring solutions.

◆ get_contact_score()

def get_contact_score (   self,
  p1,
  p2 
)

Accessing Scores and Interesting Contacts / Solutions#.

Return the score of a contact, that is the number of solutions containing this contact.

◆ get_contacts_to_counts_map()

def get_contacts_to_counts_map (   self)

get_contacts_to_counts_map

◆ get_cost_and_runtime_pair_for_a_solution()

def get_cost_and_runtime_pair_for_a_solution (   self,
  soln 
)

get_cost_and_runtime_pair_for_a_solution

◆ get_cost_components_average()

def get_cost_components_average (   self)

dagarwal: temporary function return a tuple of average of components of cost over a solution set

◆ get_count_for_the_contact_from_the_map()

def get_count_for_the_contact_from_the_map (   self,
  contact 
)

get_count_for_the_contact_from_the_map

◆ get_length_of_contacts_to_counts_map()

def get_length_of_contacts_to_counts_map (   self)

get_length_of_contacts_to_counts_map

◆ get_protein_to_neighbors_in_union_of_solutions_map()

def get_protein_to_neighbors_in_union_of_solutions_map (   self)

get_protein_to_neighbors_in_union_of_solutions_map

◆ get_set_of_solutions()

def get_set_of_solutions (   self)

Return set of solutions in a lexico ordering.

◆ get_solution_score()

def get_solution_score (   self,
  solution 
)

Return the score of a solution, that is the sum of the scores of its contacts.

◆ get_top_scoring_consensus_contacts()

def get_top_scoring_consensus_contacts (   self)

Return all the top scoring contacts of the consensus solutions.

◆ get_top_scoring_contacts()

def get_top_scoring_contacts (   self)

Return all the top scoring contacts of the solutions.

◆ get_union_of_contacts()

def get_union_of_contacts (   self)

Return union of contacts in all solutions.

◆ load_dict_of_solutions_from_file()

def load_dict_of_solutions_from_file (   self,
  in_filename = None 
)

Load the dictionary of solutions from the specified file (in_filename).

◆ pretty_print_solutions()

def pretty_print_solutions (   self,
  in_filename = 'Unnamed instance',
  out_filename = None,
  G = None,
  algorithm = None,
  verbose = 0 
)

Print the results either in the standard output (default) or in the specified file (out_filename).

◆ store_solutions_to_file_as_dict()

def store_solutions_to_file_as_dict (   self,
  out_filename = None 
)

Print all solutions in the specified file (out_filename) in the form of a dictionary.