Rosetta  2021.16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Namespaces | Classes | Typedefs | Functions
protocols::multistage_rosetta_scripts::cluster Namespace Reference

Namespaces

 metrics
 

Classes

class  ClusterMetric
 
class  ClusterMetricCreator
 
class  ClusterMetricFactory
 
class  ClusterMetricRegistrator
 This templated class will register an instance of an ClusterMetricCreator (class T) with the ClusterMetricFactory. It will ensure that no ClusterMetricCreator is registered twice, and centralizes this registration logic so that thread safety issues can be handled in one place. More...
 

Typedefs

using ClusterMetricOP = utility::pointer::shared_ptr< ClusterMetric >
 
using ClusterMetricCOP = utility::pointer::shared_ptr< ClusterMetric const >
 
using ClusterMetricCreatorOP = utility::pointer::shared_ptr< ClusterMetricCreator >
 
using ClusterMetricCreatorCOP = utility::pointer::shared_ptr< ClusterMetricCreator const >
 
using uint = unsigned int
 

Functions

float distance (utility::vector1< float > const &triangle_matrix, utility::vector1< uint > const &offsets, uint pointA, uint pointB)
 Looks up the distance between two points in the tricky triangle matrix I hacked together. More...
 
unsigned long long int number_of_elements_in_exclusive_upper_triangle (unsigned short int const num_points)
 maybe this is lazy programming on my part. I just want to count how many possible interacitons there are without using math. Feel free to replace this with a simple equation. More...
 
void initialize_offsets (utility::vector1< uint > &offsets, uint const num_points)
 Initialize the offset vector identified in schematic (2) above. More...
 
void assign_initial_medoids (utility::vector1< bool > const &medoids, utility::vector1< uint > &medoid_for_cluster, utility::vector1< uint > &cluster_for_point)
 This assumes you already created k "true"s in medoids vector. Just goes through and updates medoid_for_cluster and cluster_for_point (but only for medoids) More...
 
void assign_medoids (utility::vector1< float > const &triangle_matrix, utility::vector1< uint > const &offsets, utility::vector1< bool > &medoids, utility::vector1< uint > &medoid_for_cluster, utility::vector1< uint > const &cluster_for_point)
 Iterates though every point and tests to see if it is the best medoid for its cluster. More...
 
core::Real assign_non_medoids_to_clusters (utility::vector1< float > const &triangle_matrix, utility::vector1< uint > const &offsets, utility::vector1< bool > const &medoids, utility::vector1< uint > const &medoid_for_cluster, utility::vector1< uint > &cluster_for_point)
 After the medoids have been assigned, go through each point and determine which cluster it is in. Returns total distance cost. More...
 
void k_medoids_with_edge_precalculation (utility::vector1< ClusterMetricCOP > const &points, unsigned short int const num_medoids, utility::vector1< bool > &best_medoids)
 Finds "num_medoids" number of clusters from within the "points" vector. If a point becomes the center of a cluster, it's index in "medoid_positions" is set to true. False otherwise. medoid_positions.size() will equal points.size() More...
 
utility::vector1< boolk_medoids_with_edge_precalculation (utility::vector1< ClusterMetricCOP > const &points, unsigned short int const num_medoids)
 This overload provides you with the vector of results. It is mildly more convenient but mildly less efficient. Differences are mild all around. More...
 
bool vector_has_n_trues (utility::vector1< bool > const &vec, int n)
 This is a simple utility for debugging. Makes sure we have the right number of medoids assigned. More...
 
void assign_initial_medoids_on_the_fly (utility::vector1< bool > const &medoids, utility::vector1< uint > &medoid_for_cluster, utility::vector1< uint > &cluster_for_point)
 This assumes you already created k "true"s in medoids vector. Just goes through and updates medoid_for_cluster and cluster_for_point (but only for medoids) More...
 
void assign_medoids_on_the_fly (utility::vector1< ClusterMetricCOP > const &points, utility::vector1< bool > &medoids, utility::vector1< uint > &medoid_for_cluster, utility::vector1< uint > &cluster_for_point)
 Iterates though every point and tests to see if it is the best medoid for its cluster. More...
 
core::Real assign_non_medoids_to_clusters_on_the_fly (utility::vector1< ClusterMetricCOP > const &points, utility::vector1< bool > const &medoids, utility::vector1< uint > const &medoid_for_cluster, utility::vector1< uint > &cluster_for_point)
 After the medoids have been assigned, go through each point and determine which cluster it is in. Returns total distance cost. More...
 
