Skip to main content

cyanea_omics/
lib.rs

1//! Omics data structures for the Cyanea bioinformatics ecosystem.
2//!
3//! This crate provides core types for working with omics data:
4//!
5//! - **Genomic coordinates** — [`Strand`], [`GenomicPosition`], [`GenomicInterval`]
6//! - **Interval collections** — [`IntervalSet`] with overlap queries
7//! - **Expression matrices** — Dense [`ExpressionMatrix`] (features × samples)
8//! - **Sparse matrices** — [`SparseMatrix`] in COO format
9//! - **Variants** — VCF-style [`Variant`] representation
10//! - **Gene annotations** — [`Gene`], [`Transcript`], [`Exon`] hierarchy
11//!
12//! # Quick start
13//!
14//! ```
15//! use cyanea_omics::ExpressionMatrix;
16//! use cyanea_core::Summarizable;
17//!
18//! let matrix = ExpressionMatrix::new(
19//!     vec![vec![1.0, 2.0], vec![3.0, 4.0]],
20//!     vec!["gene1".into(), "gene2".into()],
21//!     vec!["sample_a".into(), "sample_b".into()],
22//! ).unwrap();
23//!
24//! assert_eq!(matrix.shape(), (2, 2));
25//! assert_eq!(matrix.get(0, 1), Some(2.0));
26//! assert_eq!(matrix.summary(), "ExpressionMatrix: 2 features \u{00d7} 2 samples");
27//! ```
28
29pub mod genomic;
30pub mod haplotype;
31pub mod interval;
32pub mod interval_tree;
33pub mod coverage;
34pub mod expr;
35pub mod network;
36pub mod otu;
37pub mod sparse;
38pub mod variant;
39pub mod annotation;
40pub mod variant_annotation;
41pub mod single_cell;
42pub mod spatial;
43pub mod genome_arithmetic;
44pub mod cnv;
45pub mod liftover;
46pub mod methylation;
47#[cfg(feature = "h5ad")]
48pub mod h5ad;
49#[cfg(feature = "zarr")]
50pub mod zarr;
51#[cfg(feature = "single-cell")]
52pub mod sc_preprocess;
53#[cfg(feature = "single-cell")]
54pub mod sc_cluster;
55#[cfg(feature = "single-cell")]
56pub mod sc_trajectory;
57#[cfg(feature = "single-cell")]
58pub mod sc_markers;
59#[cfg(feature = "single-cell")]
60pub mod sc_integrate;
61
62pub use cnv::{
63    BafSegment, CbsConfig, CnvSegment, SvBreakpoint, SvType,
64    baf_segmentation, circular_binary_segmentation, detect_sv_breakpoints, merge_cnv_segments,
65};
66pub use genomic::{GenomicInterval, GenomicPosition, Strand};
67pub use interval::IntervalSet;
68pub use interval_tree::{Interval, IntervalTree};
69pub use coverage::RleCoverage;
70pub use expr::ExpressionMatrix;
71pub use sparse::SparseMatrix;
72pub use variant::{Variant, VariantFilter, VariantType, Zygosity};
73pub use annotation::{Exon, Gene, GeneType, Transcript};
74pub use variant_annotation::{
75    AnnotationConfig, Consequence, SpliceScore, VariantEffect,
76    annotate_variant, annotate_variants, score_splice_disruption,
77};
78pub use single_cell::ColumnData;
79pub use genome_arithmetic::{
80    ClosestResult, GenomeInfo, JaccardStats, StrandMode,
81    closest, complement, genome_info, intersect, intersect_report_a,
82    jaccard, jaccard_stats, make_sliding_windows, make_windows,
83    merge, subtract, union, windows_around,
84};
85pub use liftover::{ChainFile, LiftoverResult, liftover, liftover_batch, parse_chain};
86pub use methylation::{
87    CpgIsland, CpgSite, DmRegion, DmrConfig,
88    bisulfite_convert, call_methylation, find_cpg_islands, find_dmrs,
89};
90pub use spatial::{
91    CooccurrenceResult, GearysC, LrInteraction, SpatialAutocorrelation, SpatialGraph, SpatialPoint,
92    cooccurrence, delaunay_neighbors, gearys_c, knn_spatial_neighbors, ligand_receptor_score,
93    morans_i,
94};
95pub use otu::OtuTable;
96pub use network::{CentralityScores, Community, Graph};
97pub use haplotype::{
98    haplotype_blocks, haplotype_diversity, phase_em, Haplotype, HaplotypeBlock, PhasedGenotypes,
99};
100#[cfg(feature = "h5ad")]
101pub use h5ad::{read_h5ad, write_h5ad};
102#[cfg(feature = "zarr")]
103pub use zarr::{read_zarr, write_zarr};