bpp-phyl3  3.0.0
bpp::BipartitionTools Class Reference

This class provides tools related to the BipartitionList class. More...

#include <Bpp/Phyl/Tree/BipartitionTools.h>

Public Member Functions

 BipartitionTools ()
 
virtual ~BipartitionTools ()
 

Static Public Member Functions

static void bit1 (int *list, int num)
 Sets bit number num of bit array list to one. More...
 
static void bit0 (int *list, int num)
 Sets bit number num of bit array plist to zero. More...
 
static void bitAnd (int *listet, int *list1, int *list2, size_t len)
 bit-wise logical AND between two arrays of bits More...
 
static void bitOr (int *listou, int *list1, int *list2, size_t len)
 bit-wise logical OR between two arrays of bits More...
 
static void bitNot (int *listnon, int *list, size_t len)
 bit-wise logical NOT More...
 
static bool testBit (int *list, int num)
 Tells whether bit number num in bit array list is one. More...
 
static std::unique_ptr< BipartitionListmergeBipartitionLists (const std::vector< std::unique_ptr< BipartitionList >> &vecBipartL, bool checkElements=true)
 Makes one BipartitionList out of several. More...
 
static std::unique_ptr< BipartitionListbuildBipartitionPair (const BipartitionList &bipartL1, size_t i1, const BipartitionList &bipartL2, size_t i2, bool checkElements=true)
 Construct a BipartitionList containing two bipartitions taken from distinct input lists. More...
 
static bool areIdentical (const BipartitionList &bipart1, size_t i1, const BipartitionList &bipart2, size_t i2, bool checkElements=true)
 Tells whether two bipartitions from distinct lists are identical. More...
 
static bool areCompatible (const BipartitionList &bipart1, size_t i1, const BipartitionList &bipart2, size_t i2, bool checkElements=true)
 Tells whether two bipartitions from distinct lists are compatible. More...
 
static std::unique_ptr< VectorSiteContainerMRPEncode (const std::vector< std::unique_ptr< BipartitionList >> &vecBipartL)
 Create a sequence data set corresponding to the Matrix Representation of the input BipartitionList objects. More...
 
static std::unique_ptr< VectorSiteContainerMRPEncodeMultilabel (const std::vector< std::unique_ptr< BipartitionList >> &vecBipartL)
 Create a sequence data set corresponding to the Matrix Representation of the input BipartitionList objects and accommodates multilabel trees. More...
 

Static Public Attributes

static int LWORD = static_cast<int>(CHAR_BIT * sizeof(int))
 Unit length (in bits) of arrays of bits. Must be a multiple of CHAR_BIT*sizeof(int). Default value is 64. More...
 

Detailed Description

This class provides tools related to the BipartitionList class.

BipartitionTools includes functions dealing with dynamic arrays of bits and tools for dealing with bipartitions from distinct lists.

See also
Tree
BipartitionList
TreeTools

Definition at line 26 of file BipartitionTools.h.

Constructor & Destructor Documentation

◆ BipartitionTools()

bpp::BipartitionTools::BipartitionTools ( )
inline

Definition at line 38 of file BipartitionTools.h.

◆ ~BipartitionTools()

virtual bpp::BipartitionTools::~BipartitionTools ( )
inlinevirtual

Definition at line 39 of file BipartitionTools.h.

Member Function Documentation

◆ areCompatible()

bool BipartitionTools::areCompatible ( const BipartitionList bipart1,
size_t  i1,
const BipartitionList bipart2,
size_t  i2,
bool  checkElements = true 
)
static

Tells whether two bipartitions from distinct lists are compatible.

Definition at line 155 of file BipartitionTools.cpp.

◆ areIdentical()

bool BipartitionTools::areIdentical ( const BipartitionList bipart1,
size_t  i1,
const BipartitionList bipart2,
size_t  i2,
bool  checkElements = true 
)
static

Tells whether two bipartitions from distinct lists are identical.

Definition at line 144 of file BipartitionTools.cpp.

Referenced by bpp::TreeTools::computeBootstrapValues(), bpp::TreeTools::haveSameTopology(), and bpp::TreeTools::robinsonFouldsDistance().

◆ bit0()

void BipartitionTools::bit0 ( int *  list,
int  num 
)
static

Sets bit number num of bit array plist to zero.

Note that no control of memory allocation is made

Definition at line 45 of file BipartitionTools.cpp.

Referenced by bpp::BipartitionList::addBipartition(), bpp::BipartitionList::buildBitBipartitions(), and bpp::BipartitionList::sortElements().

◆ bit1()

void BipartitionTools::bit1 ( int *  list,
int  num 
)
static

Sets bit number num of bit array list to one.

Note that no control of memory allocation is made

Definition at line 36 of file BipartitionTools.cpp.

Referenced by bpp::BipartitionList::addBipartition(), bpp::BipartitionList::buildBitBipartitions(), and bpp::BipartitionList::sortElements().

