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.txtDependencies
requests
pytest #for testing
Usage
Query a single gene
python main.py --gene TP53Query a list of genes from a file
python main.py --file genes.txtExample 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