% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/sequence-distances-clustering.R
\name{compute_sequence_distance}
\alias{compute_sequence_distance}
\title{Compute pairwise sequence distances}
\usage{
compute_sequence_distance(
  data,
  sequence_id_col = "sequence_id",
  order_col = "sequence_order",
  state_col = "state",
  method = c("levenshtein", "lcs", "optimal_matching", "transition"),
  indel_cost = 1,
  substitution_cost = 1,
  substitution_matrix = NULL,
  transition_smoothing = 0,
  normalise = c("none", "max_length", "path_length")
)
}
\arguments{
\item{data}{Long-format sequence data or a prepared gp3sequences result.}

\item{sequence_id_col, order_col, state_col}{Sequence columns.}

\item{method}{Distance method.}

\item{indel_cost}{Non-negative insertion/deletion cost used by
\code{method = "optimal_matching"}.}

\item{substitution_cost}{Non-negative default substitution cost used by
\code{method = "optimal_matching"}.}

\item{substitution_matrix}{Optional named square substitution-cost matrix for
\code{method = "optimal_matching"}.}

\item{transition_smoothing}{Non-negative smoothing for transition profiles.}

\item{normalise}{One of \code{"none"}, \code{"max_length"}, or \code{"path_length"}.}
}
\value{
A \code{dist} object with method and preprocessing metadata attached.
}
\description{
Provides transparent base-R implementations of Levenshtein edit distance,
longest-common-subsequence distance, optimal matching, and a first-order
transition-profile distance.
}
\examples{
sequences <- data.frame(
  sequence_id = rep(c("s1", "s2", "s3", "s4"), each = 4L),
  sequence_order = rep(1:4, times = 4L),
  state = c("A", "B", "C", "D", "A", "B", "C", "C",
            "D", "C", "B", "A", "D", "C", "A", "A"),
  group = rep(c("g1", "g2"), each = 8L),
  stringsAsFactors = FALSE
)
compute_sequence_distance(sequences, method = "lcs")

}
