Running Multiple Flash Sequence Joins in Terminal
0
0
Entering edit mode
8.0 years ago

I have input files that appear as such:

03631101_1.fastq
03631101_2.fastq

I would like to join the 100+ files I have by running a command in the terminal. From looking at another post, I tried the suggested line:

for i in $(ls *fastq | grep  "_1" | cut -f 1 -d "_"); do flash ${i}_1.fastq ${i}_2.fastq; done

But this created an error:

ERROR: zlib error opening

What can I do to create a loop for these fastq files so that I do not have to do each individually?

Thank you!

fastq shell • 2.5k views
ADD COMMENT
0
Entering edit mode

Do you want to merge all the *.fastq files into one? If yes, you can use cat. cat *.fastq >> new_file.fastq

ADD REPLY
0
Entering edit mode

I would like to create a loop to go through all the fastq files and join them

ADD REPLY
0
Entering edit mode

What OS are you using? Looks like you may be missing the zlib library.

ADD REPLY
0
Entering edit mode

It is OS X Yosemite. I checked and it is already installed.. and updated

ADD REPLY
0
Entering edit mode

Not sure why you are getting a zlib error for a straight for loop. Are there any other files that have a "_1" in name but are not ending in .fastq?

ADD REPLY
0
Entering edit mode

There aren't... but I actually have it working now. The only issue is that the output files come out like out.extendedFrags.fastq and this is being overwritten for each sample number. Do you know what I can add to the end so that the output in a folder called joined takes the sample number from each pair of fastq files? I have tried this for i in $(ls *fastq | grep "_1" | cut -f 1 -d "_"); do flash ${i}_1.fastq ${i}_2.fastq -d joined/-o; done but it just creates the output folder..

ADD REPLY
0
Entering edit mode

Try

for i in $(ls *fastq | grep "_1" | cut -f 1 -d "_"); do flash ${i}_1.fastq ${i}_2.fastq -d joined -o ${i}_joined.fastq; done
ADD REPLY

Login before adding your answer.

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