User:Timothee Flutre/Notebook/Postdoc/2011/11/08

From OpenWetWare

Jump to: navigation, search
Project name Main project page
Previous entry      Next entry

Fasta format in R with Bioconductor

  • save pairs "header+sequence" into a file in the fasta format:
library(Biostrings)  # from Bioconductor
dset <- DNAStringSet( c("ATGACG", "TTGAC") )
names(dset) <- c("seq1", "seq2")
write.XStringSet(dset, file="myreads.fa", format="fasta", width=80)
  • retrieve a given sequence
dset[ grep("^seq13$", names(dset)) ]
toString( dset[ grep("^seq13$", names(dset)) ] )

Personal tools