ProtPlot is a Julia package for rendering 3D protein ribbon and other miscellaneous protein-related plots using Makie.jl.
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
3x3xLarray of residue backbone atom coordinates (N, Ca, C), or a vector of these for each chain. - a
BioStructures.MolecularStructureorBioStructures.Chain. - a PDB file path.
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)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
Colorants, one per residue. For example,RGBA(1, 0, 0, 0.5)for a 50% transparent red. Load theColorTypesorColorspackage to create suchColorants.
# 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:
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:
Makie allows programmatic control over the camera.
Use the camcontrols keyword to control the initial view in a ribbon_scene call:
ribbon_scene("test/data/1ASS.pdb", camcontrols=(; lookat=Vec3f(30, 0, 60), eyeposition=Vec3f(160, -75, 0), upvector=Vec3f(0, 0, 1)))- BioMakie.jl (designed for more interactivity)




