'Unusual writing error in fastq file: header move to 4th line i.e. quality score value line

I have transcriptome sequencing data but there is a problem during sequence writing.

Now the sequencing data looks like this:
Problem in fastq sequence while writing from sequencer

Normally the data should look like (4 line format):

@HWI-1KL133:1:1101:3288:2194#0/1 [header- first line]
CTGCCCAAAAACTCCTTCTTCTCCGAGTTCCAGATGAATTTTTTCCAGCTG [sequence- second line]
+ [ "+" sign - third line]
Y^^]cccRbc^cWY^aacedhXJbPHWP_^ca^[^Ia^XacIY_R^^cBBB [quality values - fourth line]

@HWI-1KL133:1:1101:3567:2197#0/1
GCAGGGTTTAGGAAGTTGTTCACATTGGGGCTTGGCAGTTGTTGAGAAGGA
+
_b_eeecdgggggiiegiiiihiiiihiiiiiiiiaghgfhhiidhfhhhe

But in my case it is looking like this:

@HWI-1KL133:1:1101:3288:2194#0/1
CTGCCCAAAAACTCCTTCTTCTCCGAGTTCCAGATGAATTTTTTCCAGCTG
+
Y^^]cccRbc^cWY^aacedhXJbPHWP_^ca^[^Ia^XacIY_R^^cBBB@HWI-1KL133:1:1101:3567:2197#0/1
GCAGGGTTTAGGAAGTTGTTCACATTGGGGCTTGGCAGTTGTTGAGAAGGA
+
_b_eeecdgggggiiegiiiihiiiihiiiiiiiiaghgfhhiidhfhhhe

Here, you can see that for the first sequence the format of fastq is maintained but for the second sequence the header line i.e. started with @HWI-1KL133:1:1101:3567:2197#0/1 was merged with the fourth line of the first sequence.

I want to remove the unusual header from the 4th line and put it into the upcoming header line (1st line of the next or second sequence).

I request you to please provide possible solution.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source