addMSA: Add matching sequence alignment to the tree

Description Usage Arguments Value See Also Examples

View source: R/addMSA.R

Description

addMSA wraps read.alignment function in seqinr package and helps match names in tree and sequence alignment. Either provide the file path to an alignment file and its format or an alignment object from the return of read.alignment function. If both the file path and alignment object are given, the function will use the sequence in the alignment file.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
addMSA(tree, ...)

## S3 method for class 'phylo'
addMSA(
  tree,
  msaPath = "",
  msaFormat = c("fasta", "clustal", "phylip", "mase", "msf"),
  alignment = NULL,
  seqType = c("AA", "DNA", "RNA"),
  ...
)

## S3 method for class 'treedata'
addMSA(tree, ...)

Arguments

tree

A phylo object. This commonly can be from tree parsing function in ape or ggtree. All the tip.label should be found in the sequence alignment. The tree is supposed to be fully resolved (bifurcated) and will be resolved by multi2di if is.binary gives FALSE.

...

Other arguments.

msaPath

The file path to the multiple sequence alignment file.

msaFormat

The format of the multiple sequence alignment file. The internal uses the read.alignment from seqinr package to parse the sequence alignment. The default is "fasta" and it also accepts "clustal", "phylip", "mase", "msf".

alignment

An alignment object. This commonly can be from sequence parsing function in the seqinr package. Sequence names in the alignment should include all tip.label in the tree

seqType

The type of the sequence in the alignment file. The default is "AA" for amino acid. The other options are "DNA" and "RNA".

Value

Since 1.5.12, the function returns a phyMSAmatched object to avoid S3 methods used on phylo (better encapsulation).

See Also

read.alignment

Examples

1
2
3
data(zikv_tree)
msaPath <- system.file('extdata', 'ZIKV.fasta', package = 'sitePath')
addMSA(zikv_tree, msaPath = msaPath, msaFormat = 'fasta')

wuaipinglab/sitePath documentation built on July 25, 2021, 9:11 p.m.