Traces and returns all ancestral cell indices for a given cell by recursively following the parent relationships in the cell lineage information.

get_sc_ancestors(cell_info, cell_index)

Arguments

cell_info

Data frame containing cell lineage information with columns: cell_index, parent, and other attributes

cell_index

Integer specifying the cell index for which to find ancestors

Value

A numeric vector containing the cell indices of all ancestors of the specified cell, ordered from immediate parent to earliest ancestor

Details

This function traverses the cell lineage tree upward from the specified cell, following the parent relationships until it reaches a cell with no parent (NA in the parent column). It builds and returns a vector of all ancestor cell indices encountered during this traversal.

The function is commonly used to reconstruct the complete lineage history of a cell, which is particularly useful for aggregating mutations or other heritable properties that are passed down through cell divisions.