scloop 0.1.9__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 (79) hide show
  1. scloop-0.1.9/LICENSE +203 -0
  2. scloop-0.1.9/MANIFEST.in +7 -0
  3. scloop-0.1.9/PKG-INFO +137 -0
  4. scloop-0.1.9/README.md +105 -0
  5. scloop-0.1.9/pyproject.toml +118 -0
  6. scloop-0.1.9/setup.cfg +4 -0
  7. scloop-0.1.9/setup.py +35 -0
  8. scloop-0.1.9/src/scloop/__init__.py +27 -0
  9. scloop-0.1.9/src/scloop/analyzing/__init__.py +0 -0
  10. scloop-0.1.9/src/scloop/benchmarking/__init__.py +1 -0
  11. scloop-0.1.9/src/scloop/computing/__init__.py +8 -0
  12. scloop-0.1.9/src/scloop/computing/homology.py +230 -0
  13. scloop-0.1.9/src/scloop/data/__init__.py +6 -0
  14. scloop-0.1.9/src/scloop/data/analysis_containers.py +244 -0
  15. scloop-0.1.9/src/scloop/data/containers.py +842 -0
  16. scloop-0.1.9/src/scloop/data/loop_reconstruction.py +164 -0
  17. scloop-0.1.9/src/scloop/data/metadata.py +49 -0
  18. scloop-0.1.9/src/scloop/data/ripser.cpp +1449 -0
  19. scloop-0.1.9/src/scloop/data/ripser.hpp +191 -0
  20. scloop-0.1.9/src/scloop/data/ripser_lib.cpp +29536 -0
  21. scloop-0.1.9/src/scloop/data/ripser_lib.pyx +175 -0
  22. scloop-0.1.9/src/scloop/data/types.py +37 -0
  23. scloop-0.1.9/src/scloop/data/utils.py +166 -0
  24. scloop-0.1.9/src/scloop/matching/__init__.py +1 -0
  25. scloop-0.1.9/src/scloop/matching/cross_dataset.py +85 -0
  26. scloop-0.1.9/src/scloop/matching/data_modules.py +88 -0
  27. scloop-0.1.9/src/scloop/matching/mlp.py +160 -0
  28. scloop-0.1.9/src/scloop/matching/nf.py +174 -0
  29. scloop-0.1.9/src/scloop/plotting/__init__.py +4 -0
  30. scloop-0.1.9/src/scloop/plotting/_homology.py +544 -0
  31. scloop-0.1.9/src/scloop/preprocessing/__init__.py +2 -0
  32. scloop-0.1.9/src/scloop/preprocessing/delve/__init__.py +1 -0
  33. scloop-0.1.9/src/scloop/preprocessing/delve/delve.py +653 -0
  34. scloop-0.1.9/src/scloop/preprocessing/delve/kh.py +243 -0
  35. scloop-0.1.9/src/scloop/preprocessing/downsample.py +91 -0
  36. scloop-0.1.9/src/scloop/preprocessing/prepare.py +291 -0
  37. scloop-0.1.9/src/scloop/py.typed +0 -0
  38. scloop-0.1.9/src/scloop/tools/__init__.py +5 -0
  39. scloop-0.1.9/src/scloop/tools/_cross_match.py +20 -0
  40. scloop-0.1.9/src/scloop/tools/_loops.py +108 -0
  41. scloop-0.1.9/src/scloop/utils/__init__.py +2 -0
  42. scloop-0.1.9/src/scloop/utils/distance_metrics/__init__.py +1 -0
  43. scloop-0.1.9/src/scloop/utils/distance_metrics/discrete-frechet-distance/Frechet.cpp +133 -0
  44. scloop-0.1.9/src/scloop/utils/distance_metrics/discrete-frechet-distance/Frechet.h +15 -0
  45. scloop-0.1.9/src/scloop/utils/distance_metrics/frechet.cpp +28085 -0
  46. scloop-0.1.9/src/scloop/utils/distance_metrics/frechet.pyx +74 -0
  47. scloop-0.1.9/src/scloop/utils/linear_algebra_gf2/__init__.py +1 -0
  48. scloop-0.1.9/src/scloop/utils/linear_algebra_gf2/gf2_toolkit_lib.pyx +1 -0
  49. scloop-0.1.9/src/scloop/utils/linear_algebra_gf2/include/m4ri/brilliantrussian.h +319 -0
  50. scloop-0.1.9/src/scloop/utils/linear_algebra_gf2/include/m4ri/debug_dump.h +75 -0
  51. scloop-0.1.9/src/scloop/utils/linear_algebra_gf2/include/m4ri/djb.h +141 -0
  52. scloop-0.1.9/src/scloop/utils/linear_algebra_gf2/include/m4ri/echelonform.h +81 -0
  53. scloop-0.1.9/src/scloop/utils/linear_algebra_gf2/include/m4ri/graycode.h +181 -0
  54. scloop-0.1.9/src/scloop/utils/linear_algebra_gf2/include/m4ri/io.h +194 -0
  55. scloop-0.1.9/src/scloop/utils/linear_algebra_gf2/include/m4ri/m4ri.h +77 -0
  56. scloop-0.1.9/src/scloop/utils/linear_algebra_gf2/include/m4ri/m4ri_config.h +37 -0
  57. scloop-0.1.9/src/scloop/utils/linear_algebra_gf2/include/m4ri/misc.h +737 -0
  58. scloop-0.1.9/src/scloop/utils/linear_algebra_gf2/include/m4ri/mmc.h +85 -0
  59. scloop-0.1.9/src/scloop/utils/linear_algebra_gf2/include/m4ri/mp.h +88 -0
  60. scloop-0.1.9/src/scloop/utils/linear_algebra_gf2/include/m4ri/mzd.h +1204 -0
  61. scloop-0.1.9/src/scloop/utils/linear_algebra_gf2/include/m4ri/mzp.h +224 -0
  62. scloop-0.1.9/src/scloop/utils/linear_algebra_gf2/include/m4ri/parity.h +127 -0
  63. scloop-0.1.9/src/scloop/utils/linear_algebra_gf2/include/m4ri/ple.h +171 -0
  64. scloop-0.1.9/src/scloop/utils/linear_algebra_gf2/include/m4ri/ple_russian.h +210 -0
  65. scloop-0.1.9/src/scloop/utils/linear_algebra_gf2/include/m4ri/ple_russian_template.h +208 -0
  66. scloop-0.1.9/src/scloop/utils/linear_algebra_gf2/include/m4ri/solve.h +142 -0
  67. scloop-0.1.9/src/scloop/utils/linear_algebra_gf2/include/m4ri/strassen.h +137 -0
  68. scloop-0.1.9/src/scloop/utils/linear_algebra_gf2/include/m4ri/triangular.h +165 -0
  69. scloop-0.1.9/src/scloop/utils/linear_algebra_gf2/include/m4ri/triangular_russian.h +68 -0
  70. scloop-0.1.9/src/scloop/utils/linear_algebra_gf2/include/m4ri/xor.h +124 -0
  71. scloop-0.1.9/src/scloop/utils/linear_algebra_gf2/include/m4ri/xor_template.h +227 -0
  72. scloop-0.1.9/src/scloop/utils/linear_algebra_gf2/libm4ri.a +0 -0
  73. scloop-0.1.9/src/scloop/utils/linear_algebra_gf2/m4ri_lib.c +30501 -0
  74. scloop-0.1.9/src/scloop/utils/linear_algebra_gf2/m4ri_lib.pyx +203 -0
  75. scloop-0.1.9/src/scloop.egg-info/PKG-INFO +137 -0
  76. scloop-0.1.9/src/scloop.egg-info/SOURCES.txt +82 -0
  77. scloop-0.1.9/src/scloop.egg-info/dependency_links.txt +1 -0
  78. scloop-0.1.9/src/scloop.egg-info/requires.txt +20 -0
  79. scloop-0.1.9/src/scloop.egg-info/top_level.txt +1 -0
