Change record sequence in a BAM file using XAM


I would like to update the sequence of a list of records in a BAM file. Looking at the code of record.jl, data is stored as Vector{UInt64} and some dark magic is used to convert to a DNA sequence.

As it looks very low level, how can I change the sequence ?


I don’t think it’s possible at the moment, you would have to write a function that does the inverse of BAM.sequence basically :

Maybe a workaround would be to write back to a SAM file and then convert to BAM with samtools. Looks like there’s string constructor for SAM :