diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..bd21564 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +# pixi environments +.pixi/* +!.pixi/config.toml + +target/ diff --git a/Cargo.lock b/Cargo.lock index 79386b5..37d10c0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -327,26 +327,6 @@ version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" -[[package]] -name = "bindgen" -version = "0.69.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "271383c67ccabffb7381723dea0672a673f292304fcb45c01cc648c7a8d58088" -dependencies = [ - "bitflags", - "cexpr", - "clang-sys", - "itertools 0.12.1", - "lazy_static", - "lazycell", - "proc-macro2", - "quote", - "regex", - "rustc-hash 1.1.0", - "shlex", - "syn 2.0.111", -] - [[package]] name = "bio-types" version = "1.0.4" @@ -475,15 +455,6 @@ dependencies = [ "shlex", ] -[[package]] -name = "cexpr" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766" -dependencies = [ - "nom 7.1.3", -] - [[package]] name = "cfg-if" version = "1.0.4" @@ -513,17 +484,6 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b0fc239e0f6cb375d2402d48afb92f76f5404fd1df208a41930ec81eda078bea" -[[package]] -name = "clang-sys" -version = "1.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b023947811758c97c59bf9d1c188fd619ad4718dcaa767947df1cadb14f39f4" -dependencies = [ - "glob", - "libc", - "libloading", -] - [[package]] name = "clap" version = "4.5.53" @@ -692,20 +652,20 @@ checksum = "ef8ae57c4978a2acd8b869ce6b9ca1dfe817bff704c220209fdef2c0b75a01b9" [[package]] name = "derive-new" -version = "0.6.0" +version = "0.5.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d150dea618e920167e5973d70ae6ece4385b7164e0d799fe7c122dd0a5d912ad" +checksum = "3418329ca0ad70234b9735dc4ceed10af4df60eff9c8e7b06cb5e520d92c3535" dependencies = [ "proc-macro2", "quote", - "syn 2.0.111", + "syn 1.0.109", ] [[package]] name = "derive-new" -version = "0.7.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2cdc8d50f426189eef89dac62fabfa0abb27d5cc008f25bf4156a0203325becc" +checksum = "d150dea618e920167e5973d70ae6ece4385b7164e0d799fe7c122dd0a5d912ad" dependencies = [ "proc-macro2", "quote", @@ -913,9 +873,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "98e6430fd1aab1f2586f8ad0ef27151bee96d5adcda39b39054fc4ce9c72d08a" dependencies = [ "circular", - "itertools 0.14.0", + "itertools", "log", - "nom 8.0.0", + "nom", "thiserror 2.0.17", ] @@ -1018,7 +978,6 @@ version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e38d7f1c121cd22aa214cb4dadd4277dc5447391eac518b899b29ba6356fbbb2" dependencies = [ - "bindgen", "bzip2-sys", "cc", "curl-sys", @@ -1316,15 +1275,6 @@ version = "1.70.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" -[[package]] -name = "itertools" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" -dependencies = [ - "either", -] - [[package]] name = "itertools" version = "0.14.0" @@ -1366,12 +1316,6 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" -[[package]] -name = "lazycell" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" - [[package]] name = "lexical-core" version = "1.0.6" @@ -1452,16 +1396,6 @@ dependencies = [ "zip", ] -[[package]] -name = "libloading" -version = "0.8.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7c4b02199fee7c5d21a5ae7d8cfa79a6ef5bb2fc834d6e9058e89c825efdc55" -dependencies = [ - "cfg-if", - "windows-link", -] - [[package]] name = "libm" version = "0.2.15" @@ -1567,12 +1501,6 @@ dependencies = [ "autocfg", ] -[[package]] -name = "minimal-lexical" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" - [[package]] name = "miniz_oxide" version = "0.8.9" @@ -1620,16 +1548,6 @@ dependencies = [ "rustc_version", ] -[[package]] -name = "nom" -version = "7.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" -dependencies = [ - "memchr", - "minimal-lexical", -] - [[package]] name = "nom" version = "8.0.0" @@ -1926,7 +1844,7 @@ dependencies = [ "pin-project-lite", "quinn-proto", "quinn-udp", - "rustc-hash 2.1.1", + "rustc-hash", "rustls", "socket2", "thiserror 2.0.17", @@ -1946,7 +1864,7 @@ dependencies = [ "lru-slab", "rand 0.9.2", "ring", - "rustc-hash 2.1.1", + "rustc-hash", "rustls", "rustls-pki-types", "slab", @@ -2218,23 +2136,22 @@ dependencies = [ [[package]] name = "rust-htslib" -version = "0.51.0" +version = "0.44.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "354416dd2300ff9e7aff8ddc747c875d6c5086f83c2cb2599f3692421c2b77fd" +checksum = "7c7eb0f29fce64a4e22578905efef3d72389058016023279a58b282eb5c0c467" dependencies = [ "bio-types", "byteorder", "custom_derive", - "derive-new 0.7.0", + "derive-new 0.5.9", "hts-sys", "ieee754", "lazy_static", "libc", - "libz-sys", "linear-map", "newtype_derive", "regex", - "thiserror 2.0.17", + "thiserror 1.0.69", "url", ] @@ -2254,12 +2171,6 @@ dependencies = [ "serde_json", ] -[[package]] -name = "rustc-hash" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" - [[package]] name = "rustc-hash" version = "2.1.1" @@ -2623,7 +2534,7 @@ dependencies = [ [[package]] name = "thebigbam_calc" -version = "0.1.0" +version = "1.0.0" dependencies = [ "anyhow", "atty", diff --git a/Cargo.toml b/Cargo.toml index 7410345..52cb6e1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,7 +20,7 @@ python = ["pyo3"] [dependencies] # BAM/SAM reading -rust-htslib = "0.51" +rust-htslib = { version = "0.44", features = ["static"] } # Parallelism rayon = "1.10" diff --git a/README.md b/README.md index 9dc8c7e..aaa5c4f 100644 --- a/README.md +++ b/README.md @@ -16,10 +16,48 @@ Built with **Rust** for fast BAM processing and **Python/Bokeh** for interactive # Quick Start -You need Rust and Python installed. Install Rust following instructions at: https://rust-lang.org/tools/install/ +You need conda installed. If you don't have it yet, you can install Miniconda following instructions at: https://docs.conda.io/en/latest/miniconda.html Then in command-line: +```bash +conda env create -f thebigbam_env.yaml +conda activate thebigbam +pip install git+https://github.com/bhagavadgitadu22/theBIGbam +``` + +Be aware that it may take quite some time to compile the Rust code during installation. + +To reduce the installation size, you can at the end remove the rust cache: + +```bash +cargo clean +``` + +### Errors + +To avoid potential compilation errors: + +- On Linux: Install development headers: `sudo apt-get install libbz2-dev liblzma-dev zlib1g-dev clang libclang-dev` +- On macOS: `brew install xz bzip2 zlib` +- On HPC clusters: you may need to load the LLVM module first: `module load llvm` + +If you cannot use any of these methods and still get errors related to `libclang` during installation such as : + +```bash +thread 'main' (3889591) panicked at /home/gmichoud/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bindgen-0.69.5/lib.rs:622:31: + Unable to find libclang: "couldn't find any valid shared libraries matching: ['libclang.so', 'libclang-*.so', 'libclang.so.*', 'libclang-*.so.*'], set the `LIBCLANG_PATH` environment variable to a path where one of these files can be found (invalid: [])" + +``` + +Please set the `LIBCLANG_PATH` environment variable to the path where your `libclang` library is located. For example: + +```bash +export LIBCLANG_PATH=$(python -c "import os; print(os.environ['CONDA_PREFIX'] + '/lib')") +``` + +Then try installing again. + ```bash pip install git+https://github.com/bhagavadgitadu22/theBIGbam ``` @@ -46,6 +84,12 @@ thebigbam calculate \ thebigbam serve --db tests/HK97/test.db --port 5006 ``` +If you're using wsl, you may need to install the package `wslu` to allow opening the browser from the wsl terminal: + +```bash +sudo apt install wslu +``` + Open browser to http://localhost:5006 See [the installation guide](docs/INSTALL.md) for more detailed instructions. @@ -249,4 +293,4 @@ Export any metric as a contig x sample TSV matrix: thebigbam export -d my_database.db --metric Coverage_mean -o coverage.tsv ``` -Run `thebigbam export -h` to see the full list of available metrics. \ No newline at end of file +Run `thebigbam export -h` to see the full list of available metrics. diff --git a/docs/INSTALL.md b/docs/INSTALL.md index ab1812b..5d94a21 100644 --- a/docs/INSTALL.md +++ b/docs/INSTALL.md @@ -81,7 +81,7 @@ This installs in "editable" mode - changes to Python code take effect immediatel **Using conda/mamba (easiest):** ```bash -mamba env create -f thebigbam_env.yaml +conda env create -f thebigbam_env.yaml conda activate thebigbam pip install . # Re-install in conda environment ``` diff --git a/pyproject.toml b/pyproject.toml index 73ef0f2..96796ac 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -9,7 +9,7 @@ description = "Compression and interactive exploration of large-scale sequencing readme = "README.md" authors = [{ name = "Martin Boutroux", email = "martinboutroux@outlook.fr" }] license = { text = "MIT" } -requires-python = ">=3.9" +requires-python = ">=3.9,<3.13" classifiers = [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Science/Research", @@ -18,12 +18,6 @@ classifiers = [ "Programming Language :: Python :: 3", "Programming Language :: Rust", ] - -[project.urls] -Homepage = "https://github.com/bhagavadgitadu22/theBIGbam" -Repository = "https://github.com/bhagavadgitadu22/theBIGbam" -Issues = "https://github.com/bhagavadgitadu22/theBIGbam/issues" - dependencies = [ "bokeh>=3.0", "panel>=1.0", @@ -33,6 +27,13 @@ dependencies = [ "duckdb>=1.0", ] +[project.urls] +Homepage = "https://github.com/bhagavadgitadu22/theBIGbam" +Repository = "https://github.com/bhagavadgitadu22/theBIGbam" +Issues = "https://github.com/bhagavadgitadu22/theBIGbam/issues" + + + [project.optional-dependencies] dev = [ "pytest>=7.0", diff --git a/thebigbam/plotting/start_bokeh_server.py b/thebigbam/plotting/start_bokeh_server.py index 59484c0..0bab064 100644 --- a/thebigbam/plotting/start_bokeh_server.py +++ b/thebigbam/plotting/start_bokeh_server.py @@ -984,7 +984,7 @@ def make_data_download_callback(): toggle_stylesheet = InlineStyleSheet(css=toggle_css_text) # Load logo as base64 to avoid static file serving issues - logo_path = os.path.join(static_path, "logo.png") + logo_path = os.path.join(static_path, "LOGO.png") with open(logo_path, "rb") as f: logo_b64 = base64.b64encode(f.read()).decode("utf-8") diff --git a/thebigbam_env.yaml b/thebigbam_env.yaml index c2fb405..1d82a22 100644 --- a/thebigbam_env.yaml +++ b/thebigbam_env.yaml @@ -6,3 +6,8 @@ dependencies: - samtools=1.23 - bwa-mem2=2.3 - minimap2=2.30 + - rust>=1.72 + - libclang + - python=3.12 + - blast +