I have two files that built of blocks of 4 lines, starting with a @. They are matching and in order. The files are too big (>10 GB) so I am putting here the first 3 blocks of each (12 lines).
1st: the R file (reference file):
@NB551168:120:HTKN2BGX5:1:11101:3598:1051 2:N:0:NATC
CAATCTCTAAAGTTT
+
AA/A/EEEE///EEE
@NB551168:120:HTKN2BGX5:1:11101:24202:1051 2:N:0:NTCG
TGAGACCGGGTGTTG
+
AAAAAAEEE///<AA
@NB551168:120:HTKN2BGX5:1:11101:4381:1051 2:N:0:NCTT
GCTACTCCTAAGGCA
+
A////6/////EE//
2nd: the I file (index file):
@NB551168:120:HTKN2BGX5:1:11101:3598:1051 1:N:0:NATC
NATC
+
#EEE
@NB551168:120:HTKN2BGX5:1:11101:24202:1051 1:N:0:NTCG
NTCG
+
#EEE
@NB551168:120:HTKN2BGX5:1:11101:4381:1051 1:N:0:NCTT
NCTT
+
#EEA
The output file should contain the following (for each block (4 lines)):
- The first line exactly as in R2 (it has a space in it, it is important to keep)
- concatenate the 4 characters (always 4 letters) of the 2nd line from the I file to the beginning of the 2nd line of the R file.
- keep the 3rd line as the 3rd line in the R file
- concatenate the 4th lines (any character) in the I file to the beginning of the 4th line in the R file.
- do it to all blocks
example of an output:
@NB551168:120:HTKN2BGX5:1:11101:3598:1051 2:N:0:NATC
NATCCAATCTCTAAAGTTT
+
#EEEAA/A/EEEE///EEE
@NB551168:120:HTKN2BGX5:1:11101:24202:1051 2:N:0:NTCG
NTCGTGAGACCGGGTGTTG
+
#EEEAAAAAAEEE///<AA
@NB551168:120:HTKN2BGX5:1:11101:4381:1051 2:N:0:NCTT
NCTTGCTACTCCTAAGGCA
+
#EEAA////6/////EE//
Thanks a lot, HM