You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

go3

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

go3

Semantic similarity computations using Gene Ontology with Rust performance

0.2.0
pipPyPI
Maintainers
1

GO3: High-Performance Gene Ontology Semantic Similarity in Rust + Python

PyPI version PyPI Version Documentation License

🚀 GO3 is a high-performance Rust library with Python bindings for calculating semantic similarity between Gene Ontology (GO) terms and gene products. Designed to be significantly faster and more memory-efficient than traditional Python libraries like goatools, GO3 provides state-of-the-art similarity measures including Resnik, Lin, Jiang-Conrath, SimRel, GraphIC, Information Coefficient, and Wang.

Features

✅ Ultra-fast ontology loading (50x faster than Goatools)
✅ Parallel computation of semantic similarity (Resnik, Lin, Jiang-Conrath, SimRel, GraphIC, IC Coefficient, Wang)
✅ Both term-to-term and gene-to-gene similarity
✅ Supports batch processing of large datasets
✅ Full compatibility with Gene Association Files (GAF)
✅ Low memory footprint thanks to Rust's performance

Installation

Python (via PyPI)

pip install go3

✅ Requires Python 3.8+ ✅ Rust is bundled via maturin, no manual compilation needed

Quick Start

import go3

# Load Gene Ontology (GO) terms and annotations
go_terms = go3.load_go_terms()
annotations = go3.load_gaf("goa_human.gaf")

# Build IC Counter
counter = go3.build_term_counter(annotations)

# Compute Resnik similarity between two GO terms
sim = go3.semantic_similarity("GO:0008150", "GO:0009987", 'resnik', counter)
print(f"Resnik similarity: {sim:.4f}")

# Compute similarity between two genes using Lin and Best-Match Average (BMA)
score = go3.compare_genes("TP53", "BRCA1", "BP", "lin", "bma", counter)
print(f"Gene similarity (Lin, BMA): {score:.4f}")

Supported Similarity Measures

MeasureTypeReference
ResnikIC-basedResnik, 1995
LinIC-basedLin, 1998
Jiang-ConrathIC-basedJiang & Conrath, 1997
SimRelIC-basedSchlicker et al., 2006
GraphICHybridLi et al., 2010
IC CoefficientHybridLi et al., 2010
WangTopologyWang et al., 2007
TopoICSimHybridEhsani et al., 2016

For the theoretical details behind each measure, see the Similarity Measures Documentation.

Batch Processing

GO3 natively supports efficient parallel batch computations for both term and gene similarity.

Batch GO Term Similarity

pairs = [("GO:0008150", "GO:0009987"), ("GO:0008150", "GO:0003674")]
scores = go3.batch_similarity([a for a, _ in pairs], [b for _, b in pairs], "resnik", counter)

Batch Gene Similarity

gene_pairs = [("TP53", "BRCA1"), ("EGFR", "AKT1")]
scores = go3.compare_gene_pairs_batch(gene_pairs, "BP", "resnik", "bma", counter)

Both resnik and lin (and all other similarity methods) are fully supported in batch mode.

Benchmark

This library is built as fast, scalable and memory-efficient as possible. Comparing with Goatools, which is the de facto library for manipulating GO in Python

We compare the time and peak memory consumption of go3 vs goatools while loading the ontology and the annotation (.GAF) file, and building the TermCounter.

Loading time & memory

We also compare the speed of the libraries calculating the similarities between batches of GO Terms of different sizes.

Batch similarity speed

Finally, we compare the gene similarity calculation times. Goatools does not implement natively the groupwise algorithms to compare genes, so we built it for a fair comparison in top of the GO term semantic similarities of the library.

Gene similarity speed

Contributing

We welcome contributions!

Steps to contribute:

  • Fork the repository.
  • Create a feature branch:
    git checkout -b feature/my-feature
    
  • Implement your changes with tests.
  • Run tests:
    pytest tests/
    
  • Submit a Pull Request.

License

MIT License © Jose Luis Mellina Andreu, 2025

📄 Full documentation: https://go3.readthedocs.io

🐞 Report issues: https://github.com/Mellandd/go3/issues

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts