SubcloneSeeker  1.0.0
Subclone deconvolution software framework
 All Classes Files Functions Variables Macros Pages
treemerge_p.cc File Reference
#include "treemerge_p.h"
#include <assert.h>
#include <cmath>
#include <algorithm>
#include <iostream>
#include "SomaticEvent.h"
#include "SegmentalMutation.h"
#include "EventCluster.h"
#include "Subclone.h"

Classes

class  TreeMergeTraverseSecondary
 Traverse the secondary tree, and try to place every node it encounters onto the primary tree, which was given as a constructor parameter. More...
 

Macros

#define MIN_CLONE_FRAC   0.05
 
#define OUTPUT_SEV(sev)
 

Functions

SomaticEventPtr_vec nodeEventsList (Subclone *node)
 
SomaticEventPtr_vec SomaticEventDifference (const SomaticEventPtr_vec &master, const SomaticEventPtr_vec &unwanted)
 
bool eventSetContains (const SomaticEventPtr_vec &v_container, const SomaticEventPtr_vec &v_containee)
 
bool resultSetComparator (const SomaticEventPtr_vec &v1, const SomaticEventPtr_vec &v2)
 
SomaticEventPtr_vec checkPlacement (Subclone *pnode, SomaticEventPtr_vec somaticEvents, bool *placeableOnSubtree, int *cp)
 
bool TreeMerge (Subclone *p, Subclone *q)
 

Detailed Description

The implementation file for the implementation part of 'treemerge'

Author
Yi Qiao

Macro Definition Documentation

#define MIN_CLONE_FRAC   0.05

The minimal fraction a subclone has to have to be considered in the merging process

#define OUTPUT_SEV (   sev)
Value:
for(size_t output_sev_i=0; output_sev_i<(sev).size(); output_sev_i++) { \
std::cout<<dynamic_cast<CNV*>((sev)[output_sev_i])->range.chrom<<", "; \
} \
std::cout<<std::endl;

Print a SomaticEventPtr_vec that contains CNVs, for debugging propose

Function Documentation

SomaticEventPtr_vec checkPlacement ( Subclone pnode,
SomaticEventPtr_vec  somaticEvents,
bool *  placeableOnSubtree,
int *  cp = NULL 
)

Check if a node with certain somatic events can be placed on a subtree of a different subclonal structure.

Parameters
pnodeThe root of a subtree of the subclonal structure, to which the new node is being placed on.
somaticEventsThe somatic events found in the new node, containing all its parents' ones.
placeableOnSubtreeAn output boolean variable indicating whether the placement is successful or not.
cpThe number of children nodes that are able to contain the floating node. Used for debugging purpose.
Returns
A vector containing events not found on the subtree to the point the node is placed.
bool eventSetContains ( const SomaticEventPtr_vec &  v_container,
const SomaticEventPtr_vec &  v_containee 
)

Check if a somatic event vector contains all the events found in another vector.

Parameters
v_containerThe container vector
v_containeeThe containee vector
Returns
True if the container vector contains all the events found in the containee vector, false otherwise
SomaticEventPtr_vec nodeEventsList ( Subclone node)

Generate a list of events from a given subclone node. In the subclone data structure, events of a parent is not duplicated in the children nodes. This function will, from a given subclone node, trace back to the root of the tree, and returning all the events it encounters.

Parameters
nodeThe subclone node to generate event list from.
Returns
A vector of all the events explicitly or implicitly contained by the given node.
bool resultSetComparator ( const SomaticEventPtr_vec &  v1,
const SomaticEventPtr_vec &  v2 
)

Compare SomaticEvent vectors by size.

Parameters
v1The first SomaticEventPtr vector
v2The second SomaticEventPtr vector
Returns
True if v1 has less events than v2, false otherwise
SomaticEventPtr_vec SomaticEventDifference ( const SomaticEventPtr_vec &  master,
const SomaticEventPtr_vec &  unwanted 
)

Calculate the difference between two vectors of somatic events

Parameters
masterThe somatic event vector that contains the wanted events
unwantedThe somatic event vector that contains the unwanted events
Returns
A somatic event vector that contains all the events in 'master' that are not found in 'unwanted'
bool TreeMerge ( Subclone p,
Subclone q 
)

Check if two subclonal trees are compatible.

Parameters
pThe first subclone tree
qThe second subclone tree
Returns
True if the two trees are compatible, false otherwise