tyssue.topology package#
Submodules#
tyssue.topology.base_topology module#
- tyssue.topology.base_topology.add_vert(eptm, edge)[source]#
Adds a vertex in the middle of the edge,
which is split as is its opposite(s)
- Parameters
eptm (a
Epithelium
instance) –edge (int) –
split (the index of one of the half-edges to) –
- Returns
new_vert (int)
the index to the new vertex
new_edges (int or list of ints)
index to the new edge(s). For a sheet, returns
a single index, for a 3D epithelium, returns
the list of all the new parallel edges
new_opp_edges (int or list of ints)
index to the new opposite edge(s). For a sheet, returns
a single index, for a 3D epithelium, returns
the list of all the new parallel edges
In the simple case whith two half-edge, returns indices to the new edges, with the following convention:
- s e t
——>
<—— *
oe
- s e ne t
—— —–>
- <—– * —— *
oe nv noe
where “e” is the passed edge as argument, “s” its source “t” its target and “oe” its opposite. The returned edges are the ones between the new vertex and the input edge’s original target.
- tyssue.topology.base_topology.close_face(eptm, face)[source]#
Closes the face if a single edge is missing.
This function does not close the adjacent and opposite faces. Returns the index of the new edge if created, otherwise None
- tyssue.topology.base_topology.collapse_edge(sheet, edge, reindex=True, allow_two_sided=False)[source]#
Collapses edge and merges it’s vertices, creating (or increasing the rank of) a rosette structure.
If reindex is True (the default), resets indexes and topology data. The edge is collapsed on the smaller of the srce, trgt indexes (to minimize reindexing impact)
Returns the index of the collapsed edge’s remaining vertex (its srce)
- tyssue.topology.base_topology.condition_4i(eptm)[source]#
Return an index over the faces violating condition 4 i in Okuda et al 2013, that is edges (from the same face) sharing two vertices simultaneously.
- tyssue.topology.base_topology.condition_4ii(eptm)[source]#
Return an array of face pairs sharing more than two half-edges, as defined in Okuda et al. 2013 condition 4 ii
Note
An indication way to solve this:
faces = condition_4ii(eptm) pairs = set(frozenset(p) for p in faces) cols = ['srce', 'trgt', 'face', 'cell', 'length', 'sub_area'] edges = eptm.edge_df[ eptm.edge_df["face"].isin(faces[0]) ][cols].sort_values("face") all_edges = eptm.edge_df.loc[eptm.edge_df["face"].isin( set(faces.ravel())), cols].sort_values("face") all_edges['single'] = all_edges[["srce", "trgt"]].apply(frozenset, axis=1) ufaces = set(faces.ravel()) com_vs = set(all_edges.srce) for face in ufaces: com_vs = com_vs.intersection( all_edges.loc[all_edges["face"] == face, "srce"] )
- tyssue.topology.base_topology.drop_two_sided_faces(eptm)[source]#
Removes all the two (or one?) sided faces from the epithelium
Note that they are not collapsed, but simply eliminated Does not reindex
- tyssue.topology.base_topology.get_neighbour_face_pairs(eptm)[source]#
Returns a pandas Series of neighboring face pairs (as forzen sets of 2 indexes)
- tyssue.topology.base_topology.get_num_common_edges(eptm)[source]#
Returns the number of common edges between two neighboring faces this number is set to -1 if those faces are opposite and share the same edges.
- tyssue.topology.base_topology.merge_border_edges(sheet, drop_two_sided=True)[source]#
Merge edges at the border of a sheet such that no vertex has only one incoming and one outgoing edge.
- tyssue.topology.base_topology.merge_vertices(sheet, vert0, vert1, reindex=True)[source]#
Merge the two vertices vert0 and vert1 iff they are linked by an edge
If reindex is True (the default), resets indexes and topology data
It is more efficient to call directly collapse_edge
- tyssue.topology.base_topology.remove_face(sheet, face)[source]#
Removes a face from the mesh.
Returns the index of the new vert that replaces the face.
- tyssue.topology.base_topology.split_vert(sheet, vert, face, to_rewire, epsilon, recenter=False)[source]#
Creates a new vertex and moves it towards the center of face.
The edges in to_rewire will be connected to the new vertex.
- Parameters
sheet (a
tyssue.Sheet
instance) –vert (int, the index of the vertex to split) –
face (int, the index of the face where to move the vertex) –
to_rewire (
pd.DataFrame
a subset of sheet.edge_df) – where all the edges pointing to (or from) the old vertex will point to (or from) the new.
Note
This will leave opened faces and cells
tyssue.topology.bulk_topology module#
- tyssue.topology.bulk_topology.HI_transition(eptm, face, recenter=False)[source]#
H → I transition as defined in Okuda et al. 2013 (DOI 10.1007/s10237-012-0430-7). See tyssue/doc/illus/IH_transition.png for the algorithm
- tyssue.topology.bulk_topology.IH_transition(eptm, edge, recenter=False)[source]#
I → H transition as defined in Okuda et al. 2013 (DOI 10.1007/s10237-012-0430-7). See tyssue/doc/illus/IH_transition.png for the algorithm
- tyssue.topology.bulk_topology.cell_division(eptm, mother, geom, vertices=None, mother_verts=None, daughter_verts=None)[source]#
- tyssue.topology.bulk_topology.close_cell(eptm, cell)[source]#
Closes the cell by adding a face. Assumes a single face is missing
- tyssue.topology.bulk_topology.find_rearangements(eptm)[source]#
Finds the candidates for IH and HI transitions :returns: * edges_HI (set of indexes of short edges)
faces_IH (set of indexes of small triangular faces)
- tyssue.topology.bulk_topology.fix_pinch(eptm)[source]#
Due to rearangements, some faces in an epithelium will have more than one opposite face.
This method fixes the issue so we can have a valid epithelium back.
- tyssue.topology.bulk_topology.get_division_edges(eptm, mother, plane_normal, plane_center=None, return_verts=False)[source]#
Returns an index of the mother cell edges crossed by the division plane, ordered clockwize around the division plane normal.
- tyssue.topology.bulk_topology.get_division_vertices(eptm, division_edges=None, mother=None, plane_normal=None, plane_center=None, return_all=False)[source]#
- tyssue.topology.bulk_topology.remove_cell(eptm, cell)[source]#
Removes a tetrahedral cell from the epithelium.
- tyssue.topology.bulk_topology.split_vert(eptm, vert, face=None, multiplier=1.5, recenter=False)[source]#
Splits a vertex towards a face.
- Parameters
eptm (a
tyssue.Epithelium
instance) –vert (int the vertex to split) –
face (For a given) – if face is None, one face will be chosen at random
multiplier (float, default 1.5) – length of the new edge(s) in units of eptm.settings[“threshold_length”]
algorithm (Note on the) –
--------------------- –
face –
number (we look for the adjacent cell with the lowest) –
4 (If it's) –
ValueError (we raise a) –
3 (If it's) –
transition (we do a IH) –
faces (resulting in a new edge but no new) –
4 –
transition –
edges. (resulting in a new face and 2 ne) –
../doc/illus/IH_transition.png (see) –
tyssue.topology.monolayer_topology module#
- tyssue.topology.monolayer_topology.cell_division(monolayer, mother, orientation='vertical', psi=None)[source]#
Divides the cell mother in the monolayer.
- Parameters
monolayer (*) –
mother (*) –
orientation (*) – if “horizontal”, performs a division in the equatorial plane of the cell. If “vertical” (the default), performs a division along the basal-apical axis of the cell. If “apical”, performs a division cutting the apical face perpendicularly to its principal axis
psi (*) – extra rotation angle of the division plane around the basal-apical plane
- Returns
* daughter
- Return type
int, the index of the daughter cell
tyssue.topology.sheet_topology module#
- tyssue.topology.sheet_topology.cell_division(sheet, mother, geom, angle=None)[source]#
Causes a cell to divide
- Parameters
sheet (a 'Sheet' instance) –
mother (face index of target dividing cell) –
geom (a 2D geometry) –
angle (division angle for newly formed edge) –
- Returns
daughter
- Return type
face index of new cell
Notes
Function checks for perodic boundaries if there are, it checks if dividing cell rests on an edge of the periodic boundaries if so, it displaces the boundaries by a half a period and moves the target cell in the bulk of the tissue. It then performs cell division normally and reverts the periodic boundaries to the original configuration
- tyssue.topology.sheet_topology.face_division(sheet, mother, vert_a, vert_b)[source]#
Divides the face associated with edges indexed by edge_a and edge_b, splitting it in the middle of those edes.
- tyssue.topology.sheet_topology.get_division_edges(sheet, mother, geom, angle=None, axis='x')[source]#
- tyssue.topology.sheet_topology.split_vert(sheet, vert, face=None, multiplier=1.5, reindex=True, recenter=False, epsilon=None)[source]#
Splits a vertex towards the center of the face.
This operation removes the face face from the neighborhood of the vertex.
- Returns a list of the new edge’s indices in edge_df. This should be two:
the edge with vert as the srce and the newly created vertex as the trgt and the reverse edge with vert as the trgt and the new one as the srce
- tyssue.topology.sheet_topology.type1_transition(sheet, edge01, *, remove_tri_faces=True, multiplier=1.5)[source]#
Performs a type 1 transition around the edge edge01
See ../../doc/illus/t1_transition.png for a sketch of the definition of the vertices and cells letterings See Finegan et al. for a description of the algotithm https://doi.org/10.1101/704932
- Parameters
sheet (a Sheet instance) –
edge_01 (int) – index of the edge around which the transition takes place
epsilon (float, optional, deprecated) – default 0.1, the initial length of the new edge, in case “threshold_length” is not in the sheet.settings
remove_tri_faces (bool, optional) – if True (the default), will remove triangular cells after the T1 transition is performed
multiplier (float, optional) – default 1.5, the multiplier to the threshold length, so that the length of the new edge is set to multiplier * threshold_length
Module contents#
- exception tyssue.topology.TopologyChangeError[source]#
Bases:
ValueError
Raised when trying to assign values without the correct length to an epithelium dataset
- tyssue.topology.all_rearangements(eptm, with_t3=True)[source]#
Performs rearangements (T3/HI first) until there are none left or MAX_ITER is reached.
- tyssue.topology.single_rearangement(eptm, with_t3=True)[source]#
Performs a single rearangement (if any) on epithelium eptm.
If with_t3 is True and there are removeable faces, will perform a type 3 or HI transition on one of those faces. If no such transition should occur, will perform a type 1 or IH transition on one of the edges.