Question: export BSgenome directly in gzipped fasta
0
gravatar for TimothéeFlutre
3.5 years ago by
France
TimothéeFlutre70 wrote:

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 fasta gzip • 814 views
ADD COMMENTlink modified 3.5 years ago by Jeff Johnston90 • written 3.5 years ago by TimothéeFlutre70
Answer: export BSgenome directly in gzipped fasta
2
gravatar for Jeff Johnston
3.5 years ago by
United States
Jeff Johnston90 wrote:

This seems to work:

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

 

ADD COMMENTlink written 3.5 years ago by Jeff Johnston90
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 16.09
Traffic: 185 users visited in the last hour