BStringViews-io {Biostrings}R Documentation

Input/output of BStringViews objects

Description

Functions to create a BStringViews object by reading a file or to write a BStringViews object to a file.

Usage

  read.BStringViews(file, format, subjectClass, collapse="")
  write.BStringViews(x, file="", format, width=80)

  FASTArecordsToCharacter(FASTArecs, use.names=TRUE)
  CharacterToFASTArecords(x)
  FASTArecordsToBStringViews(FASTArecs, subjectClass, collapse="")
  BStringViewsToFASTArecords(x)

Arguments

file Either a character string naming a file or a connection open for reading or writing. If "" (the default for write.BStringViews), write.BStringViews writes to the standard output connection (the console) unless redirected by sink.
format Only "fasta" is supported for now.
subjectClass The class to be given to the subject of the BStringViews object created and returned by the function. Must be "BString" or one of its subclasses: "DNAString", "RNAString" or "AAString".
collapse An optional character string to be inserted between the views of the BStringViews object created and returned by the function.
x For write.BStringViews, the BStringViews object to be written to file. For CharacterToFASTArecords, the (possibly named) character vector to be converted to a list of FASTA records as one returned by readFASTA. For BStringViewsToFASTArecords, the BStringViews object to be converted to a list of FASTA records as one returned by readFASTA.
width Only relevant if format is "fasta". The maximum number of letters per line of sequence.
FASTArecs A list of FASTA records as one returned by readFASTA.
use.names Whether or not the desc component of the FASTA records should be used to set the names of the returned vector.

Details

Only FASTA files are supported for now.

read.BStringViews creates a BStringViews object by reading a file.

write.BStringViews writes a BStringViews object to a file or connection.

FASTArecordsToCharacter, CharacterToFASTArecords, FASTArecordsToBStringViews and BStringViewsToFASTArecords are convenience functions used internally by read.BStringViews and write.BStringViews for switching between different representations of the same object.

See Also

readFASTA, writeFASTA, BStringViews-class, BString-class, DNAString-class, RNAString-class, AAString-class

Examples

  file <- system.file("Exfiles", "someORF.fsa", package="Biostrings")
  x <- read.BStringViews(file, "fasta", "DNAString")
  write.BStringViews(x, format="fasta") # writes to the console

  ## Converting 'x'...
  ## ... to a list of FASTA records (as one returned by the "readFASTA" function)
  x1 <- BStringViewsToFASTArecords(x)
  ## ... to a named character vector
  x2 <- FASTArecordsToCharacter(x1) # same as 'as.character(x)'

[Package Biostrings version 2.6.6 Index]