fastqSampler and writeFastq in shortread package
1
2
Entering edit mode
@francescadefilippis-7043
Last seen 10.0 years ago
European Union

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

 

shortread fastq write • 3.4k views
ADD COMMENT
3
Entering edit mode
Mike Smith ★ 6.6k
@mike-smith
Last seen 4 hours ago
EMBL Heidelberg

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 COMMENT

Login before adding your answer.

Traffic: 306 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