qsar/lib.rs
1#![warn(missing_docs)]
2//! qsar — a small, focused Rust library for QSAR-related utilities.
3//!
4//! This crate provides:
5//! - `descriptors` — a lightweight exact molecular-weight calculator from SMILES/InChI (small, pure-Rust parser).
6//! - `data_io` — small CSV helpers to load descriptor matrices and target vectors.
7//! - `models` — helpers to convert descriptor vectors into `ndarray` and a minimal Linfa example.
8//!
9//! The initial release intentionally avoids heavy native FFI dependencies (Open Babel / RDKit) so
10//! the crate stays portable and easy to publish. Full parser/toolkit integration can be added later
11//! behind optional Cargo features.
12//!
13//! # Quick examples
14//!
15//! Compute exact molecular weight (SMILES):
16//!
17//! ```no_run
18//! use qsar::molecular_weight;
19//!
20//! let mw = qsar::descriptors::molecular_weight("CCO").expect("compute MW");
21//! println!("Ethanol MW: {}", mw);
22//! ```
23//!
24//! Convert vectors to `ndarray` and train a simple linear model (see `models`):
25//!
26//! ```no_run
27//! use qsar::models::train_and_predict_example;
28//! let pred = train_and_predict_example().expect("train and predict");
29//! println!("Prediction: {:?}", pred);
30//! ```
31//!
32//! Load descriptors from CSV (see `data_io`):
33//!
34//! ```no_run
35//! use qsar::data_io::read_csv_descriptors;
36//! let (x, y) = read_csv_descriptors("data/dataset.csv", &["mol_wt", "logp"], "pIC50")?;
37//! # Ok::<(), Box<dyn std::error::Error>>(())
38//! ```
39pub mod descriptors;
40pub mod data_io;
41pub mod models;
42
43// Re-exports for convenience (stable API surface)
44pub use descriptors::molecular_weight;
45pub use data_io::read_csv_descriptors;
46pub use models::{to_ndarrays, train_and_predict_example};