https://github.com/murrellgroup/protplot.jl
Protein ribbon plots implemented in Julia using Makie
https://github.com/murrellgroup/protplot.jl
julia makie plot protein ribbon
Last synced: 3 months ago
JSON representation
Protein ribbon plots implemented in Julia using Makie
- Host: GitHub
- URL: https://github.com/murrellgroup/protplot.jl
- Owner: MurrellGroup
- License: mit
- Created: 2023-10-30T13:29:19.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2025-08-14T08:28:39.000Z (4 months ago)
- Last Synced: 2025-09-16T17:55:13.725Z (3 months ago)
- Topics: julia, makie, plot, protein, ribbon
- Language: Julia
- Homepage:
- Size: 7.78 MB
- Stars: 21
- Watchers: 4
- Forks: 1
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
#
ProtPlot
[](https://MurrellGroup.github.io/ProtPlot.jl/stable/)
[](https://MurrellGroup.github.io/ProtPlot.jl/dev/)
[](https://github.com/MurrellGroup/ProtPlot.jl/actions/workflows/CI.yml?query=branch%3Amain)
[](https://codecov.io/gh/MurrellGroup/ProtPlot.jl)
ProtPlot is a Julia package for rendering 3D protein ribbon and other miscellaneous protein-related plots using [Makie.jl](https://github.com/MakieOrg/Makie.jl).
## Examples
Ribbon plots are constructed from vectors of protein backbones represented as `3x3xL` arrays.
For convenience, argument conversion methods are defined, and the ribbon constructors can take:
- a `3x3xL` array of residue backbone atom coordinates (N, Ca, C), or a vector of these for each chain.
- a `BioStructures.MolecularStructure` or `BioStructures.Chain`.
- a PDB file path.
```julia
using GLMakie # use the GLMakie backend
using ProtPlot
# Create and display a ribbon plot in an interactive window
ribbon_scene("test/data/1ASS.pdb", backgroundcolor=:black, colormap=:jet)
```

## Customizing colors
Use the `colors` keyword argument to customize colors at the residue level. This argument should be a vector of vectors, where each vector contains either:
- values between 0 and 1, representing the colors of each residue in their respective chains according to the `colormap`.
- a list of [`Colorant`s](https://github.com/JuliaGraphics/ColorTypes.jl?tab=readme-ov-file#colortypes), one per residue. For example, `RGBA(1, 0, 0, 0.5)` for a 50% transparent red. Load the `ColorTypes` or `Colors` package to create such `Colorant`s.
```julia
# Load protein data from a PDB file
chains = readpdb("test/data/1ASS.pdb")
colors = rand.(length.(chains))
ribbon_scene(chains, colors=colors, colormap=:hsv)
```

Chains can be colored by chain using something like:
```julia
colormap = [:royalblue, :violet, :limegreen, :chocolate1]
colors = [fill(i-1, l) / (length(colormap)-1) for (i, l) in enumerate(length.(struc))]
ribbon!(scene, chains; colors, colormap)
```
and then you might get something like:

## Camera controls
Makie allows programmatic control over the [camera](https://docs.makie.org/stable/explanations/cameras/index.html).
Use the `camcontrols` keyword to control the initial view in a `ribbon_scene` call:
```julia
ribbon_scene("test/data/1ASS.pdb", camcontrols=(; lookat=Vec3f(30, 0, 60), eyeposition=Vec3f(160, -75, 0), upvector=Vec3f(0, 0, 1)))
```

## See also
- [BioMakie.jl](https://github.com/BioJulia/BioMakie.jl) (designed for more interactivity)