SubcloneSeeker  1.0.0
Subclone deconvolution software framework
 All Classes Files Functions Variables Macros Pages
SubcloneSeeker::EventCluster Class Reference

A collection class that each instance groups many SomaticEvents which share the same cell frequency. More...

#include <EventCluster.h>

Inheritance diagram for SubcloneSeeker::EventCluster:
SubcloneSeeker::Archivable

Public Member Functions

 EventCluster ()
 
std::vector< SomaticEvent * > members () const
 
double cellFraction () const
 
void setCellFraction (double fraction)
 
void addEvent (SomaticEvent *event, bool updateFraction=true)
 
bool operator< (const EventCluster &another) const
 
bool operator> (const EventCluster &another) const
 
void setSubcloneID (sqlite3_int64 cloneID)
 
sqlite3_int64 subcloneID ()
 
DBObjectID_vec allObjectsOfSubclone (sqlite3 *database, sqlite3_int64 subcloneID)
 
- Public Member Functions inherited from SubcloneSeeker::Archivable
 Archivable ()
 
sqlite3_int64 getId ()
 
void setId (sqlite3_int64 nid)
 
bool createTableInDB (sqlite3 *database)
 
sqlite3_int64 archiveObjectToDB (sqlite3 *database)
 
bool unarchiveObjectFromDB (sqlite3 *database, sqlite3_int64 id)
 
DBObjectID_vec vecAllObjectsID (sqlite3 *database)
 

Static Public Member Functions

static std::vector
< EventCluster * > 
clustering (const std::vector< SomaticEvent * > &events, double threshold)
 

Protected Member Functions

virtual std::string getTableName ()
 
virtual std::string createTableStatementStr ()
 
virtual std::string createObjectStatementStr ()
 
virtual std::string updateObjectStatementStr ()
 
virtual std::string selectObjectColumnListStr ()
 
virtual int bindObjectToStatement (sqlite3_stmt *statement)
 
virtual void updateObjectFromStatement (sqlite3_stmt *statement)
 

Protected Attributes

std::vector< SomaticEvent * > _members
 
double _cellFraction
 
sqlite3_int64 ofSubcloneID
 
- Protected Attributes inherited from SubcloneSeeker::Archivable
sqlite3_int64 id
 

Detailed Description

A collection class that each instance groups many SomaticEvents which share the same cell frequency.

Clustering is a process to group somatic events with (likely) the same into a single entity, based on the simplifying (but likely to be true) assumption that events with the same cell frequency are likely to co-exist in the same subclone

See also
SomaticEvent

Constructor & Destructor Documentation

SubcloneSeeker::EventCluster::EventCluster ( )
inline

Minimal constructor that resets all member variables

Member Function Documentation

void EventCluster::addEvent ( SomaticEvent event,
bool  updateFraction = true 
)

Add an SomaticEvent object into the member list and update cell fraction

Parameters
eventThe event to be added as a member
updateFractionShould the method automatically update the cell fraction of the cluster
DBObjectID_vec EventCluster::allObjectsOfSubclone ( sqlite3 *  database,
sqlite3_int64  subcloneID 
)

Retrieve a vector of cluster IDs whose parent subclone is the given id

Parameters
databaseA live database connection
subcloneIDThe subclone id who contains the clusters
Returns
a vector of cluster ids contained by the given subclone id
int EventCluster::bindObjectToStatement ( sqlite3_stmt *  statement)
protectedvirtual

Bind archivable properties to a prepared, unbound sqlite3 statement

Parameters
statementA prepared, unbound sqlite3 statement instance
Returns
How many parameters are bound to the statement + 1

Implements SubcloneSeeker::Archivable.

double SubcloneSeeker::EventCluster::cellFraction ( ) const
inline

Retrieve the cell fraction

Returns
cell fraction centroid calculated from all members
std::vector< EventCluster * > EventCluster::clustering ( const std::vector< SomaticEvent * > &  events,
double  threshold 
)
static

SomaticEvent Clustering Algorithm

Parameters
eventsA vector of SomaticEvent to be clustered
thresholdThe difference threshold to use when doing the clustering
Returns
A vector of EventCluster containing the resulting clusters
std::string EventCluster::createObjectStatementStr ( )
protectedvirtual

return the unbound statement for record creation

Returns
unbound statement for record creation

Implements SubcloneSeeker::Archivable.

std::string EventCluster::createTableStatementStr ( )
protectedvirtual

return the table definition when creating the table in a sqlite3 database

Imagine a generic SQL create statement: CREATE TABLE <tableName> (id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT <other-columns>); Notice that the returned string must be prefixed with a comma ",", to separate any custom columns from the id column

Returns
The extra column definitions, prefixed with ","

Implements SubcloneSeeker::Archivable.

std::string EventCluster::getTableName ( )
protectedvirtual

returns the name of the table in which all object of a specific class are stored

Returns
Table name

Implements SubcloneSeeker::Archivable.

std::vector<SomaticEvent *> SubcloneSeeker::EventCluster::members ( ) const
inline

Retrieve the member vector reference

Returns
a reference to the members vector
bool SubcloneSeeker::EventCluster::operator< ( const EventCluster another) const
inline

Override the < operator for sorting purpose

Parameters
anotherthe other EventCluster to compare to
Returns
true if this object has a smaller cell frequency than the other object, false if otherwise
bool SubcloneSeeker::EventCluster::operator> ( const EventCluster another) const
inline

Override the > operator for sorting purpose

Parameters
anotherthe other EventCluster to compare to
Returns
true if this object has a greater cell frequency than the other object, false if otherwise
std::string EventCluster::selectObjectColumnListStr ( )
protectedvirtual

return the list of columns to be used in select statement for getting data from the database

Imagine the generic SQL select statement: SELECT <col1>, <col2>, ... FROM <tableName> WHERE id=?; The method should return the <col1>,<col2>,... part

Returns
the list of columns as string

Implements SubcloneSeeker::Archivable.

void SubcloneSeeker::EventCluster::setCellFraction ( double  fraction)
inline

Set a new cell fraction

Parameters
fractionthe new cell fraction
void SubcloneSeeker::EventCluster::setSubcloneID ( sqlite3_int64  cloneID)
inline

Set the subclone ID this cluster belongs to

Parameters
cloneIDthe database id of the subclone this cluster belongs to
sqlite3_int64 SubcloneSeeker::EventCluster::subcloneID ( )
inline

Retrieve the subclone ID

Returns
the subclone id this cluster belongs to
void EventCluster::updateObjectFromStatement ( sqlite3_stmt *  statement)
protectedvirtual

Populate archivable properties from a prepared statement during unarchiving

Parameters
statementA prepared statement contains the retrieved row

Implements SubcloneSeeker::Archivable.

std::string EventCluster::updateObjectStatementStr ( )
protectedvirtual

return the unbound statement for record update

Returns
unbound statement for record update

Implements SubcloneSeeker::Archivable.

Member Data Documentation

double SubcloneSeeker::EventCluster::_cellFraction
protected

the cell fraction all members share

std::vector<SomaticEvent *> SubcloneSeeker::EventCluster::_members
protected

the vector that holds all the cluster's members

sqlite3_int64 SubcloneSeeker::EventCluster::ofSubcloneID
protected

to which subclone does this cluster belongs


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