Skip to content

Commit 6c93206

Browse files
committed
fix docs adding api
1 parent 85911a7 commit 6c93206

File tree

13 files changed

+162
-46
lines changed

13 files changed

+162
-46
lines changed

docs/api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
:::LineageTree
1+
::: lineagetree.measure

docs/glossary.md

Lines changed: 18 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,54 @@
11

22
This tool may interest individuals with and without a background in computer science, so all users need to become familiar with the nomenclature used by LineageTree. To that end, this glossary defines the terms used throughout the project.
33

4-
- ### Trees
5-
6-
A tree is a hierarchical acyclic graph that contains nodes and edges, lineageTree works with at most 2 successors for one node. To create a demo tree the user can call
4+
- ### Tree Graphs
5+
A tree graph is a hierarchical acyclic graph that contains nodes and edges, **LineageTree is a tree graph** that has at most 2 successors for one node. To create a demo tree the user can call
76

87
```python
98
from lineagetree import LineageTree
109
lT = LineageTree(successors= {i:[i+1] for i in range(10)})
1110
```
1211

1312
![Image for glossary](./images/glossary_image.png)
14-
> The differences between a biological lineage and a LineageTree lineage
13+
> The differences between a biological lineage and a LineageTree.
1514
1615
- ### Nodes
17-
18-
The smallest part of a tree, a point that may or may not connect to others. The set of all the nodes may be accessed by ```lT.nodes```
16+
The **smallest part of a LineageTree**, a point that may or may not connect to others. The set of all the nodes may be accessed by ```lT.nodes```
1917

2018
- ### Edges
21-
22-
The lTect that connects 2 nodes, in the case of the tree its also directed (goes one way). The edges may be accessed throug ```lT.edges```
19+
The object that **connects 2 nodes**, in the case of the tree its also directed (goes one way). The edges may be accessed through ```lT.edges```
2320

2421
- ### Successors
25-
26-
The successor of a node n is a node connected with an edge to the node n that exists one level (timepoint) lower than n. The immutable dictionary (MappingProxy) of all the successors may be accessed by ```lT.successor```
22+
The successor of a **node n in timepoint t is the node n' in timepoint t+1** and is connected to the node n. The immutable dictionary (MappingProxy) of all the successors may be accessed by ```lT.successor```
2723

2824
- ### Predecessors
29-
30-
The predecessor of a node n is a node connected to the node that exists one time point higher than n. The immutable dictionary (MappingProxy) of all the predecessors may be accessed by ```lT.predecessor```
25+
The predecessor of a **node n in timepoint t is the node n' in timepoint t-1** and is connected to the node n. The immutable dictionary (MappingProxy) of all the predecessors may be accessed by ```lT.predecessor```
3126

3227
- ### Roots
33-
34-
The root of a tree is a node that has no predecessors. In the case of lineageTree the root has an empty tuple as predecessor. LineageTree allows for many roots to exist in the same file. The set of roots may be accessed by using ```lT.roots```
28+
The root of a tree is **a node that has no predecessors**. In the case of lineageTree the root has an empty tuple as predecessor. LineageTree allows for many roots to exist in the same file. The set of roots may be accessed by using ```lT.roots```
3529

3630
- ### Leaves
37-
38-
The leaf of a tree is a node that has no successors. In the case of lineageTree the leaf has an empty tuple as a successor. The set of leaves may be accessed through ```lT.leaves```
39-
40-
- ### Divisions
41-
42-
An event where one node has 2 successors instead of one. There is no direct way to access a division; however, the node that is before a division (or after) is always at the end or start of a chain (except for the cases that the chain contains a leaf or a root)
31+
The leaf of a tree is **a node that has no successors**. In the case of lineageTree the leaf has an empty tuple as a successor. The set of leaves may be accessed through ```lT.leaves```
4332

4433
- ### Chains
34+
A **tree segment**, where **all nodes are between a division or root and a division or a leaf**. To access a chain that contains a specific node `n`, the user may use:``` lT.get_chain_of_node(n) ```
35+
A continuous subset of a chain may be referred to as a subchain or a path, which is not a chain.
4536

46-
A tree segment, where all nodes are between a division or root and a division or a leaf. To access a chain that contains a specific node `n`, the user may use:``` lT.get_chain_of_node(n) ```
47-
A continuous subset of a chain may be referred to as a subchain or a path, which is not a chain.
37+
- ### Divisions
38+
An event where **one node has 2 successors** instead of one. There is no direct way to access a division; however, the node that is before a division (or after) is always at the end or start of a chain (except for the cases that the chain contains a leaf or a root)
4839

4940
- ### Subtree
50-
51-
Any segment of a tree that is also a tree. Using the function ```lT.get_sub_tree(node)``` will not provide a new lineageTree but a list of all the nodes contained inside the subtree.
41+
Any segment of a tree that is also a tree. The function ```lT.get_sub_tree(node)``` will return a list of all the nodes contained inside the subtree.
5242