void k_medoids_on_the_fly (utility::vector1< ClusterMetricCOP > const &points, unsigned short int const num_medoids, utility::vector1< bool > &best_medoids)
 Finds "num_medoids" number of clusters from within the "points" vector. If a point becomes the center of a cluster, it's index in "medoid_positions" is set to true. False otherwise. medoid_positions.size() will equal points.size() More...
 
utility::vector1< boolk_medoids_on_the_fly (utility::vector1< ClusterMetricCOP > const &points, unsigned short int const num_medoids)
 This overload provides you with the vector of results. It is mildly more convenient but mildly less efficient. Differences are mild all around. More...
 
void xsd_type_definition_w_attributes (utility::tag::XMLSchemaDefinition &xsd, std::string const &cm_type, std::string const &description, utility::tag::AttributeList const &attributes)
 
std::string complex_type_name_for_cluster_metric (std::string const &cm_type)
 

Typedef Documentation

using protocols::multistage_rosetta_scripts::cluster::ClusterMetricCOP = typedef utility::pointer::shared_ptr< ClusterMetric const >
using protocols::multistage_rosetta_scripts::cluster::ClusterMetricOP = typedef utility::pointer::shared_ptr< ClusterMetric >

Function Documentation

void protocols::multistage_rosetta_scripts::cluster::assign_initial_medoids ( utility::vector1< bool > const &  medoids,
utility::vector1< uint > &  medoid_for_cluster,
utility::vector1< uint > &  cluster_for_point 
)

This assumes you already created k "true"s in medoids vector. Just goes through and updates medoid_for_cluster and cluster_for_point (but only for medoids)

Referenced by k_medoids_with_edge_precalculation().

void protocols::multistage_rosetta_scripts::cluster::assign_initial_medoids_on_the_fly ( utility::vector1< bool > const &  medoids,
utility::vector1< uint > &  medoid_for_cluster,
utility::vector1< uint > &  cluster_for_point 
)

This assumes you already created k "true"s in medoids vector. Just goes through and updates medoid_for_cluster and cluster_for_point (but only for medoids)

Referenced by k_medoids_on_the_fly().

void protocols::multistage_rosetta_scripts::cluster::assign_medoids ( utility::vector1< float > const &  triangle_matrix,
utility::vector1< uint > const &  offsets,
utility::vector1< bool > &  medoids,
utility::vector1< uint > &  medoid_for_cluster,
utility::vector1< uint > const &  cluster_for_point 
)

Iterates though every point and tests to see if it is the best medoid for its cluster.

References distance().

Referenced by k_medoids_with_edge_precalculation().

void protocols::multistage_rosetta_scripts::cluster::assign_medoids_on_the_fly ( utility::vector1< ClusterMetricCOP > const &  points,
utility::vector1< bool > &  medoids,
utility::vector1< uint > &  medoid_for_cluster,
utility::vector1< uint > &  cluster_for_point 
)

Iterates though every point and tests to see if it is the best medoid for its cluster.

Referenced by k_medoids_on_the_fly().

core::Real protocols::multistage_rosetta_scripts::cluster::assign_non_medoids_to_clusters ( utility::vector1< float > const &  triangle_matrix,
utility::vector1< uint > const &  offsets,
utility::vector1< bool > const &  medoids,
utility::vector1< uint > const &  medoid_for_cluster,
utility::vector1< uint > &  cluster_for_point 
)

After the medoids have been assigned, go through each point and determine which cluster it is in. Returns total distance cost.

References distance(), and protocols::hybridization::score.

Referenced by k_medoids_with_edge_precalculation().

core::Real protocols::multistage_rosetta_scripts::cluster::assign_non_medoids_to_clusters_on_the_fly ( utility::vector1< ClusterMetricCOP > const &  points,
utility::vector1< bool > const &  medoids,
utility::vector1< uint > const &  medoid_for_cluster,
utility::vector1< uint > &  cluster_for_point 
)

After the medoids have been assigned, go through each point and determine which cluster it is in. Returns total distance cost.

References protocols::hybridization::score.

Referenced by k_medoids_on_the_fly().

std::string protocols::multistage_rosetta_scripts::cluster::complex_type_name_for_cluster_metric ( std::string const &  cm_type)
inline
float protocols::multistage_rosetta_scripts::cluster::distance ( utility::vector1< float > const &  triangle_matrix,
utility::vector1< uint > const &  offsets,
uint  pointA,
uint  pointB 
)

