[workspace]
members = [".", "crates/fgumi-raw-bam", "crates/fgumi-dna", "crates/fgumi-bgzf", "crates/fgumi-metrics", "crates/fgumi-sam", "crates/fgumi-simd-fastq", "crates/fgumi-tag", "crates/fgumi-umi", "crates/fgumi-consensus", "crates/fgumi-bam-io", "crates/fgumi-sort", "crates/xtask"]
resolver = "2"

[workspace.package]
version = "0.3.0"
edition = "2024"
rust-version = "1.87.0"
repository = "https://github.com/fulcrumgenomics/fgumi"
license = "MIT"

[workspace.dependencies]
fgumi-bam-io = { version = "0.3.0", path = "crates/fgumi-bam-io" }
fgumi-bgzf = { version = "0.3.0", path = "crates/fgumi-bgzf" }
fgumi-consensus = { version = "0.3.0", path = "crates/fgumi-consensus", default-features = false }
fgumi-dna = { version = "0.3.0", path = "crates/fgumi-dna" }
fgumi-metrics = { version = "0.3.0", path = "crates/fgumi-metrics" }
fgumi-raw-bam = { version = "0.3.0", path = "crates/fgumi-raw-bam" }
fgumi-sam = { version = "0.3.0", path = "crates/fgumi-sam" }
fgumi-simd-fastq = { version = "0.3.0", path = "crates/fgumi-simd-fastq" }
fgumi-sort = { version = "0.3.0", path = "crates/fgumi-sort" }
fgumi-tag = { version = "0.3.0", path = "crates/fgumi-tag" }
fgumi-umi = { version = "0.3.0", path = "crates/fgumi-umi" }
bytemuck = { version = "1.14", features = ["derive"] }
wide = "1.5"

[package]
name = "fgumi"
version.workspace = true
authors = ["Nils Homer <nils@fulcrumgenomics.com>", "Tim Fennell <tim@fulcrumgenomics.com>"]
description = "High-performance tools for UMI-tagged sequencing data: extraction, grouping, and consensus calling"
repository.workspace = true
homepage = "https://github.com/fulcrumgenomics/fgumi"
documentation = "https://docs.rs/fgumi"
readme = "README.md"
categories = ["command-line-utilities", "science"]
keywords = ["bioinformatics", "umi", "consensus", "sequencing", "ngs"]
license.workspace = true
edition.workspace = true
rust-version.workspace = true

[dependencies]
clap = { version = "4", features = ["derive", "string"] }
log = "0"
thiserror = "2"
noodles = { version = "0.111.0", features = ["bam", "fasta", "sam", "bgzf", "core", "vcf"] }
noodles-bgzf = { version = "0.47.0", features = ["libdeflate"] }
mimalloc = { version = "0.1.52", default-features = false }
libmimalloc-sys = { version = "0.1.44", features = ["extended"] }
env_logger = "0.11.8"
enum_dispatch = "0.3.13"
anyhow = "1.0.102"
read-structure = "0.2.0" # held at 0.2 because 0.3 is a breaking API + behavior change (zero-length-read handling) that needs a dedicated migration PR
bstr = "1.12.1"
bytes = "1"
fgoxide = "0.6.0"
tempfile = "3.3.0"
lru = "0.18.0"
crc32fast = "1.4"
crossbeam-channel = "0.5"
crossbeam-queue = "0.3"
crossbeam-utils = "0.8.21"
parking_lot = "0.12"
libdeflater = "1.22"
serde = { version = "1.0.228", features = ["derive"] }
itertools = "0.14.0"
indexmap = "2"
rand = "0.10"
csv = "1.1"
memchr = "2"
statrs = "0.18"
bytesize = "2.3"
sysinfo = { version = "0.38", default-features = false, features = ["system"] } # unconditionally used by validate_against_system_memory; held at 0.38 because sysinfo >=0.39 requires rustc 1.95 > our MSRV (rust-toolchain.toml pins 1.93)
fs4 = { version = "1.1", default-features = false, features = ["sync"] } # cross-platform filesystem free-space queries
num_cpus = "1.16"
rayon = "1.10"
approx = "0.5.1"
ahash = "0.8"
bytemuck = { workspace = true }
rand_distr = "0.6"
# `zlib-rs` selects flate2's fast Rust-zlib DEFLATE backend for gzipped FASTQ
# decompression (used by `fgumi extract`). It must be requested explicitly: the
# backend is otherwise chosen by Cargo feature unification, and a transitive
# change can silently drop it back to the ~2x slower `miniz_oxide` default —
# which regressed extract throughput ~1.6x at high thread counts. Keep this
# feature pinned so the producer-thread decompressor stays on zlib-rs.
flate2 = { version = "1.1", features = ["zlib-rs"] }
dhat = { version = "0.3", optional = true }
fgumi-raw-bam = { workspace = true, features = ["noodles"] }
fgumi-dna = { workspace = true }
fgumi-bgzf = { workspace = true }
fgumi-metrics = { workspace = true }
fgumi-sam = { workspace = true }
fgumi-simd-fastq = { workspace = true }
fgumi-umi = { workspace = true }
fgumi-consensus = { workspace = true }
fgumi-bam-io = { workspace = true }
fgumi-sort = { workspace = true }

[target.'cfg(target_os = "macos")'.dependencies]
mach2 = "0.6"

[target.'cfg(target_os = "linux")'.dependencies]
nix = { version = "0.31", default-features = false, features = ["fs"] }

[features]
default = ["simplex", "duplex", "codec"]
simplex = ["fgumi-consensus/simplex"]
# duplex and codec depend on simplex (mirrors fgumi-consensus: `duplex = ["simplex"]`
# and `codec = ["simplex"]`), and their commands share methylation/filter paths
# that live behind the `simplex` feature in this crate.
duplex = ["simplex", "fgumi-consensus/duplex"]
codec = ["simplex", "fgumi-consensus/codec"]
dhat-heap = ["dep:dhat"]
# Enable comprehensive memory debugging infrastructure (monitor thread, hot-path atomics, CLI args)
memory-debug = ["fgumi-sort/memory-debug"]
# Enable compare subcommand with bams and metrics (developer tools)
compare = []
# Enable simulate commands for generating synthetic test data
simulate = ["simplex"]
# Enable profiling output for adjacency UMI assigner
profile-adjacency = []
# Enable slow stress tests for concurrency testing
stress-tests = []

[dev-dependencies]
rstest = "0"
proptest = "1.10"
criterion = { version = "0.8", features = ["html_reports"] }
fgumi-raw-bam = { workspace = true, features = ["test-utils", "noodles"] }
noodles = { version = "0.111.0", features = ["bam", "sam"] }

[[bench]]
name = "core_functions"
harness = false
# Exercises vanilla consensus / overlap helpers that live behind `simplex`.
required-features = ["simplex"]

[[bench]]
name = "raw_bam_accessors"
harness = false

[[bench]]
name = "raw_bam_tags_editor"
harness = false

[[bench]]
name = "raw_bam_length_changing"
harness = false

[[bench]]
name = "raw_bam_vs_recordbuf"
harness = false

[[bench]]
name = "raw_bam"
harness = false

[[bench]]
name = "umi_assigner_threshold"
harness = false

[build-dependencies]
built = { version = "0", features = ["git2"] }

[profile.release]
#lto = true
lto = "fat"
codegen-units = 1

[profile.profiling]
inherits = "release"
debug = "line-tables-only"

[lib]
name = "fgumi_lib"
path = "src/lib/mod.rs"
