{ "cells": [ { "cell_type": "markdown", "id": "c4185e43-9c43-400c-9688-7b3831dacecb", "metadata": {}, "source": [ "## Nuclear Deformation Simulation" ] }, { "cell_type": "markdown", "id": "41a7c311-1202-428e-b9ce-ed77aa648d0e", "metadata": {}, "source": [ "### Import the necessary packages" ] }, { "cell_type": "code", "execution_count": 1, "id": "d7dfe668-ce05-48b3-98ba-a5b73e0df96d", "metadata": {}, "outputs": [], "source": [ "import parmed as pmd\n", "import json\n", "import sys\n", "from sys import platform\n", "import mdtraj as md\n", "import simtk.openmm.app as mmapp\n", "import mdtraj.reporters\n", "import simtk.unit as u\n", "import random\n", "from openNucleome import OpenNucleome\n", "from openNucleome.utils import coor_transformation, final_frame\n", "import warnings\n", "import numpy as np\n", "import pandas as pd" ] }, { "cell_type": "markdown", "id": "d8c3b70a-21f3-4228-bb57-945965ebee06", "metadata": {}, "source": [ "### Important parameters\n", "We defined the important parameters in the next block. First, we set the transition probability between dP particles and P particles as 0.2, and the transition frequency as 4000. When creating the system, we set type 6, 7 as the dP and P particles, respectively, so we kept using 6, 7 here. In this example, we ran a simulation with total length of 100,000 steps, and output one configuration and the energy every 2000 steps." ] }, { "cell_type": "code", "execution_count": 2, "id": "5a6e5ed3-5b95-4568-af71-336b5564cafa", "metadata": {}, "outputs": [], "source": [ "prob_P_dP = 0.2 # Transition probability from P to dP\n", "prob_dP_P = 0.2 # Transition probability from dP to P\n", "transition_freq = 4000\n", "sampling_freq = 2000\n", "dP_type = 6\n", "P_type = 7\n", "total_steps = 100000" ] }, { "cell_type": "markdown", "id": "95f76ca2-43ed-4768-9fce-257348ea81c0", "metadata": {}, "source": [ "### Initialize the system\n", "We first set up an example \"model\" of class \"OpenNucleome\" with the conserved temperature, damping coefficient, timestep, and the mass scale. In this folder, we also included the initial configuration \"human.pdb\" used for the simulation and created a system according to the initial configuration.\n", "\n", "In this example, we moved all the lamina beads, and would consider the dynamics of the membrane, and that is why we set \"True\" (on) for membrane dynamics. Consequently, we need to designate the bonds between specific lamina beads, so we included a text file, which logs all the pairs linked by the bonds, for the variable \"membrane_bond\"." ] }, { "cell_type": "code", "execution_count": 3, "id": "b0b6fb41-d073-4be8-8832-24896e0f068f", "metadata": {}, "outputs": [], "source": [ "model = OpenNucleome(1.0, 0.1, 0.005, 1.0) # 1.0: temperature (LJ reduced unit); \n", " # 0.1: damping coefficient (LJ reduced unit);\n", " # 0.005: timestep (LJ reduced unit);\n", " # 1.0: mass_scale\n", " \n", "PDB_file = \"strength_one/human.pdb\" #The initial configuration\n", "\n", "# Generate new elements and construct topology as well\n", "# flag_membrane: True for including lamina dynamics, False for excluding lamina dynamics;\n", "# lam_bond: A file contains the lamina bond when membrane_dynamics is on.\n", "\n", "warnings.filterwarnings(\"ignore\")\n", "model.create_system(PDB_file, flag_membrane = True, lam_bond = 'input_params/lamina_bond.txt') " ] }, { "cell_type": "markdown", "id": "3eee92a7-e149-45ef-b201-7b02fa5948c6", "metadata": {}, "source": [ "### Add the force field\n", "Different from the sphere nucleus situation, we used a csv file to log all the flags of interactions between chromosomes and chromosomes, or chromosomes and nuclear landmarks.\n", "\n", "The column from \"bond\" to \"lam_squeeze\" is boolen, which means the switches of the corresponding interactions. For example, if the spec-chrom is True, it means in the simulation, the interaction between speckle and chromosome will be present; if the inter is False, it means we exclude the interchromosomal interactions between chromosome. Remember some potentials require the corresponding parameter files, such as ideal requires ideal_param_file and spec-chrom requires the chr_spec_param, so if you turn those potentials on, you should also include the corresponding parameter files.\n", "\n", "In this example, we turn every interaction on, and set the strength of force squeezing the nucleus as 1.0 (k) when loading the customized force field. The users can set their specific strengths.\n", "\n", "Because during the simulations, we would transit the dP speckle and P speckle particles, here, we logged the start index and end index of speckle particle, and computed the number of speckle particles." ] }, { "cell_type": "code", "execution_count": 4, "id": "9c8cf2a5-8071-4e29-82d5-c087905883bf", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " | bond | \n", "angle | \n", "softcore | \n", "ideal | \n", "compt | \n", "inter | \n", "spec-spec | \n", "spec-chrom | \n", "nuc-nuc | \n", "nuc-spec | \n", "... | \n", "lam-chrom | \n", "hard-wall | \n", "lam-lam | \n", "lam_squeeze | \n", "ideal_param_file | \n", "compt_param_file | \n", "interchr_param_file | \n", "chr_spec_param | \n", "chr_nuc_param | \n", "chr_lam_param | \n", "
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
chromosome | \n", "True | \n", "True | \n", "True | \n", "True | \n", "True | \n", "True | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "... | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "ideal_param_file.txt | \n", "compt_param_file.txt | \n", "interchr_param_file.txt | \n", "NaN | \n", "NaN | \n", "NaN | \n", "
speckle | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "True | \n", "True | \n", "NaN | \n", "NaN | \n", "... | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "chr_spec_param.txt | \n", "NaN | \n", "NaN | \n", "
nucleolus | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "True | \n", "True | \n", "... | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "chr_nuc_param.txt | \n", "NaN | \n", "
lamina | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "... | \n", "True | \n", "True | \n", "True | \n", "True | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "chr_lam_param.txt | \n", "
4 rows × 21 columns
\n", "