A tool for visualizing Newick format phylogenetic trees
Project description
Newick Tree Visualizer
A tool for creating interactive visualizations of phylogenetic trees in Newick format.
โญ Support the Project
If you find this project helpful, please consider giving it a star on GitHub! It helps make the project more visible and encourages further development.
โจ Features
- ๐ณ Interactive visualization of phylogenetic trees
- ๐จ Configurable node and branch styling
- ๐ฏ Custom grouping and coloring of nodes
- ๐ Multiple layout directions (right, left, up, down)
- ๐ Draggable nodes for manual layout adjustments
- ๐พ Multiple export formats (HTML, PNG, JPG, PDF)
- โก๏ธ Support for large-scale trees
- ๐ฏ Optional confidence values display
๐ฆ Installation
System Dependencies
Google Chrome is required:
# macOS
brew install --cask google-chrome
# Ubuntu
sudo apt-get update
sudo apt-get install google-chrome-stable
# CentOS
sudo yum install google-chrome-stable
Python Package
pip install newick-visualizer
๐ Quick Start
Basic Usage
newick-viz input.nwk groups.json -o output.html
Example with Options
newick-viz input.nwk groups.json \
-o output.jpg \
--padding 21 \
--points 8 \
--distance-threshold 1.5 \
--min-branch-length 35 \
--default-length 60 \
--max-branch-length 80 \
--opacity 0.6 \
--font-size 13 \
--font-weight bold \
--link-width 3.0 \
--link-color '#f7cc4f' \
--render-delay 2000
Export Formats
Supports multiple output formats:
# Interactive HTML
newick-viz input.nwk groups.json -o tree.html
# Static Images
newick-viz input.nwk groups.json -o tree.jpg
newick-viz input.nwk groups.json -o tree.png
# PDF Document
newick-viz input.nwk groups.json -o tree.pdf
๐ฎ Interactive Features
๐ฑ๏ธ Node Dragging
- Click and drag any node to manually adjust its position
- Connected lines and group backgrounds will update automatically
- Visual feedback during dragging (node highlight and size change)
- Changes persist in the visualization
โฉ๏ธ Undo Function
- Undo button available in the top-left corner
- Reverts the last node movement
- Multiple levels of undo supported
- Visual feedback when undo is available/unavailable
- Keyboard shortcut support (โ/โ + Z)
โจ Hover Effects
- Nodes enlarge slightly on hover
- Labels become more prominent
- Smooth transitions for all visual changes
๐ ๏ธ Configuration Options
Basic Options
-o, --output: Output file path [default: tree_visualization.html]--render-delay: Rendering delay in milliseconds [default: 2000]
Visual Style
--padding: Padding around nodes in pixels [default: 35]--opacity: Opacity of group backgrounds (0-1) [default: 0.3]--points: Number of points around each node [range: 6-24] [default: 12]--distance-threshold: Distance threshold for group backgrounds [default: 1.2]
Font Settings
--font-size: Font size in pixels [default: 12]--font-family: Font family [default: "Arial, sans-serif"]--font-weight: Font weight [default: "normal"]
Branch Settings
--min-branch-length: Minimum branch length [default: 30]--max-branch-length: Maximum branch length [default: 70]--default-length: Default length when no confidence value [default: 40]
Connection Line Style
--link-color: Color of connecting lines [default: "#999999"]--link-width: Width of connecting lines [default: 1.5]
Other Settings
--show-confidence: Show confidence values [flag]
๐ Input File Formats
Newick File
Uses standard Newick format, for example:
((A:0.1,B:0.2)0.95:0.3,C:0.4);
Groups Configuration File (JSON)
{
"layout": {
"direction": "right",
"groupOrder": ["Group1", "Group2"]
},
"groups": {
"Group1": {
"color": "#ffcdd2",
"members": ["A", "B"],
"order": ["B", "A"]
},
"Group2": {
"color": "#c8e6c9",
"members": ["C"],
"order": ["C"]
}
}
}
๐ง Development Installation
git clone https://github.com/Bengerthelorf/newick-visualizer.git
cd newick-visualizer
pip install -e .
Project Structure
.
โโโ _version.py
โโโ LICENSE
โโโ MANIFEST.in
โโโ newick_visualizer/
โ โโโ __init__.py
โ โโโ core/
โ โ โโโ tree_generator.py
โ โ โโโ template_manager.py
โ โ โโโ utils.py
โ โโโ templates/
โ โโโ base.html
โ โโโ scripts/
โ โ โโโ tree.js
โ โ โโโ layout.js
โ โ โโโ groups.js
โ โ โโโ main.js
โ โโโ styles/
โ โโโ main.css
โโโ README.md
โโโ setup.py
๐ค Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch:
git checkout -b feature/amazing-feature - Commit your changes:
git commit -m 'Add amazing feature' - Push to the branch:
git push origin feature/amazing-feature - Open a Pull Request
If you have any suggestions or feedback, please submit them on our GitHub Issues page.
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
๐ Acknowledgments
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file newick_visualizer-1.1.1.tar.gz.
File metadata
- Download URL: newick_visualizer-1.1.1.tar.gz
- Upload date:
- Size: 28.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
86ddae190c31f94d688c1ff8d946a48c7e3e84f39f94d31ade5034a5b1b067a1
|
|
| MD5 |
e3321afa6ee3d193abcd8d2a8fb561ff
|
|
| BLAKE2b-256 |
85d3e97d025eaf2bd4b140deade3b8c6e288ef5b5286169009cfab446f29980e
|
File details
Details for the file newick_visualizer-1.1.1-py3-none-any.whl.
File metadata
- Download URL: newick_visualizer-1.1.1-py3-none-any.whl
- Upload date:
- Size: 34.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
999884a44ba8917c1ae5b817092d7ff0d841423bd72e4f88fc7ecdb023146fa6
|
|
| MD5 |
e2d2662489745b2ec6eec41f8aef3326
|
|
| BLAKE2b-256 |
c2e09b3c4db73bc9a4fce7d3e61f2d87271edad54e6d50db51bafb59dcebe93b
|