Expand description
§flow-gates
A comprehensive Rust library for working with gates in flow cytometry data analysis.
This library provides tools for creating, managing, and applying gates to flow cytometry data, supporting the GatingML 2.0 standard for gate definitions and hierarchies.
§Overview
Flow cytometry gates define regions of interest in multi-dimensional data space, allowing researchers to identify and analyze specific cell populations. This library provides:
- Gate Types: Polygon, Rectangle, and Ellipse geometries
- Gate Hierarchies: Parent-child relationships for sequential gating
- Event Filtering: Efficient spatial indexing and filtering of cytometry events
- Statistics: Comprehensive statistics for gated populations
- GatingML Support: Import/export gates in GatingML 2.0 XML format
- Thread-Safe Storage: Concurrent gate management
§Quick Start
use flow_gates::*;
use flow_gates::geometry::*;
// Create a polygon gate
let coords = vec![
(100.0, 200.0),
(300.0, 200.0),
(300.0, 400.0),
(100.0, 400.0),
];
let geometry = create_polygon_geometry(coords, "FSC-A", "SSC-A")?;
let gate = Gate::new(
"my-gate",
"My Gate",
geometry,
"FSC-A",
"SSC-A",
);
// Apply gate to FCS data
let event_indices = filter_events_by_gate(&fcs_file, &gate, None)?;§Core Concepts
§Gates
A Gate represents a region of interest defined by:
- Geometry: The shape (polygon, rectangle, or ellipse)
- Parameters: The two channels (x and y) the gate operates on
- Mode: Whether the gate applies globally or to specific files
§Gate Hierarchies
Gates can be organized in parent-child relationships, where child gates
are applied to events that pass through their parent gates. Use GateHierarchy
to manage these relationships.
§Event Filtering
The library provides efficient event filtering using spatial indexing (R*-tree)
for fast point-in-gate queries. Use EventIndex for repeated filtering operations
on the same dataset.
§Examples
See the README for detailed examples including:
- Creating different gate types
- Building gate hierarchies
- Filtering events
- Calculating statistics
- Application integration patterns
§Error Handling
The library uses GateError for all error conditions. Most operations return
Result<T, GateError>.
Re-exports§
pub use error::GateError;pub use error::Result as GateResult;pub use filtering::EventIndex;pub use filtering::FilterCache;pub use filtering::FilterCacheKey;pub use filtering::filter_events_by_gate;pub use filtering::filter_events_by_hierarchy;pub use geometry::create_ellipse_geometry;pub use geometry::create_polygon_geometry;pub use geometry::create_rectangle_geometry;pub use hierarchy::GateHierarchy;pub use statistics::GateStatistics;pub use types::Gate;pub use types::GateGeometry;pub use types::GateMode;pub use types::GateNode;
Modules§
- ellipse
- error
- Error types for gate operations.
- filtering
- Event filtering and spatial indexing for efficient gate-based event selection.
- gatingml
- geometry
- Geometry construction utilities for creating gate geometries from raw coordinates.
- hierarchy
- polygon
- rectangle
- scope
- statistics
- traits
- traits_
tests - transforms
- types