strsc 0.4.0__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.
Files changed (93) hide show
  1. strsc/__init__.py +15 -0
  2. strsc/__main__.py +30 -0
  3. strsc/api.py +1232 -0
  4. strsc/cell_biology.py +241 -0
  5. strsc/cell_core.py +420 -0
  6. strsc/cell_prepare.py +223 -0
  7. strsc/cell_rna.py +274 -0
  8. strsc/cell_score.py +361 -0
  9. strsc/evaluation_export.py +288 -0
  10. strsc/example.py +69 -0
  11. strsc/export.py +119 -0
  12. strsc/files.py +757 -0
  13. strsc/fourier.py +271 -0
  14. strsc/her2.py +303 -0
  15. strsc/her2_core.py +958 -0
  16. strsc/hest.py +246 -0
  17. strsc/hest_core.py +289 -0
  18. strsc/rsc_cli.py +101 -0
  19. strsc/training/__init__.py +5 -0
  20. strsc/training/adapters/__init__.py +0 -0
  21. strsc/training/adapters/deepspot2cell/__init__.py +40 -0
  22. strsc/training/adapters/deepspot2cell/engineering_gate.py +239 -0
  23. strsc/training/adapters/deepspot2cell/formal_runner.py +254 -0
  24. strsc/training/adapters/deepspot2cell/graph.py +228 -0
  25. strsc/training/adapters/deepspot2cell/initialization.py +36 -0
  26. strsc/training/adapters/deepspot2cell/objective.py +212 -0
  27. strsc/training/adapters/deepspot2cell/overlay.py +79 -0
  28. strsc/training/adapters/deepspot2cell/paired_data.py +229 -0
  29. strsc/training/adapters/hest_deephis2exp/__init__.py +48 -0
  30. strsc/training/adapters/hest_deephis2exp/batching.py +730 -0
  31. strsc/training/adapters/hest_deephis2exp/data.py +448 -0
  32. strsc/training/adapters/hest_deephis2exp/engineering_gate.py +312 -0
  33. strsc/training/adapters/hest_deephis2exp/export.py +173 -0
  34. strsc/training/adapters/hest_deephis2exp/formal_runner.py +480 -0
  35. strsc/training/adapters/hest_deephis2exp/models.py +95 -0
  36. strsc/training/adapters/hest_deephis2exp/objective.py +492 -0
  37. strsc/training/adapters/hest_deephis2exp/overlay.py +141 -0
  38. strsc/training/adapters/hest_deephis2exp/split.py +80 -0
  39. strsc/training/adapters/hest_deepspot_hist/__init__.py +62 -0
  40. strsc/training/adapters/hest_deepspot_hist/contract.py +136 -0
  41. strsc/training/adapters/hest_deepspot_hist/data.py +746 -0
  42. strsc/training/adapters/hest_deepspot_hist/deepspot.py +162 -0
  43. strsc/training/adapters/hest_deepspot_hist/engineering_gate.py +498 -0
  44. strsc/training/adapters/hest_deepspot_hist/formal_runner.py +1003 -0
  45. strsc/training/adapters/hest_deepspot_hist/hist.py +164 -0
  46. strsc/training/adapters/hest_deepspot_hist/manifest.py +108 -0
  47. strsc/training/adapters/hest_deepspot_hist/objective.py +94 -0
  48. strsc/training/adapters/hest_deepspot_hist/outputs.py +154 -0
  49. strsc/training/adapters/hest_deepspot_hist/paired.py +54 -0
  50. strsc/training/adapters/hest_egn_tcgn/__init__.py +27 -0
  51. strsc/training/adapters/hest_egn_tcgn/contracts.py +124 -0
  52. strsc/training/adapters/hest_egn_tcgn/engineering_gate.py +729 -0
  53. strsc/training/adapters/hest_egn_tcgn/exemplars.py +241 -0
  54. strsc/training/adapters/hest_egn_tcgn/hest_data.py +448 -0
  55. strsc/training/adapters/hest_egn_tcgn/model_inputs.py +139 -0
  56. strsc/training/adapters/hest_egn_tcgn/outputs.py +137 -0
  57. strsc/training/adapters/hest_egn_tcgn/overlay.py +388 -0
  58. strsc/training/adapters/hest_egn_tcgn/pairing.py +66 -0
  59. strsc/training/adapters/hest_egn_tcgn/train_pair.py +458 -0
  60. strsc/training/adapters/hest_egn_tcgn/training.py +750 -0
  61. strsc/training/adapters/hest_egn_tcgn/upstream.py +345 -0
  62. strsc/training/adapters/hest_thitogene/__init__.py +15 -0
  63. strsc/training/adapters/hest_thitogene/engineering_gate.py +270 -0
  64. strsc/training/adapters/hest_thitogene/hest_data.py +396 -0
  65. strsc/training/adapters/hest_thitogene/overlay.py +260 -0
  66. strsc/training/adapters/hest_thitogene/train_pair.py +584 -0
  67. strsc/training/adapters/hest_thitogene/upstream.py +336 -0
  68. strsc/training/adapters/ridge_mlp/__init__.py +6 -0
  69. strsc/training/adapters/ridge_mlp/hest_contract.py +135 -0
  70. strsc/training/adapters/ridge_mlp/model.py +23 -0
  71. strsc/training/adapters/ridge_mlp/ridge.py +55 -0
  72. strsc/training/adapters/ridge_mlp/train_pair.py +621 -0
  73. strsc/training/adapters/scellst/__init__.py +42 -0
  74. strsc/training/adapters/scellst/data.py +279 -0
  75. strsc/training/adapters/scellst/engineering_gate.py +148 -0
  76. strsc/training/adapters/scellst/formal_runner.py +311 -0
  77. strsc/training/adapters/scellst/lightning_overlay.py +148 -0
  78. strsc/training/adapters/scellst/objective.py +87 -0
  79. strsc/training/adapters/scellst/runtime.py +416 -0
  80. strsc/training/adapters/scellst/split.py +232 -0
  81. strsc/training/hest_data.py +413 -0
  82. strsc/training/non_neighbours.py +256 -0
  83. strsc/training/shared/__init__.py +25 -0
  84. strsc/training/shared/adjacency.py +169 -0
  85. strsc/training/shared/losses.py +92 -0
  86. strsc/training/shared/noop.py +102 -0
  87. strsc-0.4.0.dist-info/METADATA +173 -0
  88. strsc-0.4.0.dist-info/RECORD +93 -0
  89. strsc-0.4.0.dist-info/WHEEL +5 -0
  90. strsc-0.4.0.dist-info/entry_points.txt +2 -0
  91. strsc-0.4.0.dist-info/licenses/LICENSE +21 -0
  92. strsc-0.4.0.dist-info/licenses/NOTICE.md +13 -0
  93. strsc-0.4.0.dist-info/top_level.txt +1 -0
