LoD_Comparison_Database.py¶
Meow
-
class
Organisms.GA.Predation_Operators.IDCM_Predation_Operator_Scripts.LoD_Comparison_Database.
LoD_Comparison_Database
¶ This is a database that holds all the entries of CNA_Entry objects.
-
LoD_Similarity_Analysis
(dir_1, dir_2)¶ This def will obtain the max similarity percentage from the compararison of two clusters, name_1 and name_2.
- Parameters
name_1 (int) – The name of the first cluster you would like to look for an entry in the CNA_Database.
name_2 (int) – The name of the second cluster you would like to look for an entry in the CNA_Database.
- Returns
The result from the IDCM. This will be True if this cluster pair is in the database, False if not.
- Rtypes
bool
-
add
(dir_1, dir_2, result)¶ This def will obtain the CNA Information for the comparison of name_1 and name_2, and add it to the CNA_Database
- Parameters
name_1 (int) – The name of the first cluster to compare against.
name_2 (int) – The name of the second cluster to compare against.
result (bool) – The result of the comparison of the IDCM. True if they are structurally similar by the IDCM, False if not.
-
are_all_entries_false
(all_collections)¶ This method checks if all entries in the database are false. This method performs this after clusters have been removed from the population or offspring_pool due to violating the IDCM predatino operator. At this point, all entries should be false.
- Parameters
all_collections (list of Organisms.GA.Collections.Collections) – This is a list of the population and the offspring pool.
-
check_for_issues
(population)¶ This method check to make sure there are no issue with the LoD Database after the natural selection process
- Parameters
population (Organisms.GA.Population.Population) – This is the population
-
get_cluster_names
(order=False)¶ Will provide a list of all the names of all the clusters in the Collection
- Parameters
order (bool) – This tag will tell this method whether the user would like the list of names given in order.
- Returns
List of the names of all the clusters in the Population
-
get_entry
(dir_1, dir_2)¶ This def will return the CNA results from the comparison of two clusters.
- Parameters
name_1 (int) – the name of the first cluster you want to compare with.
name_2 (int) – the name of the second cluster you want to compare with.
- Returns
The CNA_Entry that contains all the CNA information about the comparison of these two clusters.
- Rtypes
CNA_Entry
-
is_cluster_pair_in_the_database
(dir_1, dir_2)¶ Determine if a CNA entry exists for two clusters in the database
- Parameters
name_1 (int) – The name of the first cluster you would like to look for an entry in the CNA_Database.
name_2 (int) – The name of the second cluster you would like to look for an entry in the CNA_Database.
- Returns
True if this cluster pair is in the database, False if not.
- Rtypes
bool
-
keys
()¶ give the names of the clusters in the database
- Returns
The list of the names of the clusters in the database.
- Return type
list of ints
-
make_database_table
()¶ This method prints a table of the database.
-
remove
(dir_to_remove)¶ Remove all entries that exists in the database that are associated with a particular cluster.
- Parameters
name_to_remove (int) – The name of the cluster you would like to remove from the CNA_Database.
-
reset
()¶ Reset the LoD database with a new database
-
which_clusters_in_LoD_comparison_database_are_similar
()¶ This method will return a dict of all the similar clusters in the LoD database, where pairs of clusters have been deemed structurally similar by the IDCM.
- Returns
A dictionary of all the clusters that have been deemed structurally similar to each other. The format of this dictionary is {name_1: [name_2, name_3, …, names of all the clusters that name_1 is structurally similar to by the IDCM], …}.
- Rtypes
dict.
-
-
class
Organisms.GA.Predation_Operators.IDCM_Predation_Operator_Scripts.LoD_Comparison_Database.
Tree
¶ This is a Tree designed for the CNA_Database to hold references of CNA_Entry.