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
3x3xL
array of residue backbone atom coordinates (N, Ca, C), or a vector of these for each chain. - a
BioStructures.MolecularStructure
orBioStructures.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
Colorant
s, one per residue. For example,RGBA(1, 0, 0, 0.5)
for a 50% transparent red. Load theColorTypes
orColors
package to create suchColorant
s.
# Load protein data from a PDB file
chains = readpdb("test/data/1ASS.pdb")
colors = rand.(length.(chains))
ribbon_scene(chains, colors=colors, colormap=:hsv)
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)