strsc/__init__.py ADDED
@@ -0,0 +1,15 @@
1
+ """Reproducible-signal correlation (RSC) for spatial transcriptomics predicted from histology.
2
+
3
+ import strsc
4
+ counts = strsc.read_counts("sample.h5ad")
5
+ result = strsc.rsc(counts, {"my_model": "predictions.csv"}, layout="spots")
6
+ print(result.scales)
7
+ """
8
+
9
+ __version__ = "0.4.0"
10
+
11
+ from .files import Counts, InputError, Prediction, read_counts, read_files, read_predictions # noqa: E402
12
+ from .api import Result, ideal_check, regions, rsc # noqa: E402
13
+
14
+ __all__ = ["Counts", "InputError", "Prediction", "Result", "ideal_check", "read_counts", "read_files",
15
+ "read_predictions", "regions", "rsc", "__version__"]
strsc/__main__.py ADDED
@@ -0,0 +1,30 @@
1
+ """Command-line entry point."""
2
+ import argparse
3
+ import sys
4
+
5
+
6
+ def main():
7
+ parser = argparse.ArgumentParser(prog="strsc")
8
+ parser.add_argument("command", choices=["rsc", "hest", "her2", "fourier", "export", "export-results", "example"])
9
+ args = parser.parse_args(sys.argv[1:2])
10
+ remaining = sys.argv[2:]
11
+ sys.argv = [f"strsc {args.command}", *remaining]
12
+ if args.command == "rsc":
13
+ from .rsc_cli import main as run
14
+ elif args.command == "hest":
15
+ from .hest import main as run
16
+ elif args.command == "export":
17
+ from .export import main as run
18
+ elif args.command == "export-results":
19
+ from .evaluation_export import main as run
20
+ elif args.command == "her2":
21
+ from .her2 import main as run
22
+ elif args.command == "fourier":
23
+ from .fourier import main as run
24
+ else:
25
+ from .example import main as run
26
+ return run()
27
+
28
+
29
+ if __name__ == "__main__":
30
+ raise SystemExit(main())