This is a test version of Biostars. For the public version, visit https://www.biostars.org.
add 1/2 to fastq header

How do I add a 1 or 2 to the header of a fastq read file? To specify if it is from the R1 or R2 file

fastq

the fastq file format does not have headers or file comments. This is usually disambiguated by naming the first-read file so it has the suffix suffix "_R1.fq.gz" or "_1.fq.gz" and similarly for the second-read file.

1 answer

reformat.sh from BBTools can do what you want.

This will add /1 /2 to the individual reads....which might be what the user actually wants?

There is no global header in FASTQ files, only headers of individual reads. I think it is a safe assumption that adding to individual headers is a desired outcome.

This can be achived with awk too.

zcat myfastq.gz | awk '/^@/{$0=$0"TexIWantToAdd"} 1' 

Log in to answer this question.