consensusSequence {shazam} | R Documentation |
Construct a consensus sequence
Description
Construct a consensus sequence
Usage
consensusSequence(
sequences,
db = NULL,
method = c("mostCommon", "thresholdedFreq", "catchAll", "mostMutated", "leastMutated"),
minFreq = NULL,
muFreqColumn = NULL,
lenLimit = NULL,
includeAmbiguous = FALSE,
breakTiesStochastic = FALSE,
breakTiesByColumns = NULL
)
Arguments
sequences |
character vector of sequences. |
db |
|
method |
method to calculate consensus sequence. One of
|
minFreq |
frequency threshold for calculating input consensus sequence.
Applicable to and required for the |
muFreqColumn |
|
lenLimit |
limit on consensus length. if |
includeAmbiguous |
whether to use ambiguous characters to represent positions at
which there are multiple characters with frequencies that are at least
|
breakTiesStochastic |
In case of ties, whether to randomly pick a sequence from sequences that
fulfill the criteria as consensus. Applicable to and required for all methods
except for |
breakTiesByColumns |
A list of the form |
Details
See collapseClones for detailed documentation on methods and additional parameters.
Value
A list containing cons
, which is a character string that is the consensus sequence
for sequences
; and muFreq
, which is the maximal/minimal mutation frequency of
the consensus sequence for the "mostMutated"
and "leastMutated"
methods, or
NULL
for all other methods.
Examples
# Subset example data
data(ExampleDb, package="alakazam")
db <- subset(ExampleDb, c_call %in% c("IGHA", "IGHG") & sample_id == "+7d")
clone <- subset(db, clone_id == "3192")
# First compute mutation frequency for most/leastMutated methods
clone <- observedMutations(clone, frequency=TRUE, combine=TRUE)
# Manually create a tie
clone <- rbind(clone, clone[which.max(clone$mu_freq), ])
# ThresholdedFreq method.
# Resolve ties deterministically without using ambiguous characters
cons1 <- consensusSequence(clone$sequence_alignment,
method="thresholdedFreq", minFreq=0.3,
includeAmbiguous=FALSE,
breakTiesStochastic=FALSE)
cons1$cons