export BSgenome directly in gzipped fasta
1
0
Entering edit mode
@timotheeflutre-6727
Last seen 5.6 years ago
France

I would like to save a BSgenome object into a gzipped file in the fasta format. However, the following attempts didn't work.

Pass a connection opened by gzfile:

> export(object=BSgenome..., con=gzfile("~/test.fa.gz", "w"), format="fasta")
Error in .local(object, ...) : Connection resource requested as a path

Pass nothing to the con argument to retrieve a character vector that will then be written using gzfile:

> test = export(object=BSgenome.Vvinifera.URGI.IGGP12Xv2, format="fasta")
Error in .local(object, ...) : Connection resource requested as a path

Of course, I could first do export(BSgenome.Vvinifera.URGI.IGGP12Xv2, "test.fasta") and then use gzip on the cmd-line. But I'd prefer to do it all inside R.

bsgenome gzip fasta • 1.7k views
ADD COMMENT
2
Entering edit mode
@jeff-johnston-6497
Last seen 6.9 years ago
United States

This seems to work:

library(BSgenome.Dmelanogaster.UCSC.dm3)
export(Dmelanogaster, "dm3.fasta.gz", compress=TRUE)

 

ADD COMMENT

Login before adding your answer.

Traffic: 613 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6