\HeaderA{pid}{Percent Sequence Identity}{pid}
\aliasA{pid,PairwiseAlignedXStringSet-method}{pid}{pid,PairwiseAlignedXStringSet.Rdash.method}
\keyword{methods}{pid}
\begin{Description}\relax
Calculates the percent sequence identity for a pairwise sequence alignment.
\end{Description}
\begin{Usage}
\begin{verbatim}
pid(x, type="PID1")
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{x}] a \code{\LinkA{PairwiseAlignedXStringSet}{PairwiseAlignedXStringSet}} object.
\item[\code{type}] one of percent sequence identity. One of \code{"PID1"}, \code{"PID2"},
\code{"PID3"}, and \code{"PID4"}. See Details for more information.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
Since there is no universal definition of percent sequence identity, the \code{pid} function
calculates this statistic in the following types:
\describe{
\item[\code{"PID1"}:] 100 * (identical positions) / (aligned positions + internal gap positions)

\item[\code{"PID2"}:] 100 * (identical positions) / (aligned positions)

\item[\code{"PID3"}:] 100 * (identical positions) / (length shorter sequence)

\item[\code{"PID4"}:] 100 * (identical positions) / (average length of the two sequences)

}
\end{Details}
\begin{Value}
A numeric vector containing the specified sequence identity measures.
\end{Value}
\begin{Author}\relax
P. Aboyoun
\end{Author}
\begin{References}\relax
A. May, Percent Sequence Identity: The Need to Be Explicit, Structure 2004, 12(5):737.

G. Raghava and G. Barton, Quantification of the variation in percentage
identity for protein sequence alignments, BMC Bioinformatics 2006, 7:415.
\end{References}
\begin{SeeAlso}\relax
\LinkA{pairwiseAlignment}{pairwiseAlignment},
\LinkA{PairwiseAlignedXStringSet-class}{PairwiseAlignedXStringSet.Rdash.class},
\LinkA{match-utils}{match.Rdash.utils}
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
  s1 <- DNAString("AGTATAGATGATAGAT")
  s2 <- DNAString("AGTAGATAGATGGATGATAGATA")

  palign1 <- pairwiseAlignment(s1, s2)
  palign1
  pid(palign1)

  palign2 <-
    pairwiseAlignment(s1, s2,
      substitutionMatrix =
      nucleotideSubstitutionMatrix(match = 2, mismatch = 10, baseOnly = TRUE))
  palign2
  pid(palign2, type = "PID4")
\end{ExampleCode}
\end{Examples}

