mcDETECT 1.0.1__tar.gz → 1.0.5__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.
Potentially problematic release.
This version of mcDETECT might be problematic. Click here for more details.
- {mcdetect-1.0.1 → mcdetect-1.0.5}/PKG-INFO +2 -2
- {mcdetect-1.0.1 → mcdetect-1.0.5}/mcDETECT/model.py +85 -3
- {mcdetect-1.0.1 → mcdetect-1.0.5}/mcDETECT.egg-info/PKG-INFO +2 -2
- {mcdetect-1.0.1 → mcdetect-1.0.5}/mcDETECT.egg-info/requires.txt +1 -1
- {mcdetect-1.0.1 → mcdetect-1.0.5}/setup.py +2 -2
- {mcdetect-1.0.1 → mcdetect-1.0.5}/LICENSE +0 -0
- {mcdetect-1.0.1 → mcdetect-1.0.5}/README.md +0 -0
- {mcdetect-1.0.1 → mcdetect-1.0.5}/mcDETECT/__init__.py +0 -0
- {mcdetect-1.0.1 → mcdetect-1.0.5}/mcDETECT.egg-info/SOURCES.txt +0 -0
- {mcdetect-1.0.1 → mcdetect-1.0.5}/mcDETECT.egg-info/dependency_links.txt +0 -0
- {mcdetect-1.0.1 → mcdetect-1.0.5}/mcDETECT.egg-info/top_level.txt +0 -0
- {mcdetect-1.0.1 → mcdetect-1.0.5}/pyproject.toml +0 -0
- {mcdetect-1.0.1 → mcdetect-1.0.5}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: mcDETECT
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.5
|
|
4
4
|
Summary: mcDETECT: Decoding 3D Spatial Synaptic Transcriptomes with Subcellular-Resolution Spatial Transcriptomics
|
|
5
5
|
Home-page: https://github.com/chen-yang-yuan/mcDETECT
|
|
6
6
|
Author: Chenyang Yuan
|
|
@@ -17,9 +17,9 @@ Requires-Dist: numpy
|
|
|
17
17
|
Requires-Dist: pandas
|
|
18
18
|
Requires-Dist: rtree
|
|
19
19
|
Requires-Dist: scanpy
|
|
20
|
+
Requires-Dist: scikit-learn
|
|
20
21
|
Requires-Dist: scipy
|
|
21
22
|
Requires-Dist: shapely
|
|
22
|
-
Requires-Dist: sklearn
|
|
23
23
|
Dynamic: author
|
|
24
24
|
Dynamic: author-email
|
|
25
25
|
Dynamic: classifier
|
|
@@ -304,7 +304,7 @@ class mcDETECT:
|
|
|
304
304
|
return sphere
|
|
305
305
|
|
|
306
306
|
|
|
307
|
-
# [MAIN] dataframe, metadata
|
|
307
|
+
# [MAIN] dataframe, synapse metadata
|
|
308
308
|
def detect(self):
|
|
309
309
|
|
|
310
310
|
_, data_low, data_high = self.dbscan()
|
|
@@ -319,7 +319,7 @@ class mcDETECT:
|
|
|
319
319
|
return self.nc_filter(sphere_low, sphere_high)
|
|
320
320
|
|
|
321
321
|
|
|
322
|
-
# [MAIN] anndata, spatial transcriptome profile
|
|
322
|
+
# [MAIN] anndata, synapse spatial transcriptome profile
|
|
323
323
|
def profile(self, synapse, genes = None, print_itr = False):
|
|
324
324
|
|
|
325
325
|
if genes is None:
|
|
@@ -348,4 +348,86 @@ class mcDETECT:
|
|
|
348
348
|
adata.var['genes'] = genes
|
|
349
349
|
adata.var_names = genes
|
|
350
350
|
adata.var_keys = genes
|
|
351
|
-
return adata
|
|
351
|
+
return adata
|
|
352
|
+
|
|
353
|
+
|
|
354
|
+
# [MAIN] anndata, spot-level gene expression
|
|
355
|
+
def spot_expression(self, grid_len, genes = None):
|
|
356
|
+
|
|
357
|
+
if genes is None:
|
|
358
|
+
genes = list(np.unique(self.transcripts['target']))
|
|
359
|
+
transcripts = self.transcripts
|
|
360
|
+
else:
|
|
361
|
+
transcripts = self.transcripts[self.transcripts['target'].isin(genes)]
|
|
362
|
+
|
|
363
|
+
# construct bins
|
|
364
|
+
x_bins, y_bins = self.construct_grid(grid_len = None)
|
|
365
|
+
|
|
366
|
+
# initialize data
|
|
367
|
+
X = np.zeros((len(genes), len(x_bins) * len(y_bins)))
|
|
368
|
+
global_x, global_y = [], []
|
|
369
|
+
|
|
370
|
+
# coordinates
|
|
371
|
+
for i in list(x_bins):
|
|
372
|
+
center_x = i + 0.5 * grid_len
|
|
373
|
+
for j in list(y_bins):
|
|
374
|
+
center_y = j + 0.5 * grid_len
|
|
375
|
+
global_x.append(center_x)
|
|
376
|
+
global_y.append(center_y)
|
|
377
|
+
|
|
378
|
+
# count matrix
|
|
379
|
+
for k_idx, k in enumerate(genes):
|
|
380
|
+
target_gene = transcripts[transcripts['feature_name'] == k]
|
|
381
|
+
count_gene, _, _ = np.histogram2d(target_gene['global_x'], target_gene['global_y'], bins = [x_bins, y_bins])
|
|
382
|
+
X[k_idx, :] = count_gene.flatten()
|
|
383
|
+
if k_idx % 50 == 0:
|
|
384
|
+
print("{} out of {} genes profiled!".format(k_idx + 1, len(genes)))
|
|
385
|
+
|
|
386
|
+
# spot id
|
|
387
|
+
spot_id = []
|
|
388
|
+
for i in range(len(global_x)):
|
|
389
|
+
id = 'spot_' + str(i)
|
|
390
|
+
spot_id.append(id)
|
|
391
|
+
|
|
392
|
+
# assemble data
|
|
393
|
+
adata = anndata.AnnData(X = np.transpose(X))
|
|
394
|
+
adata.obs['spot_id'] = spot_id
|
|
395
|
+
adata.obs['global_x'] = global_x
|
|
396
|
+
adata.obs['global_y'] = global_y
|
|
397
|
+
adata.var['genes'] = genes
|
|
398
|
+
adata.var_names = genes
|
|
399
|
+
adata.var_keys = genes
|
|
400
|
+
return adata
|
|
401
|
+
|
|
402
|
+
|
|
403
|
+
# [MAIN] anndata, spot-level synapse metadata
|
|
404
|
+
def spot_synapse(self, synapse, spot):
|
|
405
|
+
|
|
406
|
+
x_grid, y_grid = list(np.unique(spot.obs['global_x'])), list(np.unique(spot.obs['global_y']))
|
|
407
|
+
diameter = x_grid[1] - x_grid[0]
|
|
408
|
+
|
|
409
|
+
indicator, synapse_count, synapse_radius, synapse_size, synapse_score = [], [], [], [], []
|
|
410
|
+
for i in x_grid:
|
|
411
|
+
x_min_temp = i
|
|
412
|
+
x_max_temp = i + diameter
|
|
413
|
+
for j in y_grid:
|
|
414
|
+
y_min_temp = j
|
|
415
|
+
y_max_temp = j + diameter
|
|
416
|
+
syn_temp = synapse[(synapse['sphere_x'] > x_min_temp) & (synapse['sphere_x'] < x_max_temp) & (synapse['sphere_y'] > y_min_temp) & (synapse['sphere_y'] < y_max_temp)]
|
|
417
|
+
indicator.append(int(syn_temp.shape[0] > 0))
|
|
418
|
+
synapse_count.append(syn_temp.shape[0])
|
|
419
|
+
if syn_temp.shape[0] == 0:
|
|
420
|
+
synapse_radius.append(0)
|
|
421
|
+
synapse_size.append(0)
|
|
422
|
+
synapse_score.append(0)
|
|
423
|
+
else:
|
|
424
|
+
synapse_radius.append(np.nanmean(syn_temp['sphere_r']))
|
|
425
|
+
synapse_size.append(np.nanmean(syn_temp['size']))
|
|
426
|
+
synapse_score.append(np.nanmean(syn_temp['in_nucleus']))
|
|
427
|
+
|
|
428
|
+
spot.obs['indicator'] = indicator
|
|
429
|
+
spot.obs['syn_count'] = synapse_count
|
|
430
|
+
spot.obs['syn_radius'] = synapse_radius
|
|
431
|
+
spot.obs['syn_size'] = synapse_size
|
|
432
|
+
spot.obs['syn_score'] = synapse_score
|
|
433
|
+
return spot
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: mcDETECT
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.5
|
|
4
4
|
Summary: mcDETECT: Decoding 3D Spatial Synaptic Transcriptomes with Subcellular-Resolution Spatial Transcriptomics
|
|
5
5
|
Home-page: https://github.com/chen-yang-yuan/mcDETECT
|
|
6
6
|
Author: Chenyang Yuan
|
|
@@ -17,9 +17,9 @@ Requires-Dist: numpy
|
|
|
17
17
|
Requires-Dist: pandas
|
|
18
18
|
Requires-Dist: rtree
|
|
19
19
|
Requires-Dist: scanpy
|
|
20
|
+
Requires-Dist: scikit-learn
|
|
20
21
|
Requires-Dist: scipy
|
|
21
22
|
Requires-Dist: shapely
|
|
22
|
-
Requires-Dist: sklearn
|
|
23
23
|
Dynamic: author
|
|
24
24
|
Dynamic: author-email
|
|
25
25
|
Dynamic: classifier
|
|
@@ -2,9 +2,9 @@ from setuptools import setup, find_packages
|
|
|
2
2
|
|
|
3
3
|
setup(
|
|
4
4
|
name = "mcDETECT",
|
|
5
|
-
version = "1.0.
|
|
5
|
+
version = "1.0.5",
|
|
6
6
|
packages = find_packages(),
|
|
7
|
-
install_requires = ["anndata", "miniball", "numpy", "pandas", "rtree", "scanpy", "
|
|
7
|
+
install_requires = ["anndata", "miniball", "numpy", "pandas", "rtree", "scanpy", "scikit-learn", "scipy", "shapely"],
|
|
8
8
|
author = "Chenyang Yuan",
|
|
9
9
|
author_email = "chenyang.yuan@emory.edu",
|
|
10
10
|
description = "mcDETECT: Decoding 3D Spatial Synaptic Transcriptomes with Subcellular-Resolution Spatial Transcriptomics",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|