LineageTree 1.7.0__tar.gz → 2.0.1__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 (31) hide show
  1. {lineagetree-1.7.0/src/LineageTree.egg-info → lineagetree-2.0.1}/PKG-INFO +31 -34
  2. {lineagetree-1.7.0 → lineagetree-2.0.1}/README.md +1 -0
  3. lineagetree-2.0.1/pyproject.toml +152 -0
  4. lineagetree-2.0.1/setup.cfg +4 -0
  5. lineagetree-2.0.1/src/LineageTree/__init__.py +30 -0
  6. lineagetree-2.0.1/src/LineageTree/legacy/export_csv.py +70 -0
  7. lineagetree-2.0.1/src/LineageTree/legacy/to_lineajea.py +30 -0
  8. lineagetree-2.0.1/src/LineageTree/legacy/to_motile.py +36 -0
  9. lineagetree-2.0.1/src/LineageTree/lineageTree.py +3524 -0
  10. lineagetree-2.0.1/src/LineageTree/lineageTreeManager.py +877 -0
  11. lineagetree-2.0.1/src/LineageTree/loaders.py +974 -0
  12. lineagetree-2.0.1/src/LineageTree/test/test_lineageTree.py +634 -0
  13. lineagetree-2.0.1/src/LineageTree/tree_approximation.py +488 -0
  14. lineagetree-2.0.1/src/LineageTree/utils.py +154 -0
  15. {lineagetree-1.7.0 → lineagetree-2.0.1/src/LineageTree.egg-info}/PKG-INFO +31 -34
  16. {lineagetree-1.7.0 → lineagetree-2.0.1}/src/LineageTree.egg-info/SOURCES.txt +6 -4
  17. lineagetree-2.0.1/src/LineageTree.egg-info/requires.txt +23 -0
  18. lineagetree-1.7.0/pyproject.toml +0 -75
  19. lineagetree-1.7.0/setup.cfg +0 -70
  20. lineagetree-1.7.0/src/LineageTree/__init__.py +0 -5
  21. lineagetree-1.7.0/src/LineageTree/lineageTree.py +0 -2848
  22. lineagetree-1.7.0/src/LineageTree/lineageTreeManager.py +0 -173
  23. lineagetree-1.7.0/src/LineageTree/loaders.py +0 -722
  24. lineagetree-1.7.0/src/LineageTree/tree_styles.py +0 -322
  25. lineagetree-1.7.0/src/LineageTree/utils.py +0 -156
  26. lineagetree-1.7.0/src/LineageTree.egg-info/requires.txt +0 -28
  27. lineagetree-1.7.0/test/test_lineageTree.py +0 -115
  28. {lineagetree-1.7.0 → lineagetree-2.0.1}/LICENSE +0 -0
  29. {lineagetree-1.7.0 → lineagetree-2.0.1/src/LineageTree}/test/test_uted.py +0 -0
  30. {lineagetree-1.7.0 → lineagetree-2.0.1}/src/LineageTree.egg-info/dependency_links.txt +0 -0
  31. {lineagetree-1.7.0 → lineagetree-2.0.1}/src/LineageTree.egg-info/top_level.txt +0 -0
@@ -1,53 +1,49 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: LineageTree
3
- Version: 1.7.0
4
- Summary: Lineage tree structure
5
- Home-page: https://github.com/leoguignard/LineageTree
6
- Author: Léo Guignard
7
- Author-email: leo.guignard@univ-amu.fr
8
- License: MIT
9
- Project-URL: Bug Tracker, https://github.com/leoguignard/LineageTree/issues
10
- Project-URL: Documentation, https://github.com/leoguignard/LineageTree#README.md
11
- Project-URL: Source Code, https://github.com/leoguignard/LineageTree
12
- Project-URL: User Support, https://github.com/leoguignard/LineageTree/issues
13
- Classifier: Development Status :: 2 - Pre-Alpha
3
+ Version: 2.0.1
4
+ Summary: Structure for Lineage Trees
5
+ Author: Giannis Liaskas, Christopher Mazzerbo
6
+ Author-email: Léo Guignard <leo.guignard@univ-amu.fr>
7
+ Maintainer-email: Léo Guignard <leo.guignard@univ-amu.fr>
8
+ License-Expression: MIT
9
+ Project-URL: Bug Tracker, https://github.com/GuignardLab/LineageTree/issues
10
+ Project-URL: Documentation, https://github.com/GuignardLab/LineageTree#README.md
11
+ Project-URL: Source Code, https://github.com/GuignardLab/LineageTree
12
+ Project-URL: User Support, https://github.com/GuignardLab/LineageTree/issues
13
+ Classifier: Development Status :: 4 - Beta
14
14
  Classifier: Intended Audience :: Developers
