pombase-gocam

Crates.iopombase-gocam
lib.rspombase-gocam
version0.96.0
created_at2025-03-12 10:50:00.815622+00
updated_at2025-09-19 00:01:37.215799+00
descriptionParser for Gene Ontology Consortium GO-CAM JSON files
homepage
repositoryhttps://github.com/pombase/pombase-gocam
max_upload_size
id1589634
size3,507,552
Members (github:ssbc:members)

documentation

README

pombase-gocam

build status Crates.io Documentation GitHub

Code for parsing and processing GO-CAM JSON format model files.

There is a low level representation which closely matches the JSON data: GoCamRawModel (containing Fact, Individual and Annotation structs).

And a higher level representation, GoCamModel, implemented as a graph of nodes (activities, chemical, complexes etc.) and edges (mostly causal relations).

The high level representation is similar to the GO CAM Data Model - gocam-py

See the documentation on docs.rs for usage.

Example

curl -L https://live-go-cam.geneontology.io/product/json/low-level/665912ed00002626.json |
  jq . > gomodel_665912ed00002626.json

use std::fs::File;
use pombase_gocam::raw::gocam_parse_raw;

fn main() {
    let mut source = File::open("gomodel_665912ed00002626.json").unwrap();

    // Low level representation:
    let raw_model = gocam_parse_raw(&mut source).unwrap();
    assert_eq!(raw_model.id(), "gomodel:665912ed00002626");

    for fact in raw_model.facts() {
        let subject_id = &fact.subject;
        println!("subject_id: {}", subject_id);
        let subject_individual = raw_model.get_individual(subject_id);
        let first_type = &subject_individual.types[0];
        if let Some(ref label) = first_type.label {
            println!("type label: {}", label);
        }
    }

    // Higher level representation:
    use pombase_gocam::{GoCamModel, GoCamNodeType};
    let model = GoCamModel::new(raw_model);

    for (_, node) in model.node_iterator() {
        println!("node: {}", node);
        if let GoCamNodeType::Activity(ref enabler) = node.node_type {
            println!("enabler ID: {}", enabler.id());
        }
    }
}
cargo run

Authors

The library was developed by the PomBase project.

Commit count: 263

cargo fmt