Looks up the distance between two points in the tricky triangle matrix I hacked together.

Referenced by assign_medoids(), assign_non_medoids_to_clusters(), and k_medoids_with_edge_precalculation().

void protocols::multistage_rosetta_scripts::cluster::initialize_offsets ( utility::vector1< uint > &  offsets,
uint const  num_points 
)

Initialize the offset vector identified in schematic (2) above.

Referenced by k_medoids_with_edge_precalculation().

utility::vector1< bool > protocols::multistage_rosetta_scripts::cluster::k_medoids_on_the_fly ( utility::vector1< ClusterMetricCOP > const &  points,
unsigned short int const  num_medoids 
)
inline

This overload provides you with the vector of results. It is mildly more convenient but mildly less efficient. Differences are mild all around.

References k_medoids_on_the_fly().

void protocols::multistage_rosetta_scripts::cluster::k_medoids_on_the_fly ( utility::vector1< ClusterMetricCOP > const &  points,
unsigned short int const  num_medoids,
utility::vector1< bool > &  best_medoids 
)

Finds "num_medoids" number of clusters from within the "points" vector. If a point becomes the center of a cluster, it's index in "medoid_positions" is set to true. False otherwise. medoid_positions.size() will equal points.size()

This algorithm is stochastic but usually pretty good at finding good clusters quickly. The methods in this file precalculate all of the possible distances between the points in an attempt to save time. In practice, this does not save any time at all (tested with SequenceMetrics of length 250) so I recommend looking at protocols/multistage_rosetta_scripts/cluster/KMedoidsOnTheFly.hh

References assign_initial_medoids_on_the_fly(), assign_medoids_on_the_fly(), assign_non_medoids_to_clusters_on_the_fly(), protocols::stepwise::screener::INTEGRATION_TEST, and vector_has_n_trues().

Referenced by protocols::multistage_rosetta_scripts::MRSJobQueen::cluster(), and k_medoids_on_the_fly().

utility::vector1< bool > protocols::multistage_rosetta_scripts::cluster::k_medoids_with_edge_precalculation ( utility::vector1< ClusterMetricCOP > const &  points,
unsigned short int const  num_medoids 
)
inline

This overload provides you with the vector of results. It is mildly more convenient but mildly less efficient. Differences are mild all around.

References k_medoids_with_edge_precalculation().

void protocols::multistage_rosetta_scripts::cluster::k_medoids_with_edge_precalculation ( utility::vector1< ClusterMetricCOP > const &  points,
unsigned short int const  num_medoids,
utility::vector1< bool > &  best_medoids 
)

Finds "num_medoids" number of clusters from within the "points" vector. If a point becomes the center of a cluster, it's index in "medoid_positions" is set to true. False otherwise. medoid_positions.size() will equal points.size()

This algorithm is stochastic but usually pretty good at finding good clusters quickly. The methods in this file precalculate all of the possible distances between the points in an attempt to save time. In practice, this does not save any time at all (tested with SequenceMetrics of length 250) so I recommend looking at protocols/multistage_rosetta_scripts/cluster/KMedoidsOnTheFly.hh

References assign_initial_medoids(), assign_medoids(), assign_non_medoids_to_clusters(), distance(), initialize_offsets(), protocols::stepwise::screener::INTEGRATION_TEST, number_of_elements_in_exclusive_upper_triangle(), and vector_has_n_trues().

Referenced by k_medoids_with_edge_precalculation().

unsigned long long int protocols::multistage_rosetta_scripts::cluster::number_of_elements_in_exclusive_upper_triangle ( unsigned short int const  num_points)

maybe this is lazy programming on my part. I just want to count how many possible interacitons there are without using math. Feel free to replace this with a simple equation.

Referenced by k_medoids_with_edge_precalculation().

bool protocols::multistage_rosetta_scripts::cluster::vector_has_n_trues ( utility::vector1< bool > const &  vec,
int  n 
)
inline

This is a simple utility for debugging. Makes sure we have the right number of medoids assigned.

References protocols::match::upstream::b.

Referenced by k_medoids_on_the_fly(), and k_medoids_with_edge_precalculation().

void protocols::multistage_rosetta_scripts::cluster::xsd_type_definition_w_attributes ( utility::tag::XMLSchemaDefinition &  xsd,
std::string const &  cm_type,
std::string const &  description,
utility::tag::AttributeList const &  attributes 
)