| read.alignment {seqinr} | R Documentation |
Read a file in mase, clustal, phylip, fasta or msf format.
These formats are used to store nucleotide or protein multiple alignments.
read.alignment(file, format, forceToLower = TRUE, File = NULL)
file |
the name of the file which the aligned sequences are to be read from.
If it does not contain an absolute or relative path, the file name is relative
to the current working directory, getwd. |
format |
a character string specifying the format of the file : mase,
clustal, phylip, fasta or msf |
forceToLower |
a logical defaulting to TRUE stating whether the returned characters in the sequence should be in lower case (introduced in seqinR release 1.1-3). |
File |
synonymous of file maintained for backward compatibility. As from seqinR 1.1-3 this argument is deprecated and a warning is issued. |
;;. The body of the
file has the following structure: First, each entry must begin by
one (or more) commentary line. Commentary lines begin by the character
;. Again, this commentary line may be empty. After the
commentaries, the name of the sequence is written on a separate
line. At last, the sequence itself is written on the following lines.
An object of class alignment which is a list with the following components:
nb |
the number of aligned sequences |
nam |
a vector of strings containing the names of the aligned sequences |
seq |
a vector of strings containing the aligned sequences |
com |
a vector of strings containing the commentaries for each sequence or NA if there are no comments |
D. Charif, J.R. Lobry
citation("seqinr")
To read aligned sequences in NEXUS format, see the function
read.nexus in the CompPairWise package.
The NEXUS format is mainly used by the non-GPL commercial PAUP
software.
Related functions: as.matrix.alignment, read.fasta,
write.fasta, reverse.align, dist.alignment.
mase <- read.alignment(file = system.file("sequences/test.mase", package = "seqinr"), format = "mase")
clustal <- read.alignment(file = system.file("sequences/test.aln", package = "seqinr"), format="clustal")
phylip <- read.alignment(file = system.file("sequences/test.phylip", package = "seqinr"), format = "phylip")
msf <- read.alignment(file = system.file("sequences/test.msf", package = "seqinr"), format = "msf")
fasta <- read.alignment(file = system.file("sequences/Anouk.fasta", package = "seqinr"), format = "fasta")