2
// File: BipartitionTools.h
3
// Created by: Nicolas Galtier & Julien Dutheil
4
// Created on: Tue Apr 13 15:09 2007
8
Copyright or © or Copr. CNRS, (November 16, 2004)
10
This software is a computer program whose purpose is to provide classes
11
for phylogenetic data analysis.
13
This software is governed by the CeCILL license under French law and
14
abiding by the rules of distribution of free software. You can use,
15
modify and/ or redistribute the software under the terms of the CeCILL
16
license as circulated by CEA, CNRS and INRIA at the following URL
17
"http://www.cecill.info".
19
As a counterpart to the access to the source code and rights to copy,
20
modify and redistribute granted by the license, users are provided only
21
with a limited warranty and the software's author, the holder of the
22
economic rights, and the successive licensors have only limited
25
In this respect, the user's attention is drawn to the risks associated
26
with loading, using, modifying and/or developing or reproducing the
27
software by the user in light of its specific status of free software,
28
that may mean that it is complicated to manipulate, and that also
29
therefore means that it is reserved for developers and experienced
30
professionals having in-depth computer knowledge. Users are therefore
31
encouraged to load and test the software's suitability as regards their
32
requirements in conditions enabling the security of their systems and/or
33
data to be ensured and, more generally, to use and operate it in the
34
same conditions as regards security.
36
The fact that you are presently reading this means that you have had
37
knowledge of the CeCILL license and that you accept its terms.
40
#ifndef _BIPARTITIONTOOLS_H_
41
#define _BIPARTITIONTOOLS_H_
43
#include "BipartitionList.h"
46
#include <Bpp/Seq/Container/VectorSiteContainer.h>
52
* @brief This class provides tools related to the BipartitionList class
54
* BipartitionTools includes functions dealing with dynamic arrays of bits
55
* and tools for dealing with bipartitions from distinct lists.
58
* @see BipartitionList
61
class BipartitionTools
68
* Unit length (in bits) of arrays of bits. Must be a multiple of CHAR_BIT*sizeof(int).
69
* Default value is 64.
71
static unsigned int LWORD;
75
virtual ~BipartitionTools() {}
80
* @brief Sets bit number num of bit array list to one
82
* Note that no control of memory allocation is made
84
static void bit1(int *list, int num);
87
* @brief Sets bit number num of bit array plist to zero
89
* Note that no control of memory allocation is made
91
static void bit0(int *list, int num);
94
* @brief bit-wise logical AND between two arrays of bits
96
* (1 AND 1 = 1; 1 AND 0 = 0 AND 1 = 0 AND 0 = 0)
98
* Note that no control of memory allocation is made
100
* param list1 first array of bit
101
* param list2 second array of bit
102
* param listet resulting array of bit
103
* param len number of int over which the operation is performed
105
static void bitAnd(int *listet, int *list1, int *list2, unsigned int len);
108
* @brief bit-wise logical OR between two arrays of bits
110
* (1 OR 1 = 1 OR 0 = 0 OR 1 = 1; 0 OR 0 = 0)
112
* Note that no control of memory allocation is made
114
* param list1 first array of bit
115
* param list2 second array of bit
116
* param listou resulting array of bit
117
* param len number of int over which the operation is performed
119
static void bitOr(int *listou, int *list1, int *list2, unsigned int len);
122
* @brief bit-wise logical NOT
124
* (NOT 1 = 0; NOT 0 = 1)
126
* Note that no control of memory allocation is made
128
* param list input array of bit
129
* param listnot resulting array of bit
130
* param len number of int over which the operation is performed
132
static void bitNot(int *listnon, int *list, unsigned int len);
135
* @brief Tells whether bit number num in bit array list is one
137
static bool testBit(int *list, int num);
140
* @brief Makes one BipartitionList out of several
142
* The input BipartitionList objects must share the same set of elements. This will be checked or not
143
* depending on checkElements
145
static BipartitionList* mergeBipartitionLists(const std::vector<BipartitionList*>& vecBipartL, bool checkElements = true) throw (Exception);
148
* @brief Construct a BipartitionList containing two bipartitions taken from distinct input lists
150
static BipartitionList* buildBipartitionPair(const BipartitionList& bipartL1, unsigned int i1, const BipartitionList& bipartL2, unsigned int i2, bool checkElements = true) throw (Exception);
153
* @brief Tells whether two bipartitions from distinct lists are identical
155
static bool areIdentical(const BipartitionList& bipart1, unsigned int i1, const BipartitionList& bipart2, unsigned int i2, bool checkElements = true);
158
* @brief Tells whether two bipartitions from distinct lists are compatible
160
static bool areCompatible(const BipartitionList& bipart1, unsigned int i1, const BipartitionList& bipart2, unsigned int i2, bool checkElements = true);
163
* @brief Create a sequence data set corresponding to the Matrix Representation of the input BipartitionList objects
165
* The input BipartitionList objects can have distinct sets of elements - missing data will be represented as 'N'.
166
* The output alignment (DNA sequences including only A, C and N)) is ready for maximum parsimony analysis
167
* according to the MRP supertree method.
169
static VectorSiteContainer* MRPEncode(const std::vector<BipartitionList*>& vecBipartL) throw (Exception);
173
} //end of namespace bpp.
175
#endif //_BIPARTITIONTOOLS_H_