15
- Classifier: License :: OSI Approved :: MIT License
16
15
  Classifier: Operating System :: OS Independent
17
16
  Classifier: Programming Language :: Python
18
17
  Classifier: Programming Language :: Python :: 3
19
18
  Classifier: Programming Language :: Python :: 3 :: Only
20
- Classifier: Programming Language :: Python :: 3.8
21
- Classifier: Programming Language :: Python :: 3.9
22
19
  Classifier: Programming Language :: Python :: 3.10
23
- Classifier: Topic :: Scientific/Engineering :: Image Processing
24
- Requires-Python: >=3.8
20
+ Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Programming Language :: Python :: 3.12
22
+ Classifier: Programming Language :: Python :: 3.13
23
+ Requires-Python: >=3.10
25
24
  Description-Content-Type: text/markdown
26
25
  License-File: LICENSE
27
26
  Requires-Dist: scipy>=1.9
28
27
  Requires-Dist: numpy>=1.23
29
28
  Requires-Dist: mastodon-reader
30
29
  Requires-Dist: matplotlib
31
- Provides-Extra: svg
32
- Requires-Dist: svgwrite; extra == "svg"
33
- Requires-Dist: matplotlib; extra == "svg"
30
+ Requires-Dist: edist
31
+ Requires-Dist: svgwrite
32
+ Provides-Extra: dev
33
+ Requires-Dist: pytest; extra == "dev"
34
+ Requires-Dist: pytest-cov; extra == "dev"
35
+ Requires-Dist: tox; extra == "dev"
36
+ Requires-Dist: black; extra == "dev"
37
+ Requires-Dist: ruff; extra == "dev"
38
+ Requires-Dist: bumpver; extra == "dev"
39
+ Provides-Extra: doc
40
+ Requires-Dist: sphinx-rtd-theme; extra == "doc"
41
+ Requires-Dist: myst-parser; extra == "doc"
42
+ Requires-Dist: sphinx_book_theme; extra == "doc"
34
43
  Provides-Extra: test
35
- Requires-Dist: svgwrite; extra == "test"
36
- Requires-Dist: matplotlib; extra == "test"
37
- Requires-Dist: tox; extra == "test"
38
44
  Requires-Dist: pytest; extra == "test"
39
45
  Requires-Dist: pytest-cov; extra == "test"
40
- Requires-Dist: mastodon-reader; extra == "test"
41
- Provides-Extra: treeedit
42
- Requires-Dist: edist; extra == "treeedit"
43
- Provides-Extra: all
44
- Requires-Dist: svgwrite; extra == "all"
45
- Requires-Dist: matplotlib; extra == "all"
46
- Requires-Dist: tox; extra == "all"
47
- Requires-Dist: pytest; extra == "all"
48
- Requires-Dist: pytest-cov; extra == "all"
49
- Requires-Dist: edist; extra == "all"
50
- Requires-Dist: mastodon-reader; extra == "all"
46
+ Dynamic: license-file
51
47
 
52
48
  # LineageTree
53
49
 
