% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/cdhit-methods.R
\name{cdhit}
\alias{cdhit}
\title{R interface to CDHIT/CDHITest}
\usage{
cdhit(
  seqs,
  identity = NULL,
  kmerSize = NULL,
  min_length = 6,
  s = 1,
  only_index = FALSE,
  showProgress = interactive(),
  ...
)
}
\arguments{
\item{seqs}{\code{AAseq} or \code{DNAseq}}

\item{identity}{minimum proportion identity}

\item{kmerSize}{word size.  If NULL, it will be chosen automatically based on
the identity.
You may need to lower it below 5 for AAseq with identity less than .7.}

\item{min_length}{Minimum length for sequences to be clustered.  An error if
something smaller is passed.}

\item{s}{fraction of shorter sequence covered by alignment.}

\item{only_index}{if TRUE only return the integer cluster indices, otherwise
return a tibble.}

\item{showProgress}{show a status bar}

\item{...}{other arguments that can be passed to cdhit, see
https://github.com/weizhongli/cdhit/wiki/3.-User's-Guide#CDHIT for details.
These will override any default values.}
}
\value{
vector of \code{integer} of length \code{seqs} providing the cluster
ID for each sequence, or a \code{tibble}.  See details.
}
\description{
CDHIT is a greedy algorithm to cluster amino acid or DNA sequences based on a
minimum identity.
By default, in this package it is configured perform ungapped, global
alignments with no clipping at start or end.
The \code{identity} is the number of identical characters in alignment
divided by the full length of the shorter sequence.
Set \code{s} < 1 to change the minimum coverage of the shorter sequence, which
will allow clipping at start or end.
Changing \code{G} = 0 changes the meaning of the \code{identity} to be the number of
identical characters in the alignment divided by the length of the alignment.
In this case, you must also set the alignment coverage controls \code{aL}, \code{AL}, \code{aS}, \code{AS}.
}
\details{
CDHit is by Fu, Niu, Zhu, Wu and Li (2012).  The R interface is originally by
Thomas Lin Pedersen and was transcribed here because it is not exported from
the package FindMyFriends, which is orphaned.
}
\examples{
fasta_path = system.file('extdata', 'demo.fasta', package='CellaRepertorium')
aaseq = Biostrings::readAAStringSet(fasta_path)
# 100\% identity, global alignment
cdhit(aaseq, identity = 1, only_index = TRUE)[1:10]
# 100\% identity, local alignment with no padding of endpoints
cdhit(aaseq,identity = 1, G = 0, aL = 1, aS = 1,  only_index = TRUE)[1:10]
# 100\% identity, local alignment with .9 padding of endpoints
cdhit(aaseq,identity = 1, G = 0, aL = .9, aS = .9,  only_index = TRUE)[1:10]
# a tibble
tbl = cdhit(aaseq, identity = 1, G = 0, aL = .9, aS = .9, only_index = FALSE)
}
