-
Notifications
You must be signed in to change notification settings - Fork 296
Open
Description
Hi,
I use the pileup() function in a loop to generate pileups over a number of genomic ranges. pysam appears to reload the BAM index for each invocation of the pileup() function even though I'm using the same AlignmentFile object. Is this intended behavior? I creates considerable overhead.
Steps to reproduce:
- Create a minimal example python script:
#!/usr/bin/env python3
import pysam
bam = pysam.AlignmentFile("input.bam", "rb")
for i in range(100):
for pileupcolumn in bam.pileup("1", 1000, 1010):
pass
bam.close()
- Run the script with
straceto log file access:
strace -o strace.log ./example.py
- Count how often it opened the BAI file:
grep -c 'openat.*[.]bai' strace.log
Result: 101 times
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels