Recursively Add Child Nodes in a Gating Tree
Source:R/createGatingTreeObject.r
recursiveAddChildNode.Rd
This function recursively expands a gating tree by adding child nodes according to gating rules. It is designed to iteratively apply gating decisions down to a specified depth or until no further subdivisions are applicable (terminal nodes).
Usage
recursiveAddChildNode(
currentNode,
root_data,
sampledef,
neg_gate,
expr_group,
ctrl_group,
total_cell_per_file,
maxDepth = 3,
usedmarkers,
min_cell_num = 25,
depth = 1
)
Arguments
- currentNode
The current node in the gating tree from which children will be generated.
- root_data
A data frame containing the data set used for gating decisions.
- sampledef
A data frame specifying sample definitions and group assignments.
- neg_gate
A list containing thresholds for negative gating decisions.
- expr_group
The name of the experimental group within `sampledef`.
- ctrl_group
The name of the control group within `sampledef`.
- total_cell_per_file
A data frame mapping file names to total cell counts, used for normalization.
- maxDepth
The maximum depth to which the tree can expand.
- usedmarkers
A vector of markers already used in the gating path up to the current node.
- min_cell_num
The minimal number of cells allowed in nodes.
- depth
Integer, the depth of the node in the tree.
Value
The modified current node with potentially new child nodes added, reflecting the gating tree expansion.
Details
The function checks if the current node is terminated or if its depth equals the maximum allowed depth. If not, it applies gating rules to decide how to expand the tree by adding child nodes. These decisions are based on statistical measures such as enrichment and entropy, calculated for different marker states. If a child node results in a terminal condition ('Leaf'), the tree expansion stops at that node.
The function uses recursion to navigate and expand deeper levels of the tree, ensuring that all potential gating paths are explored up to the `maxDepth` or until no further divisions are valid.
See also
Other GatingTree:
GatingTreeToDF()
,
PlotDeltaEnrichment()
,
PlotDeltaEnrichmentPrunedTree()
,
PruneGatingTree()
,
addChildNode()
,
add_prune()
,
apply_gating_conditions()
,
baseline_entropy()
,
calculate_enrichment()
,
calculate_entropy()
,
collect_all_enrichment()
,
collect_all_entropy()
,
collect_history()
,
collect_leaf_enrichment()
,
collect_markers()
,
convertToDataTree()
,
convert_to_diagrammer()
,
count_nodes()
,
createChildNode()
,
createGatingTreeObject()
,
findNodeByPath()
,
find_and_update_nodes()
,
gating_entropy()
,
general_node_rule()
,
generate_marker_names()
,
getNode()
,
prune_tree()