This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Pysam usage problem

Hi BioStars,

I am using pysam to count read from bam file. I use pysam.AlignmentFile to read bam file and pysam.AlignmentFile.count to do read count, but it requires bai file which is an index should in the same path where bam file is. However I have no writing permission in bam file path. Is it possible to input index bai file from other path, I mean save bam file and its bai file in different path? Thanks very much if some guys can help this!

software error

1 answer

Easiest is probably to create a symbolic link to the bam (ln - s) in a directory where you can write, or /tmp/, and write the index there. You can probably fix this using the os module

Log in to answer this question.