deepTools icon indicating copy to clipboard operation
deepTools copied to clipboard

alignmentSieve v3.5.6 creates too many open files

Open kijiy opened this issue 3 months ago • 0 comments

Hi,

I found that alignmentSieve in deepTools v3.5.6 creates too many tmp files. I don't know if this is specific to my environment, but I report it here as a potential bug.

# Filter out low-quality mappers
alignmentSieve -p 1 -b bowtie_out.bam --minMappingQuality 30 --samFlagInclude 2 -o MAPQ30.bam

# Output
[E::hts_open_format] Failed to open file "/tmp/_deeptools_pq0n_woe.bam" : Too many open files
Traceback (most recent call last):
  File "/path/to/alignmentSieve", line 10, in <module>
    sys.exit(main())
             ^^^^^^
  File "/path/to/deeptools/alignmentSieve.py", line 409, in main
    pysam.samtools.cat(*arguments)
  File "/path/to/pysam/utils.py", line 84, in __call__
    raise SamtoolsError(
pysam.utils.SamtoolsError: "samtools returned with error 1: stdout=, stderr=samtools cat: fail to open file '/tmp/_deeptools_pq0n_woe.bam': Too many open files\n"

# Check the version
alignmentSieve --version
alignmentSieve 3.5.6

I realized this created ~3000 temporary files in the tmpdir, which probably caused the bug.

ls -lh /tmp/_deeptools_* | grep myusername | wc -l
2994

This error does not occur when using alignmentSieve 3.5.5.

Thank you in advance!

kijiy avatar Oct 07 '25 15:10 kijiy