scverse / scverse/SnapATAC2

`ex.export_coverage` fails with `PanicException: No data was written.`

Open
#214 6 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:

import snapatac2 as snap
print(snap.__version__)  # 2.5.2

adata = snap.read(
    "clustered.h5ad", 
    backed="r+"
)

snap.ex.export_coverage(
    adata=adata,
    groupby="integrated_manual_cellid_annotation",
    suffix=".bw",
    output_format="bigwig",
    out_dir="./bigWigs",
)

2024-01-16 08:48:55 - INFO - Exporting fragments...
2024-01-16 08:49:52 - INFO - Creating coverage files...
thread '<unnamed>' panicked at /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bigtools-0.2.5/src/utils/file/tempfilebuffer.rs:193:21:
No data was written.
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread '<unnamed>' panicked at /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bigtools-0.2.5/src/utils/file/tempfilebuffer.rs:193:21:
No data was written.
thread '<unnamed>' panicked at /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bigtools-0.2.5/src/utils/file/tempfilebuffer.rs:193:21:
No data was written.
thread '<unnamed>' panicked at /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bigtools-0.2.5/src/utils/file/tempfilebuffer.rs:193:21:
No data was written.
thread '<unnamed>' panicked at /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bigtools-0.2.5/src/utils/file/tempfilebuffer.rs:193:21:
No data was written.
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/cellar/users/aklie/opt/miniconda3/envs/scverse-lite-py39/lib/python3.9/site-packages/snapatac2/export/__init__.py", line 202, in export_coverage
    return internal.export_coverage(
pyo3_runtime.PanicException: No data was written.

It looks like fragments are exported properly (I'm also able to run ex.export_fragments with no problems), but data isn't able to be written to bigWig. I tried writing bedgraph as well and in that case the command completes, but the output files are empty.

I put the h5ad object on Google Drive if you want to take a look (https://drive.google.com/file/d/1gR3mattDYgo9m4YPV2TqpCl7hYRNtAeO/view?usp=drive_link)

I also was able to reproduce this error with the tutorial dataset (pbmc5k):

import snapatac2 as snap
print(snap.__version__)

file_path = snap.datasets.pbmc5k("annotated_h5ad")
adata = snap.read(file_path)

snap.ex.export_coverage(
    adata=adata,
    groupby="cell_type",
    suffix=".bw",
    output_format="bigwig",
    out_dir="./bigWigs",
)

Finally here is the bash to recreate my environment

conda create -n scverse-lite-py39 python=3.9 -y
conda activate scverse-lite-py39
pip install snapatac2

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

Start with snap.ex.export_coverage and reproduce the failure using the pbmc5k annotated_h5ad tutorial dataset and the environment shown in the report. Compare the bigWig panic with the empty bedgraph output; done means coverage files are written with data instead of raising PanicException or completing empty.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.