From: Michael Andreen Date: Thu, 23 Aug 2007 16:59:29 +0000 (+0000) Subject: Added more doxygen documentation X-Git-Tag: v0.1~15 X-Git-Url: https://ruin.nu/git/?p=germs.git;a=commitdiff_plain;h=4462cded18dd80075c3622e5a87ca6f5f3c84f62 Added more doxygen documentation --- diff --git a/doc/doxygen b/doc/doxygen index a671140..216a78c 100644 --- a/doc/doxygen +++ b/doc/doxygen @@ -1126,7 +1126,7 @@ UML_LOOK = NO # If set to YES, the inheritance and collaboration graphs will show the # relations between templates and their instances. -TEMPLATE_RELATIONS = NO +TEMPLATE_RELATIONS = YES # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT # tags are set to YES then doxygen will generate a graph for each documented @@ -1148,7 +1148,7 @@ INCLUDED_BY_GRAPH = YES # So in most cases it will be better to enable call graphs for selected # functions only using the \callgraph command. -CALL_GRAPH = NO +CALL_GRAPH = YES # If the CALLER_GRAPH and HAVE_DOT tags are set to YES then doxygen will # generate a caller dependency graph for every global function or class method. diff --git a/src/componenttree.h b/src/componenttree.h index 816059c..84d6270 100644 --- a/src/componenttree.h +++ b/src/componenttree.h @@ -25,8 +25,14 @@ #include #include "misc.h" +/** + * Creates and holds a component tree. + */ class ComponentTree { public: + /** + * A node in the component tree. + */ struct Node { Node(Node* parent, Component comp); ~Node(); @@ -49,8 +55,17 @@ class ComponentTree { */ void makeUnoriented(); + /** + * Count the number of leaves in the component tree. + * This is the number of hurdles, if makeUnoriented has been called. + */ size_t countLeaves(); + /** + * Number of short branches. + * If makeUnoriented has been called and countLeaves is >= 3 + * then we have a super hurdle if short branches = 0. + */ size_t shortBranches(); private: diff --git a/src/genealgorithms.h b/src/genealgorithms.h index 1d74e71..a91f67d 100644 --- a/src/genealgorithms.h +++ b/src/genealgorithms.h @@ -26,7 +26,10 @@ class GeneOrder; struct Component; - +/** + * Simple interval struct, holds the indexes + information if the interval is + * oriented or not. + */ struct Interval{ Interval(size_t f,size_t s,bool o = false):first(f),second(s),oriented(o){} bool operator==(const Interval& i){ @@ -44,6 +47,8 @@ struct Interval{ std::pair longestSequences(const GeneOrder& go); /** + * Uses the Robinson-Schensted algorithm on the gene order. Gives the longest + * increasing and decreasing subsequences. */ std::vector > robinsonSchensted(const GeneOrder& go); diff --git a/src/misc.h b/src/misc.h index ee0b578..76f722f 100644 --- a/src/misc.h +++ b/src/misc.h @@ -21,8 +21,15 @@ #ifndef __MISC_H__ #define __MISC_H__ +/** + * The type we use for genes, has to be a signed integer type. + */ typedef int Gene; +/** + * Simple struct for components. Holds the indexes, the first and last genes + * + information if the component is unoriented. + */ struct Component{ Component(int b = 0,int e = 0,int s = 0,size_t i1 = 0, size_t i2 = 0):begin(b),end(e),sign(s),i1(i1), i2(i2){} bool operator==(const Component& c){ diff --git a/src/model.h b/src/model.h index 4869793..4c5f46a 100644 --- a/src/model.h +++ b/src/model.h @@ -49,11 +49,19 @@ class Model{ Model(Models::ModelImpl* model); /** + * Gives the score for the action on a given gene order. + * A better match for this model gives a higher score. */ double score(const SortAction& sa, const GeneOrder& go) const; + /** + * The name for the model used. + */ const char* name() const; + /** + * Creates a model from a name. + */ static Model modelFactory(const std::string& name); private: diff --git a/src/models.h b/src/models.h index 8d7f9e8..f037071 100644 --- a/src/models.h +++ b/src/models.h @@ -26,41 +26,97 @@ class GeneOrder; namespace Models { +/** + * Basic implementation of a model. All sort actions are considered equal. + */ class ModelImpl { public: virtual ~ModelImpl(); + /** + * All actions return 1 in this model. + * + * \see Model::score + */ virtual double score(const SortAction& sa, const GeneOrder& go); + /** + * \see Model::name + */ virtual const char* name(); }; +/** + * A model that favors symmetric reversal, resulting in an X-like + * picture in a dot plot. + */ class X : public ModelImpl { public: + /** + * Returns a higher score for reversals around the center + * + * \see Model::score + */ double score(const SortAction& sa, const GeneOrder& go); + /** + * \see Model::name + */ const char* name(); }; +/** + * A model that favors short reversals, resulting in a zipper-like + * picture in a dot plot + */ class Zipper : public ModelImpl { public: + /** + * Returns higher score for shorter reversals. + * + * \see Model::score + */ double score(const SortAction& sa, const GeneOrder& go); + /** + * \see Model::name + */ const char* name(); }; +/** + * A model that favors single gene transpositions, resulting in a + * very scattered dot plot. + */ class Cloud : public ModelImpl { public: + /** + * \todo has to be implemented + * \see Model::score + */ double score(const SortAction& sa, const GeneOrder& go); + /** + * \see Model::name + */ const char* name(); }; +/** + * A model similar to X, but a wider X in the dot plot. + */ class FatX : public ModelImpl { public: + /** + * \todo has to be implemented + * \see Model::score + */ double score(const SortAction& sa, const GeneOrder& go); + /** + * \see Model::name + */ const char* name(); }; diff --git a/src/sortaction.h b/src/sortaction.h index 5b81050..ec9a023 100644 --- a/src/sortaction.h +++ b/src/sortaction.h @@ -26,6 +26,10 @@ class GeneOrder; +/** + * Abstraction for a sort action implementation, this is the base that other + * actions inherits from. + */ class SortActionImpl{ public: @@ -48,7 +52,7 @@ class SortActionImpl{ }; /** - * Abstraction of a sort action, all child actions has to be immutable. + * Abstraction of a sort action, all SortActionImpls has to be immutable. * * \author Michael Andreen */