5343
- ### Siblings
54-
55-
Two nodes that have the same predecessor. Often used for chains where the first node of each chain has the same predecessor as the other one.
44+
**Two nodes that have the same predecessor**. Often used for chains where the first node of each chain has the same predecessor as the other one.
5645

5746
- ### Time
58-
5947
The time point at which the nodes exist. This property concerns time points and is not real time.
6048
The immutable dictionary (MappingProxy) containing the time information for all the nodes may be accessed through ```lT.times```.
6149

6250
- ### Time resolution
63-
6451
How long one time point lasts, relevant only for comparisons across lineages. This attribute can be a property or inspected by ```lT.time_resolution```.
52+
53+
#### API reference
54+

docs/images/glossary_image.png

24.7 KB
Loading

docs/images/image39151.png

180 KB
Loading

docs/index.md

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,24 @@
11
# Welcome to LineageTree Documentation
22

3-
LineageTree is a Python framework specialized in cell tracking data. It supports importing standard or custom formats and comprehensive processing and comparison analysis capabilities.
3+
LineageTree is a Python framework specialized in analyzing cell tracking data. It supports standard or custom tracking data formats and allows comprehensive processing and pairwise distance calculation.
44

55
## Why should I use LineageTree?
66

77
<p style="text-align: justify;">
88

