align | R Documentation |
align
performs a multiple alignment on a list of
sequences using profile hidden Markov models.
align(x, ...) ## S3 method for class 'DNAbin' align( x, model = NULL, progressive = FALSE, seeds = NULL, seqweights = "Henikoff", refine = "Viterbi", k = 5, maxiter = 100, maxsize = NULL, inserts = "map", lambda = 0, threshold = 0.5, deltaLL = 1e-07, DI = FALSE, ID = FALSE, residues = NULL, gap = "-", pseudocounts = "background", qa = NULL, qe = NULL, cores = 1, quiet = FALSE, ... ) ## S3 method for class 'AAbin' align( x, model = NULL, progressive = FALSE, seeds = NULL, seqweights = "Henikoff", refine = "Viterbi", k = 5, maxiter = 100, maxsize = NULL, inserts = "map", lambda = 0, threshold = 0.5, deltaLL = 1e-07, DI = FALSE, ID = FALSE, residues = NULL, gap = "-", pseudocounts = "background", qa = NULL, qe = NULL, cores = 1, quiet = FALSE, ... ) ## S3 method for class 'list' align( x, model = NULL, progressive = FALSE, seeds = NULL, seqweights = "Henikoff", k = 5, refine = "Viterbi", maxiter = 100, maxsize = NULL, inserts = "map", lambda = 0, threshold = 0.5, deltaLL = 1e-07, DI = FALSE, ID = FALSE, residues = NULL, gap = "-", pseudocounts = "background", qa = NULL, qe = NULL, cores = 1, quiet = FALSE, ... ) ## Default S3 method: align( x, model, pseudocounts = "background", residues = NULL, gap = "-", maxsize = NULL, quiet = FALSE, ... )
x |
a list of DNA, amino acid, or other character sequences
consisting of symbols emitted from the chosen residue alphabet.
The vectors can either be of mode "raw" (consistent with the "DNAbin"
or "AAbin" coding scheme set out in the |
... |
aditional arguments to be passed to |
model |
an optional profile hidden Markov model (a |
progressive |
logical indicating whether the alignment used to derive the initial model parameters should be built progressively (assuming input is a list of unaligned sequences, ignored otherwise). Defaults to FALSE, in which case the longest sequence or sequences are used (faster, but possibly less accurate). |
seeds |
optional integer vector indicating which sequences should
be used as seeds for building the guide tree for the progressive
alignment (assuming input is a list of unaligned sequences,
and |
seqweights |
either NULL (all sequences are given weights
of 1), a numeric vector the same length as |
refine |
the method used to iteratively refine the model parameters
following the initial progressive alignment and model derivation step.
Current supported options are |
k |
integer representing the k-mer size to be used in tree-based sequence weighting (if applicable). Defaults to 5. Note that higher values of k may be slow to compute and use excessive memory due to the large numbers of calculations required. |
maxiter |
the maximum number of EM iterations or Viterbi training iterations to carry out before the cycling process is terminated and the partially trained model is returned. Defaults to 100. |
maxsize |
integer giving the upper bound on the number of modules in the PHMM. If NULL no maximum size is enforced. |
inserts |
character string giving the model construction method
in which alignment columns
are marked as either match or insert states. Accepted methods include
|
lambda |
penalty parameter used to favour models with fewer match
states. Equivalent to the log of the prior probability of marking each
column (Durbin et al 1998, chapter 5.7). Only applicable when
|
threshold |
the maximum proportion of gaps for an alignment column
to be considered for a match state in the PHMM (defaults to 0.5).
Only applicable when |
deltaLL |
numeric, the maximum change in log likelihood between EM
iterations before the cycling procedure is terminated (signifying model
convergence). Defaults to 1E-07. Only applicable if
|
DI |
logical indicating whether delete-insert transitions should be allowed in the profile hidden Markov model (if applicable). Defaults to FALSE. |
ID |
logical indicating whether insert-delete transitions should be allowed in the profile hidden Markov model (if applicable). Defaults to FALSE. |
residues |
either NULL (default; emitted residues are automatically
detected from the sequences), a case sensitive character vector
specifying the residue alphabet, or one of the character strings
"RNA", "DNA", "AA", "AMINO". Note that the default option can be slow for
large lists of character vectors. Furthermore, the default setting
|
gap |
the character used to represent gaps in the alignment matrix.
Ignored for |
pseudocounts |
character string, either "background", Laplace"
or "none". Used to account for the possible absence of certain
transition and/or emission types in the input sequences.
If |
qa |
an optional named 9-element vector of background transition
probabilities with |
qe |
an optional named vector of background emission probabilities
the same length as the residue alphabet (i.e. 4 for nucleotides and 20
for amino acids) and with corresponding names (i.e. |
cores |
integer giving the number of CPUs to parallelize the operation
over. Defaults to 1, and reverts to 1 if x is not a list.
This argument may alternatively be a 'cluster' object,
in which case it is the user's responsibility to close the socket
connection at the conclusion of the operation,
for example by running |
quiet |
logical indicating whether feedback should be printed to the console. |
This function builds a multiple sequence alignment using profile hidden Markov models. The default behaviour is to select the longest sequence in the set that had the lowest sequence weight, derive a profile HMM from the single sequence, and iteratively train the model using the entire sequence set. Training can be achieved using either the Baum Welch or Viterbi training algorithm, with the latter being significantly faster, particularly when multi-threading is used. Once the model parameters have converged (Baum Welch) or no variation is seen in the sequential alignments (Viterbi training), the sequences are aligned to the profile HMM to produce the alignment matrix. The preceeding steps can be omitted if a pre-trained profile HMM is passed to the function via the "model" argument.
If progressive = TRUE
the function alternatively uses a
progressive alignment procedure similar to the Clustal Omega algorithm
(Sievers et al 2011). The involves an initial progressive multiple
sequence alignment via a guide tree,
followed by the derivation of a profile hidden Markov model
from the alignment, an iterative model refinement step,
and finally the alignment of the sequences back to the model as above.
If only two sequences are provided, a standard pairwise alignment is carried out using the Needleman-Wunch or Smith-Waterman algorithm.
a matrix of aligned sequences, with the same mode and class as the input sequence list.
Shaun Wilkinson
Durbin R, Eddy SR, Krogh A, Mitchison G (1998) Biological sequence analysis: probabilistic models of proteins and nucleic acids. Cambridge University Press, Cambridge, United Kingdom.
Sievers F, Wilm A, Dineen D, Gibson TJ, Karplus K, Li W, Lopez R, McWilliam H, Remmert M, Soding J, Thompson JD, Higgins DG (2011) Fast, scalable generation of high-quality protein multiple sequence alignments using Clustal Omega. Molecular Systems Biology, 7, 539.
unalign
## Protein pairwise alignment example from Durbin et al (1998) chapter 2. x <- c("H", "E", "A", "G", "A", "W", "G", "H", "E", "E") y <- c("P", "A", "W", "H", "E", "A", "E") sequences <- list(x = x, y = y) glo <- align(sequences, type = "global") sem <- align(sequences, type = "semiglobal") loc <- align(sequences, type = "local") glo sem loc ## Deconstruct the woodmouse alignment and re-align library(ape) data(woodmouse) tmp <- unalign(woodmouse) x <- align(tmp, windowspace = "WilburLipman")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.