Using the packaged bamstats-v0.3.5-linux-x86_64 or a locally compiled (go1.15.6 linux/amd64) dev version on CentOS 7, bamstats will crash with "panic: <fileID.bam> too many open files" if the number of BAM references contained therein exceeds the system file open limit, given by ulimit -n (often 1024 but can vary considerably among machines).
For many high-quality genomes, the number of chromosomes, scaffolds and contigs is generally much less than 1024 - no problem for bamstats. However, in many draft genomes, this is no longer true thus limiting the applicability of bamstats to a broader audience, at least those who work in draft genome assemblies.
I have never worked in go but I suspect that this feature may result from not closing streams that were opened implicitly. In any case, I hope you can address this issue.
Using the packaged bamstats-v0.3.5-linux-x86_64 or a locally compiled (go1.15.6 linux/amd64) dev version on CentOS 7, bamstats will crash with "panic: <fileID.bam> too many open files" if the number of BAM references contained therein exceeds the system file open limit, given by ulimit -n (often 1024 but can vary considerably among machines).
For many high-quality genomes, the number of chromosomes, scaffolds and contigs is generally much less than 1024 - no problem for bamstats. However, in many draft genomes, this is no longer true thus limiting the applicability of bamstats to a broader audience, at least those who work in draft genome assemblies.
I have never worked in go but I suspect that this feature may result from not closing streams that were opened implicitly. In any case, I hope you can address this issue.