| readFasta | R Documentation |
readFasta reads all FASTA-formated files in a directory
dirPath whose file name matches pattern pattern,
returning a compact internal representation of the sequences and
quality scores in the files. Methods read all files into a single R
object; a typical use is to restrict input to a single FASTA file.
writeFasta writes an object to a single file, using
mode="w" (the default) to create a new file or mode="a"
append to an existing file. Attempting to write to an existing file
with mode="w" results in an error.
readFasta(dirPath, pattern = character(0), ...,
nrec=-1L, skip=0L)
## S4 method for signature 'character'
readFasta(dirPath, pattern = character(0), ...,
nrec=-1L, skip=0L)
writeFasta(object, file, mode="w", ...)
## S4 method for signature 'DNAStringSet'
writeFasta(object, file, mode="w", ...)
dirPath |
A character vector giving the directory path (relative or absolute) or single file name of FASTA files to be read. |
pattern |
The ( |
object |
An object to be output in |
file |
A length 1 character vector providing a path to a file to the object is to be written to. |
mode |
A length 1 character vector equal to either ‘w’ or ‘a’ to write to a new file or append to an existing file, respectively. |
... |
Additional arguments used by methods or, for
|
nrec |
See |
skip |
See |
readFasta returns a DNAStringSet.
containing sequences and qualities contained in all files in
dirPath matching pattern. There is no guarantee of order
in which files are read.
writeFasta is invoked primarily for its side effect, creating
or appending to file file. The function returns, invisibly, the
length of object, and hence the number of records
written. There is a writeFasta method for any class derived
from ShortRead.
Martin Morgan
showMethods("readFasta")
showMethods("writeFasta")
f1 <- system.file("extdata", "someORF.fa", package="Biostrings")
rfa <- readFasta(f1)
sread(rfa)
id(rfa)
sp <- SolexaPath(system.file('extdata', package='ShortRead'))
rfq <- readFastq(analysisPath(sp), pattern="s_1_sequence.txt")
file <- tempfile()
writeFasta(rfq, file)
readLines(file, 8)
writeFasta(sread(rfq), file) # no 'id's
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.