This is a test version of Biostars. For the public version, visit https://www.biostars.org.
FASTQ header correction to remove .1 and .2 from paired end - SRA files

From this step as raw data:

@ERR797585640.1.1 1 length=151
ATATCGGGACGTGCGATCAGCACAAGCCGGCTATCGGTGTGGCGC

I have converted till this:

Read 1:

@ERR797585640.1.1
ATATCGGGACGTGCGATCAGCACAAGCCGGCTATCGGTGT

Read 2:

@ERR797585640.1.2
ATATCGGGACGTGCGATCAGCACAAGCCGGCTATCGGTGT

I have taken ERR and SRA samples for RnD.

But I want to keep only format as:

Read 1:

@ERR797585640.1
ATATCGGGACGTGCGATCAGCACAAGCCGGCTATCGGTGT

Read 2:

@ERR797585640.1
ATATCGGGACGTGCGATCAGCACAAGCCGGCTATCGGTGT

Kindly provide any commands or suggestion to remove and make changes for fastq headers

fastq

I have converted till this:

how ? what was the command ?

I have used:

sed '/^@/ {s/ .*//}' SAMPLE to convert till @ERR797585640.1.1

But i need further guidance for next step

you cannot use '@' as the signal for the first line of a fastq file as @ can also be a symbol of quality

Please stop using "convert", you're using it wrong and your sentences don't make any sense.

1 answer

Not sure it's a good idea to name both reads the same, but here's a perl oneliner to change your FASTQ headers:

perl -lne 'if(/^(@[^\.)]+\.\d+)\.\d/){ print "$1" } else { print }'

If you want to make sure only headers are affected, in case quality line starts with at:

perl -lne 'if($.%4==1 && /^(@[^\.)]+\.\d+)\.\d/){ print "$1" } else { print }'

Some tools require both reads to have the same name (or least they want the part of the read name before the first whitespace to be the same).

IMPORTANT SIDE NOTE: This can break SRA download tools if you upload your files with identical read names. Surprisingly NCBI allows(ed?) this....I hope they changed it by now.

Log in to answer this question.