Simulate Tomograms
cylindra
implements several methods to simulate cylindric structures.
Open simulator widget
GUI: Image > Simulate cylindric structure
or Ctrl+K → I
The simulator widget is available at ui.simulator
.
Prepare a spline with arbitrary shape
Before running simulation, you have to place molecules at the desired positions and orientations. To do this, you can first create an empty image, and draw splines of any shape on it.
API: create_empty_image
GUI: Simulator widget > Create > Create empty image
The image size and the pixel scale will be directly used as the simulated tomograms.
Note
You can also call mapping functions on splines tagged with helical parameters measured by CFT.
Simulate cylinder with constant periodicity
API: generate_molecules
GUI: Simulator widget >
With spline-to-molecules mapping functions, the molecules were initialized based on the helical parameters of the spline. Instead of referring to the measured parameters, you can generate molecules along the spline with arbitrary parameters. Following GIF shows how to adjust parameters while previewing the result.
The generated molecules will be added to the viewer with some names like Mole(Sim)-0
.
Apply local conformational changes to molecules
The method above can only generate molecules with constant parameters. To simulate local conformational changes, you can use the following method. Common parameters are:
by
: the amount of change.yrange
: the longitudinal range of the local region.yrange=(5, 10)
means that the 5th molecules to the 9th (end excluded!) molecules from the edge will be affected.arange
: the lateral range of the local region.arange=(2, 5)
means that the molecules in the 2nd to 4th (end excluded!) protofilaments will be affected.
and the preview is also available.
Local expansion/compaction
API: expand
GUI: Simulator widget >
Programatically apply local expansion
This script will expand the 10th to 20th molecules (all the protofilaments) from the
tip in the layer named "Mole(Sim)-0"
by 0.1 nm.
ui.simulator.expand("Mole(Sim)-0", by=0.1, yrange=(10, 20))
Local twisting
API: twist
GUI: Simulator widget >
Local dilation
API: dilate
GUI: Simulator widget >
Define conformational changes by expressions
API: displace
GUI: Simulator widget >
simulate supertwist
After seam-searching, column "isotype-id" will be added to the molecules layer, which indicates the alpha/beta isotype of each molecule.
dtheta = 0.05
ui.simulator.displace(
layer="Mole(Sim)-0",
twist=pl.when(pl.col("isotype-id").eq(1)).then(-dtheta).otherwise(dtheta)
)
Asign Density to Molecules
API: add_component
GUI: Simulator widget >
Note
Before this step, you can run any operations on the molecules, such as filtration and split/combine.
Once the molecules are ready, you have to assign a template image to each molecules layer for simulation. In this method, you can select image files and assign them to one of the molecules layers in the viewer. The image don't have to be scaled; it will automatically be rescaled to the pixel scale of the tomogram.
Simulate Tomograms from Molecules
There are several methods to simulate images from molecules.
1. Simulate tomograms and save as image files
API: simulate_tomogram
GUI: Simulator widget > Simulate > Simulate tomogram
![simulate_tomogram]
2. Simulate a tomogram and open it in the viewer
API: simulate_tomogram_and_open
GUI: Simulator widget > Simulate > Simulate tomogram and open
3. Simulate tilt series
API: simulate_tilt_series
GUI: Simulator widget > Simulate > Simulate tilt series
4. Simulate tomogram from a tilt series
API: simulate_tomogram_from_tilt_series
GUI: Simulator widget > Simulate > Simulate tomogram from tilt series
5. Simulate a 2D projection
API: simulate_projection
GUI: Simulator widget > Simulate > Simulate projection