Go Back   SEQanswers > Bioinformatics > Bioinformatics

Similar Threads
Thread Thread Starter Forum Replies Last Post
For MAQ: Is there a Tool to convert sanger-format fastq file to illumina-fotmat fastq byb121 Bioinformatics 6 12-20-2013 01:26 AM
Subsampling using 'head -n #"? kga1978 Bioinformatics 32 05-04-2013 12:22 PM
Broad size range for Illumina RNA-seq library - secondary subsampling biases? JHess Sample Prep / Library Generation 3 10-05-2011 07:38 AM
Reduce file size after Illumina FASTQ to Sanger FASTQ conversion? jjw14 Illumina/Solexa 2 06-01-2010 04:35 PM
PubMed: Suppression Subtractive Hybridisation for Metagenomic Subsampling ECO Metagenomics 0 05-18-2009 09:24 PM

Thread Tools
Old 01-05-2011, 10:49 AM   #1
Location: North Carolina

Join Date: Jan 2010
Posts: 82
Default Subsampling Fastq

Anyone know an easy way to randomly subsample from a fastq (Illumina data)?

ShortReads seems to have a function FastqSampler, but I can't seem to make it work (?FastqSampler gives No documentation for 'FastqSampler' in specified packages and libraries:
you could try '??FastqSampler')


chrisbala is offline   Reply With Quote
Old 01-05-2011, 11:12 AM   #2
(Jeremy Leipzig)
Location: Philadelphia, PA

Join Date: May 2009
Posts: 116

i don't think you loaded ShortRead
start R
> R
in R:
> install.packages("ShortRead")
> library("ShortRead")
> ?FastqSampler
Jeremy Leipzig
Bioinformatics Programmer
My blog
Zigster is offline   Reply With Quote
Old 01-05-2011, 11:55 AM   #3
Location: North Carolina

Join Date: Jan 2010
Posts: 82

haha, I'm a bit of a newbie but not quite THAT bad...

I was testing it out on my Mac/GUI version of R. That does not seem to work.

Linux version seems fine. Maybe I'm still missing something ... but thats my guess as to what was going on.

Thanks though!
chrisbala is offline   Reply With Quote
Old 01-05-2011, 01:03 PM   #4
Location: North Carolina

Join Date: Jan 2010
Posts: 82
Default exporting

Ok, followup question...

Once I've done

donkey <- FastqSampler(con, n=1e6, readerBlockSize=1e8, verbose=FALSE)
How do I write the sampled sequences to a fastq file?

THanks, and apologies if this obvious.

chrisbala is offline   Reply With Quote
Old 01-09-2011, 06:28 PM   #5
Location: Davis, CA

Join Date: Mar 2009
Posts: 82

You can also use the mothur package which has a similar subsampling feature. The examples shows fasta only but I think it can handle paired fasta/qual files.
ewilbanks is offline   Reply With Quote
Old 01-11-2011, 04:51 AM   #6
Location: italy

Join Date: Feb 2010
Posts: 16

Hi chrisbala,
in ShortRead package ( manual :

there is writeFastq method that looks like what you need:
from manual:

writeFastq signature(object = "ShortReadQ", file = "character", mode="character",
...): Write object to file in fastq format. mode defaults to w. This creates a new
file, or fails if file already exists. Use mode="a" to append to an existing file. file is
expanded using path.expand.

hope it helps

Last edited by pbseq; 01-11-2011 at 05:04 AM.
pbseq is offline   Reply With Quote
Old 05-11-2012, 12:54 PM   #7
Location: California

Join Date: Nov 2009
Posts: 13

On a related note, I was trying to reduce my data size by using khmer, from a paper on Digitial Normalization. Does anyone have experience with this tool? I am getting an error when using it where it says I have no paired reads ... but I do. Are there simliar tools?
shanebrubaker is offline   Reply With Quote
Old 05-14-2012, 06:52 AM   #8
Rick Westerman
Location: Purdue University, Indiana, USA

Join Date: Jun 2008
Posts: 1,104


I suspect that you will get a better response if you ask your questing in a different thread with a title that contains "Digital Normalization" instead of burying it inside this thread. As for the answer to your question, I do not know. I am just starting to explore the program and may find out the answer later today.
westerman is offline   Reply With Quote
Old 05-02-2013, 08:01 AM   #9
Location: USA

Join Date: Nov 2012
Posts: 51

i need to subsampling my fastq file of Iontorrent shotgun reads. I install R-2.15 and going by the previous suggesitios in this thread i tried to install ShortRead by > install.packages("ShortRead") but get the folowing error
Warning message:
In getDependencies(pkgs, dependencies, available, lib) :
package ‘Shortread’ is not available

ne help regarding this and if any other ways to random sampling of my fastq file. Thanx in advannce

chayan is offline   Reply With Quote
Old 05-02-2013, 08:16 AM   #10
Senior Member
Location: East Coast USA

Join Date: Feb 2008
Posts: 7,077

Chayan: see this thread for other options in case the R solution does not work:
GenoMax is offline   Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

All times are GMT -8. The time now is 03:35 AM.

Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2020, vBulletin Solutions, Inc.
Single Sign On provided by vBSSO