Sleipnir
Public Member Functions
Sleipnir::CDatFilter Class Reference

Augments a CDat with a dynamically calculated gene set filter. More...

#include <datapair.h>

Inheritance diagram for Sleipnir::CDatFilter:
Sleipnir::CDatFilterImpl

Public Member Functions

bool Attach (const CDataPair &Dat, const CGenes &Genes, CDat::EFilter eFilter, const CDat *pAnswers=NULL)
 Associates the data filter with the given CDat, gene set, and filter type.
bool Attach (const CDatFilter &Dat, const CGenes &Genes, CDat::EFilter eFilter, const CDat *pAnswers=NULL)
 Associates (overlays0 the data filter with the given pre-existing filter, gene set, and filter type.
bool Attach (const CDataPair &Dat)
 Associates the data filter with the given CDat.
size_t GetValues () const
 Returns the number of values taken by the underlying CDataPair.
size_t GetGene (const std::string &strGene) const
 Returns the index of the requested gene name, or -1 if it does not exist.
std::string GetGene (size_t iGene) const
 Returns the gene name at the requested index.
size_t Quantize (float dValue) const
 Discretizes the given value using the quantization bins of the underlying CDataPair.
size_t Quantize (size_t iY, size_t iX, size_t iZero) const
float & Get (size_t iY, size_t iX) const
 Returns the (potentially filtered) value at the requested indices.

Detailed Description

Augments a CDat with a dynamically calculated gene set filter.

A filter wraps an underlying CDat with a dynamically calculated filter using a gene set and CDat::EFilter type. A filtered gene pair will act like missing data; unfiltered gene pairs will be retrieved from the underlying CDat. This allows data to be temporarily hidden without modifying the underlying (potentially memory mapped) CDat.

Remarks:
Permanent modifications such as CDat::Set should be performed only on the underlying dataset. Yes, an interface would make this a lot cleaner, but it also makes it a lot slower (losing the ability to inline calls to Get actually has a non-trivial impact on runtime).
See also:
CDat::FilterGenes | CDataFilter

Definition at line 235 of file datapair.h.


Member Function Documentation

bool Sleipnir::CDatFilter::Attach ( const CDataPair Dat,
const CGenes Genes,
CDat::EFilter  eFilter,
const CDat pAnswers = NULL 
)

Associates the data filter with the given CDat, gene set, and filter type.

Parameters:
DatCDat to be associated with the overlaying mask.
GenesGene set used to filter the data.
eFilterWay in which to use the given genes to remove gene pairs.
pAnswersIf non-null, answer set to be used for filter types requiring answers (e.g. CDat::EFilterTerm).
Returns:
True if filter was attached successfully.
Remarks:
No calculation occurs during Attach; the gene set and filter type are stored, and calculations are performed dynamically in IsExample. The gene set is not copied, so the given object should not be destroyed until after the filter. If a filter types requiring an answer file is given without an accompanying answer file, the filter won't crash, but results might be a little odd.

Definition at line 582 of file datapair.cpp.

Referenced by Attach().

bool Sleipnir::CDatFilter::Attach ( const CDatFilter Dat,
const CGenes Genes,
CDat::EFilter  eFilter,
const CDat pAnswers = NULL 
)

Associates (overlays0 the data filter with the given pre-existing filter, gene set, and filter type.

Parameters:
DatFilter with which this mask will associate (and overlay).
GenesGene set used to filter the data.
eFilterWay in which to use the given genes to remove gene pairs.
pAnswersIf non-null, answer set to be used for filter types requiring answers (e.g. CDat::EFilterTerm).
Returns:
True if filter was attached successfully.
Remarks:
This is a slightly ugly way to allow additive filters without requiring a virtual interface. The CDat class is so fundamental, and CDat::Get calls occur so frequently, that a virtual function call can actually have a noticeable impact on performance.

Definition at line 611 of file datapair.cpp.

References Attach().

bool Sleipnir::CDatFilter::Attach ( const CDataPair Dat) [inline]

Associates the data filter with the given CDat.

Parameters:
DatCDat to be associated with the overlaying mask.
Returns:
True if filter was attached successfully.
Remarks:
This creates an empty, pass-through mask, which can be useful when stacking multiple overlayed filters.

Definition at line 256 of file datapair.h.

References Attach(), and Sleipnir::CDat::EFilterInclude.

float& Sleipnir::CDatFilter::Get ( size_t  iY,
size_t  iX 
) const [inline]

Returns the (potentially filtered) value at the requested indices.

Parameters:
iYRow of value to retrieve.
iXColumn of value to retrieve.
Returns:
Value at the requested location, or NaN if it does not exist or has been filtered.
See also:
CDataPair::Get

Definition at line 355 of file datapair.h.

References Sleipnir::CDat::EFilterEdge, Sleipnir::CDat::EFilterExclude, Sleipnir::CDat::EFilterInclude, Sleipnir::CDat::EFilterTerm, Sleipnir::CDat::Get(), Get(), Sleipnir::CMeta::GetNaN(), and Sleipnir::CMeta::IsNaN().

Referenced by Get().

size_t Sleipnir::CDatFilter::GetGene ( const std::string &  strGene) const [inline]

Returns the index of the requested gene name, or -1 if it does not exist.

Parameters:
strGeneGene name whose index is returned.
Returns:
Index of the requested gene name, or -1 if it does not exist.
See also:
CDataPair::GetGene

Definition at line 287 of file datapair.h.

References GetGene(), and Sleipnir::CDat::GetGene().

Referenced by GetGene().

std::string Sleipnir::CDatFilter::GetGene ( size_t  iGene) const [inline]

Returns the gene name at the requested index.

Parameters:
iGeneIndex of gene name to be returned.
Returns:
Gene name at requested index.
See also:
CDataPair::GetGene

Reimplemented from Sleipnir::CDatFilterImpl.

Definition at line 304 of file datapair.h.

References GetGene().

size_t Sleipnir::CDatFilter::GetValues ( ) const [inline]

Returns the number of values taken by the underlying CDataPair.

Returns:
Number of different values taken by the underlying CDataPair.
See also:
CDataPair::GetValues

Definition at line 270 of file datapair.h.

References Sleipnir::CDataPair::GetValues(), and GetValues().

Referenced by GetValues().

size_t Sleipnir::CDatFilter::Quantize ( float  dValue) const [inline]

Discretizes the given value using the quantization bins of the underlying CDataPair.

Parameters:
dValueContinuous value to be discretized.
Returns:
Bin number of the given value using the underlying CDataPair quantization.
See also:
CDataPair::Quantize

Definition at line 321 of file datapair.h.

References Sleipnir::CDataPair::Quantize(), and Quantize().

Referenced by Quantize().


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