mcDETECT 2.0.7__py3-none-any.whl → 2.0.8__py3-none-any.whl
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.
Potentially problematic release.
This version of mcDETECT might be problematic. Click here for more details.
- mcDETECT/__init__.py +1 -1
- mcDETECT/model.py +9 -9
- {mcdetect-2.0.7.dist-info → mcdetect-2.0.8.dist-info}/METADATA +1 -1
- mcdetect-2.0.8.dist-info/RECORD +9 -0
- mcdetect-2.0.7.dist-info/RECORD +0 -9
- {mcdetect-2.0.7.dist-info → mcdetect-2.0.8.dist-info}/WHEEL +0 -0
- {mcdetect-2.0.7.dist-info → mcdetect-2.0.8.dist-info}/licenses/LICENSE +0 -0
- {mcdetect-2.0.7.dist-info → mcdetect-2.0.8.dist-info}/top_level.txt +0 -0
mcDETECT/__init__.py
CHANGED
mcDETECT/model.py
CHANGED
|
@@ -20,12 +20,12 @@ from .utils import *
|
|
|
20
20
|
class mcDETECT:
|
|
21
21
|
|
|
22
22
|
|
|
23
|
-
def __init__(self, type, transcripts,
|
|
23
|
+
def __init__(self, type, transcripts, gnl_genes, nc_genes = None, eps = 1.5, minspl = None, grid_len = 1.0, cutoff_prob = 0.95, alpha = 5.0, low_bound = 3,
|
|
24
24
|
size_thr = 4.0, in_nucleus_thr = (0.5, 0.5), l = 1.0, rho = 0.2, s = 1.0, nc_top = 20, nc_thr = 0.1):
|
|
25
25
|
|
|
26
26
|
self.type = type # string, iST platform, now support MERSCOPE, Xenium, and CosMx
|
|
27
27
|
self.transcripts = transcripts # dataframe, transcripts file
|
|
28
|
-
self.
|
|
28
|
+
self.gnl_genes = gnl_genes # list, string, all granule markers
|
|
29
29
|
self.nc_genes = nc_genes # list, string, all negative controls
|
|
30
30
|
self.eps = eps # numeric, searching radius epsilon
|
|
31
31
|
self.minspl = minspl # integer, manually select min_samples, i.e., no automatic parameter selection
|
|
@@ -74,7 +74,7 @@ class mcDETECT:
|
|
|
74
74
|
return optimal_m
|
|
75
75
|
|
|
76
76
|
|
|
77
|
-
# [INTERMEDIATE] dictionary, low- and high-in-nucleus spheres for each
|
|
77
|
+
# [INTERMEDIATE] dictionary, low- and high-in-nucleus spheres for each granule marker
|
|
78
78
|
def dbscan(self, target_names = None, record_cell_id = False, write_csv = False, write_path = "./"):
|
|
79
79
|
|
|
80
80
|
if self.type != "Xenium":
|
|
@@ -82,7 +82,7 @@ class mcDETECT:
|
|
|
82
82
|
z_grid.sort()
|
|
83
83
|
|
|
84
84
|
if target_names is None:
|
|
85
|
-
target_names = self.
|
|
85
|
+
target_names = self.gnl_genes
|
|
86
86
|
transcripts = self.transcripts[self.transcripts["target"].isin(target_names)]
|
|
87
87
|
|
|
88
88
|
num_individual, data_low, data_high = [], {}, {}
|
|
@@ -175,7 +175,7 @@ class mcDETECT:
|
|
|
175
175
|
|
|
176
176
|
# [INNER] merge points from two overlapped spheres, input for remove_overlaps()
|
|
177
177
|
def find_points(self, sphere_a, sphere_b):
|
|
178
|
-
transcripts = self.transcripts[self.transcripts["target"].isin(self.
|
|
178
|
+
transcripts = self.transcripts[self.transcripts["target"].isin(self.gnl_genes)]
|
|
179
179
|
tree_temp = make_tree(d1 = np.array(transcripts["global_x"]), d2 = np.array(transcripts["global_y"]), d3 = np.array(transcripts["global_z"]))
|
|
180
180
|
idx_a = tree_temp.query_ball_point([sphere_a["sphere_x"], sphere_a["sphere_y"], sphere_a["sphere_z"]], sphere_a["sphere_r"])
|
|
181
181
|
points_a = transcripts.iloc[idx_a]
|
|
@@ -239,10 +239,10 @@ class mcDETECT:
|
|
|
239
239
|
return set_a, set_b
|
|
240
240
|
|
|
241
241
|
|
|
242
|
-
# [INNER] merge spheres from different
|
|
242
|
+
# [INNER] merge spheres from different granule markers, input for detect()
|
|
243
243
|
def merge_sphere(self, sphere_dict):
|
|
244
244
|
sphere = sphere_dict[0].copy()
|
|
245
|
-
for j in range(1, len(self.
|
|
245
|
+
for j in range(1, len(self.gnl_genes)):
|
|
246
246
|
target_sphere = sphere_dict[j]
|
|
247
247
|
sphere, target_sphere_new = self.remove_overlaps(sphere, target_sphere)
|
|
248
248
|
sphere = pd.concat([sphere, target_sphere_new])
|
|
@@ -289,7 +289,7 @@ class mcDETECT:
|
|
|
289
289
|
return sphere
|
|
290
290
|
|
|
291
291
|
|
|
292
|
-
# [MAIN] dataframe,
|
|
292
|
+
# [MAIN] dataframe, granule metadata
|
|
293
293
|
def detect(self):
|
|
294
294
|
|
|
295
295
|
_, data_low, data_high = self.dbscan()
|
|
@@ -304,7 +304,7 @@ class mcDETECT:
|
|
|
304
304
|
return self.nc_filter(sphere_low, sphere_high)
|
|
305
305
|
|
|
306
306
|
|
|
307
|
-
# [MAIN] anndata,
|
|
307
|
+
# [MAIN] anndata, granule spatial transcriptome profile
|
|
308
308
|
def profile(self, granule, genes = None, print_itr = False):
|
|
309
309
|
|
|
310
310
|
if genes is None:
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
mcDETECT/__init__.py,sha256=b8QHgvPpsswrsFluSiXJU5FIvNxDN2M_cEEjNC1mK2k,92
|
|
2
|
+
mcDETECT/model.py,sha256=PG7R-HkKROMvo-T5T52EWVtXtn7rzE1Y7ETFxi6Yd04,29197
|
|
3
|
+
mcDETECT/model_new_but_wrong.py,sha256=MqJMAC4cyjux3BWIYWmGLugr_gHPeYcQNH-O40xbPHE,29398
|
|
4
|
+
mcDETECT/utils.py,sha256=0gvqZV7sGi8qvvdC5x9XScyiTXlSfqbUt1zks4t7Xd4,4545
|
|
5
|
+
mcdetect-2.0.8.dist-info/licenses/LICENSE,sha256=uxq-shEWOGTIGVnQLmpElILmfCkuUhFZRAMnZUiKvtg,1070
|
|
6
|
+
mcdetect-2.0.8.dist-info/METADATA,sha256=5HRW_gldUAnTBGunOqa1C8J9BpJ9-DnwTmwiF0rprFg,3016
|
|
7
|
+
mcdetect-2.0.8.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
8
|
+
mcdetect-2.0.8.dist-info/top_level.txt,sha256=WwzBojt5U-T2hZ8llO6XgpM9OFIBkWQQldQKu19O8EY,9
|
|
9
|
+
mcdetect-2.0.8.dist-info/RECORD,,
|
mcdetect-2.0.7.dist-info/RECORD
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
mcDETECT/__init__.py,sha256=_UFDBE5UfX_xzioVs7rshassZR-KO0yPDE71Uflgx-E,92
|
|
2
|
-
mcDETECT/model.py,sha256=zDmfQjQwkSm8JRe2e45FN8siS0o50AUHZQoqCWvtvw4,29200
|
|
3
|
-
mcDETECT/model_new_but_wrong.py,sha256=MqJMAC4cyjux3BWIYWmGLugr_gHPeYcQNH-O40xbPHE,29398
|
|
4
|
-
mcDETECT/utils.py,sha256=0gvqZV7sGi8qvvdC5x9XScyiTXlSfqbUt1zks4t7Xd4,4545
|
|
5
|
-
mcdetect-2.0.7.dist-info/licenses/LICENSE,sha256=uxq-shEWOGTIGVnQLmpElILmfCkuUhFZRAMnZUiKvtg,1070
|
|
6
|
-
mcdetect-2.0.7.dist-info/METADATA,sha256=TlVlS7eK2SzHiyweSTEDfNTOFJeKh66epvKLS1pCC40,3016
|
|
7
|
-
mcdetect-2.0.7.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
8
|
-
mcdetect-2.0.7.dist-info/top_level.txt,sha256=WwzBojt5U-T2hZ8llO6XgpM9OFIBkWQQldQKu19O8EY,9
|
|
9
|
-
mcdetect-2.0.7.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|