sciv 0.0.97__py3-none-any.whl → 0.0.98__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.
- sciv/model/_core_.py +23 -11
- sciv/tool/_algorithm_.py +9 -1
- {sciv-0.0.97.dist-info → sciv-0.0.98.dist-info}/METADATA +1 -1
- {sciv-0.0.97.dist-info → sciv-0.0.98.dist-info}/RECORD +6 -6
- {sciv-0.0.97.dist-info → sciv-0.0.98.dist-info}/WHEEL +0 -0
- {sciv-0.0.97.dist-info → sciv-0.0.98.dist-info}/licenses/LICENSE +0 -0
sciv/model/_core_.py
CHANGED
|
@@ -15,7 +15,7 @@ from ..tool import RandomWalk, overlap_sum, obtain_cell_cell_network, calculate_
|
|
|
15
15
|
|
|
16
16
|
from ..file import save_h5ad, save_pkl, read_h5ad, read_pkl
|
|
17
17
|
from ..preprocessing import filter_data, poisson_vi
|
|
18
|
-
from ..util import path, enrichment_optional, to_dense, collection, to_sparse, difference_peak_optional
|
|
18
|
+
from ..util import path, enrichment_optional, to_dense, collection, to_sparse, difference_peak_optional, project_name
|
|
19
19
|
|
|
20
20
|
__name__: str = "model_core"
|
|
21
21
|
|
|
@@ -453,7 +453,7 @@ def core(
|
|
|
453
453
|
model_dir=model_dir
|
|
454
454
|
)
|
|
455
455
|
|
|
456
|
-
|
|
456
|
+
poisson_vi_time = adata.uns["elapsed_time"] + da_peaks.uns["elapsed_time"]
|
|
457
457
|
|
|
458
458
|
if save_path is not None:
|
|
459
459
|
|
|
@@ -485,7 +485,7 @@ def core(
|
|
|
485
485
|
|
|
486
486
|
del variants, trait_info
|
|
487
487
|
|
|
488
|
-
|
|
488
|
+
overlap_time = overlap_adata.uns["elapsed_time"]
|
|
489
489
|
|
|
490
490
|
if save_path is not None and not overlap_is_read:
|
|
491
491
|
save_h5ad(overlap_adata, file=atac_overlap_save_file)
|
|
@@ -518,7 +518,7 @@ def core(
|
|
|
518
518
|
|
|
519
519
|
del da_peaks, overlap_adata
|
|
520
520
|
|
|
521
|
-
|
|
521
|
+
init_score_time = init_score.uns["elapsed_time"]
|
|
522
522
|
|
|
523
523
|
if save_path is not None and not init_score_is_read:
|
|
524
524
|
save_h5ad(init_score, file=init_score_save_file)
|
|
@@ -546,13 +546,13 @@ def core(
|
|
|
546
546
|
|
|
547
547
|
del adata
|
|
548
548
|
|
|
549
|
-
|
|
549
|
+
smknn_time = cc_data.uns["elapsed_time"]
|
|
550
550
|
|
|
551
551
|
if save_path is not None and not cc_data_is_read:
|
|
552
552
|
save_h5ad(cc_data, file=cc_data_save_file)
|
|
553
553
|
|
|
554
554
|
"""
|
|
555
|
-
5. Random walk
|
|
555
|
+
5. Random walk with weighted seed cells
|
|
556
556
|
"""
|
|
557
557
|
|
|
558
558
|
random_walk_is_read: bool = is_file_exist_loading and os.path.exists(random_walk_save_file) and is_save_random_walk_model
|
|
@@ -584,17 +584,29 @@ def core(
|
|
|
584
584
|
del random_walk_is_read, init_score, cc_data
|
|
585
585
|
|
|
586
586
|
trs = _run_random_walk_(random_walk, is_ablation, is_simple)
|
|
587
|
+
trs.uns["params"] = params
|
|
588
|
+
|
|
589
|
+
del params
|
|
587
590
|
|
|
588
|
-
|
|
591
|
+
random_walk_time = random_walk.elapsed_time
|
|
589
592
|
|
|
590
593
|
# end time
|
|
591
594
|
elapsed_time = time.time() - start_time
|
|
592
|
-
step_time =
|
|
595
|
+
step_time = poisson_vi_time + overlap_time + init_score_time + smknn_time + random_walk_time
|
|
593
596
|
|
|
594
|
-
|
|
595
|
-
|
|
597
|
+
if elapsed_time < step_time:
|
|
598
|
+
elapsed_time = step_time
|
|
596
599
|
|
|
597
|
-
|
|
600
|
+
ul.log(__name__).info(f"Algorithm {project_name} consumes a total of {elapsed_time} seconds.")
|
|
601
|
+
|
|
602
|
+
trs.uns["elapsed_time"] = {
|
|
603
|
+
"PoissonVI": poisson_vi_time,
|
|
604
|
+
"Overlap": overlap_time,
|
|
605
|
+
"initial TRS": init_score_time,
|
|
606
|
+
"SM-kNN": smknn_time,
|
|
607
|
+
"Random walk": random_walk_time,
|
|
608
|
+
"Total time": elapsed_time
|
|
609
|
+
}
|
|
598
610
|
|
|
599
611
|
if save_path is not None:
|
|
600
612
|
save_h5ad(trs, file=trs_save_file)
|
sciv/tool/_algorithm_.py
CHANGED
|
@@ -993,7 +993,7 @@ def overlap_sum(regions: AnnData, variants: dict, trait_info: DataFrame, n_jobs:
|
|
|
993
993
|
|
|
994
994
|
# Use Parallel to process traits in parallel
|
|
995
995
|
results = Parallel(n_jobs=n_jobs)(
|
|
996
|
-
delayed(_process_trait_)(trait_name, col_idx) for col_idx, trait_name in enumerate(trait_names)
|
|
996
|
+
delayed(_process_trait_)(trait_name, col_idx) for col_idx, trait_name in tqdm(enumerate(trait_names))
|
|
997
997
|
)
|
|
998
998
|
|
|
999
999
|
# Preallocate length to avoid list dynamic expansion
|
|
@@ -1234,10 +1234,18 @@ def calculate_init_score_weight(
|
|
|
1234
1234
|
|
|
1235
1235
|
ul.log(__name__).info("Calculate initial trait relevance scores")
|
|
1236
1236
|
_init_trs_weight_ = np.multiply(_init_trs_ncw_, _cell_type_weight_)
|
|
1237
|
+
|
|
1238
|
+
if hasattr(_init_trs_weight_, "A"):
|
|
1239
|
+
_init_trs_weight_ = _init_trs_weight_.A
|
|
1240
|
+
|
|
1237
1241
|
init_trs_adata = AnnData(_init_trs_weight_, obs=cell_anno, var=trait_anno)
|
|
1238
1242
|
del _init_trs_weight_
|
|
1239
1243
|
|
|
1240
1244
|
if not is_simple:
|
|
1245
|
+
|
|
1246
|
+
if hasattr(_init_trs_ncw_, "A"):
|
|
1247
|
+
_init_trs_ncw_ = _init_trs_ncw_.A
|
|
1248
|
+
|
|
1241
1249
|
init_trs_adata.layers["init_trs_ncw"] = _init_trs_ncw_
|
|
1242
1250
|
init_trs_adata.layers["cell_type_weight"] = to_sparse(_cell_type_weight_)
|
|
1243
1251
|
init_trs_adata.uns["cluster_weight_factor"] = da_peaks_adata.obsm["cluster_weight"]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: sciv
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.98
|
|
4
4
|
Summary: Unveiling the pivotal cell types involved in variant function regulation at a single-cell resolution
|
|
5
5
|
Project-URL: github, https://github.com/YuZhengM/sciv
|
|
6
6
|
Author-email: Zheng-Min Yu <yuzmbio@163.com>
|
|
@@ -3,7 +3,7 @@ sciv/file/__init__.py,sha256=8cYLG0S0nilblmyX46CWFrbLr-rmLbO1EEO477pZ-gk,520
|
|
|
3
3
|
sciv/file/_read_.py,sha256=UZJpN3_5hBiTjzEYO6YXORcE_dqA8HmLpV80nqTLNSo,30554
|
|
4
4
|
sciv/file/_write_.py,sha256=W3M9CmPi7BuKAffz1fdi-vA5DzAFZ7wmcggp33N9Xtg,7848
|
|
5
5
|
sciv/model/__init__.py,sha256=k8SO9FpJaGn2ANqJyaz3HXMas7jH9toPVtpw703kOqg,149
|
|
6
|
-
sciv/model/_core_.py,sha256=
|
|
6
|
+
sciv/model/_core_.py,sha256=HCXPFOxfed5TUJMI-pZV9cx9_2R8z4dNPb2f7Hp3mVc,33693
|
|
7
7
|
sciv/plot/__init__.py,sha256=2tRNT6TZNz9r38lnna712RGsH7OJ2QkGa37XKgzejHQ,1865
|
|
8
8
|
sciv/plot/_bar_.py,sha256=xWpFbJTHgQMLuUSXa4uE69RGHXSCGinapxL-1imdDcU,14355
|
|
9
9
|
sciv/plot/_barcode_.py,sha256=RDOedQ8ZtXWFyJ2c772RDfqO4TMIpHMvcMZMAVqky90,5073
|
|
@@ -27,13 +27,13 @@ sciv/preprocessing/_scanpy_.py,sha256=tB8BD2wpLAU8_YxdqrgNtcjpNXNRo-JCdm2lxaKDBL
|
|
|
27
27
|
sciv/preprocessing/_scvi_.py,sha256=7QxwPA2kR_g15X28aEak7AFA4kyQ-UbtpiLH-rc5Ksg,10780
|
|
28
28
|
sciv/preprocessing/_snapatac_.py,sha256=Dq8CHF7Psl3CQszaEokQYO56Oe2uzyWOy_cGlaOywfc,27798
|
|
29
29
|
sciv/tool/__init__.py,sha256=WXzHkWt6RgBC3qqD-98nR5wQmt6oC850ox_VpMrapSU,2468
|
|
30
|
-
sciv/tool/_algorithm_.py,sha256=
|
|
30
|
+
sciv/tool/_algorithm_.py,sha256=mYKfSuYGelLd2secwyqGPxBQYd3x2yDKw1z7HK8mqYE,53773
|
|
31
31
|
sciv/tool/_matrix_.py,sha256=SnC3sXic_ufuEXStcD_HncvYH6apBdNK6nhG6jFLmjA,24324
|
|
32
32
|
sciv/tool/_random_walk_.py,sha256=JOB97XLxlZYHvlIST1wlXgA0mw6fybkWnJGq6X_kbsk,48871
|
|
33
33
|
sciv/util/__init__.py,sha256=nOxZ8if27X7AUJ6hZwTwxOJwIBJb0obWlHjqCzjg_Gc,1964
|
|
34
34
|
sciv/util/_constant_.py,sha256=w0wKQd8guLd1ZTW24_5aECrWsIWDiNQmEpLsWlHar1A,3000
|
|
35
35
|
sciv/util/_core_.py,sha256=TUWfBNRJzWuoQ9ffew_DjnlkNydG-Rmujl_RH4Ln9io,14917
|
|
36
|
-
sciv-0.0.
|
|
37
|
-
sciv-0.0.
|
|
38
|
-
sciv-0.0.
|
|
39
|
-
sciv-0.0.
|
|
36
|
+
sciv-0.0.98.dist-info/METADATA,sha256=yZiAx2el-OqapNmZNjUpjAmTAmQbIcBIZa7QFXjYPYc,3465
|
|
37
|
+
sciv-0.0.98.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
38
|
+
sciv-0.0.98.dist-info/licenses/LICENSE,sha256=4UvHVf3qCOZjHLs4LkYz8u96XRpXnZrpTKrkUQPs5_A,1075
|
|
39
|
+
sciv-0.0.98.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|