3 releases (breaking)
Uses new Rust 2024
| 0.3.0 | Dec 5, 2025 |
|---|---|
| 0.2.0 | Dec 5, 2025 |
| 0.1.0 | Dec 4, 2025 |
#1865 in Database interfaces
81KB
1K
SLoC
kegg api
A wrapper for the KEGG API
Examples
Asynchronous API (default)
use kegg_api::{InfoDb, kid, FindDb, FindOption, OutsideDb, Org, hsa, ece, LinkDb};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// displays the current statistics of the KEGG database
kegg_api::info(InfoDb::Kegg).await?;
// returns the list of a compound entry and a glycan entry
kegg_api::list([kid!(C01290), kid!(G00092)]).await?;
// for chemical formula "C7H10O5"
kegg_api::find(FindDb::Compound, "C7H10O5", Some(FindOption::Formula)).await?;
// retrieves a human gene entry and an E.coli O157 gene entry
kegg_api::get([hsa!(10458), ece!(Z5100)], None).await?;
// conversion from NCBI GeneID to KEGG ID for E. coli genes
kegg_api::conv((OutsideDb::NcbiGeneId, Org::Eco)).await?;
// KEGG pathways linked from a human gene and an E. coli O157 gene
kegg_api::link(([hsa!(10458), ece!(Z5100)], LinkDb::Pathway)).await?;
// check if drug-drug interactions are present among given drugs
kegg_api::ddi([kid!(D00564), kid!(D00100), kid!(00109)]).await?;
Ok(())
}
Synchronous API (optional)
Enable the blocking feature in Cargo.toml:
kegg-api = { version = "0.2.0", features = ["blocking"] }
use kegg_api::{InfoDb, kid, FindDb, FindOption, OutsideDb, Org, hsa, ece, LinkDb};
fn main() -> Result<(), Box<dyn std::error::Error>> {
kegg_api::blocking::info(InfoDb::Kegg)?;
kegg_api::blocking::list([kid!(C01290), kid!(G00092)])?;
kegg_api::blocking::find(FindDb::Compound, "C7H10O5", Some(FindOption::Formula))?;
kegg_api::blocking::get([hsa!(10458), ece!(Z5100)], None)?;
kegg_api::blocking::conv((OutsideDb::NcbiGeneId, Org::Eco))?;
kegg_api::blocking::link(([hsa!(10458), ece!(Z5100)], LinkDb::Pathway))?;
kegg_api::blocking::ddi([kid!(D00564), kid!(D00100), kid!(00109)])?;
Ok(())
}
Features
- info
- list
- find
- get
- conv
- link
- ddi
LICENSE
MIT
References
Dependencies
~6–22MB
~235K SLoC