pyLoopSage 1.0.9__tar.gz → 1.0.11__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (22) hide show
  1. {pyloopsage-1.0.9 → pyloopsage-1.0.11}/PKG-INFO +1 -1
  2. {pyloopsage-1.0.9 → pyloopsage-1.0.11}/loopsage/__init__.py +1 -1
  3. {pyloopsage-1.0.9 → pyloopsage-1.0.11}/loopsage/args_definition.py +7 -7
  4. {pyloopsage-1.0.9 → pyloopsage-1.0.11}/loopsage/em.py +3 -3
  5. {pyloopsage-1.0.9 → pyloopsage-1.0.11}/loopsage/md.py +3 -3
  6. {pyloopsage-1.0.9 → pyloopsage-1.0.11}/loopsage/plots.py +3 -34
  7. {pyloopsage-1.0.9 → pyloopsage-1.0.11}/loopsage/run.py +2 -2
  8. {pyloopsage-1.0.9 → pyloopsage-1.0.11}/loopsage/stochastic_simulation.py +4 -4
  9. {pyloopsage-1.0.9 → pyloopsage-1.0.11}/pyLoopSage.egg-info/PKG-INFO +1 -1
  10. {pyloopsage-1.0.9 → pyloopsage-1.0.11}/setup.py +1 -1
  11. {pyloopsage-1.0.9 → pyloopsage-1.0.11}/LICENSE +0 -0
  12. {pyloopsage-1.0.9 → pyloopsage-1.0.11}/README.md +0 -0
  13. {pyloopsage-1.0.9 → pyloopsage-1.0.11}/loopsage/initial_structures.py +0 -0
  14. {pyloopsage-1.0.9 → pyloopsage-1.0.11}/loopsage/preproc.py +0 -0
  15. {pyloopsage-1.0.9 → pyloopsage-1.0.11}/loopsage/utils.py +0 -0
  16. {pyloopsage-1.0.9 → pyloopsage-1.0.11}/loopsage/vizualization_tools.py +0 -0
  17. {pyloopsage-1.0.9 → pyloopsage-1.0.11}/pyLoopSage.egg-info/SOURCES.txt +0 -0
  18. {pyloopsage-1.0.9 → pyloopsage-1.0.11}/pyLoopSage.egg-info/dependency_links.txt +0 -0
  19. {pyloopsage-1.0.9 → pyloopsage-1.0.11}/pyLoopSage.egg-info/entry_points.txt +0 -0
  20. {pyloopsage-1.0.9 → pyloopsage-1.0.11}/pyLoopSage.egg-info/requires.txt +0 -0
  21. {pyloopsage-1.0.9 → pyloopsage-1.0.11}/pyLoopSage.egg-info/top_level.txt +0 -0
  22. {pyloopsage-1.0.9 → pyloopsage-1.0.11}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyLoopSage
3
- Version: 1.0.9
3
+ Version: 1.0.11
4
4
  Summary: An energy-based stochastic model of loop extrusion in chromatin.
5
5
  Home-page: https://github.com/SFGLab/pyLoopSage
6
6
  Author: Sebastian Korsak
@@ -1,4 +1,4 @@
1
1
  # Importing specific functions or classes from submodules
2
2
  from .run import main
3
3
 
