Instruction file imported from murphycj/AGFusion (
.github/instructions/python.instructions.md). Copyright stays with the author.
AGFusion Python Guidelines
Code Style
- Format all Python code with black (
line-length = 100) - Target Python 3.9 - 3.13
- Run
black .before committing
Module Responsibilities
| Module | Purpose |
|---|---|
agfusion/model.py |
Core domain classes: _Gene, Fusion. Holds exon/protein architecture logic. |
agfusion/database.py |
AGFusionDB — SQLite-backed store of protein domain annotations (Pfam, TMHMM, etc.) |
agfusion/parsers.py |
Parsers for fusion-finding algorithm output files (one parser per algorithm) |
agfusion/plot.py |
Matplotlib-based visualization of protein domain and exon structures |
agfusion/cli.py |
Click-based CLI entry points: annotate, batch, download |
agfusion/utils.py |
Shared utility functions |
agfusion/exceptions.py |
Custom exception classes |
Python Conventions
- Protein database annotation keys:
"pfam","tmhmm", etc. pyensembl.EnsemblReleaseobjects provide transcript/exon lookups- Add new fusion-finding parsers to
parsers.py— one parser per algorithm
Testing
- Tests use
unittest.TestCaseintest/ - Tests require local AGFusion
.dbfiles and pyensembl data installed - Add new test cases to
test_base.py,test_parsers.py, ortest_plots.pyas appropriate - Run tests with:
python -m pytest test/