scloop-0.1.9/LICENSE ADDED
@@ -0,0 +1,203 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
203
+
@@ -0,0 +1,7 @@
1
+ include src/scloop/utils/linear_algebra_gf2/libm4ri.a
2
+ recursive-include src/scloop/utils/linear_algebra_gf2/include *.h
3
+ include src/scloop/utils/linear_algebra_gf2/*.pyx
4
+ include src/scloop/utils/distance_metrics/*.pyx
5
+ include src/scloop/data/*.pyx
6
+ include src/scloop/data/*.cpp
7
+ include src/scloop/data/*.h
scloop-0.1.9/PKG-INFO ADDED
@@ -0,0 +1,137 @@
1
+ Metadata-Version: 2.4
2
+ Name: scloop
3
+ Version: 0.1.9
4
+ Summary: single-cell loop analysis
5
+ Author-email: "Zhiyuan(Stan) Yu" <zyyu@umich.edu>, Idse Heemskerk <idse.heemskerk@gmail.com>
6
+ Classifier: Programming Language :: Python :: 3 :: Only
7
+ Classifier: Programming Language :: Python :: 3.12
8
+ Requires-Python: >=3.12
9
+ Description-Content-Type: text/markdown
10
+ License-File: LICENSE
11
+ Requires-Dist: cython>=3.0.12
12
+ Requires-Dist: glasbey==0.3
13
+ Requires-Dist: igraph>=0.11
14
+ Requires-Dist: loguru==0.7.3
15
+ Requires-Dist: numba>=0.62.1
16
+ Requires-Dist: numpy<2
17
+ Requires-Dist: pandas
18
+ Requires-Dist: pip>=25.2
19
+ Requires-Dist: pydantic>=2.11.4
20
+ Requires-Dist: pytest>=8.4
21
+ Requires-Dist: rich==14.2
22
+ Requires-Dist: scanpy[leiden]>=1.11.2
23
+ Requires-Dist: scikit-misc>=0.5.2
24
+ Requires-Dist: statsmodels==0.14.4
25
+ Requires-Dist: tensorflow>=2.18.1
26
+ Requires-Dist: torch
27
+ Requires-Dist: torchdyn>=1.0.6
28
+ Requires-Dist: torchvision
29
+ Requires-Dist: tqdm-joblib>=0.0.5
30
+ Requires-Dist: umap-learn>=0.5.7
31
+ Dynamic: license-file
32
+
33
+ # scloop - single-cell loop analysis
34
+
35
+ [![Test Import](https://github.com/stanfish06/scLoop/actions/workflows/test-import.yml/badge.svg)](https://github.com/stanfish06/scLoop/actions/workflows/test-import.yml)
36
+ [![Test Build](https://github.com/stanfish06/scLoop/actions/workflows/test-build.yml/badge.svg)](https://github.com/stanfish06/scLoop/actions/workflows/test-build.yml)
37
+
38
+ **Note: this package is still under development.**
39
+
40
+ scLoop is a library to identify statistically significant loops in single-cell RNA-seq data.
41
+
42
+ <img src="examples/loop.png" alt="persistent homology" width="300"/>
43
+
44
+ ## Basic Usage
45
+ ```python
46
+ import scloop as scl
47
+ scl.pp.prepare_adata(adata, downsample=True, n_downsample=500)
48
+ scl.tl.find_loops(adata)
49
+ ```
50
+
51
+ ## Build Instructions
52
+ ```bash
53
+ make build
54
+ ```
55
+
56
+ or
57
+
58
+ ```bash
59
+ make rebuild
60
+ ```
61
+
62
+ ## Virtual Envrionemnt
63
+ ```bash
64
+ make sync
65
+ ```
66
+
67
+ or
68
+
69
+ ```bash
70
+ make full-sync
71
+ ```
72
+
73
+ to prevent partial compilation of some modules
74
+
75
+ ## Installation
76
+ **Note: this package is still under development. The current build will likely not work.**
77
+ ```bash
78
+ pip install scloop
79
+ ```
80
+
81
+ ## Project Structure
82
+ ```
83
+ src/scloop/
84
+ ├── analyzing
85
+ │   └── __init__.py
86
+ ├── benchmarking
87
+ │   └── __init__.py
88
+ ├── computing
89
+ │   ├── homology.py
90
+ │   └── __init__.py
91
+ ├── data
92
+ │   ├── analysis_containers.py
93
+ │   ├── containers.py
94
+ │   ├── __init__.py
95
+ │   ├── loop_reconstruction.py
96
+ │   ├── metadata.py
97
+ │   ├── ripser.cpp
98
+ │   ├── ripser.hpp
99
+ │   ├── ripser_lib.cpp
100
+ │   ├── ripser_lib.pyx
101
+ │   ├── types.py
102
+ │   └── utils.py
103
+ ├── __init__.py
104
+ ├── matching
105
+ │   ├── data_modules.py
106
+ │   ├── __init__.py
107
+ │   ├── mlp.py
108
+ │   └── nf.py
109
+ ├── plotting
110
+ │   ├── _homology.py
111
+ │   └── __init__.py
112
+ ├── preprocessing
113
+ │   ├── delve
114
+ │   │   ├── delve.py
115
+ │   │   ├── __init__.py
116
+ │   │   └── kh.py
117
+ │   ├── downsample.py
118
+ │   ├── __init__.py
119
+ │   └── prepare.py
120
+ ├── py.typed
121
+ ├── tools
122
+ │   ├── _cross_match.py
123
+ │   ├── __init__.py
124
+ │   └── _loops.py
125
+ └── utils
126
+ ├── distance_metrics
127
+ │   ├── discrete-frechet-distance
128
+ │   ├── frechet.cpp
129
+ │   ├── frechet.pyx
130
+ │   └── __init__.py
131
+ ├── __init__.py
132
+ └── linear_algebra_gf2
133
+ ├── gf2_toolkit_lib.pyx
134
+ ├── __init__.py
135
+ ├── m4ri_lib.c
136
+ └── m4ri_lib.pyx
137
+ ```
scloop-0.1.9/README.md ADDED
@@ -0,0 +1,105 @@
1
+ # scloop - single-cell loop analysis
2
+
3
+ [![Test Import](https://github.com/stanfish06/scLoop/actions/workflows/test-import.yml/badge.svg)](https://github.com/stanfish06/scLoop/actions/workflows/test-import.yml)
4
+ [![Test Build](https://github.com/stanfish06/scLoop/actions/workflows/test-build.yml/badge.svg)](https://github.com/stanfish06/scLoop/actions/workflows/test-build.yml)
5
+
6
+ **Note: this package is still under development.**
7
+
8
+ scLoop is a library to identify statistically significant loops in single-cell RNA-seq data.
9
+
10
+ <img src="examples/loop.png" alt="persistent homology" width="300"/>
11
+
12
+ ## Basic Usage
13
+ ```python
14
+ import scloop as scl
15
+ scl.pp.prepare_adata(adata, downsample=True, n_downsample=500)
16
+ scl.tl.find_loops(adata)
17
+ ```
18
+
19
+ ## Build Instructions
20
+ ```bash
21
+ make build
22
+ ```
23
+
24
+ or
25
+
26
+ ```bash
27
+ make rebuild
28
+ ```
29
+
30
+ ## Virtual Envrionemnt
31
+ ```bash
32
+ make sync
33
+ ```
34
+
35
+ or
36
+
37
+ ```bash
38
+ make full-sync
39
+ ```
40
+
41
+ to prevent partial compilation of some modules
42
+
43
+ ## Installation
44
+ **Note: this package is still under development. The current build will likely not work.**
45
+ ```bash
46
+ pip install scloop
47
+ ```
48
+
49
+ ## Project Structure
50
+ ```
51
+ src/scloop/
52
+ ├── analyzing
53
+ │   └── __init__.py
54
+ ├── benchmarking
55
+ │   └── __init__.py
56
+ ├── computing
57
+ │   ├── homology.py
58
+ │   └── __init__.py
59
+ ├── data
60
+ │   ├── analysis_containers.py
61
+ │   ├── containers.py
62
+ │   ├── __init__.py
63
+ │   ├── loop_reconstruction.py
64
+ │   ├── metadata.py
65
+ │   ├── ripser.cpp
66
+ │   ├── ripser.hpp
67
+ │   ├── ripser_lib.cpp
68
+ │   ├── ripser_lib.pyx
69
+ │   ├── types.py
70
+ │   └── utils.py
71
+ ├── __init__.py
72
+ ├── matching
73
+ │   ├── data_modules.py
74
+ │   ├── __init__.py
75
+ │   ├── mlp.py
76
+ │   └── nf.py
77
+ ├── plotting
78
+ │   ├── _homology.py
79
+ │   └── __init__.py
80
+ ├── preprocessing
81
+ │   ├── delve
82
+ │   │   ├── delve.py
83
+ │   │   ├── __init__.py
84
+ │   │   └── kh.py
85
+ │   ├── downsample.py
86
+ │   ├── __init__.py
87
+ │   └── prepare.py
88
+ ├── py.typed
89
+ ├── tools
90
+ │   ├── _cross_match.py
91
+ │   ├── __init__.py
92
+ │   └── _loops.py
93
+ └── utils
94
+ ├── distance_metrics
95
+ │   ├── discrete-frechet-distance
96
+ │   ├── frechet.cpp
97
+ │   ├── frechet.pyx
98
+ │   └── __init__.py
99
+ ├── __init__.py
100
+ └── linear_algebra_gf2
101
+ ├── gf2_toolkit_lib.pyx
102
+ ├── __init__.py
103
+ ├── m4ri_lib.c
104
+ └── m4ri_lib.pyx
105
+ ```
@@ -0,0 +1,118 @@
1
+ [build-system]
2
+ build-backend = "setuptools.build_meta"
3
+ # [tool.setuptools]
4
+ # package-dir = { "" = "src" }
5
+ # ext-modules = [
6
+ # { name = "scloop.data.ripser_lib", sources = [
7
+ # "./src/scloop/data/ripser_lib.pyx",
8
+ # "./src/scloop/data/ripser.cpp",
9
+ # ], language = "c++", optional = false },
10
+ # { name = "scloop.utils.linear_algebra_gf2.m4ri_lib", sources = [
11
+ # "./src/scloop/utils/linear_algebra_gf2/m4ri_lib.pyx",
12
+ # ], language = "c", optional = false, libraries = ["m4ri"], extra-objects = [
13
+ # "./src/scloop/utils/linear_algebra_gf2/libm4ri.a",
14
+ # ], include-dirs = [
15
+ # "./src/scloop/utils/linear_algebra_gf2/include",
16
+ # ] },
17
+ # ]
18
+ requires = [ "cython>=3.0.12", "setuptools>=74.1" ]
19
+
20
+ [project]
21
+ name = "scloop"
22
+ version = "0.1.9"
23
+ description = "single-cell loop analysis"
24
+ readme = "README.md"
25
+ authors = [
26
+ { name = "Zhiyuan(Stan) Yu", email = "zyyu@umich.edu" },
27
+ { name = "Idse Heemskerk", email = "idse.heemskerk@gmail.com" },
28
+ ]
29
+ requires-python = ">=3.12"
30
+ # tensorflow hasn't supported 3.13 yet
31
+ classifiers = [
32
+ "Programming Language :: Python :: 3 :: Only",
33
+ "Programming Language :: Python :: 3.12",
34
+ ]
35
+ dependencies = [
36
+ "cython>=3.0.12",
37
+ "glasbey==0.3",
38
+ "igraph>=0.11",
39
+ "loguru==0.7.3",
40
+ "numba>=0.62.1",
41
+ "numpy<2",
42
+ "pandas",
43
+ "pip>=25.2",
44
+ "pydantic>=2.11.4",
45
+ "pytest>=8.4",
46
+ "rich==14.2",
47
+ "scanpy[leiden]>=1.11.2",
48
+ "scikit-misc>=0.5.2",
49
+ "statsmodels==0.14.4",
50
+ "tensorflow>=2.18.1",
51
+ "torch",
52
+ "torchdyn>=1.0.6",
53
+ "torchvision",
54
+ "tqdm-joblib>=0.0.5",
55
+ "umap-learn>=0.5.7",
56
+ ]
57
+
58
+ [dependency-groups]
59
+ dev = [
60
+ "pyright==1.1.406",
61
+ "ty>=0.0.1a34",
62
+ ]
63
+
64
+ [tool.uv]
65
+ package = true
66
+
67
+ [tool.uv.extra-build-dependencies]
68
+ scloop = [ "Cython" ]
69
+
70
+ [tool.uv.sources]
71
+ torch = [
72
+ { index = "pytorch-cu128", marker = "sys_platform == 'linux'" },
73
+ ]
74
+
75
+ torchvision = [
76
+ { index = "pytorch-cu128", marker = "sys_platform == 'linux'" },
77
+ ]
78
+
79
+ [[tool.uv.index]]
80
+ name = "pytorch-cu128"
81
+ url = "https://download.pytorch.org/whl/cu128"
82
+ explicit = true
83
+
84
+ [tool.ruff]
85
+ format.indent-style = "space"
86
+ format.quote-style = "double"
87
+ lint.extend-select = [ "I" ]
88
+ lint.fixable = [ "ALL" ]
89
+
90
+ [tool.pyproject-fmt]
91
+ column_width = 120
92
+ indent = 2
93
+ keep_full_version = false
94
+ max_supported_python = "3.12"
95
+
96
+ # use 1.1.406 pyright or a version after 1.1.407 (does not work well with pydantic dataclass)
97
+
98
+ [tool.pyright]
99
+ include = [ "src" ]
100
+ exclude = [
101
+ "**/__pycache__",
102
+ "examples",
103
+ "**/*.pyx",
104
+ "**/*.pxd",
105
+ ]
106
+
107
+ reportMissingImports = "error"
108
+ reportMissingTypeStubs = false
109
+
110
+ pythonVersion = "3.12"
111
+ pythonPlatform = "Linux"
112
+
113
+ executionEnvironments = [
114
+ { root = "src" },
115
+ ]
116
+
117
+ venvPath = "/home/stanfish/Git/scloop"
118
+ venv = ".venv"
scloop-0.1.9/setup.cfg ADDED
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
scloop-0.1.9/setup.py ADDED
@@ -0,0 +1,35 @@
1
+ import os
2
+
3
+ from Cython.Build import cythonize
4
+ from setuptools import Extension, setup
5
+
6
+ project_root = os.path.dirname(os.path.abspath(__file__))
7
+ m4ri_dir = os.path.join(project_root, "src/scloop/utils/linear_algebra_gf2")
8
+
9
+ extensions = [
10
+ Extension(
11
+ "scloop.data.ripser_lib",
12
+ sources=["./src/scloop/data/ripser_lib.pyx", "./src/scloop/data/ripser.cpp"],
13
+ language="c++",
14
+ include_dirs=["./src/scloop/data"],
15
+ ),
16
+ Extension(
17
+ "scloop.utils.linear_algebra_gf2.m4ri_lib",
18
+ sources=["./src/scloop/utils/linear_algebra_gf2/m4ri_lib.pyx"],
19
+ include_dirs=[os.path.join(m4ri_dir, "include")],
20
+ extra_objects=[os.path.join(m4ri_dir, "libm4ri.a")],
21
+ extra_compile_args=["-fopenmp"],
22
+ extra_link_args=["-fopenmp"],
23
+ ),
24
+ Extension(
25
+ "scloop.utils.distance_metrics.frechet",
26
+ sources=[
27
+ "./src/scloop/utils/distance_metrics/frechet.pyx",
28
+ "./src/scloop/utils/distance_metrics/discrete-frechet-distance/Frechet.cpp",
29
+ ],
30
+ include_dirs=["./src/scloop/utils/distance_metrics/discrete-frechet-distance"],
31
+ language="c++",
32
+ ),
33
+ ]
34
+
35
+ setup(ext_modules=cythonize(extensions, compiler_directives={"language_level": "3"}))
@@ -0,0 +1,27 @@
1
+ import warnings
2
+
3
+ from loguru import logger
4
+
5
+ warnings.filterwarnings("ignore", category=FutureWarning, module="scanpy")
6
+ warnings.filterwarnings("ignore", category=FutureWarning, module="anndata")
7
+ warnings.filterwarnings("ignore", category=SyntaxWarning, module="colorspacious")
8
+
9
+ try:
10
+ from . import plotting as pl
11
+ except ImportError as e:
12
+ logger.warning(f"Could not import plotting modules: {e}")
13
+ pl = None
14
+
15
+ try:
16
+ from . import preprocessing as pp
17
+ except ImportError as e:
18
+ logger.warning(f"Could not import preprocessing modules: {e}")
19
+ pp = None
20
+
21
+ try:
22
+ from . import tools as tl
23
+ except ImportError as e:
24
+ logger.warning(f"Could not import tools modules: {e}")
25
+ tl = None
26
+
27
+ __all__ = [pkg for pkg in ["pl", "pp", "tl"] if globals().get(pkg) is not None]
File without changes
@@ -0,0 +1,8 @@
1
+ """Lightweight compute helpers used by the public API layer."""
2
+ # Copyright 2025 Zhiyuan Yu (Heemskerk's lab, University of Michigan)
3
+
4
+ from .homology import (
5
+ compute_boundary_matrix_data,
6
+ compute_persistence_diagram_and_cocycles,
7
+ compute_sparse_pairwise_distance,
8
+ )