% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/random_strata_cells.R
\name{random_strata_cells}
\alias{random_strata_cells}
\title{Stratified Random Sampling of Cells}
\usage{
random_strata_cells(
  input,
  group,
  proportion = 0.1,
  minimum_count_include = 300,
  minimum_count = 200,
  maximum_count = 1000,
  sub_cluster = NULL,
  cell_type = NULL
)
}
\arguments{
\item{input}{A data frame or Seurat object containing cell annotations.}

\item{group}{Character string specifying the column name for cell type
grouping.}

\item{proportion}{Numeric value between 0 and 1 specifying the sampling
proportion. Default is 0.1.}

\item{minimum_count_include}{Integer specifying the minimum count threshold
for a cell type to be included in sampling. Default is 300.}

\item{minimum_count}{Integer specifying the minimum number of cells to
sample per cell type. Default is 200.}

\item{maximum_count}{Integer specifying the maximum number of cells to
sample per cell type. Default is 1000.}

\item{sub_cluster}{Optional character string specifying a sub-cluster
column for filtering. Default is NULL.}

\item{cell_type}{Optional character string specifying the cell type value
to filter when `sub_cluster` is provided. Default is NULL.}
}
\value{
A data frame containing the sampled cells with preserved cell type
  proportions.
}
\description{
Performs stratified random sampling of cells from single-cell data,
ensuring proportional representation of each cell type while respecting
minimum and maximum count constraints.
}
\examples{
# Create simulated cell annotation data
set.seed(123)
sim_cells <- data.frame(
  cell_id = paste0("Cell", 1:500),
  cell_type = sample(c("T_cell", "B_cell", "NK_cell", "Macrophage"), 500, replace = TRUE)
)
# Sample cells with stratified random sampling
sampled <- random_strata_cells(
  input = sim_cells,
  group = "cell_type",
  proportion = 0.2,
  minimum_count_include = 50,
  minimum_count = 20,
  maximum_count = 100
)
if (!is.null(sampled)) head(sampled)
}
