exprmat 0.1.44__tar.gz → 0.1.46__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 (228) hide show
  1. {exprmat-0.1.44 → exprmat-0.1.46}/PKG-INFO +2 -1
  2. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/ansi.py +75 -2
  3. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/descriptive/aggregate.py +7 -12
  4. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/descriptive/gse.py +5 -2
  5. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/dynamics/moments.py +6 -1
  6. exprmat-0.1.46/exprmat/metacell/__init__.py +158 -0
  7. exprmat-0.1.46/exprmat/metacell/engine.py +204 -0
  8. exprmat-0.1.46/exprmat/metacell/model.py +273 -0
  9. exprmat-0.1.46/exprmat/metacell/utils.py +151 -0
  10. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/plotting/expression.py +3 -2
  11. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/plotting/trajectory.py +72 -7
  12. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/preprocessing/__init__.py +1 -1
  13. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/preprocessing/filter.py +42 -37
  14. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/preprocessing/qc.py +8 -1
  15. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/reader/experiment.py +122 -31
  16. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/reader/static.py +82 -10
  17. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/reader/updater.py +13 -2
  18. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/reduction/plot.py +5 -18
  19. exprmat-0.1.46/exprmat/trajectory/trace.py +366 -0
  20. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/transfer/atlas.py +32 -14
  21. {exprmat-0.1.44 → exprmat-0.1.46}/pyproject.toml +3 -2
  22. {exprmat-0.1.44 → exprmat-0.1.46}/Cargo.lock +0 -0
  23. {exprmat-0.1.44 → exprmat-0.1.46}/Cargo.toml +0 -0
  24. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/__init__.py +0 -0
  25. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/clustering/__init__.py +0 -0
  26. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/clustering/cnmf.py +0 -0
  27. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/clustering/dbscan.py +0 -0
  28. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/clustering/kmeans.py +0 -0
  29. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/clustering/leiden.py +0 -0
  30. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/clustering/nmf.py +0 -0
  31. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/clustering/rogue.py +0 -0
  32. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/clustering/seriation.py +0 -0
  33. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/clustering/spectral.py +0 -0
  34. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/clustering/utils.py +0 -0
  35. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/cnv/__init__.py +0 -0
  36. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/cnv/cnvscore.py +0 -0
  37. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/cnv/infercnv.py +0 -0
  38. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/configuration.py +0 -0
  39. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/data/__init__.py +0 -0
  40. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/data/cistarget.py +0 -0
  41. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/data/cre.py +0 -0
  42. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/data/finders.py +0 -0
  43. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/data/geneset.py +0 -0
  44. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/data/io.py +0 -0
  45. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/data/lr.py +0 -0
  46. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/data/presets.py +0 -0
  47. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/data/signature.py +0 -0
  48. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/data/tf.py +0 -0
  49. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/descriptive/__init__.py +0 -0
  50. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/descriptive/atac.py +0 -0
  51. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/descriptive/aucell.py +0 -0
  52. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/descriptive/de.py +0 -0
  53. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/descriptive/kde.py +0 -0
  54. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/descriptive/recovery.py +0 -0
  55. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/descriptive/summary.py +0 -0
  56. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/descriptive/tcr.py +0 -0
  57. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/deseq/dataset.py +0 -0
  58. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/deseq/gridsearch.py +0 -0
  59. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/deseq/inference.py +0 -0
  60. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/deseq/preprocessing.py +0 -0
  61. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/deseq/stats.py +0 -0
  62. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/deseq/utils.py +0 -0
  63. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/dynamics/__init__.py +0 -0
  64. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/dynamics/generank.py +0 -0
  65. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/dynamics/linreg.py +0 -0
  66. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/dynamics/optimization.py +0 -0
  67. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/dynamics/parallel.py +0 -0
  68. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/dynamics/preprocess.py +0 -0
  69. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/dynamics/pseudotime.py +0 -0
  70. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/dynamics/transition.py +0 -0
  71. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/dynamics/utils.py +0 -0
  72. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/dynamics/velocity.py +0 -0
  73. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/grn/__init__.py +0 -0
  74. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/grn/infergrn.py +0 -0
  75. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/grn/modules.py +0 -0
  76. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/grn/prune.py +0 -0
  77. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/grn/regressors.py +0 -0
  78. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/grn/utils.py +0 -0
  79. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/image/__init__.py +0 -0
  80. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/image/align.py +0 -0
  81. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/lr/__init__.py +0 -0
  82. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/lr/aggregate.py +0 -0
  83. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/lr/method.py +0 -0
  84. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/lr/methods/__init__.py +0 -0
  85. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/lr/methods/cellchat.py +0 -0
  86. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/lr/methods/cellphonedb.py +0 -0
  87. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/lr/methods/connectome.py +0 -0
  88. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/lr/methods/geomean.py +0 -0
  89. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/lr/methods/logfc.py +0 -0
  90. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/lr/methods/natmi.py +0 -0
  91. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/lr/methods/rank_aggregate.py +0 -0
  92. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/lr/methods/scseqcomm.py +0 -0
  93. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/lr/methods/singlecellsignalr.py +0 -0
  94. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/lr/pipeline.py +0 -0
  95. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/lr/preprocess.py +0 -0
  96. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/lr/resources.py +0 -0
  97. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/lr/utils.py +0 -0
  98. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/peaks/__init__.py +0 -0
  99. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/peaks/callpeak.py +0 -0
  100. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/peaks/common.py +0 -0
  101. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/peaks/coverage.py +0 -0
  102. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/peaks/footprint.py +0 -0
  103. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/peaks/idr/__init__.py +0 -0
  104. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/peaks/idr/constants.py +0 -0
  105. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/peaks/idr/idr.py +0 -0
  106. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/peaks/idr/invcdf.pyx +0 -0
  107. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/peaks/idr/optimization.py +0 -0
  108. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/peaks/idr/utils.py +0 -0
  109. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/peaks/linkage.py +0 -0
  110. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/peaks/motif.py +0 -0
  111. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/peaks/sequence.py +0 -0
  112. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/plotting/__init__.py +0 -0
  113. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/plotting/atac.py +0 -0
  114. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/plotting/cnmf.py +0 -0
  115. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/plotting/cnv.py +0 -0
  116. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/plotting/data/A.pk +0 -0
  117. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/plotting/data/B.pk +0 -0
  118. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/plotting/data/C.pk +0 -0
  119. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/plotting/data/D.pk +0 -0
  120. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/plotting/data/E.pk +0 -0
  121. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/plotting/data/F.pk +0 -0
  122. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/plotting/data/G.pk +0 -0
  123. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/plotting/data/H.pk +0 -0
  124. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/plotting/data/I.pk +0 -0
  125. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/plotting/data/J.pk +0 -0
  126. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/plotting/data/K.pk +0 -0
  127. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/plotting/data/L.pk +0 -0
  128. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/plotting/data/M.pk +0 -0
  129. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/plotting/data/N.pk +0 -0
  130. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/plotting/data/O.pk +0 -0
  131. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/plotting/data/P.pk +0 -0
  132. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/plotting/data/Q.pk +0 -0
  133. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/plotting/data/R.pk +0 -0
  134. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/plotting/data/S.pk +0 -0
  135. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/plotting/data/T.pk +0 -0
  136. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/plotting/data/U.pk +0 -0
  137. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/plotting/data/V.pk +0 -0
  138. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/plotting/data/W.pk +0 -0
  139. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/plotting/data/X.pk +0 -0
  140. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/plotting/data/Y.pk +0 -0
  141. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/plotting/data/Z.pk +0 -0
  142. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/plotting/de.py +0 -0
  143. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/plotting/gse.py +0 -0
  144. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/plotting/lr.py +0 -0
  145. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/plotting/milestone.py +0 -0
  146. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/plotting/palettes.py +0 -0
  147. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/plotting/sankey.py +0 -0
  148. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/plotting/sequence.py +0 -0
  149. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/plotting/summary.py +0 -0
  150. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/plotting/track.py +0 -0
  151. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/plotting/utils.py +0 -0
  152. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/plotting/velocity.py +0 -0
  153. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/preprocessing/doublets/__init__.py +0 -0
  154. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/preprocessing/doublets/composite.py +0 -0
  155. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/preprocessing/doublets/scrublet.py +0 -0
  156. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/preprocessing/emptydrops.py +0 -0
  157. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/preprocessing/impute/__init__.py +0 -0
  158. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/preprocessing/impute/magic.py +0 -0
  159. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/preprocessing/integrate.py +0 -0
  160. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/preprocessing/linear.py +0 -0
  161. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/preprocessing/normal.py +0 -0
  162. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/preprocessing/plot.py +0 -0
  163. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/preprocessing/sctransform/__init__.py +0 -0
  164. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/preprocessing/sctransform/estimate.py +0 -0
  165. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/preprocessing/sctransform/ksmooth.py +0 -0
  166. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/preprocessing/sctransform/residual.py +0 -0
  167. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/preprocessing/sctransform/transform.py +0 -0
  168. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/preprocessing/sparse.py +0 -0
  169. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/preprocessing/uniform.py +0 -0
  170. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/reader/__init__.py +0 -0
  171. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/reader/conversions.py +0 -0
  172. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/reader/matcher.py +0 -0
  173. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/reader/metadata.py +0 -0
  174. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/reader/spatial.py +0 -0
  175. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/reduction/__init__.py +0 -0
  176. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/reduction/diffmap.py +0 -0
  177. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/reduction/forceatlas.py +0 -0
  178. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/reduction/mde.py +0 -0
  179. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/reduction/nn.py +0 -0
  180. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/reduction/outliers.py +0 -0
  181. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/reduction/pca.py +0 -0
  182. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/reduction/scvi.py +0 -0
  183. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/reduction/spectral.py +0 -0
  184. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/reduction/tsne.py +0 -0
  185. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/reduction/umap.py +0 -0
  186. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/trajectory/__init__.py +0 -0
  187. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/trajectory/elpi.py +0 -0
  188. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/trajectory/pcurve.py +0 -0
  189. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/trajectory/pseudotime.py +0 -0
  190. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/trajectory/root.py +0 -0
  191. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/transfer/__init__.py +0 -0
  192. {exprmat-0.1.44 → exprmat-0.1.46}/exprmat/utils.py +0 -0
  193. {exprmat-0.1.44 → exprmat-0.1.46}/license +0 -0
  194. {exprmat-0.1.44 → exprmat-0.1.46}/readme.md +0 -0
  195. {exprmat-0.1.44 → exprmat-0.1.46}/snapatac2/Cargo.toml +0 -0
  196. {exprmat-0.1.44 → exprmat-0.1.46}/snapatac2/license +0 -0
  197. {exprmat-0.1.44 → exprmat-0.1.46}/snapatac2/readme +0 -0
  198. {exprmat-0.1.44 → exprmat-0.1.46}/snapatac2/src/call_peaks.rs +0 -0
  199. {exprmat-0.1.44 → exprmat-0.1.46}/snapatac2/src/embedding.rs +0 -0
  200. {exprmat-0.1.44 → exprmat-0.1.46}/snapatac2/src/export.rs +0 -0
  201. {exprmat-0.1.44 → exprmat-0.1.46}/snapatac2/src/knn.rs +0 -0
  202. {exprmat-0.1.44 → exprmat-0.1.46}/snapatac2/src/lib.rs +0 -0
  203. {exprmat-0.1.44 → exprmat-0.1.46}/snapatac2/src/motif.rs +0 -0
  204. {exprmat-0.1.44 → exprmat-0.1.46}/snapatac2/src/network.rs +0 -0
  205. {exprmat-0.1.44 → exprmat-0.1.46}/snapatac2/src/preprocessing.rs +0 -0
  206. {exprmat-0.1.44 → exprmat-0.1.46}/snapatac2/src/utils/anndata.rs +0 -0
  207. {exprmat-0.1.44 → exprmat-0.1.46}/snapatac2/src/utils.rs +0 -0
  208. {exprmat-0.1.44 → exprmat-0.1.46}/snapatac2-core/Cargo.toml +0 -0
  209. {exprmat-0.1.44 → exprmat-0.1.46}/snapatac2-core/src/embedding.rs +0 -0
  210. {exprmat-0.1.44 → exprmat-0.1.46}/snapatac2-core/src/export.rs +0 -0
  211. {exprmat-0.1.44 → exprmat-0.1.46}/snapatac2-core/src/feature_count/counter.rs +0 -0
  212. {exprmat-0.1.44 → exprmat-0.1.46}/snapatac2-core/src/feature_count/data_iter.rs +0 -0
  213. {exprmat-0.1.44 → exprmat-0.1.46}/snapatac2-core/src/feature_count/matrix.rs +0 -0
  214. {exprmat-0.1.44 → exprmat-0.1.46}/snapatac2-core/src/feature_count/mod.rs +0 -0
  215. {exprmat-0.1.44 → exprmat-0.1.46}/snapatac2-core/src/genome.rs +0 -0
  216. {exprmat-0.1.44 → exprmat-0.1.46}/snapatac2-core/src/lib.rs +0 -0
  217. {exprmat-0.1.44 → exprmat-0.1.46}/snapatac2-core/src/motif.rs +0 -0
  218. {exprmat-0.1.44 → exprmat-0.1.46}/snapatac2-core/src/network.rs +0 -0
  219. {exprmat-0.1.44 → exprmat-0.1.46}/snapatac2-core/src/preprocessing/bam/flagstat.rs +0 -0
  220. {exprmat-0.1.44 → exprmat-0.1.46}/snapatac2-core/src/preprocessing/bam/header.rs +0 -0
  221. {exprmat-0.1.44 → exprmat-0.1.46}/snapatac2-core/src/preprocessing/bam/mark_duplicates.rs +0 -0
  222. {exprmat-0.1.44 → exprmat-0.1.46}/snapatac2-core/src/preprocessing/bam.rs +0 -0
  223. {exprmat-0.1.44 → exprmat-0.1.46}/snapatac2-core/src/preprocessing/import.rs +0 -0
  224. {exprmat-0.1.44 → exprmat-0.1.46}/snapatac2-core/src/preprocessing/mod.rs +0 -0
  225. {exprmat-0.1.44 → exprmat-0.1.46}/snapatac2-core/src/preprocessing/qc.rs +0 -0
  226. {exprmat-0.1.44 → exprmat-0.1.46}/snapatac2-core/src/utils/knn.rs +0 -0
  227. {exprmat-0.1.44 → exprmat-0.1.46}/snapatac2-core/src/utils/mod.rs +0 -0
  228. {exprmat-0.1.44 → exprmat-0.1.46}/snapatac2-core/src/utils/similarity.rs +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: exprmat
