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

From OpenWetWare
Jump to: navigation, search
Owwnotebook icon.png Project name Report.pngMain project page
Resultset previous.pngPrevious entry      Next entryResultset next.png

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)) ] )