Read and write CryoEM metadata formats (STAR, XMD, SQLite, HDF5) as Pandas or Polars DataFrames. Rust core, Python API, extensible by design.
Part of the REX suite (gigabit-clowns org).
- Read STAR files to Pandas or Polars DataFrames with a single call
- All values preserved as strings — no silent type inference; type conversion is the convention system's job
- Lazy I/O —
rm.read()returns immediately with no file I/O; data is only loaded when you callto_pandas()orto_polars() - Extensible — plug in custom readers and conventions by subclassing Python ABCs; no Rust required
- Fast core — parsing and Arrow serialization in Rust via PyO3 + Maturin
| Phase | Status |
|---|---|
| STAR reader | ✅ Done |
| Schema + Relion4 convention system | Planned |
| STAR writer + roundtrip | Planned |
| Chunked / streaming reads | Planned |
| XMD (Xmipp) | Planned |
| SQLite | Planned |
| HDF5 | Planned |
# With pandas
pip install rexlib-metadata[pandas]
# With polars
pip install rexlib-metadata[polars]
# Both
pip install rexlib-metadata[pandas,polars]Requires Python ≥ 3.9.
import rexlib_metadata as rm
result = rm.read("particles.star")
df = result.to_pandas() # pandas.DataFrame
df = result.to_polars() # polars.DataFrameAll column values come back as strings. Type conversion is intentionally deferred to the convention system (Phase 2).
print(df.columns)
# ['_rlnAngleRot', '_rlnAngleTilt', '_rlnCoordinateX', '_rlnCoordinateY', ...]
print(df.dtypes)
# All object / String — no silent inferenceSubclass Reader to add support for any format without touching Rust:
from rexlib_metadata.abc import Reader
from rexlib_metadata.result import ReadResult
from rexlib_metadata.registry import global_registry
import pyarrow as pa
class MyFormatReader(Reader):
def read_all(self, path: str) -> pa.Table:
# parse your format, return an Arrow Table
...
def read(self, path: str, **kwargs) -> ReadResult:
return ReadResult(path, self)
global_registry.register_reader([".myext"], MyFormatReader)
# Now rm.read() dispatches to your reader automatically
result = rm.read("data.myext")pip install maturin
maturin developpip install .[test]
pytestcargo test