Search
Question: fastqSampler and writeFastq in shortread package
1
gravatar for francesca.defilippis
2.8 years ago by
European Union
francesca.defilippis40 wrote:

Hello!

I need to randomly subsample a fastq file. I'm trying to use the shortbread package.

This are the commands I tried:

xx=FastqSampler("~/Desktop/Silano2014_RawReads/1_S1_R1.fastq", 100)

xx
class: FastqSampler 
file: 1_S1_R1.fastq 
status: n=100 current=0 added=0 total=0 buffer=0 
ordered: FALSE 

set.seed(123L);
p1 = yield(xx)

class: ShortReadQ
length: 100 reads; width: 151 cycles

Then I tried to write this new file:

writeFastq(p1,file="subset.fastq", mode="w")

But the file it created doesn't look like a fastq

head subset.fastq

?]K??<????ث?aٲh
Am I doing something wrong?

Thanks

Francesca

 

ADD COMMENTlink modified 2.8 years ago by Martin Morgan ♦♦ 20k • written 2.8 years ago by francesca.defilippis40
2
gravatar for Mike Smith
2.8 years ago by
Mike Smith2.1k
EMBL Heidelberg / de.NBI
Mike Smith2.1k wrote:

Hi Francesca,

By default writeFastq() will gz compress the file it creates.  If you want an uncompressed file you have to provide the argument compress=FALSE.  Hopefully this will work for you:

writeFastq(p1,file="subset.fastq", mode="w", compress = FALSE)

Mike

ADD COMMENTlink modified 2.8 years ago • written 2.8 years ago by Mike Smith2.1k
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 2.2.0
Traffic: 304 users visited in the last hour