This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How to convert SAM/BAM file to GTF/GFF file?

Hello, Curious to know if there's a way to convert SAM/BAM file generated using minimap2 to GTF/GFF file. The purpose is to use it as transcript alignment evidence for EVM. Kindly suggest!

Regards, B

gtf sam bam gff minimap2

2 answers

You can convert to BED format with

bedtools bamtobed

then either use the resulting BED file or transform that to GFF. But with the caveat that it is none of the attributes would be filled in, so it would be quite the minimal and simplistic GFF

a better solution would be to use a tool like miniprot

https://github.com/lh3/miniprot

to generate actual GFF files based on proteins aligned to genome

You can try AGAT toolkit to convert sam/bam to gff.

agat_convert_minimap2_bam2gff

Or there is an indirect solution:

https://github.com/lh3/minimap2/issues/455

Log in to answer this question.