GitHunt
PS

PSBioinfo/gene_annotator

Command-line tool for retrieving and logging human gene annotations from MyGene.info

Gene_Annotator

Command-line tool for retrieving and logging human gene annotations from MyGene.info. Supports single gene queries or batch queries from a file.

Features

  • Query a single gene ('--gene') or a list of genes ('--file')
  • Uses MyGene.info live API
  • Prints results to console
  • Logs annotated results to 'annotation_logs.txt'
  • Handles missing data and alternate formats
  • Fully unit-tested with 'pytest'

Installation

#Clone the repo
git clone https://github.com/PSBioinfo/gene_annotator.git
cd gene_annotator

#Create a virtual environment
python3 -m venv venv
source venv/bin/activate

#Install dependencies
pip install -r requirements.txt

Dependencies

requests
pytest #for testing

Usage

Query a single gene

python main.py --gene TP53

Query a list of genes from a file

python main.py --file genes.txt

Example genes.txt:

TP53
BRCA1
EGFR
AIF1

Sample output:

Looking up: TP53
Name: tumor protein p53
Entrez: 7157
Ensembl: ENSG00000141510

๐Ÿ“ Results saved to: annotation_log.txt

Running Tests

pytest tests/

Project Structure

gene_annotator/
โ”œโ”€โ”€ main.py # CLI tool
โ”œโ”€โ”€ annotator.py # Core logic (API query)
โ”œโ”€โ”€ tests/
โ”‚ โ””โ”€โ”€ test_core.py # Unit tests for annotation function
โ”œโ”€โ”€ annotation_log.txt # Output log (auto-generated)
โ”œโ”€โ”€ requirements.txt # Dependencies
โ””โ”€โ”€ README.md

License

MIT License