tomodrgn.commands.subtomo2chimerax#
Create a ChimeraX command script (.cxc) to map particles back to their source positions within a tomogram. Particles may be rendered as ChimeraX spherical markers, as a consensus .mrc volume, or as unique-per-particle volumes generated by tomoDRGN on-the-fly. Particles may be colored by an array of numeric values per particle, colormapped by a Matplotlib colormap. Script adapted from relionsubtomo2ChimeraX.py, written by Huy Bui, McGill University, doi: https://doi.org/10.5281/zenodo.6820119.
Example usage: marker mode (places chimerax markers only)
python tomodrgn/commands/subtomo2chimerax.py ../m_output_starfiles/10499_22k_box64_angpix6_volumeseries.star --output test_subtomo2chimerax --ind ../27_vae_box96_256x3_128_256x3_128_256x3_b1_gaussian/ind_keep.20981_particles.pkl --mode markers --marker-radius-angstrom 150 --coloring-labels analyze.49/kmeans20/labels.pkl
Example usage: volumes mode (places unique tomoDRGN volumes per particle)
python tomodrgn/commands/subtomo2chimerax.py ../m_output_starfiles/10499_22k_box64_angpix6_volumeseries.star --outdir test_subtomo2chimerax_volumes --ind ../27_vae_box96_256x3_128_256x3_128_256x3_b1_gaussian/ind_keep.20981_particles.pkl --mode volumes --weights weights.49.pkl --config config.pkl --zfile z.49.pkl --downsample 64 --vol-render-level 0.008 --coloring-labels analyze.49/kmeans20/labels.pkl
Functions
Calculate an RGBA color for each particle's unique label and store both labels and RGBA tuples in the particles star dataframe. |
|
Validate that particle volumes can be found for volume-based rendering modes. |
|
Identify the star file particles data block and relevant columns within it which specify particle coordinates, angle, pixel size, and tomogram name. |
|
Check that required inputs are present depending on the volume rendering mode selected. |
|
Write a text file specifying the mapping between label value - RGBA color - ChimeraX models associated with this label, for the current tomogram' |
|
Write a .cxc ChimeraX command file to map back all particles specified in df_one_tomo to source tomogram positions using the specified rendering mode and coloring scheme. |