scverse / scverse/SnapATAC2

ex.export_coverage fails with some probloms

Open
#398 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
323
Forks
43
PR merge metrics
No merged PRs in 30d

Description

Hey Kai,

Running into an error when using the export_coverage function with mostly defaults:

2025-05-23 19:17:15 - INFO - Exporting fragments...
Processing cluster: 4
2025-05-23 19:17:18 - INFO - Computing coverage...

RuntimeError Traceback (most recent call last)
Cell In[252], line 13
10 subset = data[cluster_cells]
12 # 导出当前cluster的bw文件
---> 13 snap.ex.export_coverage(
14 adata=subset,
15 groupby="cluster", # 实际上这里只有当前cluster
16 out_dir=output_dir,
17 prefix=f"cluster_{cluster}_", # 文件名包含cluster名
18 suffix=".bw",
19 n_jobs=1, # 单线程更稳妥
20 normalization="RPKM"
21 )

File ~/miniconda3/envs/omicverse/lib/python3.9/site-packages/snapatac2/export/init.py:232, in export_coverage(adata, groupby, selections, bin_size, blacklist, normalization, include_for_norm, exclude_for_norm, min_frag_length, max_frag_length, counting_strategy, smooth_base, out_dir, prefix, suffix, output_format, compression, compression_level, tempdir, n_jobs)
229 compression = inferred_compression
231 n_jobs = None if n_jobs <= 0 else n_jobs
--> 232 return internal.export_coverage(
233 adata, list(groupby), bin_size, out_dir, prefix, suffix, output_format, counting_strategy,
234 selections, blacklist, normalization, include_for_norm, exclude_for_norm, min_frag_length,
235 max_frag_length, smooth_base, compression, compression_level, tempdir, n_jobs,
236 )

RuntimeError: Too many open files (os error 24)

Caused by:
Too many open files (os error 24)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the reported call through snap.ex.export_coverage, using the shown defaults and n_jobs=1, then inspect the export_coverage entry point at snapatac2/export/init.py around the internal.export_coverage call. Done means the same coverage export completes without raising "Too many open files".

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
bioinformatics
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.