@@ -59,6 +55,7 @@ With LineageTree you can read from:
59
55
  - MaMuT files described in [Wolff et al. 2018](https://doi.org/10.7554/eLife.34410)
60
56
  - SVF algorithm outputs described in [McDole, Guignard et al. 2018](https://doi.org/10.1016/j.cell.2018.09.031)
61
57
  - ASTEC algorithm outputs described in [Guignard, Fiuza et al. 2020](https://doi.org/10.1126/science.aar5663)
58
+ - Data from the [Digital development Database](http://digital-development.org/index.html) described in [Du et al. 2014](https://www.cell.com/fulltext/S0092-8674(13)01542-0) and [Du et al. 2015](https://www.sciencedirect.com/science/article/pii/S1534580715004876?via%3Dihub)
62
59
  - and few others
63
60
 
64
61
  ## Basic usage
@@ -8,6 +8,7 @@ With LineageTree you can read from:
8
8
  - MaMuT files described in [Wolff et al. 2018](https://doi.org/10.7554/eLife.34410)
9
9
  - SVF algorithm outputs described in [McDole, Guignard et al. 2018](https://doi.org/10.1016/j.cell.2018.09.031)
10
10
  - ASTEC algorithm outputs described in [Guignard, Fiuza et al. 2020](https://doi.org/10.1126/science.aar5663)
11
+ - Data from the [Digital development Database](http://digital-development.org/index.html) described in [Du et al. 2014](https://www.cell.com/fulltext/S0092-8674(13)01542-0) and [Du et al. 2015](https://www.sciencedirect.com/science/article/pii/S1534580715004876?via%3Dihub)
11
12
  - and few others
12
13
 
13
14
  ## Basic usage
@@ -0,0 +1,152 @@
1
+ [build-system]
2
+ requires = ["setuptools>=42.0.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [tool.setuptools.packages.find]
6
+ where = ["src"]
7
+
8
+ [project]
9
+ authors = [
10
+ { name = "Léo Guignard", email = "leo.guignard@univ-amu.fr"},
11
+ { name = "Giannis Liaskas"},
12
+ { name = "Christopher Mazzerbo"},
13
+ ]
14
+ maintainers = [
15
+ {name = "Léo Guignard", email = "leo.guignard@univ-amu.fr"}
16
+ ]
17
+ name = "LineageTree"
18
+ description = "Structure for Lineage Trees"
19
+ version = "2.0.1"
20
+ license = "MIT"
21
+ license-files = [ "LICENSE" ]
22
+ readme = {file = "README.md", content-type = "text/markdown"}
23
+ requires-python = ">= 3.10"
24
+ classifiers = [
25
+ "Development Status :: 4 - Beta",
26
+ "Intended Audience :: Developers",
27
+ "Operating System :: OS Independent",
28
+ "Programming Language :: Python",
29
+ "Programming Language :: Python :: 3",
30
+ "Programming Language :: Python :: 3 :: Only",
31
+ "Programming Language :: Python :: 3.10",
32
+ "Programming Language :: Python :: 3.11",
33
+ "Programming Language :: Python :: 3.12",
34
+ "Programming Language :: Python :: 3.13",
35
+ ]
36
+
37
+ dependencies = [
38
+ "scipy>=1.9",
39
+ "numpy>=1.23",
40
+ "mastodon-reader",
41
+ "matplotlib",
42
+ "edist",
43
+ "svgwrite",
44
+ ]
45
+
46
+ [project.optional-dependencies]
47
+ dev = [
48
+ "pytest",
49
+ "pytest-cov",
50
+ "tox",
51
+ "black",
52
+ "ruff",
53
+ "bumpver",
54
+ ]
55
+ doc = [
56
+ "sphinx-rtd-theme",
57
+ "myst-parser",
58
+ "sphinx_book_theme",
59
+ ]
60
+ test = [
61
+ "pytest",
62
+ "pytest-cov",
63
+ ]
64
+
65
+ [project.urls]
66
+ "Bug Tracker" = "https://github.com/GuignardLab/LineageTree/issues"
67
+ Documentation = "https://github.com/GuignardLab/LineageTree#README.md"
68
+ "Source Code" = "https://github.com/GuignardLab/LineageTree"
69
+ "User Support" = "https://github.com/GuignardLab/LineageTree/issues"
70
+
71
+ [tool.black]
72
+ line-length = 79
73
+
74
+ [tool.isort]
75
+ profile = "black"
76
+ line_length = 79
77
+
78
+ [tool.bumpver]
79
+ current_version = "2.0.1"
80
+ version_pattern = "MAJOR.MINOR.PATCH[-TAG]"
81
+ commit_message = "bump version {old_version} -> {new_version}"
82
+ commit = true
83
+ tag = true
84
+ push = false
85
+
86
+ [tool.bumpver.file_patterns]
87
+ "pyproject.toml" = [
88
+ 'current_version = "{version}"',
89
+ 'version = "{version}"',
90
+ ]
91
+ "src/LineageTree/__init__.py" = [
92
+ '__version__ = "{version}"',
93
+ ]
94
+
95
+ [tool.ruff]
96
+ line-length = 79
97
+ lint.select = [
98
+ "E", "F", "W", #flake8
99
+ "UP", # pyupgrade
100
+ "I", # isort
101
+ "BLE", # flake8-blind-exception
102
+ "B", # flake8-bugbear
103
+ "A", # flake8-builtins
104
+ "C4", # flake8-comprehensions
105
+ "ISC", # flake8-implicit-str-concat
106
+ "G", # flake8-logging-format
107
+ "PIE", # flake8-pie
108
+ "SIM", # flake8-simplify
109
+ "I", # imports
110
+ "T201", # print statements
111
+ "ERA001", #commented out code
112
+ ]
113
+ lint.ignore = [
114
+ "E501", # line too long. let black handle this
115
+ "SIM300", # yoda conditions
116
+ ]
117
+
118
+ exclude = [
119
+ ".bzr",
120
+ ".direnv",
121
+ ".eggs",
122
+ ".git",
123
+ ".mypy_cache",
124
+ ".pants.d",
125
+ ".ruff_cache",
126
+ ".svn",
127
+ ".tox",
128
+ ".venv",
129
+ "__pypackages__",
130
+ "_build",
131
+ "buck-out",
132
+ "build",
133
+ "dist",
134
+ "node_modules",
135
+ "venv",
136
+ "*vendored*",
137
+ "*_vendor*",
138
+ ]
139
+
140
+ target-version = "py310"
141
+
142
+ [tool.ty.src]
143
+ root = "./src"
144
+
145
+ [tool.ty.rules]
146
+ unresolved-import = "ignore"
147
+
148
+ [tool.pytest.ini_options]
149
+ addopts = "--cov"
150
+
151
+ [report]
152
+ show_missing=true
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,30 @@
1
+ __version__ = "2.0.1"
2
+ from .lineageTree import lineageTree
3
+ from .lineageTreeManager import lineageTreeManager
4
+ from .loaders import (
5
+ read_from_ASTEC,
6
+ read_from_binary,
7
+ read_from_csv,
8
+ read_from_mamut_xml,
9
+ read_from_mastodon,
10
+ read_from_mastodon_csv,
11
+ read_from_tgmm_xml,
12
+ read_from_txt_for_celegans,
13
+ read_from_txt_for_celegans_BAO,
14
+ read_from_txt_for_celegans_CAO,
15
+ )
16
+
17
+ __all__ = (
18
+ "lineageTree",
19
+ "lineageTreeManager",
20
+ "read_from_tgmm_xml",
21
+ "read_from_txt_for_celegans_BAO",
22
+ "read_from_ASTEC",
23
+ "read_from_binary",
24
+ "read_from_csv",
25
+ "read_from_mamut_xml",
26
+ "read_from_mastodon_csv",
27
+ "read_from_mastodon",
28
+ "read_from_txt_for_celegans",
29
+ "read_from_txt_for_celegans_CAO",
30
+ )
@@ -0,0 +1,70 @@
1
+ import csv
2
+
3
+ from lineageTree import lineageTree
4
+
5
+ """Writes a lineage tree into a series of csv files.
6
+
7
+ * spots.csv: id; label; timePoint; x; y; z; volume
8
+ * links.csv: source spot id; target spot id
9
+ * fates1.csv: tagValue
10
+ * fate_values1.csv: spot id; tagValue
11
+ * fates2.csv: tagValue
12
+ * fate_values2.csv: spot id; tagValue
13
+ * fates3.csv: tagValue
14
+ * fate_values3.csv: spot id; tagValue
15
+ """
16
+
17
+
18
+ def export_to_csv():
19
+ tree = lineageTree("Astec-Pm10_properties.pkl", file_type="ASTEC")
20
+
21
+ spots = [["id", "label", "timePoint", "x", "y", "z", "volume"]]
22
+ for node_id in tree.nodes:
23
+ cell_name = tree["cell_name"].get(node_id, "unknown")
24
+ spots.append(
25
+ [
26
+ node_id,
27
+ cell_name,
28
+ tree.time.get(node_id),
29
+ tree.pos[node_id][0],
30
+ tree.pos[node_id][1],
31
+ tree.pos[node_id][2],
32
+ tree.volume[node_id],
33
+ ]
34
+ )
35
+ write("spots.csv", spots)
36
+
37
+ links = [["source", "target"]]
38
+ for edge in tree.edges:
39
+ links.append([edge[0], edge[1]])
40
+ write("links.csv", links)
41
+
42
+ write_fate(tree.fates, "fates1.csv", tree, "fate_values1.csv")
43
+ write_fate(tree["cell_fate_2"], "fates2.csv", tree, "fate_values2.csv")
44
+ write_fate(tree["cell_fate_3"], "fates3.csv", tree, "fate_values3.csv")
45
+
46
+
47
+ def write_fate(fates, fate_name, tree, fate_value_name):
48
+ all_fates = []
49
+ for index in fates:
50
+ all_fates.append(fates[index])
51
+ unique_fates = set(all_fates)
52
+ fates_list = [["fate"]]
53
+ for fate in unique_fates:
54
+ fates_list.append([fate])
55
+ write(fate_name, fates_list)
56
+
57
+ fate_values = [["id", "value"]]
58
+ for node_id in tree.nodes:
59
+ fate_values.append([node_id, tree.fates.get(node_id)])
60
+ write(fate_value_name, fate_values)
61
+
62
+
63
+ def write(file_path, data):
64
+ with open(file_path, mode="w", newline="") as file:
65
+ writer = csv.writer(file)
66
+ writer.writerows(data)
67
+
68
+
69
+ if __name__ == "__main__":
70
+ export_to_csv()
@@ -0,0 +1,30 @@
1
+ import csv
2
+
3
+
4
+ def write_csv_from_lT_to_lineaja(
5
+ lT, path_to, start: int = 0, finish: int = 300
6
+ ):
7
+ csv_dict = {}
8
+ for time in range(start, finish):
9
+ for node in lT.time_nodes[time]:
10
+ csv_dict[node] = {"pos": lT.pos[node], "t": time}
11
+ with open(path_to, "w", newline="\n") as file:
12
+ fieldnames = [
13
+ "time",
14
+ "positions_x",
15
+ "positions_y",
16
+ "positions_z",
17
+ "id",
18
+ ]
19
+ writer = csv.DictWriter(file, fieldnames=fieldnames)
20
+ writer.writeheader()
21
+ for node in csv_dict:
22
+ writer.writerow(
23
+ {
24
+ "time": csv_dict[node]["t"],
25
+ "positions_z": csv_dict[node]["pos"][0],
26
+ "positions_y": csv_dict[node]["pos"][1],
27
+ "positions_x": csv_dict[node]["pos"][2],
28
+ "id": node,
29
+ }
30
+ )
@@ -0,0 +1,36 @@
1
+ import warnings
2
+
3
+ from ..lineageTree import lineageTree
4
+
5
+ try:
6
+ import motile
7
+ except ImportError:
8
+ warnings.warn(
9
+ "No motile installed therefore you will not be able to produce links with motile.",
10
+ stacklevel=2,
11
+ )
12
+
13
+
14
+ def to_motile(
15
+ lT: lineageTree, crop: int | None = None, max_dist=200, max_skip_frames=1
16
+ ):
17
+ try:
18
+ import networkx as nx
19
+ except ImportError:
20
+ raise Warning("Please install networkx") # noqa: B904
21
+
22
+ fmt = nx.DiGraph()
23
+ if not crop:
24
+ crop = lT.t_e
25
+ for time in range(crop):
26
+ for time_node in lT.nodes_at_t(time):
27
+ fmt.add_node(
28
+ time_node,
29
+ t=lT.time[time_node],
30
+ pos=lT.pos[time_node],
31
+ score=1,
32
+ )
33
+
34
+ motile.add_cand_edges(fmt, max_dist, max_skip_frames=max_skip_frames)
35
+
36
+ return fmt