New guide article on 3D Flexible Refinement mesh creation

Hello CryoSPARC users! We have created a new guide tutorial which goes into significant detail on the tetrahedral mesh used in 3D Flexible Refinement. This new page covers

  1. Why a tetrahedral mesh is needed
  2. How the mesh is used to model deformation of the target
  3. When a custom mesh (as opposed to the default mesh generated by the 3D Flex Mesh Prep job) is needed
  4. The process by which you can create a custom mesh
  5. Potential pitfalls in custom mesh creation, with special care paid to the treatment of the micelle in membrane proteins

The material is also covered in video form here.

In some cases, changes in mesh topology can produce significant improvements in the quality of flexible refinement results. We hope that this new page helps improve the quality of your experiments with this technique!


Thanks a lot for the tutorial this is super helpful!

Regarding the tetra-mesh preparation, is it possible that we could use multiple map files to generate a combined map automatically segments based on these independent maps? The reason behind is that it is sometimes not accurate to do this via the map segmentation tool. Thanks a lot.

Hi @nym2834610! I’m not sure I quite understand your goal — could you give me a bit more detail about what you’re trying to do, and the issues you run into using Segger?

Hello, what I meant was instead of using segger, for example we have a protein complex of three domains, is it possible that we could generate map segmentation file via combing three maps of individual domains? In other words, are there other ways to generate map segmentation file other than the segger?

Hi @nym2834610! We do indeed allow for non-Segger segmentation methods. Instead of providing a .seg file, you can instead provide a .mrc file with the same dimensions as your map. In each voxel of this .mrc, store an integer value for the segment it should belong to. Use -1 to indicate solvent.

For a concrete example, if a slice through your MRC looked like this:
you’d be segmenting a spherical region at the center of the map into the “left” and “right” halves with the center as a separate segment. Note that the blue region at the outside is all -1, so would not be a segment in the final mesh.

I’ll also note here that in my testing, ChimeraX silently turns any voxels with value -1.0 into 0.0 when saving, so if you’re using ChimeraX to generate your segmentation you may want to assign solvent to 0, number your segments 1 through N + 1, and then use a simple python script to subtract 1.0 from every voxel, e.g.,

import mrcfile
from pathlib import Path

seg ='~/from_chimerax.mrc').expanduser())
seg = seg - 1
mrcfile.write(Path('~/ready_for_mesh_prep.mrc').expanduser(), seg)

Then, when you’re fusing these regions, their segment IDs are the values in the .mrc. So in this case, if you wanted to fuse both outer halves of the sphere to the central core, your Segment connections parameter would be 2>1,2>0.

How you generate this .mrc is up to you — but this is the format it has to be in!

I realize that this detail should be in the guide and will add it soon. Thanks for your question!

I got the following error when trying to do exactly this: a custom segmentation .mrc file for a map with three segments.

I created the segment mrc file with a custom script, and set the mrcfile datatype to np.int8

I set the solvent to -1.

When I set the segment voxels to to 0, 1, and 2, I kept seeing in the log that 3D Flex Mesh Prep only picked up on two segments [0,1].

When I set the segment voxels to 1, 2, and 3 I didn’t get this error anymore.

Loaded 3 segmentation with segment IDs: [0 1 2]

(But, using 2>1,2>3 to connect the segments didn’t work, so I did have to index the segments with 1>0,1>2 even though the values in the voxels weren’t the same.)

This appeared to be working alright (the segments look right in the viewer), but I got the following error.

  Tree of segment connections:
> 1 > 0 
    > 2 

  Segment connections (segment indices): [(1, 0), (1, 2)]

  Segmenting mesh...

    Expanding input segments to fill mask...

    Splitting contiguous mesh...

    Fusing connected segments...

Traceback (most recent call last):
  File "cryosparc_master/cryosparc_compute/", line 95, in
  File "cryosparc_master/cryosparc_compute/jobs/flex_refine/", line 167, in
  File "cryosparc_master/cryosparc_compute/jobs/flex_refine/", line 50, in
  File "cryosparc_master/cryosparc_compute/jobs/flex_refine/", line 44, in
IndexError: arrays used as indices must be of integer (or boolean) type

Do I need to do something else to the .mrc, (e.g. the header?) file to ensure that the segments can be read in properly?

I got the above to Mesh Prep job to successfully finish by using the Segment Connections input 0>1,1>2 but it doesn’t look like it properly processed the segments (see image below). In the “Segment Masks” image there are the correct three segments. But “Segments expanded to fill mask” and “Segmented Mesh” only have two segments.

When I try to reset the indices of the segments in the .mrc file to -1 for solvent and 0,1 and 2 for the segments, it is only able to identify two segments ([0,1]), and the segment connections 0>1,1>2 leads to an error that 2 isn’t a valid segment ID.

Hello all – apologies for this bug. CryoSPARC v4.5 fixes the underlying issue, and MRC-format mesh segmentations should now work as expected, with segment -1 being solvent and the others being the segments used to generate the mesh.

Note that the ChimeraX issue I mentioned in my previous post is out of our control, so you should still double-check that your saved MRC file has the expected values after saving it.