9-
How does a cluster of cells become organized? Do cells move and divide randomly until an organism starts to exist? People from multiple fields have worked tirelessly to answer such questions, resulting in better microscopy techniques to image embryos developing in real time and software that allows users to track nuclei or particles inside the organisms. Many scientists have developed algorithms analyzing the positions of all these particles, however, there is a lack of software that takes time and division patterns into account. LineageTree offers out-of-the-box algorithms to compare lineage data to extract results on the similarity of lineages. It also offers a strong enough backbone for the user to build their algorithms to analyze time and spatial data. One type of lineage data analysis is lineage comparison, which can provide useful information on how variable the development of an organism is, or extract information on fate gain or loss, or check for symmetric lineages in one organism. A napari plugin called [ReLAX](http://127.0.0.1:8000/). accompanies this framework, where the user can explore a digital clone of the embryo on both spatial and image data (4D 3D+time), label different lineages, and perform systematic comparison analysis on imported lineages.
10-
Using LineageTree the user can:
9+
How does a cluster of cells become organized? Do cells move and divide randomly until an organism starts to exist? People from multiple fields have worked tirelessly to answer such questions, resulting in better microscopy techniques to image embryos developing in real time and software that allows users to track nuclei or particles inside the organisms. Many scientists have developed algorithms analyzing the positions of all these particles, however, there is a lack of software that takes time and division patterns into account. LineageTree offers out-of-the-box algorithms to compare lineage data to extract results on the similarity of lineages. It also offers a strong enough backbone for the user to build their algorithms to analyze time and spatial data.
1110
</p>
11+
<!-- <p style="text-align: justify;"> -->
12+
13+
One type of lineage data analysis is lineage comparison, which can provide useful information on how variable the development of an organism is, or extract information on fate gain or loss, or check for symmetric lineages in one organism. A napari plugin called [ReLAX](https://guignardlab.github.io/napari-relax/). accompanies this framework, where the user can explore a digital clone of the embryo on both spatial and temporal data, label different lineages, and perform systematic comparison analysis on imported lineages.
14+
<!-- </p> -->
15+
16+
Using LineageTree the user can:
1217

13-
- Import any tracking format (link to loaders)
14-
- Perform analysis on the data ( link to tree_styles) (maybe talk a bit about the spatial algorithms)?
15-
- Perform unordered tree edit distance analysis using different heuristics (tree_Styles)
16-
- Visualize lineages imported (plot_node, plot_lineages)
18+
- [Import any tracking format](./loaders.md)
19+
- Perform spatial analysis on the data
20+
- Perform [unordered tree edit distance analysis](./uted.md) using different heuristics
21+
- [Visualize lineages](./viz.md) imported
1722

1823
## Quick Installation
1924

docs/loaders.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
# Loaders
2+
### Premade Loaders
33

44
Multiple well known formats are ready for import out of the box:
55

@@ -25,7 +25,7 @@ Other attributes that can be used to initiate a lineageTree file apart from the
2525

2626
- **kwargs: Any other dictionary provided during imaging can be loaded into lineageTree. The format is {unique_id: value}
2727

28-
### Example of loading and template with **kwargs
28+
### Custom Loaders
2929

3030
```python
3131

@@ -82,4 +82,6 @@ def template_load(path, name=None):
8282
)
8383
```
8484

85-
:::LineageTree.loaders
85+
### API reference for existing loaders
86+
87+
#### ::: lineagetree._io

docs/uted.md

Lines changed: 43 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -124,14 +124,52 @@ This section is focused on showcasing the advantages and disadvantages of the tr
124124

125125
![synthetic_trees](./images/synthetic_trees.png)
126126

127-
## Tree distance Graphs
127+
<!-- ### API reference
128+
129+
#### :::lineagetree.measure.unordered_tree_edit_distance
130+
#### :::lineagetree.measure.unordered_tree_edit_distances_at_time_t
131+
#### :::lineagetree.measure.clear_comparisons -->
132+
## API reference for uted
133+
134+
### ::: lineagetree.measure
135+
options:
136+
filters:
137+
- "^unordered_tree_edit_distance$"
138+
- "^unordered_tree_edit_distances_at_time_t$"
139+
- "^clear_comparisons$"
140+
141+
142+
## Using the Matching Component of UTED
143+
144+
UTED calculates distances between two tree graphs by matching their nodes. Extracting the matched nodes provides important information, particularly for labeled datasets. For example, when calculating the distance between two embryos, we can identify which clone or sublineage in one embryo corresponds to a clone or sublineage in the other. To support this, UTED includes functions specifically designed to find the matching between two lineages.
145+
146+
#### API
147+
148+
#### ::: lineagetree.measure
149+
options:
150+
filters:
151+
- "^labelled_mappings$"
152+
153+
154+
155+
### Tree distance Graphs
128156

129157
<p style="text-align: justify;">
130158

131-
The distance value is a very useful metric to check the similarity of two lineages, however its just a distance, it does not give you further information. A user should not only know how similar a tree is to another, but also which sublineages/subtrees are similar and which are not! Fortunately, we realized that we can extract important information during an important step of the algorithm, the matched pairs created during the mapping process and plot them into a new graph, called the tree distance graph. To produce these graphs, we color each chain that has been mapped with the value of the subtree spawned by these chains, showing a metric that can be interpreted as the quality of mapping. Such graphs can show two very significant things:
159+
The distance value is a useful metric for quantifying the similarity between two lineages, but it does not provide detailed information about which sublineages are similar or different. To address this, UTED generates tree distance graphs by leveraging the matched pairs produced during the mapping process.
160+
161+
In these graphs, each matched chain is colored according to the value of its subtree, providing a visual representation of mapping quality. Tree distance graphs reveal two important aspects:
162+
163+
- Variance: The color spectrum highlights the distances of mapped chains. Colors representing good mappings indicate low variance during development.
164+
165+
- Gain or Loss of Function: Unmapped regions indicate lineages that exist in one tree but not the other. This may reflect biological differences, such as the emergence or loss of a lineage, or it may point to data quality issues.
132166
</p>
133-
- Variance: Such graphs will use a spectrum of colors to show the distances that are mapped and how well their mapping is, so colors that correspond to the good mapping indicate small variance during development.
167+
![add_an_example](./images/image39151.png)
168+
134169

135-
- Gain or loss of function, the unmapped regions can be interpreted as regions, where no region of one tree corresponds to the one with unmapped (of course this may also happen due to a bad dataset), which means that there is a lineage that does not exist in the other, a new lineage, the organism gained or lost a function!
170+
#### API
136171

137-
![add_an_example](tree_distance_graph.png)
172+
#### ::: lineagetree.measure
173+
options:
174+
filters:
175+
- "^plot_tree_distance_graphs$"

docs/viz.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,7 @@ Usually, tracked lineages contain hundreds of thousands of nodes, thus calculati
77
![viz](./images/2_trees.png)
88

99
This way, the whole lineage can be plotted efficiently, even if the second graph is more representative of the truth.
10+
11+
### API Reference
12+
13+
#### ::: lineagetree.plot

mkdocs.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,21 @@ theme:
1818
- navigation.path
1919
- navigation.expand
2020
- content.code.annotate
21+
markdown_extensions:
22+
- toc:
23+
permalink: true
24+
- tables
25+
- pymdownx.superfences
2126
plugins:
2227
- mkdocstrings:
2328
handlers:
2429
python:
30+
setup_commands:
31+
- import os, sys
32+
- sys.path.append(os.path.abspath("._io"))
2533
options:
26-
show_submodules: true
2734
docstring_style: numpy
35+
2836
nav:
2937
- Home: index.md
3038
- Getting started:

src/lineagetree/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
read_from_txt_for_celegans_CAO,
1515
LOADERS,
1616
)
17+
1718
from .lineage_tree_manager import LineageTreeManager
1819

1920
__all__ = (
@@ -31,4 +32,4 @@
3132
"read_from_txt_for_celegans",
3233
"read_from_txt_for_celegans_CAO",
3334
"LOADERS",
34-
)
35+
)

0 commit comments

Comments
 (0)