%load_ext autoreload
%autoreload 2
%run nb_init
# This imports leg_joint as lj
2014-03-18 17:59:42,321 -leg_joint -INFO -successfully imported leg_joint
params = {'seq_kwargs': {'num_cells': 1.,#[30, 20, 10, 5, 1],
'width_apopto':2,
'p0': 1.,
'amp': 0.4,
'gamma': 1.0,
'seed': 5,
'num_steps': 10,
'random': True},
'apopto_kwargs': {'vol_reduction':0.5,
'contractility': 1.2,
'radial_tension': 0.3},
'post_kwargs': {'max_ci':3.,
'rate_ci':1.4,
'span_ci':1}}
all_kwargs = lj.get_kwargs(0, params)
eptm = lj.Epithelium(graphXMLfile='../saved_graphs/xml/before_apoptosis.xml',
identifier='single')
2014-03-18 17:59:50,190 -leg_joint.epithelium -INFO -Instanciating epithelium single 2014-03-18 17:59:51,608 -leg_joint.epithelium -INFO -Initial cells 2014-03-18 17:59:51,609 -leg_joint.epithelium -INFO -Initial junctions 2014-03-18 18:00:03,948 -leg_joint.epithelium -INFO -Update geometry
and get apoptic cells sequence (here only one cell will die)
seq_kwargs = all_kwargs['seq_kwargs']
apopto_kwargs = all_kwargs['apopto_kwargs']
post_kwargs = all_kwargs['post_kwargs']
apopto_cells, fold_cells, apopto_sequence = lj.get_apoptotic_cells(eptm, **seq_kwargs)
print('%i apoptotic cell(s)' % len(apopto_cells))
print('surrounded by %i fold cell(s)' % len(fold_cells))
1 apoptotic cell(s) surrounded by 157 fold cell(s)
Now grab our apoptotic cell, and have a look at it's surroundings
a_cell = apopto_cells[0]
eptm.set_local_mask(None)
eptm.set_local_mask(a_cell, wider=True)
neighbours = [neighbour for neighbour in eptm.cells.get_neighbor_cells(a_cell)]
## Let's define a neat plotting function
def show_apopto_surroundings(eptm, a_cell):
eptm.set_local_mask(None)
eptm.set_local_mask(a_cell, wider=True)
is_apoptotic = eptm.ixs.copy()
is_apoptotic.a[:] = 0.
is_apoptotic[a_cell] = 1.
ax_zs, ax_xy = lj.plot_2pannels(eptm,
edge_kwargs={'c':'k', 'lw':0.5, 'alpha':0.5},
cell_kwargs={'cell_colors':is_apoptotic,
'alpha':0.5})
eptm.set_local_mask(None)
return ax_zs, ax_xy
### And use it straight away
ax_zs, ax_xy = show_apopto_surroundings(eptm, a_cell)
/home/guillaume/python3/lib/python3.3/site-packages/matplotlib-1.4.x-py3.3-linux-x86_64.egg/matplotlib/figure.py:1617: UserWarning: This figure includes Axes that are not compatible with tight_layout, so its results might be incorrect. warnings.warn("This figure includes Axes that are not "
lj.apoptosis_step(eptm, a_cell, **apopto_kwargs)
ax_zs, ax_xy = show_apopto_surroundings(eptm, a_cell)
Now let's do the above repeatidly
steps = 1
for sub_sequence in apopto_sequence:
for a_cell in sub_sequence:
lj.apoptosis_step(eptm, a_cell, **apopto_kwargs)
steps += 1
print('We did %i steps' % steps)
#new_jv = remove_cell(eptm, prev_first)
ax_zs, ax_xy = show_apopto_surroundings(eptm, a_cell)
We did 11 steps
lj.post_apoptosis(eptm, a_cell, fold_cells, **post_kwargs)
2014-03-18 18:03:53,696 -leg_joint.topology -INFO -new vertex 5123
alignment, anisotropies = eptm.cells.get_anisotropies()
eptm.set_local_mask(None)
for neighbour in neighbours:
eptm.set_local_mask(neighbour, wider=True)
rel_c = eptm.cells.contractilities
lj.local_slice(eptm, zed_amp=15, theta_amp=2*np.pi)
ax_zs, ax_xy = lj.plot_2pannels(eptm,
cell_kwargs={'c_text':False,
'cell_colors':rel_c,
'alpha':0.4},
edge_kwargs={'j_text':False,
'c':'k',
'lw':0.5,
'alpha':0.8})
eptm.set_local_mask(None)
for neighbour in neighbours:
eptm.set_local_mask(neighbour, wider=True)
eptm.graph.set_edge_filter(eptm.is_local_edge)
eptm.update_rhotheta()
depth = eptm.dzeds.copy()
for edge in eptm.graph.edges():
depth[edge] = (eptm.rhos[edge.source()]
+ eptm.rhos[edge.target()]) / 2.
depth.a -= depth.fa.min()
eptm.graph.set_edge_filter(None)
axes = lj.plot_2pannels(eptm,
cell_kwargs={'c_text':False},
edge_kwargs={'edge_color':depth, 'alpha':0.8})
eptm.graph.set_vertex_filter(eptm.is_cell_vert)
print(eptm.cells.contractilities.fa.mean())
eptm.graph.set_vertex_filter(None)
277.709242626
eptm.params['contractility']
276.48