Hi Pierre, Just one more question, if the format is rather K182:79:HV56XX:6:1101:11160:388737da9_ACAGTG_GAGAAG can you please tell me the modified samjdk.jar command to provide the tags? Thanks! That will be really helpful!
PS: May be this? Just worked on it....
$ java -jar dist/samjdk.jar -e 'String s=record.getReadName(); int h=s.indexOf("_"),u=s.lastIndexOf("_");record.setReadName(s.substring(0,h-1));record.setAttribute("CB",s.substring(h+1,u));record.setAttribute("UB",s.substring(u+2,u+7));return record;' jeter.sam 2> /dev/null
this works perfectly! thanks a lot!
update 2021: samtools 1.13:samtools view --add-flags/--remove-flagsCan you provide more information about how the new samtools feature --add-flags works? I would like to be able to use this feature, but for me it doesn't add a tag. For example, I tried to add a CB tag "AAAAAAAAAA" to each read in a small test bam:
Results in the original bam read (i.e., with no new CB tag):
nice catch. I was wrong
--add-flagis about mapping flag (integer), not attributes, my solution above was wrong.