Sleipnir
|
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. |
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.
Sleipnir::CSeekIntIntMap::CSeekIntIntMap | ( | const utype & | iSize | ) |
Constructor.
iSize | The 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.
cP | The gene presence vector (char type) |
bReverse | When creating the map, whether or not to follow the reverse logic. (eg 1 means absent, 0 means present) |
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.
cP | The gene presence array (char* type) |
iSize | The size of the gene-presence array |
bReverse | When creating the map, whether or not to follow the reverse logic. (eg 1 means absent, 0 means present) |
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().
void Sleipnir::CSeekIntIntMap::Add | ( | const utype & | i | ) |
Add an available gene to the map.
i | The gene ID to be added |
gene_map.txt
. Definition at line 84 of file seekmap.cpp.
Referenced by Sleipnir::CSeekDataset::InitializeGeneMap(), Sleipnir::CSeekDataset::InitializeQuery(), Sleipnir::CSeekDataset::InitializeQueryBlock(), and Reset().
void Sleipnir::CSeekIntIntMap::Clear | ( | ) |
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 |
const vector< utype > & Sleipnir::CSeekIntIntMap::GetAllReverse | ( | ) | const |
Get the entire reverse array.
Definition at line 43 of file seekmap.cpp.
Referenced by Sleipnir::CSeekDataset::InitializeDataMatrix().
utype Sleipnir::CSeekIntIntMap::GetForward | ( | const utype & | i | ) | const |
Get an element from the forward array.
i | Element index |
Definition at line 76 of file seekmap.cpp.
Referenced by Sleipnir::CSeekWeighter::CVWeighting(), Sleipnir::CSeekDataset::InitializeQuery(), Sleipnir::CSeekDataset::InitializeQueryBlock(), Sleipnir::CSeekWeighter::LinearCombine(), Sleipnir::CSeekWeighter::OneGeneWeighting(), and Sleipnir::CSeekTools::ReadDatabaselets().
utype Sleipnir::CSeekIntIntMap::GetNumSet | ( | ) | const |
Get the number of present genes that are currently contained in the map.
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.
i | Element index |
Definition at line 80 of file seekmap.cpp.
Referenced by Sleipnir::CSeekDataset::InitializeDataMatrix().
utype Sleipnir::CSeekIntIntMap::GetSize | ( | ) | const |
void Sleipnir::CSeekIntIntMap::Initialize | ( | const utype & | iSize | ) |
Helper function that is used by constructor.
iSize | The genome size |
Definition at line 29 of file seekmap.cpp.
References Clear().
Referenced by CSeekIntIntMap().