Skip to content

Commit

Permalink
rerun
Browse files Browse the repository at this point in the history
  • Loading branch information
Zhuohan1999 committed Mar 25, 2024
1 parent dfc3904 commit 04405d0
Show file tree
Hide file tree
Showing 11 changed files with 282,312 additions and 70,653 deletions.
140 changes: 81 additions & 59 deletions tutorials/HFF_100KB/NuclearDeformation/NuclearDeformation.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"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"
Expand Down Expand Up @@ -86,14 +87,14 @@
" # 0.005: timestep (LJ reduced unit);\n",
" # 1.0: mass_scale\n",
" \n",
"PDB_file = \"human.pdb\" #The initial configuration\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 = 'lamina_bond.txt') "
"model.create_system(PDB_file, flag_membrane = True, lam_bond = 'input_params/lamina_bond.txt') "
]
},
{
Expand Down Expand Up @@ -308,8 +309,8 @@
"# In this customized setting, I logged all the flags for different interactions\n",
"# (True means on, False means off, and NaN means N/A)\n",
"# and all the corresponding files required for interactions. \n",
"force_field = pd.read_csv('input.csv', sep=' ', header=0, index_col=0)\n",
"model.load_customized_settings(force_field, k = 1.0)\n",
"force_field = pd.read_csv('input_params/input.csv', sep=' ', header=0, index_col=0)\n",
"model.load_customized_settings(force_field, 'input_params', k = 1.0)\n",
"\n",
"index_spec_spec_potential = 6 #The 6-th potential is speckle-speckle interaction in the default settings\n",
"start_spec_index = model.N_chr_nuc+1\n",
Expand Down Expand Up @@ -339,56 +340,56 @@
"output_type": "stream",
"text": [
"#\"Progress (%)\"\t\"Step\"\t\"Potential Energy (kJ/mole)\"\t\"Kinetic Energy (kJ/mole)\"\t\"Temperature (K)\"\t\"Time Remaining\"\n",
"2.0%\t2000\t117616.47977582889\t99839.74559860234\t113.48285494230906\t--\n",
"4.0%\t4000\t134255.17869981972\t98505.69644786902\t111.96650786679427\t9:10\n",
"6.0%\t6000\t139626.5962219246\t103363.05068186947\t117.48761995132067\t8:43\n",
"8.0%\t8000\t138422.31900849155\t106160.78815787584\t120.66766848061837\t8:26\n",
"10.0%\t10000\t136876.3147479449\t107124.04389536048\t121.76255319285312\t8:17\n",
"12.0%\t12000\t135761.08125620737\t106116.78953242837\t120.61765743943052\t8:07\n",
"14.0%\t14000\t134950.05574804617\t106592.04317908129\t121.15785453549233\t7:57\n",
"16.0%\t16000\t135071.53483395698\t105517.58794190043\t119.93657490289775\t7:46\n",
"18.0%\t18000\t135336.79790046596\t106493.16693579014\t121.04546684552605\t7:35\n",
"20.0%\t20000\t135073.43377513258\t106480.33326483476\t121.03087945239244\t7:24\n",
"22.0%\t22000\t135995.87157752056\t105568.72676501282\t119.99470185034126\t7:13\n",
"24.0%\t24000\t134968.8553694152\t106715.20231363198\t121.29784337578074\t7:02\n",
"26.0%\t26000\t135548.8257316695\t106233.87931914399\t120.75074755500931\t6:51\n",
"28.0%\t28000\t135416.7301567195\t105590.1363613937\t120.01903706980619\t6:39\n",
"30.0%\t30000\t135459.97742399783\t105556.62345403162\t119.98094462093162\t6:29\n",
"32.0%\t32000\t135326.39527055767\t105793.90759403387\t120.25065365793424\t6:17\n",
"34.0%\t34000\t136114.85256771866\t105887.10068992445\t120.35658159794617\t6:06\n",
"36.0%\t36000\t135306.9146546221\t105786.12578840624\t120.24180846793564\t5:55\n",
"38.0%\t38000\t135822.1983962797\t105544.54865488072\t119.96721979949619\t5:44\n",
"40.0%\t40000\t135455.5810930714\t105727.8793586577\t120.17560265883196\t5:33\n",
"42.0%\t42000\t135513.74105806244\t105275.94593041574\t119.66191249092071\t5:22\n",
"44.0%\t44000\t135419.66422712884\t105172.18501463122\t119.54397263756816\t5:11\n",
"46.0%\t46000\t135666.6534070136\t105767.22453918935\t120.22032436147836\t5:00\n",
"48.0%\t48000\t135355.88947474648\t105933.83831788144\t120.40970592655889\t4:48\n",
"50.0%\t50000\t135932.10797529516\t105438.66849259501\t119.84687110443595\t4:37\n",
"52.0%\t52000\t136024.55835441878\t105476.07532527938\t119.88938958384433\t4:26\n",
"54.0%\t54000\t135589.48643476743\t105901.41017328986\t120.37284647337549\t4:15\n",
"56.0%\t56000\t135474.83120412444\t106064.82464540712\t120.55859154637793\t4:04\n",
"58.0%\t58000\t135966.78143004136\t106200.32839153234\t120.71261189041496\t3:53\n",
"60.0%\t60000\t136164.535022414\t105912.90855783362\t120.3859161131009\t3:42\n",
"62.0%\t62000\t135474.24310149613\t105960.72110211673\t120.440262245443\t3:30\n",
"64.0%\t64000\t135085.35981679964\t105444.23041434481\t119.85319306324453\t3:19\n",
"66.0%\t66000\t135320.41595140478\t106061.02627608908\t120.55427412958412\t3:08\n",
"68.0%\t68000\t135527.48051452375\t105471.211801704\t119.88386145937741\t2:57\n",
"70.0%\t70000\t135929.29511321377\t105992.29374161572\t120.47614928869343\t2:46\n",
"72.0%\t72000\t135880.911512187\t105841.185666048\t120.3043922823284\t2:35\n",
"74.0%\t74000\t136089.02945649484\t106144.66086350978\t120.64933739016755\t2:24\n",
"76.0%\t76000\t136020.11082802236\t106329.84642875202\t120.85982857793844\t2:13\n",
"78.0%\t78000\t136375.00752144557\t105649.52596317437\t120.08654226549302\t2:02\n",
"80.0%\t80000\t136403.72297112842\t106524.24101177527\t121.08078719651797\t1:50\n",
"82.0%\t82000\t136192.75954015323\t105823.38315730357\t120.28415705931835\t1:39\n",
"84.0%\t84000\t136176.92228594967\t106082.85963821632\t120.57909102241906\t1:28\n",
"86.0%\t86000\t135786.46343169894\t105842.42926998399\t120.30580582484322\t1:17\n",
"88.0%\t88000\t135472.29064079304\t105516.81387057203\t119.93569505465946\t1:06\n",
"90.0%\t90000\t135941.06197925174\t106290.66210817888\t120.81528971677695\t0:55\n",
"92.0%\t92000\t136281.15393019054\t105655.63187968488\t120.09348255599053\t0:44\n",
"94.0%\t94000\t136077.60105442748\t106261.07545128607\t120.78166004081712\t0:33\n",
"96.0%\t96000\t136144.83389322643\t106074.20068039645\t120.56924881730993\t0:22\n",
"98.0%\t98000\t136118.38704320946\t106559.2246545185\t121.12055135688297\t0:11\n",
"100.0%\t100000\t136981.71278016892\t106225.44199384481\t120.74115726852283\t0:00\n"
"2.0%\t2000\t123136.44445905171\t100752.69234185581\t114.52055593216552\t--\n",
"4.0%\t4000\t138145.93252829043\t99854.70038122084\t113.4998532971868\t9:06\n",
"6.0%\t6000\t142575.6182367836\t104465.90880812544\t118.741183730089\t8:38\n",
"8.0%\t8000\t141094.42452352808\t107327.50563145665\t121.99381799170929\t8:21\n",
"10.0%\t10000\t139697.16552712512\t107342.47070395519\t122.01082804258003\t8:13\n",
"12.0%\t12000\t137654.04464475974\t106994.70033531352\t121.61553482482218\t8:03\n",
"14.0%\t14000\t138386.55393252496\t105782.62134612219\t120.2378251433289\t7:53\n",
"16.0%\t16000\t137409.19082230702\t106199.98460544148\t120.71222112592687\t7:42\n",
"18.0%\t18000\t138944.10917304258\t106093.39691125305\t120.59106821467195\t7:32\n",
"20.0%\t20000\t137593.22835381792\t106262.0393691768\t120.78275567816587\t7:21\n",
"22.0%\t22000\t138695.92867257126\t105989.21260070454\t120.47264710962654\t7:10\n",
"24.0%\t24000\t138082.96422167047\t105636.71725733916\t120.07198324896527\t6:59\n",
"26.0%\t26000\t138577.68014618923\t105942.89960543014\t120.42000543978695\t6:48\n",
"28.0%\t28000\t138547.97569732778\t105614.2894846135\t120.04649071927538\t6:37\n",
"30.0%\t30000\t139048.79707005448\t105953.13915726854\t120.43164422721559\t6:26\n",
"32.0%\t32000\t139369.4478256774\t106096.93739319986\t120.5950925037643\t6:15\n",
"34.0%\t34000\t139349.70734011347\t105551.45826302844\t119.9750736061584\t6:04\n",
"36.0%\t36000\t138652.69678783504\t106307.39016938012\t120.83430366889978\t5:53\n",
"38.0%\t38000\t138994.0196299976\t105924.91785091767\t120.39956647706012\t5:42\n",
"40.0%\t40000\t138711.95389602106\t106045.77361075555\t120.53693718629414\t5:31\n",
"42.0%\t42000\t139755.55680584465\t106157.32762501454\t120.66373506566056\t5:20\n",
"44.0%\t44000\t139418.1188406263\t105861.9173488944\t120.32795695131931\t5:09\n",
"46.0%\t46000\t139318.77307771594\t106084.84309645879\t120.58134552039144\t4:58\n",
"48.0%\t48000\t139156.1582248191\t106000.44885852029\t120.48541880298527\t4:47\n",
"50.0%\t50000\t139394.24871664512\t106154.93144347834\t120.66101144572286\t4:36\n",
"52.0%\t52000\t138976.02488041663\t105917.33440921981\t120.39094675743841\t4:24\n",
"54.0%\t54000\t139636.7751483859\t105824.53815483821\t120.2854698873599\t4:13\n",
"56.0%\t56000\t139109.49119912702\t105962.1255783129\t120.44185864342542\t4:02\n",
"58.0%\t58000\t139591.83060822415\t105548.44699685683\t119.9716508502199\t3:51\n",
"60.0%\t60000\t139158.00653002597\t105773.10164969457\t120.22700457961139\t3:40\n",
"62.0%\t62000\t139141.23690284294\t106340.19938493858\t120.87159626642863\t3:29\n",
"64.0%\t64000\t138657.07116640714\t106162.69666414094\t120.66983778441957\t3:18\n",
"66.0%\t66000\t138872.56066384647\t105709.55038510424\t120.154769029554\t3:07\n",
"68.0%\t68000\t139552.46901895298\t106237.45014421445\t120.75480633361563\t2:56\n",
"70.0%\t70000\t140314.6318439555\t105998.06802734527\t120.48271263103683\t2:45\n",
"72.0%\t72000\t139878.4964976344\t105824.37540777247\t120.28528490089441\t2:34\n",
"74.0%\t74000\t140049.54976571468\t105978.09999204957\t120.46001596209643\t2:23\n",
"76.0%\t76000\t139040.28804717027\t105698.80343463195\t120.14255350742695\t2:12\n",
"78.0%\t78000\t139441.61604379857\t105796.50827126215\t120.25360971791694\t2:01\n",
"80.0%\t80000\t139103.81283076043\t105733.9975154245\t120.1825568622178\t1:50\n",
"82.0%\t82000\t139735.49375639576\t105520.89870734174\t119.94033808470546\t1:39\n",
"84.0%\t84000\t139625.44875567633\t105857.33796241746\t120.32275179130842\t1:28\n",
"86.0%\t86000\t139302.36985220472\t106414.25964148348\t120.95577686304458\t1:17\n",
"88.0%\t88000\t139197.9629622838\t105156.448308775\t119.52608550957876\t1:06\n",
"90.0%\t90000\t138969.3590577207\t105676.13902677708\t120.1167920063982\t0:55\n",
"92.0%\t92000\t138261.92996336846\t105622.26065619843\t120.05555115210468\t0:44\n",
"94.0%\t94000\t138923.98136101887\t106060.5908358773\t120.55377918643204\t0:33\n",
"96.0%\t96000\t138863.37451388055\t105655.18511185612\t120.0929747373017\t0:22\n",
"98.0%\t98000\t138649.21396001056\t106102.68049923926\t120.60162040571038\t0:11\n",
"100.0%\t100000\t138531.91066385998\t106315.62779116184\t120.84366696236692\t0:00\n"
]
}
],
Expand All @@ -400,7 +401,7 @@
"\n",
"simulation.minimizeEnergy()\n",
"\n",
"simulation.reporters.append(mdtraj.reporters.DCDReporter('step_100000.dcd', sampling_freq))\n",
"simulation.reporters.append(mdtraj.reporters.DCDReporter('results/step_100000.dcd', sampling_freq))\n",
"\n",
"def setVelocity(context):\n",
" sigma = u.sqrt(1.0*u.kilojoule_per_mole / model.chr_system.getParticleMass(1))\n",
Expand Down Expand Up @@ -431,15 +432,36 @@
" model.chr_system.getForce(index_spec_spec_potential).updateParametersInContext(simulation.context)\n",
"\n",
"# Keep the final result of bead types in case constructing the configuration for the continuous simulation.\n",
"np.savetxt('compt_final_frame.txt', (np.array(model.compart_type)+1).reshape((-1,1)), fmt='%d')"
"np.savetxt('results/compt_final_frame.txt', (np.array(model.compart_type)+1).reshape((-1,1)), fmt='%d')"
]
},
{
"cell_type": "markdown",
"id": "d1d36075-fdef-4ef0-95a9-d4d0bc3a6b82",
"metadata": {},
"source": [
"### Post-process the output files\n",
"\n",
"We converted the trajectory with the default OpenMM unit to the nex trajectory with the reduced unit, and saved the final configuration according to the last frame."
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "6a73e27e-6326-4e45-9da3-299907a60fa7",
"metadata": {},
"outputs": [],
"source": [
"coor_transformation('results/step_100000.dcd', 'results/reduced_traj.dcd')\n",
"final_frame('results/step_100000.dcd', 'results/compt_final_frame.txt', 'results/final_config.pdb')"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"display_name": "Python [conda env:anaconda3-openmm]",
"language": "python",
"name": "python3"
"name": "conda-env-anaconda3-openmm-py"
},
"language_info": {
"codemirror_mode": {
Expand All @@ -451,7 +473,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.15"
"version": "3.6.15"
}
},
"nbformat": 4,
Expand Down
46 changes: 6 additions & 40 deletions tutorials/HFF_100KB/NuclearDeformation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,48 +2,14 @@

With Langevin dynamics, this folder provides tutorials for setting up and performing Nuclear Deformation simulations of the HFF nucleus at the 100KB resolution with the presence of various nuclear landmarks, including nuclear lamina, speckles, and nucleoli. And here, we also show how to create the system with customized setup.

- NuclearDeformation.ipynb: The jupyter notebook showing how to create a system and run a simulation with the nucleus deformation. Make sure you put all the force field parameter files in the parameter folder.
- input_params: The folder saves all the customized parameters (input_params/input.csv: The file logs which potential that the users hope to add; input_params/lamina_bond.txt: The file logs where the lamina connected bonds are)

- parameters: The folder saves all the parameters that the simulation needs
- NuclearDeformation.ipynb: The jupyter notebook showing how to create a system and run a simulation with the nucleus deformation.

- input.csv: The file logs which potential that the users hope to add
- results: This folder contains the trajectory and new configuration files after running the notebook "NuclearDeformation.ipynb".

- lamina_bond.txt: The file logs where the lamina connected bonds are
- strength_zero: This folder contains the initial structure and final structure with strength = 0.0 when squeezing the nucleus.

- step_100000.dcd: The trajectory from the Nuclear Deformation with Langevin Dynamics
- strength_half: This folder contains the initial structure and final structure with strength = 0.5 when squeezing the nucleus.

- reduced_traj.dcd: The trajectory after converting the OpenMM default unit to the reduced unit

- compt_final_frame.txt: A file saves the type of each bead of the last frame

- human.pdb: An initial configuration used for creating a simulation

- human_final.pdb: The configuration of the last frame from the trajectory (reduced_traj.dcd)

- coordinate_transformation.py: This file converts the trajectory with position in OpenMM default unit to reduced unit

- final_frame.py: We output the final configuration according to the converted trajectory after running script "coordinate_transformation.py"

- bead_info.txt: This file contains the information of each chromatin bead, and is necessary when creating the final configuration. 1st column: the index of each bead; 2nd column: the index of belonging chromosome; 3rd column: the type of each chromatin bead.

- strength_zero: This folder contains the initial structure and final structure with strength = 0.0 when squeezing the nucleus

- strength_half: This folder contains the initial structure and final structure with strength = 0.5 when squeezing the nucleus

- strength_one: This folder contains the initial structure and final structure with strength = 1.0 when squeezing the nucleus

The pipeline is as follows:

(i) Obtain the trajectories from NuclearDeformation.ipynb

(ii) Convert the trajectory with position in OpenMM default unit to reduced unit

```
python coordinate_transformation.py step_100000.dcd
```

(iii) Create a configuration file with the last frame

```
python coordinate_transformation.py reduced_traj.dcd
```
- strength_one: This folder contains the initial structure and final structure with strength = 1.0 when squeezing the nucleus.
Loading

0 comments on commit 04405d0

Please sign in to comment.