◆ bitAnd()

void BipartitionTools::bitAnd ( int *  listet,
int *  list1,
int *  list2,
size_t  len 
)
static

bit-wise logical AND between two arrays of bits

(1 AND 1 = 1; 1 AND 0 = 0 AND 1 = 0 AND 0 = 0)

Note that no control of memory allocation is made

param list1 first array of bit param list2 second array of bit param listet resulting array of bit param len number of int over which the operation is performed

Definition at line 54 of file BipartitionTools.cpp.

◆ bitNot()

void BipartitionTools::bitNot ( int *  listnon,
int *  list,
size_t  len 
)
static

bit-wise logical NOT

(NOT 1 = 0; NOT 0 = 1)

Note that no control of memory allocation is made

param list input array of bit param listnot resulting array of bit param len number of int over which the operation is performed

Definition at line 74 of file BipartitionTools.cpp.

Referenced by bpp::BipartitionList::flip().

◆ bitOr()

void BipartitionTools::bitOr ( int *  listou,
int *  list1,
int *  list2,
size_t  len 
)
static

bit-wise logical OR between two arrays of bits

(1 OR 1 = 1 OR 0 = 0 OR 1 = 1; 0 OR 0 = 0)

Note that no control of memory allocation is made

param list1 first array of bit param list2 second array of bit param listou resulting array of bit param len number of int over which the operation is performed

Definition at line 64 of file BipartitionTools.cpp.

Referenced by bpp::BipartitionList::toTree().

◆ buildBipartitionPair()

unique_ptr< BipartitionList > BipartitionTools::buildBipartitionPair ( const BipartitionList bipartL1,
size_t  i1,
const BipartitionList bipartL2,
size_t  i2,
bool  checkElements = true 
)
static

◆ mergeBipartitionLists()

std::unique_ptr< BipartitionList > BipartitionTools::mergeBipartitionLists ( const std::vector< std::unique_ptr< BipartitionList >> &  vecBipartL,
bool  checkElements = true 
)
static

Makes one BipartitionList out of several.

The input BipartitionList objects must share the same set of elements. This will be checked or not depending on checkElements

Definition at line 166 of file BipartitionTools.cpp.

References bpp::BipartitionList::getBitBipartitionList(), bpp::VectorTools::haveSameElements(), LWORD, and bpp::BipartitionList::sortElements().

Referenced by bpp::TreeTools::bipartitionOccurrences().

◆ MRPEncode()

unique_ptr< VectorSiteContainer > BipartitionTools::MRPEncode ( const std::vector< std::unique_ptr< BipartitionList >> &  vecBipartL)
static

Create a sequence data set corresponding to the Matrix Representation of the input BipartitionList objects.

The input BipartitionList objects can have distinct sets of elements - missing data will be represented as 'N'. The output alignment (DNA sequences including only A, C and N)) is ready for maximum parsimony analysis according to the MRP supertree method.

Definition at line 227 of file BipartitionTools.cpp.

References bpp::VectorTools::contains(), bpp::AlphabetTools::DNA_ALPHABET, bpp::MapTools::getKeys(), and bpp::VectorTools::vectorUnion().

Referenced by bpp::TreeTools::MRPEncode().

◆ MRPEncodeMultilabel()

unique_ptr< VectorSiteContainer > BipartitionTools::MRPEncodeMultilabel ( const std::vector< std::unique_ptr< BipartitionList >> &  vecBipartL)
static

Create a sequence data set corresponding to the Matrix Representation of the input BipartitionList objects and accommodates multilabel trees.

The input BipartitionList objects can have distinct sets of elements - missing data will be represented as 'N'. The output alignment (DNA sequences including only A, C and N)) is ready for maximum parsimony analysis according to the MRP supertree method.

Definition at line 286 of file BipartitionTools.cpp.

References bpp::VectorTools::contains(), bpp::AlphabetTools::DNA_ALPHABET, element, bpp::MapTools::getKeys(), bpp::VectorTools::vectorIntersection(), and bpp::VectorTools::vectorUnion().

Referenced by bpp::TreeTools::MRPEncodeMultilabel().

◆ testBit()

Member Data Documentation

◆ LWORD

int BipartitionTools::LWORD = static_cast<int>(CHAR_BIT * sizeof(int))
static

Unit length (in bits) of arrays of bits. Must be a multiple of CHAR_BIT*sizeof(int). Default value is 64.

Definition at line 35 of file BipartitionTools.h.

Referenced by bpp::BipartitionList::addBipartition(), bpp::BipartitionList::BipartitionList(), bpp::BipartitionList::flip(), mergeBipartitionLists(), bpp::BipartitionList::operator=(), bpp::BipartitionList::sortElements(), and bpp::BipartitionList::toTree().


The documentation for this class was generated from the following files: