This is a test version of Biostars. For the public version, visit https://www.biostars.org.
how to change fastq header??

Hello. I have a fastq file with this header.

@HISEQ:209:C7FUUANXX:2:1101:1265:83081/1
NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 
@HISEQ:209:C7FUUANXX:2:1101:1279:58268/1
NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

But I need to add "1:N:0:13" to the read descriptor so it looks like this. How can I add this to every line that starts with @HISEQ? Thanks.

@HISEQ:209:C7FUUANXX:2:1101:1265:83081/1 1:N:0:13
NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

@HISEQ:209:C7FUUANXX:2:1101:1279:58268/1 1:N:0:13
NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
fastq header

What have you tried? How well do you know sed? Please show us you have invested at least some effort in the task as well as in drafting this post.

Please use the formatting bar (especially the code option) to present your post better. I've done it for you this time.
code_formatting

1 answer

Hi Ram. I googled myself for a couple of hours and I think I got it. Here is what I used.

Find a line that starts with @HISEQ and add " 1:N:0:13" to the end of that line. There is a space included.

sed -i '/^@HISEQ/ s/$/ 1:N:0:13/' filename.fastq

the output of this command was

@HISEQ:209:C7FUUANXX:2:1101:1265:83081/1 1:N:0:13
NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@HISEQ:209:C7FUUANXX:2:1101:1279:58268/1 1:N:0:13
NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Is this the original fastq file? Your SEQ (line1) and QUAL (line3) are of different length.

Likely just a fake example that OP typed up. Must have gone overboard with the qual line :-)

Log in to answer this question.