3
- Version: 0.1.44
3
+ Version: 0.1.46
4
4
  Classifier: Programming Language :: Rust
5
5
  Classifier: Programming Language :: Python :: Implementation :: CPython
6
6
  Classifier: Programming Language :: Python :: Implementation :: PyPy
@@ -78,6 +78,7 @@ Requires-Dist: xgboost
78
78
  Requires-Dist: simpleppt
79
79
  Requires-Dist: elpigraph-python
80
80
  Requires-Dist: dask-expr>=2.0
81
+ Requires-Dist: einops==0.8.1
81
82
  Requires-Dist: sphinx ; extra == 'dev'
82
83
  Requires-Dist: twine ; extra == 'dev'
83
84
  Requires-Dist: ipykernel ; extra == 'dev'
@@ -83,7 +83,7 @@ def common_length(string: str, limit: int) -> str:
83
83
  cn = re.findall(cn_re, string)
84
84
  cn_length = len(cn)
85
85
 
86
- if limit <= 5:
86
+ if limit < 5:
87
87
  x_str = string[-limit:]
88
88
  cn = len(re.findall(cn_re, x_str))
89
89
  while cn + len(x_str) > limit:
@@ -160,6 +160,74 @@ def cyan(x): return '\033[36m' + x + '\033[0m'
160
160
  def annot(x): return '\033[90;3m' + x + '\033[0m'
