Cross-Dataset Comparison¶
napari_relax.relax_multipledatasets.manager_widget
¶
Manager Manipulation entry of the Cross Lineagetree comparison widget.
CrossEmbryo
¶
Bases: LayerCorrectorTreeProducer
Create, load, edit and save a LineageTreeManager.
The manager is sent to the other cross-dataset widgets through
send_manager_to_classes whenever it changes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
napari_viewer
|
Viewer
|
The napari viewer. |
required |
update_layer_list()
¶
Map the manager names of the viewer layers to the layers.
save_manager()
¶
Save the manager to the selected file.
add_a_new_embryo()
¶
Add the selected .lT files to the manager.
add_a_new_embryo_from_viewer()
¶
Not implemented.
remove_embryo(source, pos)
¶
Remove the dataset under the cursor from the manager.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
QListWidget
|
The list of datasets. |
required |
pos
|
QPoint
|
Position of the right click in the list. |
required |
load_a_manager()
¶
Load a LineageTreeManager from the selected file.
add_new_layer(name=None)
¶
Add datasets of the manager to the viewer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
list of QListWidgetItem
|
Items to add; the items selected in the list are used if None. Datasets already in the viewer are skipped. |
None
|
create_a_manager()
¶
Create a new LineageTreeManager from all LineageTree layers.
update_Qlistwidget()
¶
Refresh the list of datasets from the manager.
eventFilter(source, event)
¶
Show the context menu of the dataset list on right click.
The menu offers "Change Time Resolution" and "Remove Embryo".
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
QObject
|
The object receiving the event. |
required |
event
|
QEvent
|
The event. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if the event was handled. |
change_time_resolution(source, pos)
¶
Ask for a new time resolution for the dataset under the cursor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
QListWidget
|
The list of datasets. |
required |
pos
|
QPoint
|
Position of the right click in the list. |
required |
resizeEvent(event)
¶
Keep the help button in the top right corner.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event
|
QResizeEvent
|
The resize event. |
required |
napari_relax.relax_multipledatasets.cross_comparisons_handler
¶
Cross Distance Calculation entry of the Cross Lineagetree comparison widget.
CrossHandler
¶
Bases: LayerCorrectorTreeProducer
Two dataset viewers plus tabs to configure and inspect comparisons.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
napari_viewer
|
Viewer
|
The napari viewer. |
required |
get_lt_manager(signal)
¶
Receive the manager whenever it changes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
signal
|
LineageTreeManager
|
The updated manager. |
required |
kill_thread(dummy_event=None)
¶
Stop the comparison thread and close the progress bar.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dummy_event
|
object
|
Event of the signal that triggered the stop, unused. |
None
|
thread_handler()
¶
Start the cross-dataset comparisons in a background thread.
Warns first if a dataset name is longer than 6 characters.
update_comparisons(product)
¶
Send the results yielded by the comparison thread to the plots.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
product
|
tuple
|
Comparisons, sublineage names and normalizations, one entry per level of comparison computed so far. |
required |
napari_relax.relax_multipledatasets.cross_config
¶
Configuration tab of the Cross Distance Calculation.
CrossConfig
¶
Bases: LayerCorrectorTreeProducer
Approximation style, dataset selection and one tab per dataset.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
napari_viewer
|
Viewer
|
The napari viewer. |
required |
lcm
property
¶
Least common multiple of the time resolutions of the datasets.
Returns:
| Type | Description |
|---|---|
int
|
The least common multiple, or 1 if no dataset is selected. |
get_lt_manager(signal)
¶
Receive the manager whenever it changes and list its datasets.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
signal
|
LineageTreeManager
|
The updated manager. |
required |
tab_maker()
¶
Create one configuration tab per selected dataset.
roots_selector()
¶
Compute the pairwise distances of sublineages across datasets.
Yields:
| Type | Description |
|---|---|
tuple
|
Comparisons, sublineage names and normalizations, one entry per level of comparison computed so far. |
kill_thread()
¶
Stop the comparison thread.
update_comparisons(product)
¶
Store the results yielded by the comparison thread.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
product
|
tuple
|
Comparisons, sublineage names and normalizations. |
required |
update_tree_style()
¶
Show the downsampling box only for the downsampled style.
change_downsampling_rates()
¶
Reset the downsampling rates offered.
change_tooltip_for_downsample()
¶
Show the real downsampling rate of each dataset in the tooltip.
resizeEvent(event)
¶
Keep the help button in the top right corner.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event
|
QResizeEvent
|
The resize event. |
required |
napari_relax.relax_multipledatasets.cross_embryo_comparison
¶
Plots tab of the Cross Distance Calculation.
CrossClustermap
¶
Bases: LayerCorrectorTreeProducer
Tree plots, clustermap and save widgets for cross-dataset results.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
napari_viewer
|
Viewer
|
The napari viewer. |
required |
dataset_viewers
|
list of napari.components.ViewerModel
|
The two viewers showing the compared datasets. |
required |
get_lt_manager(signal)
¶
Receive the manager whenever it changes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
signal
|
LineageTreeManager
|
The updated manager. |
required |
send_data()
¶
Plot the comparisons of the level selected by the slider.
add_spot_on_graph(cell, index, lineagetree_name)
¶
Add a cell to its graph if it is in the middle of a chain.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cell
|
int
|
ID of the cell. |
required |
index
|
int
|
Index of the graph in the list of graphs. |
required |
lineagetree_name
|
str
|
Name of the dataset in the layers and the manager. |
required |
paint_sublineage(cell, index, color, lineagetree_name)
¶
Return the node colors of a graph with a sublineage highlighted.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cell
|
int
|
Root of the sublineage. |
required |
index
|
int
|
Index of the graph in the list of graphs. |
required |
color
|
int or color
|
Highlight color; 0 means magenta and 1 cyan. |
required |
lineagetree_name
|
str
|
Name of the dataset in the layers and the manager. |
required |
Returns:
| Type | Description |
|---|---|
list
|
Color of each node of the graph; other nodes are black. |
reset_graph(cell, index, lineagetree_name)
¶
Remove a cell added by add_spot_on_graph from its graph.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cell
|
int
|
ID of the cell. |
required |
index
|
int
|
Index of the graph in the list of graphs. |
required |
lineagetree_name
|
str
|
Name of the dataset in the layers and the manager. |
required |
tree_painter(node, lineagetree_name, color, ax)
¶
Draw a lineage with a sublineage highlighted on a tree plot.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
node
|
int
|
The first node of the sublineage. |
required |
lineagetree_name
|
str
|
Name of the dataset in the manager and the layers. |
required |
color
|
color
|
Color of the sublineage. |
required |
ax
|
Axes
|
Axes of the tree plot. |
required |
sub_points_painter(node, lineagetree_name, viewer, color)
¶
Show a dataset in a dataset viewer with a sublineage colored.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
node
|
int
|
The first node of the sublineage. |
required |
lineagetree_name
|
str
|
Name of the dataset in the manager and the layers. |
required |
viewer
|
ViewerModel
|
The dataset viewer to draw in. |
required |
color
|
color
|
Color of the sublineage; other cells are white. |
required |
save_dictionary()
¶
Save the comparisons and the manager to the selected .pkl file.
time_changer()
¶
Show the clustermap of the level selected by the slider.
resizeEvent(event)
¶
Keep the help button in the top right corner.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event
|
QResizeEvent
|
The resize event. |
required |
napari_relax.relax_multipledatasets.cross_clustermap_canvas
¶
Matplotlib canvas drawing the cross-dataset clustermap.
CrossClusterMapCanvas
¶
Bases: ClusterMapCanvas
Clustermap canvas for sublineages of several datasets.
clear_data()
¶
Clear the plot, the data and the manager.
annotation_maker(x, y, offset_xy, ha, value)
¶
Create the hover box of a clustermap cell.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
float
|
Column of the cell. |
required |
y
|
float
|
Row of the cell. |
required |
offset_xy
|
tuple of int
|
Offset of the box from the cell, in points. |
required |
ha
|
str
|
Horizontal alignment of the box. |
required |
value
|
float
|
Score shown in the box. |
required |
napari_relax.relax_multipledatasets.cell_size
¶
Point size sliders of the two dataset viewers.
MinimalCellSize
¶
Bases: LayerCorrectorTreeProducer
Point size sliders for the two dataset viewers.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
napari_viewer
|
Viewer
|
The main napari viewer. |
required |
napari_viewer_1
|
ViewerModel
|
The first dataset viewer. |
required |
napari_viewer_2
|
ViewerModel
|
The second dataset viewer. |
required |
change(viewer, slider, other_viewer, other_slider, event)
¶
Apply a slider value to its viewer, or to both viewers.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
viewer
|
ViewerModel
|
The viewer of the moved slider. |
required |
slider
|
QSlider
|
The moved slider. |
required |
other_viewer
|
ViewerModel
|
The other viewer. |
required |
other_slider
|
QSlider
|
The slider of the other viewer. |
required |
event
|
object
|
The slider event, unused. |
required |
napari_relax._util_classes.tab_template
¶
TabTemplate
¶
Bases: QWidget
Per-dataset configuration tab of the cross-dataset comparison.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lineagetree
|
LineageTree
|
The dataset configured by this tab. |
required |
name
|
str
|
Name of the dataset in the manager. |
required |
time_cropping()
¶
Read the crop time typed by the user.
show_roots()
¶
Return the roots selected for the comparison.
Returns:
| Type | Description |
|---|---|
list
|
The selected root IDs. |
times_selector()
¶
Read the timepoints to compare.
They are either a comma-separated list or a range built from start, stop and step.
ret_times()
¶
Read and return the timepoints to compare.
Returns:
| Type | Description |
|---|---|
list
|
The timepoints. |