{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# 3D Flex: Custom Latent Trajectory\n", "\n", "```{note}\n", "[Read the tutorial](https://guide.cryosparc.com/processing-data/tutorials-and-case-studies/tutorial-3d-flexible-refinement) to learn more about 3D Flexible Refinement.\n", "```\n", "\n", "This example covers the following:\n", "\n", "* Load particle latent coordinates from a 3D Flex Training job\n", "* Plot the latent coordinates\n", "* Interactively draw a trajectory through the latent space\n", "* Output the trajectory as a new output in CryoSPARC\n", "\n", "The resulting trajectory may be used as input to the 3D Flex Generator job to generate a volume series along the trajectory. In this way, you can visualize specific regions or pathways through the latent conformational distribution of the particle." ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "vscode": { "languageId": "python" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Connection succeeded to CryoSPARC command_core at http://cryoem5:40002\n", "Connection succeeded to CryoSPARC command_vis at http://cryoem5:40003\n" ] } ], "source": [ "import numpy as n\n", "from cryosparc.tools import CryoSPARC\n", "\n", "cs = CryoSPARC(host=\"cryoem5\", base_port=40000)\n", "assert cs.test_connection()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Load the particles dataset from the 3D Flex Training job." ] }, { "cell_type": "code", "execution_count": 9, "metadata": { "vscode": { "languageId": "python" } }, "outputs": [ { "data": { "text/html": [ "
\n", " | components_mode_0/component | \n", "components_mode_0/value | \n", "components_mode_1/component | \n", "components_mode_1/value | \n", "uid | \n", "
---|---|---|---|---|---|
0 | \n", "0 | \n", "0.016000 | \n", "1 | \n", "0.314667 | \n", "3070975014664207456 | \n", "
1 | \n", "0 | \n", "-0.122667 | \n", "1 | \n", "-0.293333 | \n", "4618435520677801850 | \n", "
2 | \n", "0 | \n", "-0.496000 | \n", "1 | \n", "0.048000 | \n", "5473205460946538064 | \n", "
3 | \n", "0 | \n", "0.357333 | \n", "1 | \n", "0.133333 | \n", "16310523440862460071 | \n", "
4 | \n", "0 | \n", "0.698667 | \n", "1 | \n", "0.048000 | \n", "13340786341065263892 | \n", "
... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "
83995 | \n", "0 | \n", "0.229333 | \n", "1 | \n", "0.314667 | \n", "16055293458929423443 | \n", "
83996 | \n", "0 | \n", "-0.208000 | \n", "1 | \n", "0.784000 | \n", "4138809144408497890 | \n", "
83997 | \n", "0 | \n", "0.069333 | \n", "1 | \n", "0.005333 | \n", "12856011472364466207 | \n", "
83998 | \n", "0 | \n", "-0.176000 | \n", "1 | \n", "0.272000 | \n", "14511870028664140377 | \n", "
83999 | \n", "0 | \n", "0.890667 | \n", "1 | \n", "0.048000 | \n", "17110459322516273008 | \n", "
84000 rows × 5 columns
\n", "