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 f9315a9 commit dfc3904
Show file tree
Hide file tree
Showing 42 changed files with 71,005 additions and 759,553 deletions.
2 changes: 1 addition & 1 deletion openNucleome/utils/final_frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def final_frame(traj_data, type_final, output_config, n_chrom = 46, n_nuc = 300,
"""

traj = mda.coordinates.LAMMPS.DCDReader(traj_data)
chr_info = np.loadtxt(os.path.join(config_path, 'chromatin_info.txt'))
chr_info = np.loadtxt(os.path.join(config_path, 'chromatin_info.txt'), dtype=int)
X, zero = 'X', 0
type_final = np.loadtxt(type_final, dtype=int)
coor = traj.trajectory[-1].positions
Expand Down
18 changes: 11 additions & 7 deletions openNucleome/whole_nucleus_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,14 +311,18 @@ def load_default_settings(self):
self.add_nucleolus_potential(dict_nuc_ff, chr_nuc_param)
self.add_lamina_potential(dict_lam_ff, chr_lam_param)

def load_customized_settings(self, force_field, k = 1.0):
def load_customized_settings(self, force_field, param_folder, k = 1.0):
'''
Load customized force field settings
Parameters
----------
force_field (Pandas Dataframe, required):
Store the flag of all the potentials and the parameter file names
param_folder (string, required):
Save the customized parameters used in the simulations
k (float, required):
The strength of force squeezing the nucleus (Default: 1.0)
'''
Expand All @@ -328,22 +332,22 @@ def load_customized_settings(self, force_field, k = 1.0):
dict_lam_ff = {'lam-chrom':force_field.loc['lamina']['lam-chrom'], 'hard-wall':force_field.loc['lamina']['hard-wall'], 'lam-lam':self.flag_membrane, 'squeeze_nucleus':self.flag_membrane, 'strength': k}
ideal_param_file = force_field.loc['chromosome']['ideal_param_file']
if ideal_param_file:
ideal_param_file = os.path.join('.', 'parameters', ideal_param_file)
ideal_param_file = os.path.join('.', param_folder, ideal_param_file)
compt_param_file = force_field.loc['chromosome']['compt_param_file']
if compt_param_file:
compt_param_file = os.path.join('.', 'parameters', compt_param_file)
compt_param_file = os.path.join('.', param_folder, compt_param_file)
interchr_param_file = force_field.loc['chromosome']['interchr_param_file']
if interchr_param_file:
interchr_param_file = os.path.join('.', 'parameters', interchr_param_file)
interchr_param_file = os.path.join('.', param_folder, interchr_param_file)
chr_nuc_param = force_field.loc['nucleolus']['chr_nuc_param']
if chr_nuc_param:
chr_nuc_param = os.path.join('.', 'parameters', chr_nuc_param)
chr_nuc_param = os.path.join('.', param_folder, chr_nuc_param)
chr_spec_param = force_field.loc['speckle']['chr_spec_param']
if chr_spec_param:
chr_spec_param = os.path.join('.', 'parameters', chr_spec_param)
chr_spec_param = os.path.join('.', param_folder, chr_spec_param)
chr_lam_param = force_field.loc['lamina']['chr_lam_param']
if chr_lam_param:
chr_lam_param = os.path.join('.', 'parameters', chr_lam_param)
chr_lam_param = os.path.join('.', param_folder, chr_lam_param)
self.add_chromosome_potential(dict_chrom_ff, ideal_param_file, compt_param_file, interchr_param_file)
self.add_speckle_potential(dict_spec_ff, chr_spec_param)
self.add_nucleolus_potential(dict_nuc_ff, chr_nuc_param)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@
"force_field = pd.read_csv('input.csv', sep=' ', header=0, index_col=0)\n",
"model.load_customized_settings(force_field, k = 1.0)\n",
"\n",
"index_spec_spec_potential = 6\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",
"end_spec_index = model.N_chr_nuc_spec+1\n",
"N_spec = end_spec_index-start_spec_index\n",
Expand Down Expand Up @@ -430,14 +430,14 @@
" model.chr_system.getForce(index_spec_spec_potential).setParticleParameters(m, [model.compart_type[m]])\n",
" model.chr_system.getForce(index_spec_spec_potential).updateParametersInContext(simulation.context)\n",
"\n",
"# Keep the final result of spec types in case constructing the configuration for the continuous simulation.\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')"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -451,7 +451,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.8"
"version": "3.8.15"
}
},
"nbformat": 4,
Expand Down
Loading

0 comments on commit dfc3904

Please sign in to comment.