Skip to content

Commit

Permalink
Trow error if scatac_from_fragments split can't write to fragments …
Browse files Browse the repository at this point in the history
…files.

Trow error if `scatac_from_fragments split` can't write to fragments files,
by updating rust_htslib as both `rust_htslib::bgzf:Reader` and
`rust_htslib::bgzf:Writer` did not check if it could open a file successfully.

  rust-bio/rust-htslib#444

This now print a traceback instead of silently failing:

    Processing contig "chr1"
    thread '<unnamed>' panicked at src/split_fragments.rs:56:37:
    Could not open file "/tmp/sample1/cellA.fragments.tsv.gz" for writing
    note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
    Traceback (most recent call last):
      File "/software/anaconda3/envs/pycistopic/bin/scatac_fragment_tools", line 8, in <module>
        sys.exit(main())
             ^^^^^^
      File "/software/scatac_fragment_tools/src/scatac_fragment_tools/cli/main.py", line 317, in main
        args.func(args)
      File "/software/scatac_fragment_tools/src/scatac_fragment_tools/cli/commands.py", line 186, in command_split_fragments_by_cell_type
        split_fragment_files_by_cell_type(
      File "/software/scatac_fragment_tools/src/scatac_fragment_tools/library/split/split_fragments_by_cell_type.py", line 79, in split_fragment_files_by_cell_type
        joblib.Parallel(n_jobs=n_cpu)(
      File "/software/anaconda3/envs/pycistopic/lib/python3.11/site-packages/joblib/parallel.py", line 1918, in __call__
        return output if self.return_generator else list(output)
                                                ^^^^^^^^^^^^
      File "/software/anaconda3/envs/pycistopic/lib/python3.11/site-packages/joblib/parallel.py", line 1847, in _get_sequential_output
        res = func(*args, **kwargs)
              ^^^^^^^^^^^^^^^^^^^^^
    pyo3_runtime.PanicException: Could not open file "/tmp/sample1/cellA.fragments.tsv.gz" for writing
  • Loading branch information
ghuls committed Nov 12, 2024
1 parent c9f2e65 commit 86f5ac5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions rust/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "_rust_scatac_fragment_tools"
version = "0.1.2"
version = "0.1.3"
authors = ["Seppe De Winter <[email protected]>", "Gert Hulselmans <[email protected]>"]
edition = "2021"

Expand All @@ -15,6 +15,6 @@ itertools = "0.13.0"
pyo3 = { version = "0.22.1", features = ["abi3-py38", "extension-module"] }

[target.'cfg(not(all(target_os = "linux", target_arch = "powerpc64")))'.dependencies]
rust-htslib = { version = "0.47.0", default-features = false, features = ["libdeflate"] }
rust-htslib = { version = "0.48.0", default-features = false, features = ["libdeflate"] }
[target.'cfg(all(target_os = "linux", target_arch = "powerpc64"))'.dependencies]
rust-htslib = { version = "0.47.0", default-features = false }
rust-htslib = { version = "0.48.0", default-features = false }

0 comments on commit 86f5ac5

Please sign in to comment.