Skip to contents

Filters gradient flow cells to retain only those with at least a specified number of vertices. This is useful for focusing analysis on cells with sufficient statistical power or biological significance.

Usage

filter.cells.by.vertex.count(flow.cells, min.vertices = 50, verbose = FALSE)

Arguments

flow.cells

A gradient flow cells object returned by extract.gradient.flow.cells()

min.vertices

Minimum number of vertices required for a cell to be retained

verbose

If TRUE, print filtering summary

Value

A filtered gradient flow cells object with the same structure as the input, containing only cells meeting the vertex count threshold. The object retains: - basin.label: Basin identifier - max.vertex: Reference extremum vertex - basin.size: Original basin size (unchanged) - cells: List of filtered cells - n.cells: Number of cells after filtering - assigned.vertices: Set of vertices in retained cells - n.assigned: Count of assigned vertices after filtering - diagnostics: Updated diagnostic information

Details

The function preserves all trajectory information for retained cells and recalculates coverage statistics based on the filtered cell set. Cells are removed if they contain fewer than min.vertices unique vertices.

Examples

if (FALSE) { # \dontrun{
## Extract cells from a basin
flow.cells <- extract.gradient.flow.cells(basins.obj, max.basin.label = "M1")

## Keep only cells with at least 50 vertices
large.cells <- filter.cells.by.vertex.count(flow.cells, min.vertices = 50)

## Keep only cells with at least 100 vertices, with verbose output
very.large.cells <- filter.cells.by.vertex.count(
  flow.cells,
  min.vertices = 100,
  verbose = TRUE
)
} # }