Learn R Programming

SVAlignR (version 0.9.2)

AlignedCluster-class: Class "AlignedCluster"

Description

The AlignedCluster class is used to align a set of clustered sequences. The alignClusters function creates a new object of the AlignedCluster class. The alignAllClusters function takes a SequenceCluster object and returns a list of AlignedCluster objects. Clustering is performed using the ClustalW algorithm. The associated class and functions take care of encoding and decoding sequences into a form that can be used by the implementation of ClustalW in the msa package.

Usage

alignCluster(sequences, mysub = NULL, gapO = 10, gapE = 0.2)
alignAllClusters(sc, mysub = NULL, gapO = 10, gapE = 0.2)
makeSubsMatrix(match = 5, mismatch = -2)
# S4 method for AlignedCluster
image(x, col = "black", cex = 1, main = "", ...)

Value

The alignCluster function returns a new object of the AlignedCluster

class. The alignAllClusters function returns a list of AlignedCluster objects. The makeSubMatrix function returns a symmetric substitution matrix.

Objects from the Class

Objects should be defined using the alignCluster or alignAllCluster functions. You typically pass in a character vector of sequences that have already been found to form a cluster.

Arguments

sequences

A character vector that contains all sequences to be aligned.

mysub

A square (usually symmetric) substitution matrix.

gapO

A numeric value defining the penalty for opening a gap.

gapE

A numeric value defining the penalty for extending a gap.

sc

An object of the SequenceCluster class.

match

A numeric value defining the reward for matching symbols from two sequences.

mismatch

A numeric value defining the penalty for mismatching symbols from two sequences.

x

An object of the AlignedCluster class.

col

A character setting the color of annotations in the image.

main

Character; the plot title.

cex

Numeric; size of teh text inside the image of the alignment matrix.

...

Extra arguments for generic or plotting routines.

Slots

alignment:

A matrix of aligned sequences; rows are sequences and columns are aligned positions..

weights

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

consensus:

A character vector; the consensus sequence of a successful alignment.

Author

Kevin R. Coombes <krc@silicovore.com>

Details

Alignment is performed using the implementation of the ClustalW algorithm provided by the msa package. The existing code to align amino-acid protein sequences is used by converting the current alphabet to one that limits its use to the known amino acids. The decision to ue this method introduces a limitation: we are unable to align any set of seqeunces that use more than 25 distinct symbols. Attempting such an alignment will result in the alignCluster function returning a NULL value, which is passed on as one of the list items from alignAllClusters.

Examples

Run this code
data(longreads)
seqs <- longreads$connection[1:15]
pad <- c(rep("0", 9), rep("", 6))
names(seqs) <- paste("LR", pad, 1:length(seqs), sep = "")
seqs <- seqs[!duplicated(seqs)]
mysub <- makeSubsMatrix(match = 2, mismatch = -6)
if (!requireNamespace("msa", quietly = TRUE)) {
  warning("Cluster alignment is only available if the 'msa' package is installed.\n")
} else {
  ab <- alignCluster(seqs, mysub)
  image(ab)
}

Run the code above in your browser using DataLab