Write free text comment with @CO in BAM file

I'm trying to add a free text while writing the reads in a BAM file. As the Java hstjdk samtool doc mentions, I can add a free text with @CO SAMTag. For example,

I'm adding the NM tag and MD tag using this code

record.setAttribute(htsjdk.samtools.SAMTag.MD.name(), "Value");
record.setAttribute(htsjdk.samtools.SAMTag.NM.name(), "Value");

But when I try to do the same for @CO tag

record.setAttribute(htsjdk.samtools.SAMTag.CO.name(), "Value");

I get the following error

cannot find symbol
symbol:   variable CO
location: class htsjdk.samtools.SAMTag

Can someone help me figure out how to add free text while writing a BAM file? Thanks in advance.





Source link