https://github.com/althonos/pubchem.rs

Rust data structures and client for the PubChem REST API

https://github.com/althonos/pubchem.rs

Science Score: 46.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
    Links to: ncbi.nlm.nih.gov
  • Committers with academic emails
    1 of 1 committers (100.0%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (8.9%) to scientific vocabulary

Keywords

api-client bioinformatics cheminformatics pubchem rust-library
Last synced: 5 months ago · JSON representation

Repository

Rust data structures and client for the PubChem REST API

Basic Info
  • Host: GitHub
  • Owner: althonos
  • License: mit
  • Language: Rust
  • Default Branch: main
  • Homepage: https://docs.rs/pubchem
  • Size: 43 KB
Statistics
  • Stars: 12
  • Watchers: 4
  • Forks: 1
  • Open Issues: 1
  • Releases: 2
Topics
api-client bioinformatics cheminformatics pubchem rust-library
Created about 4 years ago · Last pushed almost 3 years ago
Metadata Files
Readme Changelog License

README.md

pubchem.rs Star me

Rust data structures and client for the PubChem REST API.

Actions Codecov License Source Crate Documentation Changelog GitHub issues

🔌 Usage

💊 Compound

Create a Compound to query the PubChem API for a single compound. It can be constructed from a compound ID, from a compound name, from an InChI or InChIKey, or from a SMILES string:

```rust extern crate pubchem;

let alanine = pubchem::Compound::new(5950); let aspirin = pubchem::Compound::withname("aspirin"); let acetone = pubchem::Compound::withinchi("InChI=1S/C3H6O/c1-3(2)4/h1-2H3"); let lysine = pubchem::Compound::withinchikey("KDXKERNSBIXSRK-YFKPBYRVSA-N"); let benzene = pubchem::Compound::withsmiles("C1=CC=CC=C1"); ```

Use the methods to query the REST API with ureq. Dedicated methods exist for common single properties:

```rust let alanine = pubchem::Compound::new(5950);

alanine.title().unwrap(); // "Alanine" alanine.molecularformula().unwrap(); // "C3H7NO2" alanine.canonicalsmiles().unwrap(); // "CC(C(=O)O)N" alanine.isomeric_smiles().unwrap(); // "CC@@HN" ```

Each method will perform a single query to the PubChem API, which is inefficient if you wish to retrieve several properties at once. In that case, use the properties method and select which properties you want to retrieve in a single query:

```rust use pubchem::CompoundProperty::*;

let properties = pubchem::Compound::new(5950) .properties(&[Title, MolecularFormula, CanonicalSMILES]) .unwrap();

properties.molecularformula; // Some("C3H7NO2") properties.canonicalsmiles; // Some("CC(C(=O)O)N") properties.isomeric_smiles; // Some("CC@@HN") ```

To retrieve metadata from multiple compounds at once, use the Compounds struct and use the properties method to pack everything into a single query:

```rust use pubchem::CompoundProperty::*;

// retrieve metadata from the three aromatic L-amino acids at once for prop in pubchem::Compounds::new([6140, 145742, 6305]) .properties(&[Title, IUPACName, ExactMass]) .unwrap() { println!( "[{cid}] {title} {iupac} {mass}g/mol", cid = prop.cid, title = prop.title.unwrap(), iupac = prop.iupacname.unwrap(), mass = prop.exactmass.unwrap(), ); } ```

💭 Feedback

⚠️ Issue Tracker

Found a bug ? Have an enhancement request ? Head over to the GitHub issue tracker if you need to report or ask something. If you are filing in on a bug, please include as much information as you can about the issue, and try to recreate the same bug in a simple, easily reproducible situation.

📋 Changelog

This project adheres to Semantic Versioning and provides a changelog in the Keep a Changelog format.

🔍 See Also

If you're a bioinformatician and a Rustacean, you may be interested in these other libraries:

  • uniprot.rs: Rust data structures for the UniProtKB databases.
  • obofoundry.rs: Rust data structures for the OBO Foundry.
  • fastobo: Rust parser and abstract syntax tree for Open Biomedical Ontologies.
  • proteinogenic: Chemical structure generation for protein sequences as SMILES strings.

📜 License

This library is provided under the open-source MIT license.

This project is in no way not affiliated, sponsored, or otherwise endorsed by the PubChem developers. It was developed by Martin Larralde during his PhD project at the European Molecular Biology Laboratory in the Zeller team. PubChem® is a registered trademark of the US National Library of Medicine.

Owner

  • Name: Martin Larralde
  • Login: althonos
  • Kind: user
  • Location: Heidelberg, Germany
  • Company: EMBL / LUMC, @zellerlab

PhD candidate in Bioinformatics, passionate about programming, SIMD-enthusiast, Pythonista, Rustacean. I write poems, and sometimes they are executable.

GitHub Events

Total
  • Watch event: 5
Last Year
  • Watch event: 5

Committers

Last synced: 10 months ago

All Time
  • Total Commits: 19
  • Total Committers: 1
  • Avg Commits per committer: 19.0
  • Development Distribution Score (DDS): 0.0
Past Year
  • Commits: 0
  • Committers: 0
  • Avg Commits per committer: 0.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Martin Larralde m****e@e****e 19
Committer Domains (Top 20 + Academic)
embl.de: 1

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 1
  • Total pull requests: 8
  • Average time to close issues: 9 days
  • Average time to close pull requests: about 1 month
  • Total issue authors: 1
  • Total pull request authors: 1
  • Average comments per issue: 2.0
  • Average comments per pull request: 0.88
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 8
Past Year
  • Issues: 1
  • Pull requests: 0
  • Average time to close issues: 9 days
  • Average time to close pull requests: N/A
  • Issue authors: 1
  • Pull request authors: 0
  • Average comments per issue: 2.0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • bhargavakula01 (1)
Pull Request Authors
  • dependabot[bot] (8)
Top Labels
Issue Labels
question (1)
Pull Request Labels
dependencies (8)

Packages

  • Total packages: 1
  • Total downloads:
    • cargo 5,256 total
  • Total dependent packages: 1
  • Total dependent repositories: 1
  • Total versions: 2
  • Total maintainers: 1
crates.io: pubchem

Rust data structures and client for the PubChem API.

  • Versions: 2
  • Dependent Packages: 1
  • Dependent Repositories: 1
  • Downloads: 5,256 Total
Rankings
Dependent repos count: 16.6%
Dependent packages count: 18.2%
Average: 30.4%
Stargazers count: 31.2%
Forks count: 40.6%
Downloads: 45.3%
Maintainers (1)
Last synced: 6 months ago

Dependencies

.github/workflows/test.yml actions
  • actions-rs/cargo v1 composite
  • actions-rs/tarpaulin v0.1 composite
  • actions-rs/toolchain v1 composite
  • actions/cache v2 composite
  • actions/checkout v1 composite
  • codecov/codecov-action v2 composite
  • rasmus-saks/release-a-changelog-action v1.0.1 composite
Cargo.toml cargo