View source: R/read_sequences.r
read_sequences | R Documentation |
These functions read a sequence alignment file and return a named list of sequences. Currently supported formats are 'fasta' and 'nexus'. Interleaved formats, where sequences are defined in a repeating blocks, are not supported.
read_sequences(file, format = NULL) read_fasta(file) read_nexus(file)
file |
with alignment |
format |
requested format |
The function '[read_sequences]' tries to guess the correct format from the file extension. Alternatively, the correct format can be specified. Currently supported formats are fasta and nexus.
Functions '[read_fasta]' and '[read_nexus]' are then used to read the sequence alignment file.
named list of sequences
seq1 = c("A" = "AAA", "B" = "BBB", "C" = "CCC") fasta = tempfile(fileext = ".fasta") writeLines(paste0(">", names(seq1), "\n", seq1), fasta) seq2 = read_sequences(fasta) seq3 = read_fasta(fasta) identical(seq1, seq2) identical(seq1, seq3)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.