161
161
 
162
162
 
163
+ def dtypestr(dty):
164
+ string = str(dty)
165
+ if string == 'category': return 'cat'
166
+ elif 'float' in string: return string.replace('float', 'f')
167
+ elif 'int' in string: return string.replace('int', 'i')
168
+ elif string == 'object': return 'o'
169
+ return string
170
+
171
+
172
+ def dtypemat(dty):
173
+ from numpy import matrix, ndarray
174
+ from scipy.sparse import csr_array, csr_matrix, csc_array, csc_matrix, coo_array, coo_matrix
175
+ from pandas import DataFrame
176
+
177
+ classdef = ''
178
+ if isinstance(dty, DataFrame): return 'df'
179
+ elif isinstance(dty, matrix): classdef = 'dense'
180
+ elif isinstance(dty, ndarray): classdef = 'arr'
181
+ elif isinstance(dty, csr_array): classdef = 'csra'
182
+ elif isinstance(dty, csr_matrix): classdef = 'csr'
183
+ elif isinstance(dty, csc_array): classdef = 'csca'
184
+ elif isinstance(dty, csc_matrix): classdef = 'csc'
185
+ elif isinstance(dty, coo_array): classdef = 'cooa'
186
+ elif isinstance(dty, coo_matrix): classdef = 'coo'
187
+ else: classdef = str(type(dty))
188
+
189
+ size = ''
190
+ try:
191
+ if dty.shape[1] != dty.shape[0]: size = dty.shape[1]
192
+ except: pass
193
+
194
+ ret = ':'.join([classdef, dtypestr(dty.dtype)])
195
+ if size != '': ret += f'({size})'
196
+ return ret
197
+
198
+
199
+ def remove_ansi_escape_sequences(text):
200
+ ansi_escape = re.compile(r'\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])')
201
+ return ansi_escape.sub('', text)
202
+
203
+
204
+ def lenp(string: str):
205
+ return len(remove_ansi_escape_sequences(string))
206
+
207
+
208
+ def wrap(array: list[str], sep = ' ', n = 100) -> list[str]:
209
+ results = []
210
+ cumulative = ''
211
+ lencum = 0
212
+
213
+ for a in array:
214
+
215
+ lenprint = lenp(a)
216
+
217
+ if lencum + lenprint + len(sep) <= n:
218
+ cumulative += (sep + a)
219
+ lencum += (len(sep) + lenprint)
220
+ else:
221
+ results += [cumulative[1:] if cumulative[0] == ' ' else cumulative]
222
+ cumulative = a
223
+ lencum = lenprint
224
+
225
+ if cumulative != '':
226
+ results += [cumulative[1:] if cumulative[0] == ' ' else cumulative]
227
+
228
+ return results
229
+
230
+
163
231
  progress_styles = {
164
232
  'ncols': 80,
165
233
  'ascii': '-━',
@@ -175,4 +243,9 @@ class pprog(tqdm):
175
243
 
176
244
  class pproga(tqdma):
177
245
  def __init__(self, iterable = None, **kwargs):
178
- super().__init__(iterable, **progress_styles, **kwargs)
246
+ super().__init__(iterable, **progress_styles, **kwargs)
247
+
248
+
249
+ def tqinfo(x):
250
+ if SILENT: return
251
+ tqdm.write(cyan('[i] ') + x)
@@ -21,6 +21,13 @@ from exprmat.preprocessing.linear import get_size_factor_for_regions, normalize_
21
21
  from exprmat.ansi import error, warning, info
22
22
 
23
23
 
24
+ methods = {
25
+ 'mean': np.mean,
26
+ 'sum': np.sum,
27
+ 'median': np.median
28
+ }
29
+
30
+
24
31
  def aggregate(
25
32
  adata, data = 'X', method = 'mean', method_args = {},
26
33
  obs_key = 'sample', var_key = None
@@ -56,10 +63,6 @@ def aggregate(
56
63
  mat = np.ndarray(shape = (len(obs_val), len(var_val)), dtype = np.float32)
57
64
  meth = None
58
65
 
59
- methods = {
60
- 'mean': np.mean
61
- }
62
-
63
66
  for i in range(len(obs_val)):
64
67
  for j in range(len(var_val)):
65
68
 
@@ -88,10 +91,6 @@ def aggregate_obs(
88
91
 
89
92
  mat = np.ndarray(shape = (len(obs_val), adata.n_vars), dtype = np.float32)
90
93
 
91
- methods = {
92
- 'mean': np.mean
93
- }
94
-
95
94
  for i in range(len(obs_val)):
96
95
  mat[i, :] = methods[method](
97
96
  source[obs == obs_val[i], :],
@@ -120,10 +119,6 @@ def aggregate_var(
120
119
 
121
120
  mat = np.ndarray(shape = (adata.n_obs, len(var_val)), dtype = np.float32)
122
121
 
123
- methods = {
124
- 'mean': np.mean
125
- }
126
-
127
122
  for i in range(len(var_val)):
128
123
  mat[:, i] = methods[method](
129
124
  source[:, var == var_val[i]],
@@ -218,7 +218,7 @@ def opa(
218
218
 
219
219
 
220
220
  def gsva(
221
- adata, taxa, identifier = 'uppercase', gene_sets = 'kegg', lognorm = 'X',
221
+ adata, taxa, identifier = 'entrez', gene_sets = 'kegg', lognorm = 'X',
222
222
  n_cores = 1, kcdf = 'Gaussian', weight = 1, min_genes = 15, max_genes = 1000
223
223
  ):
224
224
  mat = choose_layer(adata, layer = lognorm)
@@ -238,9 +238,12 @@ def gsva(
238
238
  inp = inp.loc[~ inp.index.isna(), :]
239
239
  inp = inp.loc[~ inp.index.duplicated(), :].copy()
240
240
 
241
+ if isinstance(gene_sets, str):
242
+ gene_sets = get_genesets(taxa = taxa, name = gene_sets, identifier = identifier)
243
+
241
244
  import gseapy as gp
242
245
  gsv = gp.gsva(
243
- data = inp, gene_sets = get_genesets(taxa = taxa, name = gene_sets, identifier = identifier),
246
+ data = inp, gene_sets = gene_sets,
244
247
  kcdf = kcdf, weight = weight, min_size = min_genes, max_size = max_genes, seed = 42,
245
248
  threads = n_cores
246
249
  )
@@ -7,7 +7,12 @@ from exprmat.ansi import error, warning, info
7
7
 
8
8
 
9
9
  def not_yet_normalized(X):
10
- return np.allclose(np.ravel(X[:5].data if issparse(X) else X[:5]) % 1, 0, atol=1e-3)
10
+
11
+ # this logic sometimes have bugs.
12
+ # just cancel it for now.
13
+
14
+ return False
15
+ return np.allclose(np.ravel(X[:5].data if issparse(X) else X[:5]) % 1, 0, atol = 1e-3)
11
16
 
12
17
 
13
18
  def moments(
@@ -0,0 +1,158 @@
1
+
2
+ import os
3
+ import torch
4
+ import random
5
+ import argparse
6
+ import matplotlib
7
+ import numpy as np
8
+ import scanpy as sc
9
+ import seaborn as sns
10
+ from matplotlib import rcParams
11
+
12
+ from exprmat import warning, info, error, pprog
13
+ from exprmat.metacell.model import MetaQ
14
+ from exprmat.metacell.engine import train_one_epoch, warm_one_epoch, inference
15
+ from exprmat.metacell.utils import (
16
+ load_data, compute_metacell
17
+ )
18
+
19
+
20
+ def assign_metacell(
21
+ scaleds,
22
+ size_factors,
23
+ counts,
24
+ n_metacell,
25
+ datatypes = ['rna'],
26
+ device = 'cuda',
27
+ random_seed = 42,
28
+ train_epoch = 300,
29
+ adam_learning_rate = 1e-3,
30
+ adam_weight_decay = 1e-2,
31
+ codebook_init = 'random',
32
+ converge_threshold = 10,
33
+ batch_size = 32,
34
+ ):
35
+
36
+ # set random seeds
37
+ random.seed(random_seed)
38
+ np.random.seed(random_seed)
39
+ torch.manual_seed(random_seed)
40
+ torch.random.manual_seed(random_seed)
41
+ if device == "cuda":
42
+ torch.cuda.manual_seed_all(random_seed)
43
+
44
+ device = torch.device(device)
45
+
46
+ dataloader_train, dataloader_eval, input_dims = load_data(
47
+ scaleds, size_factors, counts,
48
+ n_metacells = n_metacell, batch_size = batch_size
49
+ )
50
+
51
+ omics_num = len(scaleds)
52
+
53
+ info(f"target metacell number: {n_metacell}")
54
+
55
+ net = MetaQ(
56
+ input_dims = input_dims,
57
+ data_types = datatypes,
58
+ entry_num = n_metacell,
59
+ ).to(device)
60
+
61
+ optimizer = torch.optim.AdamW(
62
+ net.parameters(),
63
+ lr = adam_learning_rate,
64
+ weight_decay = adam_weight_decay
65
+ )
66
+
67
+ info('training metacell quantization model ...')
68
+
69
+ loss_rec_his = loss_vq_his = 1e7
70
+ stable_epochs = 0
71
+
72
+ if codebook_init == "random":
73
+ warm_epochs = 0
74
+ else:
75
+ # for Kmeans and Geometric initialization
76
+ warm_epochs = min(50, int(train_epoch * 0.2))
77
+
78
+ prog = pprog(range(train_epoch), desc = 'training network')
79
+ for epoch in prog:
80
+
81
+ if epoch < warm_epochs:
82
+ warm_one_epoch(
83
+ model = net,
84
+ data_types = datatypes,
85
+ dataloader = dataloader_train,
86
+ optimizer = optimizer,
87
+ epoch = epoch,
88
+ device = device,
89
+ prog = prog,
90
+ )
91
+
92
+ elif epoch == warm_epochs:
93
+ embeds, ids, _, _, _ = inference(
94
+ model = net,
95
+ data_types = datatypes,
96
+ data_loader = dataloader_eval,
97
+ device = device,
98
+ )
99
+ net.quantizer.init_codebook(embeds, method = codebook_init)
100
+ if omics_num == 1: net.copy_decoder_q()
101
+
102
+ else:
103
+ loss_rec, loss_vq = train_one_epoch(
104
+ model = net,
105
+ data_types = datatypes,
106
+ dataloader = dataloader_train,
107
+ optimizer = optimizer,
108
+ epoch = epoch,
109
+ device = device,
110
+ prog = prog,
111
+ )
112
+
113
+ converge = (abs(loss_vq_his - loss_vq) <= 1e-5) and (
114
+ abs(loss_rec_his - loss_rec) <= 1e-5)
115
+
116
+ if converge:
117
+ stable_epochs += 1
118
+ if stable_epochs >= converge_threshold:
119
+ info(f'early stopping the training process at epoch {epoch}')
120
+ break
121
+
122
+ else:
123
+ stable_epochs = 0
124
+ loss_rec_his = loss_rec
125
+ loss_vq_his = loss_vq
126
+
127
+
128
+ embeds, ids, delta_confs, rec_q_percent, loss_codebook = inference(
129
+ model = net,
130
+ data_types = datatypes,
131
+ data_loader = dataloader_eval,
132
+ device = device
133
+ )
134
+
135
+ info(f"quantized reconstruction: {rec_q_percent:.2f}")
136
+ info(f"delta assignment confidence: {np.mean(delta_confs):.2f}")
137
+ info(f"codebook loss: {loss_codebook:.2f}")
138
+
139
+ assignment = sc.AnnData(embeds.astype('float32'))
140
+ assignment.obs["metacell"] = ids
141
+
142
+ return assignment
143
+
144
+
145
+ def aggregate_metacell(adata_list, assignment):
146
+
147
+ # supply a list of log normalized (X) full matrix.
148
+ # note that the obs order must match that of the initial input.
149
+ # and the previously computed assignment.
150
+
151
+ omics_num = len(adata_list)
152
+ metacells = []
153
+ for i in range(omics_num):
154
+ adata = adata_list[i]
155
+ metacell_adata = compute_metacell(adata, assignment.obs["metacell"].to_numpy())
156
+ metacells.append(metacell_adata)
157
+
158
+ return metacells
@@ -0,0 +1,204 @@
1
+
2
+ import torch
3
+ import numpy as np
4
+ from exprmat.metacell.model import reconstruction_loss
5
+ from exprmat.ansi import tqinfo
6
+
7
+
8
+ def train_one_epoch(
9
+ model,
10
+ data_types,
11
+ dataloader,
12
+ optimizer,
13
+ epoch,
14
+ device,
15
+ prog
16
+ ):
17
+ model.train(True)
18
+ optimizer.zero_grad()
19
+
20
+ omics_num = model.omics_num
21
+
22
+ loss_rec_epoch = [0 for _ in range(omics_num)]
23
+ loss_rec_q_epoch = [0 for _ in range(omics_num)]
24
+ loss_c_epoch = 0
25
+
26
+ for data in dataloader:
27
+ x_list = []
28
+ sf_list = []
29
+ raw_list = []
30
+ for i in range(omics_num):
31
+ x_list.append(data["x"][i].to(device, non_blocking = True))
32
+ sf_list.append(data["sf"][i].to(device, non_blocking = True))
33
+ raw_list.append(data["raw"][i].to(device, non_blocking = True))
34
+
35
+ hiddens = model(x_list)
36
+ hidden_q, loss_c = model.quantize(hiddens)
37
+ means, disps = model.decode(hiddens)
38
+ means_q, disps_q = model.decode_q(hidden_q)
39
+
40
+ loss_rec_all = 0
41
+ loss_rec_q_all = 0
42
+
43
+ for i in range(omics_num):
44
+ loss_rec = reconstruction_loss(
45
+ means[i], disps[i], sf_list[i], raw_list[i], data_types[i])
46
+ loss_rec_q = reconstruction_loss(
47
+ means_q[i], disps_q[i], sf_list[i], raw_list[i], data_types[i])
48
+ loss_rec_all += loss_rec
49
+ loss_rec_q_all += loss_rec_q
50
+ loss_rec_epoch[i] += loss_rec.item()
51
+ loss_rec_q_epoch[i] += loss_rec_q.item()
52
+
53
+ loss_c_epoch += loss_c.item()
54
+ loss = loss_rec_all + loss_rec_q_all + loss_c
55
+
56
+ loss.backward()
57
+ optimizer.step()
58
+ optimizer.zero_grad()
59
+
60
+ # if (epoch + 1) % 20 == 0 or epoch == 0:
61
+ # for i in range(omics_num):
62
+ # prog.write(
63
+ # f'(epoch {epoch + 1}) [{data_types[i]}] ' +
64
+ # f'loss-rec: {(loss_rec_epoch[i] / len(dataloader)):.4f}, ' +
65
+ # f'loss-rec-q: {(loss_rec_q_epoch[i] / len(dataloader)):.4f}'
66
+ # )
67
+ #
68
+ # prog.write(
69
+ # f'(epoch {epoch + 1}) [codebook]: ' +
70
+ # f'loss: {(loss_c / len(dataloader)):.4f}'
71
+ # )
72
+
73
+ loss_rec_q_epoch = np.array(loss_rec_q_epoch).mean() / len(dataloader)
74
+ loss_c_epoch = loss_c / len(dataloader)
75
+
76
+ return loss_rec_q_epoch, loss_c_epoch
77
+
78
+
79
+ def warm_one_epoch(
80
+ model,
81
+ data_types,
82
+ dataloader,
83
+ optimizer,
84
+ epoch,
85
+ device,
86
+ prog
87
+ ):
88
+ model.train(True)
89
+ optimizer.zero_grad()
90
+
91
+ omics_num = model.omics_num
92
+
93
+ loss_rec_epoch = [0 for _ in range(omics_num)]
94
+
95
+ for data in dataloader:
96
+ x_list = []
97
+ sf_list = []
98
+ raw_list = []
99
+ for i in range(omics_num):
100
+ x_list.append(data["x"][i].to(device, non_blocking=True))
101
+ sf_list.append(data["sf"][i].to(device, non_blocking=True))
102
+ raw_list.append(data["raw"][i].to(device, non_blocking=True))
103
+
104
+ hiddens = model(x_list)
105
+ means, disps = model.decode(hiddens)
106
+
107
+ loss_rec_all = 0
108
+ for i in range(omics_num):
109
+ loss_rec = reconstruction_loss(
110
+ means[i], disps[i], sf_list[i], raw_list[i], data_types[i]
111
+ )
112
+ loss_rec_all += loss_rec
113
+ loss_rec_epoch[i] += loss_rec.item()
114
+
115
+ loss = loss_rec_all
116
+
117
+ loss.backward()
118
+ optimizer.step()
119
+ optimizer.zero_grad()
120
+
121
+ # if (epoch + 1) % 20 == 0 or epoch == 0:
122
+ # for i in range(omics_num):
123
+ # prog.write(
124
+ # f'(epoch {epoch + 1}) [{data_types[i]}] ' +
125
+ # f'loss: {(loss_rec_epoch[i] / len(dataloader)):.4f}'
126
+ # )
127
+
128
+ loss_rec_epoch = np.array(loss_rec_epoch).mean() / len(dataloader)
129
+
130
+ return loss_rec_epoch
131
+
132
+
133
+ @torch.no_grad()
134
+ def inference(model, data_types, data_loader, device):
135
+
136
+ model.eval()
137
+ omics_num = model.omics_num
138
+
139
+ embeds = []
140
+ ids = []
141
+ delta_confs = []
142
+ loss_rec_all = 0
143
+ loss_rec_q_all = 0
144
+ loss_c_all = 0
145
+
146
+ for data in data_loader:
147
+ x_list = []
148
+ sf_list = []
149
+ raw_list = []
150
+ for i in range(omics_num):
151
+ x_list.append(data["x"][i].to(device, non_blocking=True))
152
+ sf_list.append(data["sf"][i].to(device, non_blocking=True))
153
+ raw_list.append(data["raw"][i].to(device, non_blocking=True))
154
+
155
+ with torch.no_grad():
156
+ hiddens = model(x_list)
157
+
158
+ id, delta_conf, loss_c = model.quantize(hiddens, return_assignment=True)
159
+ loss_c_all += loss_c
160
+
161
+ hidden_q, _ = model.quantize(hiddens)
162
+ means, disps = model.decode(hiddens)
163
+ means_q, disps_q = model.decode_q(hidden_q)
164
+
165
+ for i in range(omics_num):
166
+
167
+ loss_rec = reconstruction_loss(
168
+ means[i],
169
+ disps[i],
170
+ sf_list[i],
171
+ raw_list[i],
172
+ data_types[i],
173
+ reduction = "sum",
174
+ )
175
+
176
+ loss_rec_all += loss_rec
177
+ loss_rec_q = reconstruction_loss(
178
+ means_q[i],
179
+ disps_q[i],
180
+ sf_list[i],
181
+ raw_list[i],
182
+ data_types[i],
183
+ reduction = "sum",
184
+ )
185
+
186
+ loss_rec_q_all += loss_rec_q
187
+
188
+ if omics_num > 1: hidden = torch.cat(hiddens, dim=1)
189
+ else: hidden = hiddens[0]
190
+
191
+ embeds.append(hidden.detach().cpu().numpy())
192
+ ids.append(id.detach().cpu().numpy())
193
+ delta_confs.append(delta_conf.detach().cpu().numpy())
194
+
195
+ embeds = np.concatenate(embeds, axis=0)
196
+ ids = np.concatenate(ids, axis=0)
197
+ delta_confs = np.concatenate(delta_confs, axis=0)
198
+
199
+ rec_q_percent = (loss_rec_all / loss_rec_q_all).item()
200
+ loss_c_all = loss_c_all.item() / (
201
+ data_loader.dataset.__len__() * model.quantizer.entry_dim
202
+ )
203
+
204
+ return embeds, ids, delta_confs, rec_q_percent, loss_c_all