NCBI C++ ToolKit
cuSeqTreeSlc.hpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 #ifndef CU_SLC_TREEALG__HPP
2 #define CU_SLC_TREEALG__HPP
3 
4 /* $Id: cuSeqTreeSlc.hpp 33815 2007-05-04 17:18:18Z kazimird $
5 * ===========================================================================
6 *
7 * PUBLIC DOMAIN NOTICE
8 * National Center for Biotechnology Information
9 *
10 * This software/database is a "United States Government Work" under the
11 * terms of the United States Copyright Act. It was written as part of
12 * the author's official duties as a United States Government employee and
13 * thus cannot be copyrighted. This software/database is freely available
14 * to the public for use. The National Library of Medicine and the U.S.
15 * Government have not placed any restriction on its use or reproduction.
16 *
17 * Although all reasonable efforts have been taken to ensure the accuracy
18 * and reliability of the software and data, the NLM and the U.S.
19 * Government do not and cannot warrant the performance or results that
20 * may be obtained by using this software or data. The NLM and the U.S.
21 * Government disclaim all warranties, express or implied, including
22 * warranties of performance, merchantability or fitness for any particular
23 * purpose.
24 *
25 * Please cite the author in any work or product based on this material.
26 *
27 * ===========================================================================
28 *
29 * Author: Chris Lanczycki
30 *
31 * File Description:
32 * Implementation of a single-linkage clustering algorithm
33 * Produces a tree with a FAKE root.
34 * Estimates branch lengths as half node-to-node distance.
35 *
36 */
37 
41 #include <corelib/ncbistd.hpp>
44 
47 BEGIN_SCOPE(cd_utils)
48 
50 
51  static const double REPLACE_NEG_DIST;
52  static const Rootedness MY_ROOTEDNESS;
55 
56 public:
57 
59 
61 
62  virtual ~SLC_TreeAlgorithm();
63  virtual long GetNumLoopsForTreeCalc();
64  virtual void ComputeTree(SeqTree* tree, pProgressFunction pFunc);
65  virtual string toString();
66 // string toString(const TSeqIt& sit);
67 
68  //virtual void SetCDD(CCd* cdd);
69  virtual void SetDistMat(DistanceMatrix* dm);
70 
71 
72 private:
73 
74  static const int USED_ROW;
75  static const int BAD_INDEX;
76 
77  void initializeNodes();
78  bool isHub(const TSeqIt& sit);
79  bool isInternal(const TSeqIt& sit);
80 
81  int numChildren(const TSeqIt& sit);
82 
83  void Join(int inode1, int inode2, double len1, double len2);
84 
85  // SLC method data members.
86 
87  int m_nseqs; // Number of sequences (dimension of m_dm)
88  int m_nextNode; // Index of next free node in m_seqiters.
89  vector< SeqItem* > m_items; // Contents of a tree node.
90  TTreeIt m_seqiters; // List of iterators pointing to tree nodes,
91  // identified using the row id from alignment provided.
92 
93 };
94 
95 // Hub node is node 0.
96 inline
98  return (it == m_seqiters[0]);
99 }
100 
101 inline
103  return (it.is_valid() && !isHub(it));
104 }
105 
106 END_SCOPE(cd_utils)
108 
109 #endif /* CU_SLC_TREEALG__HPP */
User-defined methods of the data storage class.
double TMatType
Definition: cuDistmat.hpp:91
bool isHub(const TSeqIt &sit)
bool isInternal(const TSeqIt &sit)
static const DistanceMatrix::TMatType INIT_MINIMA
static const ETreeMethod MY_TREE_METHOD
vector< SeqItem * > m_items
static const double REPLACE_NEG_DIST
static const int BAD_INDEX
static const Rootedness MY_ROOTEDNESS
static const int USED_ROW
vector< TSeqIt > TTreeIt
bool is_valid() const
Definition: tree_msvc7.hpp:134
Include a standard set of the NCBI C++ Toolkit most basic headers.
void(* pProgressFunction)(int Num, int Total)
Definition: cuDistmat.hpp:47
ETreeMethod
USING_SCOPE(objects)
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define END_SCOPE(ns)
End the previously defined scope.
Definition: ncbistl.hpp:75
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
#define BEGIN_SCOPE(ns)
Define a new scope.
Definition: ncbistl.hpp:72
#define NCBI_CDUTILS_EXPORT
Definition: ncbi_export.h:376
static std::string toString(boost::unit_test::const_string bstr)
Modified on Fri Sep 20 14:58:18 2024 by modify_doxy.py rev. 669887