02-seqclust: Class '"SequenceCluster"'

SequenceCluster-classR Documentation

Class "SequenceCluster"

Description

The SequenceCluster class is used to cluster sequences of "words" from an arbitrarily long alphabet. The SequenceCluster function returns a new object of the SequenceCluster class.

Usage

SequenceCluster(rawseq, method = c("needelman", "levenshtein"), NC = 5)
## S4 method for signature 'SequenceCluster,missing'
plot(x, type = "rooted", main = "Colored Clusters", ...)
updateClusters(sc, NC)
heat(x, ...)

Arguments

rawseq

A character vector that contains all words or "sequences" to be clustered.

method

The algorithm to use to compute distances between sequences. The choices are "levenshstein", which uses the Levenshtein edit distance, or "needelman", which uses the Needelman-Wunsch global alignment algorithm.

x

An object of the SequenceCluster class.

sc

An object of the SequenceCluster class.

NC

An integer; the number of clusters to cut from the dendrogram.

type

A character strnig; the type of plot to make. Valid types are "rooted", "clipped", or "unrooted".

main

Character; the plot title.

...

extra arguments for generic or plotting routines

Value

The SequenceCluster function returns a new object of the SequenceCluster class.

Objects from the Class

Objects should be defined using the SequenceCluster constructor. You typically pass in a character vector of "words" to be clustered.

Slots

method:

A character vector describing which algorithm was used.

rawSequences

A character vector that contains the input words or "sequences" tthat were clustered.

weights

A numeric vactor; the numbof times each unique raw sequence occurs.

distance:

A dist object.

hc:

An hclust object.

NC:

An integer; the number of clusters cut from the dendrogram.

clusters:

An integer vector containing cluster assignments.

Author(s)

Kevin R. Coombes <krc@silicovore.com>

Examples

data(longreads)
sequences <- longreads$connection[1:30]        # named character vector
sequences <- sequences[!duplicated(sequences)] # dedup
sc <- SequenceCluster(sequences)               # cluster
plot(sc)                                    # visualize
sc <- updateClusters(sc, NC = 7)
plot(sc, type = "unrooted")

SVAlignR documentation built on Sept. 20, 2025, 3:01 p.m.