Skip to content

Implement genomic figure rendering and template management features#16

Merged
alsmith151 merged 16 commits intomainfrom
feat/templating-for-plots
Mar 25, 2026
Merged

Implement genomic figure rendering and template management features#16
alsmith151 merged 16 commits intomainfrom
feat/templating-for-plots

Conversation

@alsmith151
Copy link
Copy Markdown
Owner

This pull request significantly improves the documentation for the PlotNado project, focusing on clarifying the dual Python API and CLI workflows, updating installation and development instructions, and providing comprehensive usage guides for both interfaces. The changes introduce new AI coding guidelines, overhaul the README and CLI documentation, and enhance discoverability of key features and best practices.

Major documentation improvements:

  • Modernized and expanded the README.md to clearly present both the Python API and CLI workflows, add quick start examples for each, and update installation and development instructions. The README now better guides users to choose the workflow that fits their needs and provides concise code and command-line examples. [1] [2] [3] [4]

  • Overhauled the CLI documentation in docs/cli.md to describe the standard workflow (init, validate, plot), provide usage examples and option explanations for each command, and clarify how the CLI integrates with the Python API.

Clarification and expansion of workflow concepts:

  • Updated docs/index.md to introduce the parallel Python API and template-driven CLI workflows, with clear examples and improved navigation to relevant documentation sections. [1] [2]
  • Improved developer and testing instructions in docs/best_practices.md and docs/api_reference.md, including updated commands for running tests and building docs, and clarified entry points for key classes and models. [1] [2]

AI coding guidelines and architecture documentation:

  • Added two new guideline documents for AI coding agents (AGENTS.md and CLAUDE.md), detailing project architecture, design decisions, extension points, and common pitfalls. These are tailored for different agent conventions and provide step-by-step instructions for adding new track types and ensuring code quality. [1] [2]

Most important changes:

1. Documentation structure and workflow clarity

  • Major rewrite of README.md to distinguish Python API vs. CLI workflows, add quick start examples for both, and improve installation/development instructions. [1] [2] [3] [4]
  • Overhaul of docs/cli.md to explain the CLI's template-driven workflow, command usage, and integration with the Python API.
  • Updates to docs/index.md to introduce and exemplify the two main usage patterns, and improve navigation to other docs. [1] [2]

2. Developer and testing workflow improvements

  • Updated instructions for running tests and building documentation using uv in docs/best_practices.md, and clarified the API reference for key entry points. [1] [2]

3. AI coding guidelines and architecture

  • Added AGENTS.md and CLAUDE.md with detailed architecture diagrams, extension instructions, and best practices for AI coding agents and contributors. [1] [2]

These changes collectively make the project easier to use, extend, and maintain, while providing clear guidance for both end users and developers.

- Implemented `render.py` to handle conversion from templates to plottable figures, including `ResolvedTrack` and `RenderPlan` classes.
- Created `template.py` to define the structure for genomic figure specifications in YAML format, including track and group specifications.
- Enhanced `bed.py` to adjust label positioning for better visibility.
- Updated `region.py` to ensure proper string representation of genomic regions.
- Modified `pyproject.toml` to include dynamic dependencies and improved package metadata.
- Added `requirements.txt` for additional dependencies including `pyyaml` and `rich`.
- Introduced CLI integration tests in `test_cli.py` for validating YAML templates and command outputs.
- Developed grouping strategy tests in `test_grouping.py` to ensure correct grouping behavior.
- Created inference tests in `test_inference.py` to validate track classification and color assignment.
- Added rendering tests in `test_render.py` to verify template compilation and group handling.
- Implemented template model tests in `test_template.py` for round-trip serialization and YAML output.
- Removed obsolete `fix_conflicts.py` script as it is no longer needed.
…ion and rendering

- Implemented `plotnado init` command to generate a YAML template from track files using inference heuristics.
- Added `plotnado plot` command to render plots for specified genomic regions based on a template.
- Introduced `plotnado validate` command to validate templates and check for missing files or group reference errors.
- Enhanced `GenomicFigure` class with a method to create figures directly from templates.
- Created a `TemplateCompiler` to handle the conversion of templates into render plans for plotting.
- Updated `Template` and `TrackSpec` classes to use `TemplateTrackType` for better clarity and type safety.
- Added comprehensive tests for the new commands and functionalities, ensuring robustness and correctness.
- Improved docstrings across multiple modules including `render.py`, `template.py`, `theme.py`, and various track classes to provide clearer descriptions and usage examples.
- Updated the `CoolerTrack`, `CapcruncherTrack`, and `CoolerAverage` classes with detailed docstrings for better understanding of their functionalities.
- Refactored the `generate_figure_overloads.py` and `generate_kwargs.py` scripts to accommodate new track types and improve type hinting.
- Adjusted CLI tests to ensure compatibility with recent changes in the `CliRunner` initialization.
- Added tests for new track types in `test_figure_refactor.py` to validate their integration within the `GenomicFigure`.
- Updated references in test files to reflect changes in file structure and naming conventions.
…lity

- Deleted outdated design specification document.
- Updated troubleshooting instructions for Python version and documentation build commands.
- Enhanced CLI plot command to correctly handle data source keyword arguments.
- Modified GenomicFigure to utilize new data source handling in add_track method.
- Introduced source_kwarg_name method in ResolvedTrack for better data source resolution.
- Added test fixture for cooler file and included a sample cooler file for testing.
- Expanded CLI tests to include plotting functionality for cooler templates and validate output.
- Ensured all references to TemplateTrackType are replaced with TrackType across the codebase.
@alsmith151 alsmith151 merged commit 6a18032 into main Mar 25, 2026
@alsmith151 alsmith151 deleted the feat/templating-for-plots branch March 25, 2026 17:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant