Find a consensus sequence for a set of sequences.

seq_consensus(x, method = "chr_majority", weights = NULL, gaps = TRUE)

Arguments

x

a DNA, RNA or AA vector.

method

the consensus method (see Details).

weights

an optional numeric vector of same length as x giving a weight for each input sequence.

gaps

logical. Should the gaps ("-") taken into account.

Value

A consensus sequence

Details

"chr_majority", "chr_ambiguity", "seq_centrality", "seq_majority"

For chr_ambiguity gap character always override other characters. Use gaps = FALSE to ignore gaps.

See also

Other aggregation operations: seq_cluster()

Examples

x <- c("-----TACGCAGTAAAAGCTACTGATG",
       "CGTCATACGCAGTAAAAACTACTGATG",
       "CTTCATACGCAGTAAAAACTACTGATG",
       "CTTCATATGCAGTAAAAACTACTGATG",
       "CTTCATACGCAGTAAAAACTACTGATG",
       "CGTCATACGCAGTAAAAGCTACTGATG",
       "CTTCATATGCAGTAAAAGCTACTGACG")
x <- dna(x)
seq_consensus(x)
#> DNA vector of 1 sequences
#> >   CTTCATACGCAGTAAAAACTACTGATG