Sleipnir
|
Representation of a query gene-set that is used by Seek. More...
#include <seekquery.h>
Public Types | |
enum | PartitionMode { LEAVE_ONE_IN = 0, LEAVE_ONE_OUT = LEAVE_ONE_IN + 1, CUSTOM_PARTITION = LEAVE_ONE_OUT + 1 } |
Query partitioning mode. More... | |
Public Member Functions | |
CSeekQuery () | |
Constructor. | |
~CSeekQuery () | |
Destructor. | |
bool | Reset () |
The reset function. | |
bool | InitializeQuery (const vector< char > &) |
Initialize with a 0-1 query presence vector. | |
bool | InitializeQuery (const vector< utype > &, const utype &) |
Initialize with a vector of query genes' ID. | |
utype | GetNumFold () const |
Get the number of query partitions. | |
const vector< utype > & | GetQuery () const |
Get the query genes as a vector. | |
const vector< char > & | GetQueryPresence () const |
Get the query presence as a char vector. | |
const vector< utype > & | GetCVQuery (utype &) const |
Get the i-th query partition. | |
bool | CreateCVPartitions (const gsl_rng *, const enum PartitionMode &, const utype=-1) |
Create N random query partitions. |
Representation of a query gene-set that is used by Seek.
Includes vectors for storing the query genes, and utilities for partitioning query genes into specified number of groups
There are two ways to represent a query.
char
vector, with number of elements = size of genome. All elements are 0 except the elements indexed by the query genes, which have a value of 1.utype
vector, with number of elements = size of query. A compact representation which only stores the query genes' ID. Definition at line 45 of file seekquery.h.
Query partitioning mode.
Let us consider a query of size N.
LEAVE_ONE_IN
: create N partitions, where each partition is one of the query genes
LEAVE_ONE_OUT
: create N partitions, where each partition is everything excluding one of the query genes
CUSTOM_PARTITION
: create X equally sized partitions, where each partition is N / X number of genes. X is a user-given parameter.
Definition at line 65 of file seekquery.h.
bool Sleipnir::CSeekQuery::CreateCVPartitions | ( | const gsl_rng * | , |
const enum PartitionMode & | , | ||
const utype | = -1 |
||
) |
Create N
random query partitions.
rnd | A random number generator |
p | The partitioning mode |
iFold | The number of partitions to be created |
iFold
is not used if the partitioning mode is LEAVE_ONE_IN
or LEAVE_ONE_OUT
, because the number of partitions in this case is the size of the query. Definition at line 93 of file seekquery.cpp.
References Sleipnir::CSeekTools::IsNaN().
const vector< utype > & Sleipnir::CSeekQuery::GetCVQuery | ( | utype & | i | ) | const |
Get the i-th
query partition.
i | The index of partition to return |
i-th
partition i
. Definition at line 89 of file seekquery.cpp.
Referenced by Sleipnir::CSeekWeighter::CVWeighting(), and Sleipnir::CSeekWeighter::OneGeneWeighting().
utype Sleipnir::CSeekQuery::GetNumFold | ( | ) | const |
Get the number of query partitions.
Definition at line 77 of file seekquery.cpp.
Referenced by Sleipnir::CSeekWeighter::CVWeighting().
const vector< utype > & Sleipnir::CSeekQuery::GetQuery | ( | ) | const |
Get the query genes as a vector.
utype
vector Definition at line 85 of file seekquery.cpp.
Referenced by Sleipnir::CSeekWeighter::CVWeighting(), Sleipnir::CSeekWeighter::OneGeneWeighting(), and Sleipnir::CSeekCentral::VarianceWeightSearch().
const vector< char > & Sleipnir::CSeekQuery::GetQueryPresence | ( | ) | const |
Get the query presence as a char
vector.
char
vector Definition at line 81 of file seekquery.cpp.
bool Sleipnir::CSeekQuery::InitializeQuery | ( | const vector< char > & | query | ) |
Initialize with a 0-1 query presence vector.
query | A char vector (0 or 1) that specifies the location of the query genes, |
query:
based on the gene_map.txt
, all genes are mapped to integers between 0 to 21000 (or whatever the upper limit is). In the char
vector query
, query
[q] = 1 for q
in Q
. All other genes: query
[g] = 0. Definition at line 50 of file seekquery.cpp.
References Reset().
bool Sleipnir::CSeekQuery::InitializeQuery | ( | const vector< utype > & | query, |
const utype & | iGenes | ||
) |
Initialize with a vector of query genes' ID.
query | A utype-vector that stores the query genes' ID |
iGenes | The number of genes in the genome |
query
parameter is <201, 242, 42>, and iGenes
is 21000 (if there are 21000 genes). Definition at line 63 of file seekquery.cpp.
References Reset().