SEQanswers

Go Back   SEQanswers > Bioinformatics > Bioinformatics



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to merge two vcf files. cardillox Bioinformatics 3 11-27-2019 10:25 PM
merge gbk files krispy Bioinformatics 14 08-29-2016 03:48 AM
Merge two gff3 files? BobFreemanMA Bioinformatics 3 02-05-2013 05:53 AM
Merge Fasq Files yagoubali Illumina/Solexa 0 12-13-2012 06:45 PM
Can we merge 2 csfasta files ? tdm SOLiD 9 12-10-2010 10:10 AM

Reply
 
Thread Tools
Old 07-03-2013, 02:59 AM   #1
sazz
Member
 
Location: Istanbul, Turkey

Join Date: Oct 2012
Posts: 28
Default how to merge fastq files

Hello all,

I got my fastq files after sequencing, but they sent them in 5 pieces for 1 sample. Do you know a way to merge them?

Thanks!
sazz is offline   Reply With Quote
Old 07-03-2013, 03:20 AM   #2
mastal
Senior Member
 
Location: uk

Join Date: Mar 2009
Posts: 667
Default how to merge fastq files

Use 'cat' from the command line;

In the directory containing your fastq files:

$ cat *.fastq > merged.fastq
mastal is offline   Reply With Quote
Old 07-03-2013, 04:22 AM   #3
sazz
Member
 
Location: Istanbul, Turkey

Join Date: Oct 2012
Posts: 28
Default

I keep getting "-bash: *.fastq: Permission denied" even though I have read - write and execute permissions (-rwxrwxrwx) :/ But thanks for the command, I will try to make it work.
sazz is offline   Reply With Quote
Old 07-03-2013, 04:30 AM   #4
GenoMax
Senior Member
 
Location: East Coast USA

Join Date: Feb 2008
Posts: 7,087
Default

Are your files are in the *.fastq.gz format? Is so, you need to amend mastal's command as follows:

Code:
$ cat *.fastq.gz > merged_file.fastq.gz
It is probably not required but you could keep the sequence of the pieces intact like this:

Code:
cat Sample_ATCACG_L002_R1_001.fastq.gz Sample_ATCACG_L002_R1_002.fastq.gz > Sample_ATCACG_L002_R1_combined.fastq.gz

Last edited by GenoMax; 07-03-2013 at 04:32 AM.
GenoMax is offline   Reply With Quote
Old 07-03-2013, 04:33 AM   #5
mastal
Senior Member
 
Location: uk

Join Date: Mar 2009
Posts: 667
Default how to merge fastq files

Maybe your system has a problem with using the wildcard * ?

Since you just have 5 files, try listing the individual file names,

$ cat file1.fastq file2.fastq file3.fastq file4.fastq file5.fastq > merged.fastq
mastal is offline   Reply With Quote
Old 07-03-2013, 04:41 AM   #6
sazz
Member
 
Location: Istanbul, Turkey

Join Date: Oct 2012
Posts: 28
Default

I have unpacked them before and they are all in .fastq format. I tried like you wrote, in the long form as:

Quote:
sudo cat I-1_ATCACG_L002_R1_001.fastq I-1_ATCACG_L002_R1_002.fastq I-1_ATCACG_L002_R1_003.fastq I-1_ATCACG_L002_R1_004.fastq I-1_ATCACG_L002_R1_005.fastq > I-1.fastq
Still give the same error:

Quote:
-bash: I-1.fastq: Permission denied
But what I have realized is that; I have other fastq files (from a previous sequencing but in 1 piece for each sample), they are colored in "white" in the bash screen and before, I used split option on those and it worked fine; but this time, those new fastq files are colored green. This means anything?
sazz is offline   Reply With Quote
Old 07-03-2013, 04:45 AM   #7
GenoMax
Senior Member
 
Location: East Coast USA

Join Date: Feb 2008
Posts: 7,087
Default

Hmm. You should not have to "sudo" to "cat" files. It looks to me like you do not have write permissions on the directory where these files are residing.

See if this works. This will put the merged file in your $HOME where you should have write permissions.

Code:
cat I-1_ATCACG_L002_R1_001.fastq I-1_ATCACG_L002_R1_002.fastq I-1_ATCACG_L002_R1_003.fastq I-1_ATCACG_L002_R1_004.fastq I-1_ATCACG_L002_R1_005.fastq > ~/I-1.fastq
GenoMax is offline   Reply With Quote
Old 07-03-2013, 04:58 AM   #8
sazz
Member
 
Location: Istanbul, Turkey

Join Date: Oct 2012
Posts: 28
Default

Worked like a dream ! thanks GenoMax.
sazz 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 05:45 AM.


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