% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/population-size-estimate.R
\name{HSC_population_size_estimate}
\alias{HSC_population_size_estimate}
\title{Hematopoietic stem cells population size estimate.}
\usage{
HSC_population_size_estimate(
  x,
  metadata,
  stable_timepoints = NULL,
  aggregation_key = c("SubjectID", "CellMarker", "Tissue", "TimePoint"),
  blood_lineages = blood_lineages_default(),
  timepoint_column = "TimePoint",
  seqCount_column = "seqCount_sum",
  seqCount_threshold = 3,
  nIS_threshold = 5,
  cell_type = "MYELOID",
  tissue_type = "PB"
)
}
\arguments{
\item{x}{An aggregated integration matrix. See details.}

\item{metadata}{An aggregated association file. See details.}

\item{stable_timepoints}{A numeric vector or NULL if there are no
stable time points.}

\item{aggregation_key}{A character vector indicating the key used for
aggregating x and metadata. Note that x and metadata should always be
aggregated with the same key.}

\item{blood_lineages}{A data frame containing information on the blood
lineages. Users can supply their own, provided the columns \code{CellMarker} and
\code{CellType} are present.}

\item{timepoint_column}{What is the name of the time point column to use?
Note that this column must be present in the key.}

\item{seqCount_column}{What is the name of the column in x holding the
values of sequence count quantification?}

\item{seqCount_threshold}{A single numeric value. After re-aggregating \code{x},
rows with a value greater or equal will be kept, the others will be
discarded.}

\item{nIS_threshold}{A single numeric value. If a group (row) in the
metadata data frame has a count of distinct integration sites strictly
greater than this number it will be kept, otherwise discarded.}

\item{cell_type}{The cell types to include in the models. Note that
the matching is case-insensitive.}

\item{tissue_type}{The tissue types to include in the models. Note that
the matching is case-insensitive.}
}
\value{
A data frame with the results of the estimates
}
\description{
\lifecycle{experimental}
Hematopoietic stem cells population size estimate with capture-recapture
models.
}
\section{Input formats}{
Both \code{x} and \code{metadata} should be supplied to the function in aggregated
format (ideally through the use of \code{\link{aggregate_metadata}}
and \code{\link{aggregate_values_by_key}}).
Note that the \code{aggregation_key}, aka the vector of column names used for
aggregation, must contain at least the columns SubjectID, CellMarker,
Tissue and a time point column (the user can specify the name of the
column in the argument \code{timepoint_column}).
}

\section{On time points}{
If \code{stable_timepoints} is a vector with length > 1, the function will look
for the first available stable time point and slice the data from that
time point onward. If NULL is supplied instead, it means there are no
stable time points available. Note that 0 time points are ALWAYS discarded.
Also, to be included in the analysis, a group must have at least 2
distinct non-zero time points.
}

\examples{
data("integration_matrices", package = "ISAnalytics")
data("association_file", package = "ISAnalytics")
aggreg <- aggregate_values_by_key(
    x = integration_matrices,
    association_file = association_file,
    value_cols = c("seqCount", "fragmentEstimate")
)
aggreg_meta <- aggregate_metadata(association_file = association_file)
estimate <- HSC_population_size_estimate(
    x = aggreg,
    metadata = aggreg_meta,
    stable_timepoints = c(90, 180, 360),
    cell_type = "Other"
)
}
\concept{Population estimates}
