kegg-api

Crates.iokegg-api
lib.rskegg-api
version0.3.0
created_at2025-12-04 09:16:04.751537+00
updated_at2025-12-05 08:40:57.552769+00
descriptionA wrapper for kegg api
homepage
repositoryhttps://github.com/MoleSir/kegg-api
max_upload_size
id1966220
size126,017
(MoleSir)

documentation

README

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

Commit count: 0

cargo fmt