Writes sq
objects with their names to
a fasta file.
[sq
]
An object this function is applied to.
further arguments to be passed from or to other methods.
[character
]
Vector of sequence names. Must be of the same length as sq
object.
[character(1)
]
Absolute path to file to write to.
[integer(1)
]
Maximum number of characters to put in each line of file. Must be positive.
[character(1)
]
A string that is used to interpret and display NA
value in the
context of sq class
. Default value equals to
"!
".
[character(1)
]
Name of a column that stores sequences.
[character(1)
]
Name of a column that stores names (unique identifiers).
No value is returned.
Whenever a name has more letters than width
parameter, nothing
happens, as only sequences are split to fit within designated space.
Functions from output module:
as.character.sq()
,
as.matrix.sq()
,
as.sq()
,
export_sq()
if (FALSE) {
sq_dna <- sq(c("ACTGCTG", "CTTAGA", "CCCT", "CTGAATGT"),
alphabet = "dna_bsc")
write_fasta(sq_dna,
c("bat", "cat", "rat", "elephant_swallowed_by_A_snake"),
tempfile())
}
# It can be a part of tidyverse pipeline:
library(dplyr)
fasta_file <- system.file(package = "tidysq", "examples/example_aa.fasta")
read_fasta(fasta_file) %>%
mutate(name = toupper(name)) %>%
write_fasta(tempfile())
#> Warning: Non-standard IUPAC symbols detected for DNA: 1549 characters were converted to N.
#> Error in UseMethod("mutate"): no applicable method for 'mutate' applied to an object of class "c('bioseq_dna', 'vctrs_vctr')"