Sleipnir
Public Member Functions
Sleipnir::CSeekIntIntMap Class Reference

An integer to integer mapping structure that is used to detect the presence of genes in a dataset. More...

#include <seekmap.h>

Public Member Functions

 CSeekIntIntMap (const utype &)
 Constructor.
 CSeekIntIntMap (const vector< char > &, const bool=false)
 Constructor.
 CSeekIntIntMap (const char *, const utype &, const bool=false)
 Constructor.
 CSeekIntIntMap (CSeekIntIntMap *)
 Copy constructor.
void Initialize (const utype &)
 Helper function that is used by constructor.
 ~CSeekIntIntMap ()
 Destructor.
utype GetForward (const utype &) const
 Get an element from the forward array.
utype GetReverse (const utype &) const
 Get an element from the reverse array.
const vector< utype > & GetAllForward () const
 Get the entire forward array.
const vector< utype > & GetAllReverse () const
 Get the entire reverse array.
void Add (const utype &)
 Add an available gene to the map.
void Clear ()
 Clear the member arrays in the structure.
void Reset (const vector< char > &, const bool=false)
 Reset function.
void Reset (const char *, const bool=false)
 Reset function.
utype GetNumSet () const
 Get the number of present genes that are currently contained in the map.
utype GetSize () const
 Get the genome size.

Detailed Description

An integer to integer mapping structure that is used to detect the presence of genes in a dataset.

This map is used to conveniently get a set of available genes in a dataset, and to quickly check if a given gene is present in the dataset. Normally, a user needs to create two separate arrays for this purpose:

The solution is to use this int-int mapping structure.

CSeekIntIntMap encapsulates the two arrays that we want: forward and reverse.

As an example, let us consider a simple scenario where we have a genome of 5 genes {0, 1, 2, 3, 4}. We want to use CSeekIntIntMap to capture the gene-presence for a dataset d which contains the following genes: {1, 3, 4}. Then the two arrays would be:

These arrays are automatically updated as genes are added to the map.

Definition at line 64 of file seekmap.h.


Constructor & Destructor Documentation

Sleipnir::CSeekIntIntMap::CSeekIntIntMap ( const utype &  iSize)

Constructor.

Parameters:
iSizeThe number of genes in the gene-database

Definition at line 35 of file seekmap.cpp.

References Initialize().

Sleipnir::CSeekIntIntMap::CSeekIntIntMap ( const vector< char > &  cP,
const bool  bReverse = false 
)

Constructor.

Parameters:
cPThe gene presence vector (char type)
bReverseWhen creating the map, whether or not to follow the reverse logic. (eg 1 means absent, 0 means present)
Remarks:
If bReverse is true, then this map captures only the absent genes in the dataset. By default, bReverse is false.

Definition at line 47 of file seekmap.cpp.

References Initialize(), and Reset().

Sleipnir::CSeekIntIntMap::CSeekIntIntMap ( const char *  cP,
const utype &  iSize,
const bool  bReverse = false 
)

Constructor.

Parameters:
cPThe gene presence array (char* type)
iSizeThe size of the gene-presence array
bReverseWhen creating the map, whether or not to follow the reverse logic. (eg 1 means absent, 0 means present)
Remarks:
If bReverse is true, then this map captures only the absent genes in the dataset. By default, bReverse is false.

Definition at line 53 of file seekmap.cpp.

References Initialize(), and Reset().

Copy constructor.

Parameters:
aA map instance

Definition at line 59 of file seekmap.cpp.


Member Function Documentation

void Sleipnir::CSeekIntIntMap::Add ( const utype &  i)

Add an available gene to the map.

Parameters:
iThe gene ID to be added
Remarks:
The gene ID is a number between 0 and 21000 (the genome size). It is specified by the gene ID mapping file gene_map.txt.

Definition at line 84 of file seekmap.cpp.

Referenced by Sleipnir::CSeekDataset::InitializeGeneMap(), Sleipnir::CSeekDataset::InitializeQuery(), Sleipnir::CSeekDataset::InitializeQueryBlock(), and Reset().

Clear the member arrays in the structure.

This is used by the destructor.

Definition at line 91 of file seekmap.cpp.

Referenced by Initialize().

const vector< utype > & Sleipnir::CSeekIntIntMap::GetAllForward ( ) const

Get the entire forward array.

Returns:
The forward array

Definition at line 39 of file seekmap.cpp.

const vector< utype > & Sleipnir::CSeekIntIntMap::GetAllReverse ( ) const

Get the entire reverse array.

Returns:
The reverse array

Definition at line 43 of file seekmap.cpp.

Referenced by Sleipnir::CSeekDataset::InitializeDataMatrix().

utype Sleipnir::CSeekIntIntMap::GetForward ( const utype &  i) const

Get the number of present genes that are currently contained in the map.

Returns:
The number of genes that are present

Definition at line 102 of file seekmap.cpp.

Referenced by Sleipnir::CSeekCentral::GetMaxGenomeCoverage(), Sleipnir::CSeekDataset::InitializeDataMatrix(), Sleipnir::CSeekDataset::InitializeQueryBlock(), and Sleipnir::CSeekPerformanceMeasure::SortRankVector().

utype Sleipnir::CSeekIntIntMap::GetReverse ( const utype &  i) const

Get an element from the reverse array.

Parameters:
iElement index
Returns:
The item at the index

Definition at line 80 of file seekmap.cpp.

Referenced by Sleipnir::CSeekDataset::InitializeDataMatrix().

Get the genome size.

Returns:
The genome size

Definition at line 106 of file seekmap.cpp.

void Sleipnir::CSeekIntIntMap::Initialize ( const utype &  iSize)

Helper function that is used by constructor.

Parameters:
iSizeThe genome size

Definition at line 29 of file seekmap.cpp.

References Clear().

Referenced by CSeekIntIntMap().


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