Welcome to the gEAR developer documentation. This guide is intended for developers working on the gEAR codebase.
- Setup Guides - Server installation and configuration
- Services - Microservices documentation (ProjectR, Spatial Panel)
- Architecture Overview
- Development Workflow
gEAR is a LAMP-stack portal with the following key components:
- Python/Flask API: Main API endpoints in
www/api/ - Legacy CGI: Single-purpose scripts in
www/cgi/(still in use) - MySQL Database: Metadata and user data storage
- HDF5/H5AD: Large expression matrix storage using AnnData format
- RabbitMQ: Message broker for async job processing
- Libraries: Core functionality in
lib/
- JavaScript: ES modules in
www/js/- Files with
.v2suffix are newer UI code - jQuery-based code is legacy (being phased out)
- Files with
- D3.js & Snap.svg: SVG-based data visualization
- Plot.ly: Interactive plots
- Bulma: CSS framework (
www/css/bulma/) - Plugin Support: in
www/plugins/
- ProjectR Service: Containerized microservice for matrix projection
- Spatial Panel: Dashboard service using Panel (Holoviz suite)
- RabbitMQ Consumers: Background workers in
listeners/ - Systemd Services: Service templates in
systemd/
- Scanpy: tSNE/UMAP plots and single-cell analysis
- AnnData: Primary data structure for datasets
- SpatialData: Zarr-based spatial data storage
We follow the nvie.com git branching model:
main: Production-ready codedevel: Development branch- Feature branches:
feature/feature-name - Hotfix branches:
hotfix/issue-description
-
Clone the Repository
git clone https://github.com/IGS/gEAR.git cd gEAR -
Follow Setup Guides
- See setup/README.md for detailed instructions
- Recommended: 16+ cores, 100GB+ RAM for production-like environment
-
Configure gear.ini
cp gear.ini.template gear.ini # Edit gear.ini with your configuration -
Install Git Hooks (Pre-commit)
This project uses pre-commit to manage git hooks. These hooks automatically:
- Bump the cache version in
www/site_domain_prefs.jsonon commits with code changes - Check code formatting and linting with Ruff
- Fix common issues like trailing whitespace and file endings
Setup:
# Install pre-commit framework pip install pre-commit # Install the git hooks defined in .pre-commit-config.yaml pre-commit install # (Optional) Run the hooks on all files to verify setup pre-commit run --all-files
After this, the hooks will run automatically on every
git commit. See the cache busting guide for details on how the cache version bump works. - Bump the cache version in
-
UI Tests: Automated tests using Mocha, Chai, and Playwright
cd tests npm test
-
API Tests: Planned (not yet implemented)
-
Front-end tests mock API responses for speed and CI compatibility
- Use snake_case for variables/functions, PascalCase for classes
- Follow PEP 8 style guide
- Use Ruff for linting/formatting when available
- Type hints encouraged but not required
- Functional style using ES6+ features
- Prefer
constoverfunctionfor arrow functions - Prefer
for...ofloops overforEach - Use camelCase for variables/functions, PascalCase for classes
- Use
getElementById/getElementsByClassNameoverquerySelectorwhen possible
- Imports (must be at top)
- Constants and variables
- Functions and classes
- Initialization logic
- Event listeners (at bottom to avoid hoisting issues)
gEAR/
├── bin/ # Utility scripts (see ../misc/scripts/README.md)
├── docs/ # Documentation
│ ├── analyst/ # Analyst documentation
│ ├── developer/ # Developer documentation (you are here)
│ ├── misc/ # Miscellaneous documentation
│ ├── wiki/ # End-user wiki content
│ ├── posters/ # Historical presentations (DO NOT MODIFY)
│ └── ui-v2-design/ # UI v2 prototypes (DO NOT MODIFY)
├── docker/ # Docker configuration
├── lib/ # Python libraries
├── listeners/ # RabbitMQ consumer scripts
├── services/ # Microservices (ProjectR, Spatial)
├── systemd/ # Systemd service templates
├── tests/ # Automated tests
└── www/ # Web application
├── api/ # Flask API
├── cgi/ # Legacy CGI scripts
├── css/ # Stylesheets (Bulma)
├── datasets/ # Dataset storage (H5AD files)
└── js/ # JavaScript code
- Datasets are stored as H5AD files (AnnData format)
- Reading datasets:
adata = anndata.read_h5ad(path) - Spatial data uses Zarr stores, converted to AnnData for analysis
- Create a feature branch from
devel - Implement changes following code guidelines
- Write/update tests
- Test locally
- Create pull request to
devel
See setup/services.md for details on:
- Starting systemd services
- Running ProjectR locally vs Cloud Run
- Running spatial panel dashboard
- Backend: Check logs in
/var/log/apache2/or use Flask debugging - Frontend: Browser developer tools
- Services:
sudo journalctl -u <service-name>
- Gosling: Epigenome browser for visualizing epigenetic data (replaced Epiviz)
- ProjectR: Microservice for matrix projection (Docker/Cloud Run)
Main configuration file: gear.ini
Key sections:
[database]: MySQL connection[projectr_service]: ProjectR endpoint configuration[rabbitmq]: Message broker settings
- GitHub Wiki: End-user documentation
- Issue Tracker: GitHub Issues
- Production Instances:
- UMgEAR - Hearing research
- NeMO Analytics - Brain research
- Check this documentation
- Review relevant code examples in the repository
- Ask team members (@adkinsrs maintains infrastructure docs)
- Create an issue on GitHub
- Fork the repository
- Create a feature branch
- Make your changes following the guidelines
- Submit a pull request
All contributions should include:
- Clear commit messages
- Updated documentation
- Tests (when applicable)
- Code following style guidelines