Dear all,
I have bam file (bamfile.bam) where I need to add a flag and annotation from text file.
The bam file looks like this:
NS500688:631:HFLVJBGXF:1:11105:17585:2382       4       *       0       0       *       *       0       0       GTTGTGAAACATCTCAGTACCCACAGGAAGA //A///EEEEEAEEEE//EEA<EAEEEEEAE B0:Z:AGTTCCCGCATAGTGCC       B3:Z:ATCTTTA    RG:Z:0  B0:Z:AGTTCCCGCATAGTGCCG B1:Z:4  B2:Z:18
Then I have in a txt file (annotations.txt) all the annotations.
NS500688:631:HFLVJBGXF:1:11105:17585:2382       TRINITY_DN3616_c0_g2_i2: 121: 0: 31M`
I want to add the annotation to the bam file with the XF flag so that it will look like this:
NS500688:631:HFLVJBGXF:1:11105:17585:2382       4       *       0       0       *       *       0       0       GTTGTGAAACATCTCAGTACCCACAGGAAGA //A///EEEEEAEEEE//EEA<EAEEEEEAE B0:Z:AGTTCCCGCATAGTGCC       B3:Z:ATCTTTA    RG:Z:0  B0:Z:AGTTCCCGCATAGTGCCG B1:Z:4  B2:Z:18  XF:Z:TRINITY_DN3616_c0_g2_i2: 121: 0: 31M`
Basically each row in bam file should have the XF:Z: + annotation included after the correct read. What would be the best way to do this?
Thanks a lot!
how big is the annotations.txt file ?
I'm not sure those spaces in
TRINITY_DN3616_c0_g2_i2: 121: 0: 31Mare valid.