7 releases (breaking)
Uses new Rust 2024
new 0.43.0 | Mar 16, 2025 |
---|---|
0.42.0 | Mar 15, 2025 |
0.40.0 | Mar 13, 2025 |
0.39.0 | Mar 13, 2025 |
0.36.0 | Mar 12, 2025 |
#585 in Parser implementations
461 downloads per month
55KB
1K
SLoC
pombase-gocam
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::gocam_parse;
fn main() {
let mut source = File::open("gomodel_665912ed00002626.json").unwrap();
// Low level representation:
let raw_model = gocam_parse(&mut source).unwrap();
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 individual_type = &subject_individual.types[0];
if let Some(ref label) = individual_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());
}
}
}
Authors
The library was developed by the PomBase project.
Dependencies
~3–4MB
~74K SLoC