Read DNA Sequences

Description

This functions parse DNA sequences in FASTA, PHILIP, and NEXUS formatted files.

Usage

1
2
3
4
5

Arguments

x

a character string, giving the file name.

text

a character string in FASTA format.

Value

An object of class DNAbin and of mode matrix if all sequences are of same length or matrix if they are not.

Author(s)

Christoph Heibl

References

Maddison, D.R., D.L. Swofford, and W.P. Maddison. 1997. NEXUS: an extensible file format for systematic information. Syst. Biol. 46: 590-621.

See Also

mafft and prank for sequence alignment, gblocks and aliscore for quality check and cleaning of sequence alignments, cbind.DNAbin for concatenation of sequence alignments.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
## bark beetle COX1 sequences
## --------------------------
data(ips.cox1)

## create temporary file names
## ---------------------------
format <- c(".fas", ".phy", ".nex")
fn <- sapply(format, tempfile, 
  pattern = "ips", tmpdir = tempdir())

## write sequences files
## ---------------------
write.fas(ips.cox1, fn[".fas"])
write.phy(ips.cox1, fn[".phy"])
write.nex(ips.cox1, fn[".nex"])

## read sequence files
## -------------------
fas <- read.fas(fn[".fas"])
phy <- read.phy(fn[".phy"])
nex <- read.nex(fn[".nex"])

## remove sequence files
## ---------------------
unlink(fn)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.