Writes a data frame containing id, sequence, and comment columns,
write_fasta will write the data frame out to a
standard FASTA-formatted file.
The header will have a tab character between the sequence id and any
comments. There won't be a tab if there's no comment for the sequence. All
sequence data will be on a single line
Arguments
- data_frame
A data frame object with three columns. The
idcolumn will contain the non-space characters following the>in the header line of each sequence; thesequencecolumn will contain the sequence; and thecommentcolumn will contain any text found after the first whitespace character on the header line. Thecommentcolumn is optional.- file
Either a path to a file, a connection, or literal data (either a single string or a raw vector) to write to a standard FASTA formatted file. There are no checks to determine whether the data are DNA or amino acid sequences.
Files ending in .gz, .bz2, .xz, or .zip will be automatically compressed. Files starting with
http://,https://,ftp://, orftps://will be automatically downloaded. Remote gz files can also be autom downloaded and decompressed.If the value of
fileisNULL(default), the string will be written out to the screen
Examples
df_d <- data.frame(
id = c("seqA", "seqB", "seqC"),
sequence = c("ATGCATGC", "ATGCATGA", "ATGCATGT"),
comment = c("comment 1", "", "comment 3")
)
string_d <- write_fasta(df_d)