4
- __version__ = "1.0.9"
4
+ __version__ = "1.0.10"
@@ -136,12 +136,12 @@ args = ListOfArgs([
136
136
 
137
137
  # Stochastic Simulation parameters
138
138
  Arg('LEF_RW', help="True in case that you would like to make cohesins slide as random walk, instead of sliding only in one direction.", type=bool, default='True', val='True'),
139
- Arg('N_STEPS', help="Number of Monte Carlo steps.", type=int, default='', val=''),
139
+ Arg('N_STEPS', help="Number of Monte Carlo steps.", type=int, default='40000', val='40000'),
140
140
  Arg('N_LEF', help="Number of loop extrusion factors (condensins and cohesins).", type=int, default='', val=''),
141
- Arg('MC_STEP', help="Monte Carlo frequency. It should be hundreds of steps, except if you would like to include molecular dynamics (MD) and in this case it should be ideally 1.", type=int, default='200', val='200'),
141
+ Arg('MC_STEP', help="Monte Carlo frequency. It should be hundreds of steps so as to avoid autocorrelated ensembles.", type=int, default='200', val='200'),
142
142
  Arg('BURNIN', help="Burnin-period (steps that are considered before equillibrium).", type=int, default='1000', val='1000'),
143
- Arg('T_INIT', help="Initial Temperature of the Stochastic Model.", type=float, default='1.8', val='1.8'),
144
- Arg('T_FINAL', help="Final Temperature of the Stochastic Model.", type=float, default='0.01', val='0.01'),
143
+ Arg('T_INIT', help="Initial Temperature of the Stochastic Model.", type=float, default='2.0', val='2.0'),
144
+ Arg('T_FINAL', help="Final Temperature of the Stochastic Model.", type=float, default='1.0', val='1.0'),
145
145
  Arg('METHOD', help="Stochastic modelling method. It can be Metropolis or Simulated Annealing.", type=str, default='Annealing', val='Annealing'),
146
146
  Arg('FOLDING_COEFF', help="Folding coefficient.", type=float, default='1.0', val='1.0'),
147
147
  Arg('CROSS_COEFF', help="LEF crossing coefficient.", type=float, default='1.0', val='1.0'),
@@ -152,15 +152,15 @@ args = ListOfArgs([
152
152
  # Molecular Dynamic Properties
153
153
  Arg('INITIAL_STRUCTURE_TYPE', help="you can choose between: rw, confined_rw, self_avoiding_rw, helix, circle, spiral, sphere.", type=str, default='rw', val='rw'),
154
154
  Arg('SIMULATION_TYPE', help="It can be either EM (multiple energy minimizations) or MD (one energy minimization and then run molecular dynamics).", type=str, default='', val=''),
155
- Arg('INTEGRATOR_STEP', help="The step of the integrator.", type=Quantity, default='5 femtosecond', val='5 femtosecond'),
155
+ Arg('INTEGRATOR_STEP', help="The step of the integrator.", type=Quantity, default='100 femtosecond', val='100 femtosecond'),
156
156
  Arg('FORCEFIELD_PATH', help="Path to XML file with forcefield.", type=str, default='forcefield/classic_sm_ff.xml', val='forcefield/classic_sm_ff.xml'),
157
157
  Arg('ANGLE_FF_STRENGTH', help="Angle force strength.", type=float, default='200.0', val='200.0'),
158
158
  Arg('LE_FF_LENGTH', help="Equillibrium distance of loop forces.", type=float, default='0.1', val='0.1'),
159
- Arg('LE_FF_STRENGTH', help="Interaction Strength of loop forces.", type=float, default='3000.0', val='3000.0'),
159
+ Arg('LE_FF_STRENGTH', help="Interaction Strength of loop forces.", type=float, default='50000.0', val='50000.0'),
160
160
  Arg('EV_FF_STRENGTH', help="Excluded-volume strength.", type=float, default='10.0', val='10.0'),
161
161
  Arg('FRICTION',help='Friction coefficient of the Langevin integrator.',type=float, default='0.1', val='0.1'),
162
162
  Arg('TOLERANCE', help="Tolerance that works as stopping condition for energy minimization.", type=float, default='0.001', val='0.001'),
163
163
  Arg('VIZ_HEATS', help="Visualize the output average heatmap.", type=bool, default='True', val='True'),
164
164
  Arg('SIM_TEMP', help="The temperature of the 3D simulation (EM or MD).", type=Quantity, default='310 kelvin', val='310 kelvin'),
165
- Arg('SIM_STEP', help="This is the amount of simulation steps that are perform each time that we change the loop forces. If this number is too high, the simulation is slow, if is too low it may not have enough time to adapt the structure to the new constraints.", type=int, default='10', val='10'),
165
+ Arg('SIM_STEP', help="This is the amount of simulation steps that are perform each time that we change the loop forces. If this number is too high, the simulation is slow, if is too low it may not have enough time to adapt the structure to the new constraints.", type=int, default='1000', val='1000'),
166
166
  ])
@@ -12,7 +12,7 @@ from .utils import *
12
12
  from .initial_structures import *
13
13
 
14
14
  class EM_LE:
15
- def __init__(self,M,N,N_beads,burnin,MC_step,path=None,platform='CPU',angle_ff_strength=200,le_distance=0.1,le_ff_strength=300000.0,ev_ff_strength=10.0,tolerance=0.001):
15
+ def __init__(self,M,N,N_beads,burnin,MC_step,path=None,platform='CPU',angle_ff_strength=200,le_distance=0.1,le_ff_strength=50000.0,ev_ff_strength=10.0,tolerance=0.001):
16
16
  '''
17
17
  M, N (np arrays): Position matrix of two legs of cohesin m,n.
18
18
  Rows represent loops/cohesins and columns represent time
@@ -31,7 +31,7 @@ class EM_LE:
31
31
  self.ev_ff_strength = ev_ff_strength
32
32
  self.tolerance = tolerance
33
33
 
34
- def run_pipeline(self,plots=False, friction=0.1, integrator_step = 5 * mm.unit.femtosecond, temperature = 310):
34
+ def run_pipeline(self,plots=False, friction=0.1, ff_path='forcefields/classic_sm_ff.xml', integrator_step = 100 * mm.unit.femtosecond, temperature = 310):
35
35
  '''
36
36
  This is the basic function that runs the molecular simulation pipeline.
37
37
  '''
@@ -48,7 +48,7 @@ class EM_LE:
48
48
  for i in tqdm(range(self.burnin,self.N_steps)):
49
49
  # Define System
50
50
  pdb = PDBxFile(self.path+'/LE_init_struct.cif')
51
- forcefield = ForceField('forcefields/classic_sm_ff.xml')
51
+ forcefield = ForceField(ff_path)
52
52
  self.system = forcefield.createSystem(pdb.topology, nonbondedCutoff=1*u.nanometer)
53
53
  integrator = mm.LangevinIntegrator(temperature, friction, integrator_step)
54
54
 
@@ -16,7 +16,7 @@ from .utils import *
16
16
  from .initial_structures import *
17
17
 
18
18
  class MD_LE:
19
- def __init__(self,M,N,N_beads,burnin,MC_step,path=None,platform='CPU',angle_ff_strength=200,le_distance=0.1,le_ff_strength=30000.0,ev_ff_strength=10.0,tolerance=0.001):
19
+ def __init__(self,M,N,N_beads,burnin,MC_step,path=None,platform='CPU',angle_ff_strength=200,le_distance=0.1,le_ff_strength=50000.0,ev_ff_strength=10.0,tolerance=0.001):
20
20
  '''
21
21
  M, N (np arrays): Position matrix of two legs of cohesin m,n.
22
22
  Rows represent loops/cohesins and columns represent time
@@ -35,7 +35,7 @@ class MD_LE:
35
35
  self.ev_ff_strength = ev_ff_strength
36
36
  self.tolerance = tolerance
37
37
 
38
- def run_pipeline(self,run_MD=True, friction=0.1, integrator_step=5 * mm.unit.femtosecond, sim_step=100, temperature=310, plots=False):
38
+ def run_pipeline(self,run_MD=True, friction=0.1, integrator_step=10 * mm.unit.femtosecond, sim_step=1000, ff_path = 'forcefields/classic_sm_ff.xml',temperature=310, plots=False):
39
39
  '''
40
40
  This is the basic function that runs the molecular simulation pipeline.
41
41
  '''
@@ -54,7 +54,7 @@ class MD_LE:
54
54
 
55
55
  # Define System
56
56
  pdb = PDBxFile(self.path+'/LE_init_struct.cif')
57
- forcefield = ForceField('forcefields/classic_sm_ff.xml')
57
+ forcefield = ForceField(ff_path)
58
58
  self.system = forcefield.createSystem(pdb.topology, nonbondedCutoff=1*u.nanometer)
59
59
  integrator = mm.LangevinIntegrator(temperature, friction, integrator_step)
60
60
 
@@ -25,10 +25,6 @@ def make_loop_hist(Ms,Ns,path=None):
25
25
  if path!=None:
26
26
  save_path = path+'/plots/loop_length.png'
27
27
  plt.savefig(save_path,format='png',dpi=200)
28
- save_path = path+'/plots/loop_length.svg'
29
- plt.savefig(save_path,format='svg',dpi=600)
30
- save_path = path+'/plots/loop_length.pdf'
31
- plt.savefig(save_path,format='pdf',dpi=600)
32
28
  plt.close()
33
29
 
34
30
  Is, Js = Ms.flatten(), Ns.flatten()
@@ -40,10 +36,6 @@ def make_loop_hist(Ms,Ns,path=None):
40
36
  if path!=None:
41
37
  save_path = path+'/plots/ij_prob.png'
42
38
  plt.savefig(save_path,format='png',dpi=200)
43
- save_path = path+'/plots/ij_prob.svg'
44
- plt.savefig(save_path,format='svg',dpi=600)
45
- save_path = path+'/plots/ij_prob.pdf'
46
- plt.savefig(save_path,format='pdf',dpi=600)
47
39
  plt.close()
48
40
 
49
41
  def make_gif(N,path=None):
@@ -71,10 +63,6 @@ def make_timeplots(Es, Bs, Ks, Fs, burnin, mode, path=None):
71
63
  if path!=None:
72
64
  save_path = path+'/plots/energies.png'
73
65
  plt.savefig(save_path,format='png',dpi=200)
74
- save_path = path+'/plots/energies.svg'
75
- plt.savefig(save_path,format='svg',dpi=200)
76
- save_path = path+'/plots/energies.pdf'
77
- plt.savefig(save_path,format='pdf',dpi=600)
78
66
  plt.close()
79
67
 
80
68
  # Autocorrelation plot
@@ -91,10 +79,6 @@ def make_timeplots(Es, Bs, Ks, Fs, burnin, mode, path=None):
91
79
  if path!=None:
92
80
  save_path = path+'/plots/autoc.png'
93
81
  plt.savefig(save_path,dpi=200)
94
- save_path = path+'/plots/autoc.svg'
95
- plt.savefig(save_path,format='svg',dpi=200)
96
- save_path = path+'/plots/autoc.pdf'
97
- plt.savefig(save_path,format='pdf',dpi=200)
98
82
  plt.close()
99
83
 
100
84
  def make_moveplots(unbinds, slides, path=None):
@@ -108,9 +92,7 @@ def make_moveplots(unbinds, slides, path=None):
108
92
  plt.grid()
109
93
  if path!=None:
110
94
  save_path = path+'/plots/moveplot.png'
111
- plt.savefig(save_path,dpi=600)
112
- save_path = path+'/plots/moveplot.pdf'
113
- plt.savefig(save_path,dpi=600)
95
+ plt.savefig(save_path,dpi=200)
114
96
  plt.close()
115
97
 
116
98
  def average_pooling(mat,dim_new):
@@ -171,10 +153,6 @@ def coh_traj_plot(ms,ns,N_beads,path):
171
153
  plt.gca().invert_yaxis()
172
154
  save_path = path+'/plots/coh_trajectories.png' if path!=None else 'coh_trajectories.png'
173
155
  plt.savefig(save_path, format='png', dpi=200)
174
- save_path = path+'/plots/coh_trajectories.svg' if path!=None else 'coh_trajectories.svg'
175
- plt.savefig(save_path, format='svg', dpi=600)
176
- save_path = path+'/plots/coh_trajectories.pdf' if path!=None else 'coh_trajectories.pdf'
177
- plt.savefig(save_path, format='pdf', dpi=600)
178
156
  plt.close()
179
157
 
180
158
  def coh_probdist_plot(ms,ns,N_beads,path):
@@ -192,10 +170,6 @@ def coh_probdist_plot(ms,ns,N_beads,path):
192
170
  plt.title('Probablity distribution of cohesin')
193
171
  save_path = path+'/plots/coh_probdist.png' if path!=None else 'coh_trajectories.png'
194
172
  plt.savefig(save_path, format='png', dpi=200)
195
- save_path = path+'/plots/coh_probdist.svg' if path!=None else 'coh_trajectories.svg'
196
- plt.savefig(save_path, format='svg', dpi=600)
197
- save_path = path+'/plots/coh_probdist.pdf' if path!=None else 'coh_trajectories.pdf'
198
- plt.savefig(save_path, format='pdf', dpi=600)
199
173
  plt.close()
200
174
 
201
175
  def stochastic_heatmap(ms,ns,step,L,path,comm_prop=True,fill_square=True):
@@ -229,9 +203,7 @@ def stochastic_heatmap(ms,ns,step,L,path,comm_prop=True,fill_square=True):
229
203
  figure(figsize=(10, 10))
230
204
  plt.imshow(avg_mat,cmap="Reds",vmax=np.average(avg_mat)+3*np.std(avg_mat))
231
205
  save_path = path+f'/plots/stochastic_heatmap.svg' if path!=None else 'stochastic_heatmap.svg'
232
- plt.savefig(save_path,format='svg',dpi=500)
233
- save_path = path+f'/plots/stochastic_heatmap.pdf' if path!=None else 'stochastic_heatmap.pdf'
234
- plt.savefig(save_path,format='pdf',dpi=500)
206
+ plt.savefig(save_path,format='svg',dpi=200)
235
207
  # plt.colorbar()
236
208
  plt.close()
237
209
 
@@ -266,8 +238,5 @@ def combine_matrices(path_upper,path_lower,label_upper,label_lower,th1=0,th2=50,
266
238
  # plt.ylabel('Genomic Distance (x5kb)',fontsize=16)
267
239
  plt.xlabel('Genomic Distance (x5kb)',fontsize=20)
268
240
  plt.ylabel('Genomic Distance (x5kb)',fontsize=20)
269
- # plt.title('Experimental (upper triangle) versus simulation (lower triangle) heatmap',fontsize=25)
270
- plt.savefig('comparison_reg3.svg',format='svg',dpi=500)
271
- plt.savefig('comparison_reg3.png',format='png',dpi=500)
272
- plt.savefig('comparison_reg3.pdf',format='pdf',dpi=500)
241
+ plt.savefig('comparison_reg3.png',format='png',dpi=200)
273
242
  plt.close()
@@ -72,9 +72,9 @@ def main():
72
72
  sim = StochasticSimulation(region,chrom,bedpe_file,out_dir=output_name,N_beads=N_beads,N_lef=N_lef)
73
73
  Es, Ms, Ns, Bs, Ks, Fs, ufs = sim.run_energy_minimization(N_steps,MC_step,burnin,T,T_min,mode=mode,viz=args.SAVE_PLOTS,save=args.SAVE_MDT,lef_rw=args.LEF_RW)
74
74
  if args.SIMULATION_TYPE=='EM':
75
- sim.run_EM(args.PLATFORM,args.ANGLE_FF_STRENGTH,args.LE_FF_LENGTH,args.LE_FF_STRENGTH,args.EV_FF_STRENGTH,args.TOLERANCE,args.FRICTION,args.INTEGRATOR_STEP,args.SIM_TEMP,args.VIZ_HEATS)
75
+ sim.run_EM(args.PLATFORM,args.ANGLE_FF_STRENGTH,args.LE_FF_LENGTH,args.LE_FF_STRENGTH,args.EV_FF_STRENGTH,args.TOLERANCE,args.FRICTION,args.INTEGRATOR_STEP,args.SIM_TEMP,args.VIZ_HEATS,args.FORCEFIELD_PATH)
76
76
  elif args.SIMULATION_TYPE=='MD':
77
- sim.run_MD(args.PLATFORM,args.ANGLE_FF_STRENGTH,args.LE_FF_LENGTH,args.LE_FF_STRENGTH,args.EV_FF_STRENGTH,args.TOLERANCE,args.FRICTION,args.INTEGRATOR_STEP,args.SIM_TEMP,args.SIM_STEP,args.VIZ_HEATS)
77
+ sim.run_MD(args.PLATFORM,args.ANGLE_FF_STRENGTH,args.LE_FF_LENGTH,args.LE_FF_STRENGTH,args.EV_FF_STRENGTH,args.TOLERANCE,args.FRICTION,args.INTEGRATOR_STEP,args.SIM_TEMP,args.SIM_STEP,args.VIZ_HEATS,args.FORCEFIELD_PATH)
78
78
  elif args.SIMULATION_TYPE==None:
79
79
  print('\n3D simulation did not run because it was not specified. Please specify argument SIMULATION_TYPE as EM or MD.')
80
80
  else:
@@ -272,14 +272,14 @@ class StochasticSimulation:
272
272
  self.N_CTCF = np.max([np.count_nonzero(self.L),np.count_nonzero(self.R)])
273
273
  print('Number of CTCF:',self.N_CTCF)
274
274
 
275
- def run_EM(self,platform='CPU',angle_ff_strength=200,le_distance=0.0,le_ff_strength=300000.0,ev_ff_strength=10.0,tolerance=0.001,friction=0.1,integrator_step=5*mm.unit.femtosecond,temperature=310,save_plots=True):
275
+ def run_EM(self,platform='CPU',angle_ff_strength=200,le_distance=0.0,le_ff_strength=300000.0,ev_ff_strength=10.0,tolerance=0.001,friction=0.1,integrator_step=5*mm.unit.femtosecond,temperature=310,save_plots=True,ff_path='forcefields/classic_sm_ff.xml'):
276
276
  em = EM_LE(self.Ms,self.Ns,self.N_beads,self.burnin,self.MC_step,self.path,platform,angle_ff_strength,le_distance,le_ff_strength,ev_ff_strength,tolerance)
277
- sim_heat = em.run_pipeline(plots=save_plots,friction=friction,integrator_step=integrator_step,temperature=temperature)
277
+ sim_heat = em.run_pipeline(plots=save_plots,friction=friction,integrator_step=integrator_step,temperature=temperature,ff_path=ff_path)
278
278
  corr_exp_heat(sim_heat,self.bedpe_file,self.region,self.chrom,self.N_beads,self.path)
279
279
 
280
- def run_MD(self,platform='CPU',angle_ff_strength=200,le_distance=0.0,le_ff_strength=300000.0,ev_ff_strength=10.0,tolerance=0.001,friction=0.1,integrator_step=5*mm.unit.femtosecond,temperature=310,sim_step=100,save_plots=True):
280
+ def run_MD(self,platform='CPU',angle_ff_strength=200,le_distance=0.0,le_ff_strength=300000.0,ev_ff_strength=10.0,tolerance=0.001,friction=0.1,integrator_step=5*mm.unit.femtosecond,temperature=310,sim_step=100,save_plots=True,ff_path='forcefields/classic_sm_ff.xml'):
281
281
  md = MD_LE(self.Ms,self.Ns,self.N_beads,self.burnin,self.MC_step,self.path,platform,angle_ff_strength,le_distance,le_ff_strength,ev_ff_strength,tolerance)
282
- sim_heat = md.run_pipeline(plots=save_plots,sim_step=sim_step,friction=friction,integrator_step=integrator_step,temperature=temperature)
282
+ sim_heat = md.run_pipeline(plots=save_plots,sim_step=sim_step,friction=friction,integrator_step=integrator_step,temperature=temperature,ff_path=ff_path)
283
283
  corr_exp_heat(sim_heat,self.bedpe_file,self.region,self.chrom,self.N_beads,self.path)
284
284
 
285
285
  def main():
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyLoopSage
3
- Version: 1.0.9
3
+ Version: 1.0.11
4
4
  Summary: An energy-based stochastic model of loop extrusion in chromatin.
5
5
  Home-page: https://github.com/SFGLab/pyLoopSage
6
6
  Author: Sebastian Korsak
@@ -6,7 +6,7 @@ with open('README.md', 'r', encoding='utf-8') as f:
6
6
 
7
7
  setup(
8
8
  name='pyLoopSage', # Package name
9
- version='1.0.9', # Version of the software
9
+ version='1.0.11', # Version of the software
10
10
  description='An energy-based stochastic model of loop extrusion in chromatin.',
11
11
  long_description=long_description,
12
12
  long_description_content_type='text/markdown',
File without changes
File without changes
File without changes