Skip to contents

Write sequences to a file

Usage

write_sequences(seq, file = "", format = NULL, ...)

write_fasta(seq, file = "", nchar = 80)

write_nexus(seq, file = "", datatype = NULL, missing = NULL, gap = NULL)

Arguments

seq

a named vector of sequences

file

a character string naming a file

format

**optional** write sequences in this format, currently supported formats are `fasta` and `nexus`

...

**optional** parameters passed to the underlying function

nchar

**optional** a number of characters per line

datatype

**optional** the type of data

missing

**optional** symbol representing missing data

gap

**optional** symbol representing a gap in aligned sequence

Examples

seq1 = c("A" = "AAA", "B" = "BBB", "C" = "CCC")
fasta = tempfile(fileext = ".fasta")
write_fasta(seq1, fasta)

seq2 = read_fasta(fasta)
identical(seq1, seq2)
#> [1] TRUE