sciv 0.0.97__tar.gz → 0.0.99__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 (44) hide show
  1. {sciv-0.0.97 → sciv-0.0.99}/PKG-INFO +1 -1
  2. {sciv-0.0.97 → sciv-0.0.99}/pyproject.toml +1 -1
  3. {sciv-0.0.97 → sciv-0.0.99}/src/sciv/model/_core_.py +23 -11
  4. {sciv-0.0.97 → sciv-0.0.99}/src/sciv/tool/_algorithm_.py +9 -1
  5. {sciv-0.0.97 → sciv-0.0.99}/.gitignore +0 -0
  6. {sciv-0.0.97 → sciv-0.0.99}/LICENSE +0 -0
  7. {sciv-0.0.97 → sciv-0.0.99}/MANIFEST.in +0 -0
  8. {sciv-0.0.97 → sciv-0.0.99}/README.en.md +0 -0
  9. {sciv-0.0.97 → sciv-0.0.99}/README.md +0 -0
  10. {sciv-0.0.97 → sciv-0.0.99}/requirements.txt +0 -0
  11. {sciv-0.0.97 → sciv-0.0.99}/src/sciv/__init__.py +0 -0
  12. {sciv-0.0.97 → sciv-0.0.99}/src/sciv/file/__init__.py +0 -0
  13. {sciv-0.0.97 → sciv-0.0.99}/src/sciv/file/_read_.py +0 -0
  14. {sciv-0.0.97 → sciv-0.0.99}/src/sciv/file/_write_.py +0 -0
  15. {sciv-0.0.97 → sciv-0.0.99}/src/sciv/model/__init__.py +0 -0
  16. {sciv-0.0.97 → sciv-0.0.99}/src/sciv/plot/__init__.py +0 -0
  17. {sciv-0.0.97 → sciv-0.0.99}/src/sciv/plot/_bar_.py +0 -0
  18. {sciv-0.0.97 → sciv-0.0.99}/src/sciv/plot/_barcode_.py +0 -0
  19. {sciv-0.0.97 → sciv-0.0.99}/src/sciv/plot/_box_.py +0 -0
  20. {sciv-0.0.97 → sciv-0.0.99}/src/sciv/plot/_bubble_.py +0 -0
  21. {sciv-0.0.97 → sciv-0.0.99}/src/sciv/plot/_core_.py +0 -0
  22. {sciv-0.0.97 → sciv-0.0.99}/src/sciv/plot/_graph_.py +0 -0
  23. {sciv-0.0.97 → sciv-0.0.99}/src/sciv/plot/_heat_map_.py +0 -0
  24. {sciv-0.0.97 → sciv-0.0.99}/src/sciv/plot/_kde_.py +0 -0
  25. {sciv-0.0.97 → sciv-0.0.99}/src/sciv/plot/_line_.py +0 -0
  26. {sciv-0.0.97 → sciv-0.0.99}/src/sciv/plot/_pie_.py +0 -0
  27. {sciv-0.0.97 → sciv-0.0.99}/src/sciv/plot/_radar_.py +0 -0
  28. {sciv-0.0.97 → sciv-0.0.99}/src/sciv/plot/_scatter_.py +0 -0
  29. {sciv-0.0.97 → sciv-0.0.99}/src/sciv/plot/_venn_.py +0 -0
  30. {sciv-0.0.97 → sciv-0.0.99}/src/sciv/plot/_violin_.py +0 -0
  31. {sciv-0.0.97 → sciv-0.0.99}/src/sciv/preprocessing/__init__.py +0 -0
  32. {sciv-0.0.97 → sciv-0.0.99}/src/sciv/preprocessing/_anndata_.py +0 -0
  33. {sciv-0.0.97 → sciv-0.0.99}/src/sciv/preprocessing/_gencode_.py +0 -0
  34. {sciv-0.0.97 → sciv-0.0.99}/src/sciv/preprocessing/_gsea_.py +0 -0
  35. {sciv-0.0.97 → sciv-0.0.99}/src/sciv/preprocessing/_scanpy_.py +0 -0
  36. {sciv-0.0.97 → sciv-0.0.99}/src/sciv/preprocessing/_scvi_.py +0 -0
  37. {sciv-0.0.97 → sciv-0.0.99}/src/sciv/preprocessing/_snapatac_.py +0 -0
  38. {sciv-0.0.97 → sciv-0.0.99}/src/sciv/tool/__init__.py +0 -0
  39. {sciv-0.0.97 → sciv-0.0.99}/src/sciv/tool/_matrix_.py +0 -0
  40. {sciv-0.0.97 → sciv-0.0.99}/src/sciv/tool/_random_walk_.py +0 -0
  41. {sciv-0.0.97 → sciv-0.0.99}/src/sciv/util/__init__.py +0 -0
  42. {sciv-0.0.97 → sciv-0.0.99}/src/sciv/util/_constant_.py +0 -0
  43. {sciv-0.0.97 → sciv-0.0.99}/src/sciv/util/_core_.py +0 -0
  44. {sciv-0.0.97 → sciv-0.0.99}/tests/scivTest/__init__.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sciv
3
- Version: 0.0.97
3
+ Version: 0.0.99
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 @@ requires = ["hatchling"]
3
3
  build-backend = "hatchling.build"
4
4
  [project]
5
5
  name = "sciv"
6
- version = "0.0.97"
6
+ version = "0.0.99"
7
7
  authors = [
8
8
  { name = "Zheng-Min Yu", email = "yuzmbio@163.com" },
9
9
  ]
@@ -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
- step1_time = adata.uns["elapsed_time"] + da_peaks.uns["elapsed_time"]
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
- step2_time = overlap_adata.uns["elapsed_time"]
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
- step3_time = init_score.uns["elapsed_time"]
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
- step4_time = cc_data.uns["elapsed_time"]
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
- step5_time = random_walk.elapsed_time
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 = step1_time + step2_time + step3_time + step4_time + step5_time
595
+ step_time = poisson_vi_time + overlap_time + init_score_time + smknn_time + random_walk_time
593
596
 
594
- params.update({"elapsed_time": elapsed_time if elapsed_time > step_time else step_time})
595
- trs.uns["params"] = params
597
+ if elapsed_time < step_time:
598
+ elapsed_time = step_time
596
599
 
597
- del params
600
+ ul.log(__name__).info(f"Algorithm {project_name} consumes a total of {elapsed_time:.2f}s.")
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)
@@ -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"]
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes