This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Edit bam files using Pysam

Hi there! I am trying to edit values in a bam file, using Pysam, or any other interface. I want to change the base quality, and the read sequence of certain reads. I have searched a ton, but have not found any methods of editing bam files directly. I am not sure if this is possible. Any help would be appreciated! Thanks :)

genome alignment sequence sequencing

Out of curiosity, why do you want to do that?

1 answer

You can't really edit a BAM file directly, but you can iterate over the reads and write them in a modified state to a new file.

Log in to answer this question.