SEQanswers

Go Back   SEQanswers > Bioinformatics > Bioinformatics



Similar Threads
Thread Thread Starter Forum Replies Last Post
splitting big genbank file joscarhuguet Bioinformatics 9 05-20-2013 06:39 AM
Splitting a BAM based on # of reads? kga1978 Bioinformatics 6 05-02-2013 09:55 AM
TopHat internals (splitting longer reads) ocs Bioinformatics 5 08-11-2011 01:15 AM
Splitting concatenated PE fastq to two files for respect reads JayM Illumina/Solexa 5 11-05-2010 02:58 AM
Splitting 454 paired reads in a FASTQ file sjackman Bioinformatics 5 09-10-2010 11:09 AM

Reply
 
Thread Tools
Old 02-04-2013, 04:38 AM   #1
yaximik
Senior Member
 
Location: Oregon

Join Date: Apr 2011
Posts: 205
Default splitting fastq?

I wonder if anyone knows about tools that allow splitting large fastq into smaller chunks. I found a couple scripts that split fasta, but not fastq.
yaximik is offline   Reply With Quote
Old 02-04-2013, 04:52 AM   #2
GenoMax
Senior Member
 
Location: East Coast USA

Join Date: Feb 2008
Posts: 7,077
Default

You can use "split" with the -l option (if your sequences/quality values do not wrap around on multiple lines). Check the manual page for split for more details.
GenoMax is offline   Reply With Quote
Old 02-04-2013, 04:55 AM   #3
JackieBadger
Senior Member
 
Location: Halifax, Nova Scotia

Join Date: Mar 2009
Posts: 381
Default

in unix use:

wc -l filename ### gets the number of lines

Then calculate how many lines you want in each smaller chunk to generate clean divisions of the data

Then:

split -l {number of lines to split} filename
JackieBadger is offline   Reply With Quote
Old 02-04-2013, 05:43 AM   #4
lorendarith
Guest
 

Posts: n/a
Default

I also asked the same question before
http://seqanswers.com/forums/showthread.php?t=25568

Last edited by lorendarith; 02-04-2013 at 05:51 AM.
  Reply With Quote
Old 02-05-2013, 05:33 AM   #5
mgogol
Senior Member
 
Location: Kansas City

Join Date: Mar 2008
Posts: 197
Default

Make sure you use numbers that are divisible by 4.
mgogol is offline   Reply With Quote
Old 02-05-2013, 07:12 PM   #6
Jeremy
Senior Member
 
Location: Pathum Thani, Thailand

Join Date: Nov 2009
Posts: 190
Default

If you aren't using Unix, you can get Unix tools by installing Cygwin.
Like people said, fastq is just a text file, anything that can split a text file will split a fastq file.
sed is generally slower than split, but you could try it:
Code:
sed -n 'start,endp' infile > outfile
the "p" after "end" means print, the "-n" means only print the selected lines, if you leave it out the original file is copied over and the selected lines appended to it (so don't leave it out).
e.g. you want a file with a million lines starting from the 4 millionth line:
Code:
sed -n '4000000,5000000p' infile > outfile

Last edited by Jeremy; 02-05-2013 at 10:31 PM.
Jeremy is offline   Reply With Quote
Reply

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 09:15 AM.


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