\HeaderA{get\_selfhyb\_subseq}{Get Self-Hybridizing Subsequences}{get.Rul.selfhyb.Rul.subseq}
\aliasA{show\_selfhyb\_counts}{get\_selfhyb\_subseq}{show.Rul.selfhyb.Rul.counts}
\aliasA{show\_selfhyb\_lengths}{get\_selfhyb\_subseq}{show.Rul.selfhyb.Rul.lengths}
\begin{Description}\relax
This function finds the longest self-hybridizing subsequences present
in RNA or DNA sequences.
\end{Description}
\begin{Usage}
\begin{verbatim}
get_selfhyb_subseq(seq, minlen, type = c("RNA", "DNA"))
show_selfhyb_counts(L)
show_selfhyb_lengths(L)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{seq}] character vector of RNA or DNA sequences
\item[\code{minlen}] an integer specifying the minimum length in bases of the
self-hybridizing subsequences.  Subsequences with length less than
\code{minlen} will be ignored.
\item[\code{type}] one of \code{"RNA"} or \code{"DNA"} depending on the type of
sequences provided in \code{seq}.  Note that you cannot mix RNA and
DNA sequences.
\item[\code{L}] The output of \code{get\_selfhyp\_subseq}.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
\code{get\_selfhyb\_subseq} finds the longest self-hybridizing
subsequences of the specified minimum length.  It does this using
suffix trees and the \code{getLongestSubstring} function provided by
the Rlibstree package.

These are defined to be the longest string that is found in both
the input sequence, \code{seq}, and in its reverse complement.
\end{Details}
\begin{Value}
A list with an element for each sequence in \code{seq}.  The list will
be named using \code{names(seq)}.

Each element is itself a list with an element for each longest
self-hybridizing subsequence (there can be more than one).  Each such
element is yet another list with components:

\begin{ldescription}
\item[\code{starts}] integer vector giving the character start positions for
the self-hybridizing subsequence in the sequence.
\item[\code{rcstarts}] integer vector giving the character start positions
for the reverse complement of the self-hybridizing subsequence in
the sequence.
\end{ldescription}
\end{Value}
\begin{Author}\relax
Seth Falcon
\end{Author}
\begin{Examples}
\begin{ExampleCode}
seqs = c(a="UGAGGUAGUAGGUUGUAUAGUU", b="UGAGGUAGUAGGUUGUGUGGUU",
         c="UGAGGUAGUAGGUUGUAUGGUU")

ans = get_selfhyb_subseq(seqs, minlen=3, type="RNA")
length(ans)

ans[["a"]]

show_selfhyb_counts(ans)
show_selfhyb_lengths(ans)

\end{ExampleCode}
\end{Examples}

