exprmat 0.1.37__tar.gz → 0.1.39__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 (220) hide show
  1. {exprmat-0.1.37 → exprmat-0.1.39}/PKG-INFO +4 -3
  2. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/__init__.py +38 -5
  3. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/ansi.py +14 -0
  4. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/cnv/infercnv.py +10 -11
  5. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/configuration.py +6 -3
  6. exprmat-0.1.39/exprmat/data/cre.py +111 -0
  7. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/data/finders.py +15 -9
  8. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/data/geneset.py +3 -3
  9. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/data/presets.py +36 -1
  10. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/descriptive/aucell.py +2 -2
  11. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/dynamics/parallel.py +7 -23
  12. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/grn/infergrn.py +3 -4
  13. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/lr/utils.py +2 -3
  14. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/peaks/callpeak.py +131 -19
  15. exprmat-0.1.39/exprmat/peaks/coverage.py +159 -0
  16. exprmat-0.1.39/exprmat/peaks/footprint.py +152 -0
  17. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/peaks/idr/idr.py +0 -169
  18. exprmat-0.1.39/exprmat/peaks/linkage.py +534 -0
  19. exprmat-0.1.39/exprmat/peaks/motif.py +475 -0
  20. exprmat-0.1.39/exprmat/peaks/sequence.py +49 -0
  21. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/plotting/track.py +187 -16
  22. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/plotting/utils.py +19 -7
  23. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/preprocessing/linear.py +2 -4
  24. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/preprocessing/qc.py +1 -1
  25. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/preprocessing/sctransform/estimate.py +2 -2
  26. exprmat-0.1.39/exprmat/reader/conversions.py +85 -0
  27. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/reader/experiment.py +288 -74
  28. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/reader/matcher.py +6 -3
  29. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/reader/spatial.py +2 -2
  30. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/reader/static.py +144 -24
  31. exprmat-0.1.39/exprmat/reader/updater.py +83 -0
  32. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/reduction/plot.py +4 -4
  33. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/reduction/spectral.py +2 -3
  34. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/utils.py +9 -10
  35. {exprmat-0.1.37 → exprmat-0.1.39}/pyproject.toml +5 -4
  36. {exprmat-0.1.37 → exprmat-0.1.39}/snapatac2-core/src/feature_count/mod.rs +3 -3
  37. {exprmat-0.1.37 → exprmat-0.1.39}/snapatac2-core/src/genome.rs +2 -2
  38. {exprmat-0.1.37 → exprmat-0.1.39}/snapatac2-core/src/preprocessing/import.rs +2 -2
  39. exprmat-0.1.37/exprmat/data/delim.py +0 -89
  40. exprmat-0.1.37/exprmat/data/gff.py +0 -162
  41. exprmat-0.1.37/exprmat/data/private.py +0 -70
  42. exprmat-0.1.37/exprmat/data/ranges.py +0 -164
  43. exprmat-0.1.37/exprmat/peaks/sequence.py +0 -29
  44. {exprmat-0.1.37 → exprmat-0.1.39}/Cargo.lock +0 -0
  45. {exprmat-0.1.37 → exprmat-0.1.39}/Cargo.toml +0 -0
  46. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/clustering/__init__.py +0 -0
  47. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/clustering/cnmf.py +0 -0
  48. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/clustering/dbscan.py +0 -0
  49. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/clustering/kmeans.py +0 -0
  50. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/clustering/leiden.py +0 -0
  51. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/clustering/nmf.py +0 -0
  52. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/clustering/rogue.py +0 -0
  53. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/clustering/seriation.py +0 -0
  54. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/clustering/spectral.py +0 -0
  55. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/clustering/utils.py +0 -0
  56. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/cnv/__init__.py +0 -0
  57. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/cnv/cnvscore.py +0 -0
  58. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/data/__init__.py +0 -0
  59. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/data/cistarget.py +0 -0
  60. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/data/io.py +0 -0
  61. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/data/lr.py +0 -0
  62. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/data/signature.py +0 -0
  63. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/data/tf.py +0 -0
  64. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/descriptive/__init__.py +0 -0
  65. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/descriptive/aggregate.py +0 -0
  66. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/descriptive/atac.py +0 -0
  67. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/descriptive/de.py +0 -0
  68. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/descriptive/gse.py +0 -0
  69. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/descriptive/kde.py +0 -0
  70. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/descriptive/recovery.py +0 -0
  71. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/descriptive/summary.py +0 -0
  72. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/descriptive/tcr.py +0 -0
  73. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/deseq/dataset.py +0 -0
  74. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/deseq/gridsearch.py +0 -0
  75. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/deseq/inference.py +0 -0
  76. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/deseq/preprocessing.py +0 -0
  77. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/deseq/stats.py +0 -0
  78. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/deseq/utils.py +0 -0
  79. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/dynamics/__init__.py +0 -0
  80. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/dynamics/generank.py +0 -0
  81. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/dynamics/linreg.py +0 -0
  82. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/dynamics/moments.py +0 -0
  83. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/dynamics/optimization.py +0 -0
  84. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/dynamics/preprocess.py +0 -0
  85. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/dynamics/pseudotime.py +0 -0
  86. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/dynamics/transition.py +0 -0
  87. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/dynamics/utils.py +0 -0
  88. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/dynamics/velocity.py +0 -0
  89. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/grn/__init__.py +0 -0
  90. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/grn/modules.py +0 -0
  91. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/grn/prune.py +0 -0
  92. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/grn/regressors.py +0 -0
  93. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/grn/utils.py +0 -0
  94. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/image/__init__.py +0 -0
  95. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/image/align.py +0 -0
  96. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/lr/__init__.py +0 -0
  97. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/lr/aggregate.py +0 -0
  98. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/lr/method.py +0 -0
  99. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/lr/methods/__init__.py +0 -0
  100. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/lr/methods/cellchat.py +0 -0
  101. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/lr/methods/cellphonedb.py +0 -0
  102. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/lr/methods/connectome.py +0 -0
  103. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/lr/methods/geomean.py +0 -0
  104. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/lr/methods/logfc.py +0 -0
  105. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/lr/methods/natmi.py +0 -0
  106. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/lr/methods/rank_aggregate.py +0 -0
  107. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/lr/methods/scseqcomm.py +0 -0
  108. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/lr/methods/singlecellsignalr.py +0 -0
  109. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/lr/pipeline.py +0 -0
  110. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/lr/preprocess.py +0 -0
  111. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/lr/resources.py +0 -0
  112. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/peaks/__init__.py +0 -0
  113. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/peaks/idr/__init__.py +0 -0
  114. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/peaks/idr/constants.py +0 -0
  115. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/peaks/idr/invcdf.pyx +0 -0
  116. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/peaks/idr/optimization.py +0 -0
  117. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/peaks/idr/utils.py +0 -0
  118. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/plotting/__init__.py +0 -0
  119. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/plotting/atac.py +0 -0
  120. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/plotting/cnmf.py +0 -0
  121. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/plotting/cnv.py +0 -0
  122. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/plotting/data/A.pk +0 -0
  123. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/plotting/data/B.pk +0 -0
  124. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/plotting/data/C.pk +0 -0
  125. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/plotting/data/D.pk +0 -0
  126. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/plotting/data/E.pk +0 -0
  127. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/plotting/data/F.pk +0 -0
  128. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/plotting/data/G.pk +0 -0
  129. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/plotting/data/H.pk +0 -0
  130. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/plotting/data/I.pk +0 -0
  131. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/plotting/data/J.pk +0 -0
  132. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/plotting/data/K.pk +0 -0
  133. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/plotting/data/L.pk +0 -0
  134. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/plotting/data/M.pk +0 -0
  135. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/plotting/data/N.pk +0 -0
  136. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/plotting/data/O.pk +0 -0
  137. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/plotting/data/P.pk +0 -0
  138. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/plotting/data/Q.pk +0 -0
  139. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/plotting/data/R.pk +0 -0
  140. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/plotting/data/S.pk +0 -0
  141. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/plotting/data/T.pk +0 -0
  142. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/plotting/data/U.pk +0 -0
  143. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/plotting/data/V.pk +0 -0
  144. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/plotting/data/W.pk +0 -0
  145. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/plotting/data/X.pk +0 -0
  146. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/plotting/data/Y.pk +0 -0
  147. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/plotting/data/Z.pk +0 -0
  148. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/plotting/de.py +0 -0
  149. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/plotting/expression.py +0 -0
  150. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/plotting/gse.py +0 -0
  151. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/plotting/lr.py +0 -0
  152. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/plotting/palettes.py +0 -0
  153. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/plotting/sankey.py +0 -0
  154. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/plotting/sequence.py +0 -0
  155. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/plotting/summary.py +0 -0
  156. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/plotting/velocity.py +0 -0
  157. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/preprocessing/__init__.py +0 -0
  158. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/preprocessing/doublets/__init__.py +0 -0
  159. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/preprocessing/doublets/composite.py +0 -0
  160. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/preprocessing/doublets/scrublet.py +0 -0
  161. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/preprocessing/emptydrops.py +0 -0
  162. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/preprocessing/filter.py +0 -0
  163. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/preprocessing/impute/__init__.py +0 -0
  164. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/preprocessing/impute/magic.py +0 -0
  165. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/preprocessing/integrate.py +0 -0
  166. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/preprocessing/normal.py +0 -0
  167. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/preprocessing/plot.py +0 -0
  168. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/preprocessing/sctransform/__init__.py +0 -0
  169. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/preprocessing/sctransform/ksmooth.py +0 -0
  170. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/preprocessing/sctransform/residual.py +0 -0
  171. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/preprocessing/sctransform/transform.py +0 -0
  172. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/preprocessing/sparse.py +0 -0
  173. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/preprocessing/uniform.py +0 -0
  174. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/reader/__init__.py +0 -0
  175. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/reader/metadata.py +0 -0
  176. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/reader/peaks.py +0 -0
  177. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/reduction/__init__.py +0 -0
  178. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/reduction/forceatlas.py +0 -0
  179. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/reduction/mde.py +0 -0
  180. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/reduction/nn.py +0 -0
  181. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/reduction/outliers.py +0 -0
  182. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/reduction/pca.py +0 -0
  183. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/reduction/tsne.py +0 -0
  184. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/reduction/umap.py +0 -0
  185. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/trajectory/pcurve.py +0 -0
  186. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/transfer/__init__.py +0 -0
  187. {exprmat-0.1.37 → exprmat-0.1.39}/exprmat/transfer/atlas.py +0 -0
  188. {exprmat-0.1.37 → exprmat-0.1.39}/license +0 -0
  189. {exprmat-0.1.37 → exprmat-0.1.39}/readme.md +0 -0
  190. {exprmat-0.1.37 → exprmat-0.1.39}/snapatac2/Cargo.toml +0 -0
  191. {exprmat-0.1.37 → exprmat-0.1.39}/snapatac2/license +0 -0
  192. {exprmat-0.1.37 → exprmat-0.1.39}/snapatac2/readme +0 -0
  193. {exprmat-0.1.37 → exprmat-0.1.39}/snapatac2/src/call_peaks.rs +0 -0
  194. {exprmat-0.1.37 → exprmat-0.1.39}/snapatac2/src/embedding.rs +0 -0
  195. {exprmat-0.1.37 → exprmat-0.1.39}/snapatac2/src/export.rs +0 -0
  196. {exprmat-0.1.37 → exprmat-0.1.39}/snapatac2/src/knn.rs +0 -0
  197. {exprmat-0.1.37 → exprmat-0.1.39}/snapatac2/src/lib.rs +0 -0
  198. {exprmat-0.1.37 → exprmat-0.1.39}/snapatac2/src/motif.rs +0 -0
  199. {exprmat-0.1.37 → exprmat-0.1.39}/snapatac2/src/network.rs +0 -0
  200. {exprmat-0.1.37 → exprmat-0.1.39}/snapatac2/src/preprocessing.rs +0 -0
  201. {exprmat-0.1.37 → exprmat-0.1.39}/snapatac2/src/utils/anndata.rs +0 -0
  202. {exprmat-0.1.37 → exprmat-0.1.39}/snapatac2/src/utils.rs +0 -0
  203. {exprmat-0.1.37 → exprmat-0.1.39}/snapatac2-core/Cargo.toml +0 -0
  204. {exprmat-0.1.37 → exprmat-0.1.39}/snapatac2-core/src/embedding.rs +0 -0
  205. {exprmat-0.1.37 → exprmat-0.1.39}/snapatac2-core/src/export.rs +0 -0
  206. {exprmat-0.1.37 → exprmat-0.1.39}/snapatac2-core/src/feature_count/counter.rs +0 -0
  207. {exprmat-0.1.37 → exprmat-0.1.39}/snapatac2-core/src/feature_count/data_iter.rs +0 -0
  208. {exprmat-0.1.37 → exprmat-0.1.39}/snapatac2-core/src/feature_count/matrix.rs +0 -0
  209. {exprmat-0.1.37 → exprmat-0.1.39}/snapatac2-core/src/lib.rs +0 -0
  210. {exprmat-0.1.37 → exprmat-0.1.39}/snapatac2-core/src/motif.rs +0 -0
  211. {exprmat-0.1.37 → exprmat-0.1.39}/snapatac2-core/src/network.rs +0 -0
  212. {exprmat-0.1.37 → exprmat-0.1.39}/snapatac2-core/src/preprocessing/bam/flagstat.rs +0 -0
  213. {exprmat-0.1.37 → exprmat-0.1.39}/snapatac2-core/src/preprocessing/bam/header.rs +0 -0
  214. {exprmat-0.1.37 → exprmat-0.1.39}/snapatac2-core/src/preprocessing/bam/mark_duplicates.rs +0 -0
  215. {exprmat-0.1.37 → exprmat-0.1.39}/snapatac2-core/src/preprocessing/bam.rs +0 -0
  216. {exprmat-0.1.37 → exprmat-0.1.39}/snapatac2-core/src/preprocessing/mod.rs +0 -0
  217. {exprmat-0.1.37 → exprmat-0.1.39}/snapatac2-core/src/preprocessing/qc.rs +0 -0
  218. {exprmat-0.1.37 → exprmat-0.1.39}/snapatac2-core/src/utils/knn.rs +0 -0
  219. {exprmat-0.1.37 → exprmat-0.1.39}/snapatac2-core/src/utils/mod.rs +0 -0
  220. {exprmat-0.1.37 → exprmat-0.1.39}/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.37
3
+ Version: 0.1.39
4
4
  Classifier: Programming Language :: Rust
5
5
  Classifier: Programming Language :: Python :: Implementation :: CPython
6
6
  Classifier: Programming Language :: Python :: Implementation :: PyPy
@@ -42,7 +42,6 @@ Requires-Dist: metacells
42
42
  Requires-Dist: sh
43
43
  Requires-Dist: networkx
44
44
  Requires-Dist: palantir
45
- Requires-Dist: rich
46
45
  Requires-Dist: adjusttext
47
46
  Requires-Dist: h5py
48
47
  Requires-Dist: cytoolz
@@ -55,7 +54,6 @@ Requires-Dist: hdbscan
55
54
  Requires-Dist: graphtools
56
55
  Requires-Dist: bincsync>=0.3.0
57
56
  Requires-Dist: pybigwig
58
- Requires-Dist: pybedgraph
59
57
  Requires-Dist: loompy
60
58
  Requires-Dist: squidpy
61
59
  Requires-Dist: zarr
@@ -75,6 +73,9 @@ Requires-Dist: formulaic>=1.0.2
75
73
  Requires-Dist: formulaic-contrasts>=0.2.0
76
74
  Requires-Dist: cython
77
75
  Requires-Dist: pyfastx
76
+ Requires-Dist: genomicranges
77
+ Requires-Dist: rustworkx
78
+ Requires-Dist: xgboost
78
79
  Requires-Dist: sphinx ; extra == 'dev'
79
80
  Requires-Dist: twine ; extra == 'dev'
80
81
  Requires-Dist: ipykernel ; extra == 'dev'
@@ -1,10 +1,19 @@
1
1
 
2
+ # the file specification, defined as the earlieast version to handle
3
+ # current file standard. (revision number). specification versions are not
4
+ # continuous. historically taken [1, 39]
5
+
6
+ SPECIFICATION = 39
7
+
8
+ import importlib.metadata
9
+ ver_string = importlib.metadata.version("exprmat")
10
+ MAJOR, MINOR, REVISION = [int(x) for x in ver_string.split('.')]
11
+
2
12
  import os
3
13
  os.environ['OPENBLAS_NUM_THREADS'] = '1'
4
14
  os.environ['GOTO_NUM_THREADS'] = '1'
5
15
  os.environ['OMP_NUM_THREADS'] = '1'
6
16
 
7
- import importlib.metadata
8
17
  import mudata as mu
9
18
  import anndata as ad
10
19
  import scanpy as sc
@@ -100,6 +109,7 @@ basepath = config['data']
100
109
  from exprmat.utils import setup_styles
101
110
  from exprmat.reader.experiment import experiment, load_experiment
102
111
  from exprmat.reader.metadata import metadata, load_metadata
112
+ from exprmat.ansi import error, warning, info, pprog, pproga
103
113
 
104
114
  setup_styles()
105
115
 
@@ -128,16 +138,33 @@ if PERFORM_DATABASE_CHECK:
128
138
  warning(f'db version: {db_ver} package version: {importlib.metadata.version("exprmat")}')
129
139
 
130
140
 
141
+ def cuda():
142
+
143
+ import torch
144
+ info(f'PyTorch version: {torch.__version__}')
145
+ info(f'GPU acceleration availability: {"YES" if torch.cuda.is_available() else "NO"}')
146
+ if torch.cuda.is_available():
147
+ info(f'CUDA version: {torch.version.cuda}')
148
+ info(f'Number of installed GPUs: {torch.cuda.device_count()}')
149
+ info(f'Supporting BF16 format: {"YES" if torch.cuda.is_bf16_supported() else "NO"}')
150
+ info(f'Devices:')
151
+ for i in range(torch.cuda.device_count()):
152
+ total_mem = torch.cuda.get_device_properties(i).total_memory / 1024 / 1024 / 1024
153
+ dedicated_mem = torch.cuda.memory_allocated(i) / 1024 / 1024 / 1024
154
+ info(f'[{i}] {torch.cuda.get_device_name(i)} {"*" if torch.cuda.current_device() == i else ""}')
155
+ info(f' CUDA capability: {torch.cuda.get_device_capability(i)}')
156
+ info(f' Installed VRAM (GiB): {total_mem:.2f} GiB')
157
+ info(f' Supporting TensorCore: {"YES" if torch.cuda.get_device_properties(0).major >= 7 else "NO"}')
158
+ info(f' Current dedicated memory: {dedicated_mem:.2f} / {total_mem:.2f} GiB ({100 * dedicated_mem / total_mem:.1f}%)')
159
+
160
+
131
161
  def version():
132
162
  import os
133
163
  import sys
134
164
  import platform
135
165
  from exprmat.ansi import info, error, format_file_size
136
166
 
137
- ver_string = importlib.metadata.version("exprmat")
138
167
  db_ver = version_db()
139
-
140
- MAJOR, MINOR, REVISION = [int(x) for x in ver_string.split('.')]
141
168
  info(f'exprmat {MAJOR}.{MINOR}.{REVISION} / exprmat-db {db_ver if db_ver is not None else "(Not installed)"}')
142
169
  info(f'os: {os.name} ({sys.platform}) platform version: {platform.release()}')
143
170
  info(f'loaded configuration from {finder}')
@@ -170,6 +197,12 @@ __all__ = [
170
197
  'load_metadata',
171
198
  'version',
172
199
  'memory',
200
+ 'cuda',
173
201
  'setwd',
174
- 'getwd'
202
+ 'getwd',
203
+ 'error',
204
+ 'warning',
205
+ 'info',
206
+ 'pprog',
207
+ 'pproga'
175
208
  ]
@@ -2,6 +2,10 @@
2
2
  import re
3
3
  import os
4
4
 
5
+ from functools import partial
6
+ from tqdm import tqdm
7
+ from tqdm.auto import tqdm as tqdma
8
+
5
9
 
6
10
  def fore_black() -> None:
7
11
  print('\033[30m', end = '')
@@ -147,3 +151,13 @@ def yellow(x): return '\033[33m' + x + '\033[0m'
147
151
  def blue(x): return '\033[34m' + x + '\033[0m'
148
152
  def purple(x): return '\033[35m' + x + '\033[0m'
149
153
  def cyan(x): return '\033[36m' + x + '\033[0m'
154
+
155
+
156
+ progress_styles = {
157
+ 'ncols': 80,
158
+ 'ascii': '-━',
159
+ 'bar_format': ' {bar} {desc:20} {n:5d} / {total:<5d} ({elapsed} < {remaining})'
160
+ }
161
+
162
+ pprog = partial(tqdm, **progress_styles)
163
+ pproga = partial(tqdma, **progress_styles)
@@ -10,10 +10,9 @@ import scipy.ndimage
10
10
  import scipy.sparse
11
11
  from anndata import AnnData
12
12
  from scanpy import logging
13
- from tqdm.auto import tqdm
14
13
  from tqdm.contrib.concurrent import process_map
15
14
 
16
- from exprmat.ansi import error, warning, info
15
+ from exprmat.ansi import error, warning, info, pproga
17
16
  from exprmat.utils import ensure_array
18
17
 
19
18
 
@@ -80,7 +79,7 @@ def infercnv(
80
79
  exclude_chromosomes
81
80
  List of chromosomes to exclude. The default is to exclude genosomes.
82
81
  For list of all available chromosomes in the dataset, you should manually check
83
- the adata.var['.seqid'] column, when you are not using the pre-built genome annotations.
82
+ the adata.var['chr'] column, when you are not using the pre-built genome annotations.
84
83
 
85
84
  chunksize
86
85
  Process dataset in chunks of cells. This allows to run infercnv on
@@ -113,16 +112,16 @@ def infercnv(
113
112
 
114
113
  if not adata.var_names.is_unique:
115
114
  error('ensure your var_names are unique.')
116
- if {'.seqid', '.start', '.end'} - set(adata.var.columns) != set():
117
- warning('ensure your var table contains ".seqid", ".start", and ".end"')
115
+ if {'chr', 'start', 'end'} - set(adata.var.columns) != set():
116
+ warning('ensure your var table contains "chr", "start", and "end"')
118
117
  warning('this should be automatically queried for you if you specify a legal taxa name.')
119
118
  error('otherwise, you should parse the gff and configure these information yourself.')
120
119
 
121
- var_mask = adata.var['.seqid'].isnull()
120
+ var_mask = adata.var['chr'].isnull()
122
121
  if np.sum(var_mask):
123
122
  warning(f'skipped {np.sum(var_mask)} genes because they don\'t have a genomic position annotated.') # type: ignore
124
123
  if exclude_chromosomes is not None:
125
- var_mask = var_mask | adata.var['.seqid'].isin(exclude_chromosomes)
124
+ var_mask = var_mask | adata.var['chr'].isin(exclude_chromosomes)
126
125
 
127
126
  valid_annot_adata = adata[:, ~ var_mask]
128
127
  reference = get_reference_cells(adata, reference_key, reference_cat, reference)[:, ~ var_mask]
@@ -131,7 +130,7 @@ def infercnv(
131
130
  if scipy.sparse.issparse(expr):
132
131
  expr = expr.tocsr()
133
132
 
134
- var = valid_annot_adata.var.loc[:, ['.seqid', '.start', '.end']]
133
+ var = valid_annot_adata.var.loc[:, ['chr', 'start', 'end']]
135
134
  chr_pos, chunks, convolved_dfs = zip(
136
135
  *process_map(
137
136
  infercnv_proc,
@@ -143,7 +142,7 @@ def infercnv(
143
142
  itertools.repeat(step),
144
143
  itertools.repeat(dynamic_threshold),
145
144
  itertools.repeat(calculate_gene_values),
146
- tqdm_class=tqdm,
145
+ tqdm_class = pproga,
147
146
  max_workers=cpu_count() if n_jobs is None else n_jobs,
148
147
  ),
149
148
  strict=False,
@@ -341,7 +340,7 @@ def running_mean_by_chr(
341
340
  and genomic position. This is a row in the plotted chromosome CNV matrix.
342
341
  '''
343
342
 
344
- chromosomes = natural_sort([x for x in var['.seqid'].unique() if x != 'MT'])
343
+ chromosomes = natural_sort([x for x in var['chr'].unique() if x != 'MT'])
345
344
  running_means = [
346
345
  running_mean_chr(
347
346
  chr, expr, var, window_size, step, calculate_gene_values
@@ -361,7 +360,7 @@ def running_mean_by_chr(
361
360
 
362
361
  def running_mean_chr(chr, expr, var, window_size, step, calculate_gene_values):
363
362
 
364
- genes = var.loc[var['.seqid'] == chr].sort_values('.start').index.values
363
+ genes = var.loc[var['chr'] == chr].sort_values('start').index.values
365
364
  tmp_x = expr[:, var.index.get_indexer(genes)]
366
365
  x_conv, convolved_gene_values = running_mean(
367
366
  tmp_x, n = window_size, step = step,
@@ -24,18 +24,21 @@ class Configuration:
24
24
  # target taxa
25
25
 
26
26
  self.config['taxa.reference'] = {
27
- 'mm10': 'mmu', # alias of grcm38
27
+ 'mm10': 'mmu', # the slightly modified version from ucsc based on grcm38
28
28
  'grcm39': 'mmu',
29
29
  'grcm38': 'mmu',
30
30
 
31
- 'hg19': 'hsa', # alias of grch37
31
+ 'hg19': 'hsa', # the slightly modified version from ucsc based on grch37
32
32
  'grch37': 'hsa',
33
33
  'grch38': 'hsa',
34
+
35
+ 'dm6': 'dme'
34
36
  }
35
37
 
36
38
  self.config['default.assembly'] = {
37
39
  'mmu': 'grcm39',
38
- 'hsa': 'grch38'
40
+ 'hsa': 'grch38',
41
+ 'dme': 'dm6'
39
42
  }
40
43
 
41
44
  self.config['max.image'] = int(10000 * 50000)
@@ -0,0 +1,111 @@
1
+
2
+ import os
3
+ import pandas as pd
4
+ import pickle
5
+ import numpy as np
6
+ import lightmotif
7
+
8
+ from exprmat.data.finders import basepath
9
+ from exprmat.ansi import error, warning, info
10
+
11
+ with open(os.path.join(basepath, 'shared', 'motifs.pkl'), 'rb') as f:
12
+ motif_tree = pickle.load(f)
13
+
14
+ pssm_table = {}
15
+ transcription_factor_bindings = {}
16
+ motif_subsets = {}
17
+
18
+
19
+ def get_motifs(subset = 'all'):
20
+ if subset == 'all': return motif_tree
21
+ elif subset in motif_subsets.keys(): return motif_subsets[subset]
22
+ else:
23
+ subtree = {}
24
+ for key in motif_tree.keys():
25
+ items = {}
26
+ for mot in motif_tree[key].keys():
27
+ if motif_tree[key][mot]['source'] == subset:
28
+ items[mot] = motif_tree[key][mot]
29
+ subtree[key] = items
30
+ motif_subsets[subset] = subtree
31
+ return motif_subsets[subset]
32
+
33
+
34
+ def get_transcription_factor_binding_motifs(taxa):
35
+
36
+ if not taxa in transcription_factor_bindings.keys():
37
+ transcription_factor_bindings[taxa] = \
38
+ pd.read_feather(os.path.join(basepath, taxa, 'tf', 'transcription-factors.feather'))
39
+
40
+ return transcription_factor_bindings[taxa]
41
+
42
+
43
+ def search_transcription_factor(taxa, factor, subset = 'all'):
44
+
45
+ tfbindings = get_transcription_factor_binding_motifs(taxa)
46
+ if factor in tfbindings['symbol'].tolist():
47
+ row = tfbindings['symbol'].tolist().index(factor)
48
+ row = tfbindings.iloc[row, :].copy()
49
+ metaclust = row['metacluster'].split(' ')
50
+ motifs = row['motif'].split(' ')
51
+
52
+ table = get_motifs(subset)
53
+ pairs = []
54
+ for mc in metaclust:
55
+ for mot in motifs:
56
+ if mot in table[mc].keys():
57
+ pairs.append((mc, mot))
58
+
59
+ return pairs
60
+
61
+ else: error(f'could not find transcription factor {factor} in taxa {taxa}.')
62
+
63
+
64
+ def plot_sequence_logo(motif, fig_height = 1, fig_width_per_base = 0.2, dpi = 100):
65
+
66
+ from exprmat.plotting.sequence import sequence_logo
67
+ motifs = get_motifs()
68
+ if isinstance(motif, tuple):
69
+ return sequence_logo(
70
+ np.array(motifs[motif[0]][motif[1]]['ppm'].T, dtype = np.float32),
71
+ ppm = True, y_format = 'bits', dpi = dpi,
72
+ fig_height = fig_height, fig_width_per_base = fig_width_per_base
73
+ )
74
+
75
+ elif isinstance(motif, str):
76
+ for mc in motifs.keys():
77
+ if motif in motifs[mc].keys():
78
+ return sequence_logo(
79
+ np.array(motifs[mc][motif]['ppm'].T, dtype = np.float32),
80
+ ppm = True, y_format = 'bits', dpi = dpi,
81
+ fig_height = fig_height, fig_width_per_base = fig_width_per_base
82
+ )
83
+
84
+
85
+ def motif_to_tuple(motif):
86
+ motifs = get_motifs()
87
+ for mc in motifs.keys():
88
+ if motif in motifs[mc].keys():
89
+ return (mc, motif)
90
+ error(f'could not find motif {motif}')
91
+
92
+
93
+ def to_pssm(motif, eps = 0.01):
94
+
95
+ if isinstance(motif, str): motif = motif_to_tuple(motif)
96
+ if motif[1] in pssm_table.keys(): return pssm_table[motif[1]]
97
+
98
+ motifs = get_motifs()
99
+ integral = np.array(motifs[motif[0]][motif[1]]['ppm'].T * 100000, dtype = np.int32)
100
+
101
+ # original order: acgt.
102
+ pwm = lightmotif.CountMatrix({
103
+ 'A': integral[:, 0].tolist(),
104
+ 'C': integral[:, 1].tolist(),
105
+ 'T': integral[:, 3].tolist(),
106
+ 'G': integral[:, 2].tolist(),
107
+ }).normalize(eps)
108
+
109
+ pssm = pwm.log_odds()
110
+ pssm_table[motif[1]] = pssm
111
+ return pssm
@@ -28,23 +28,28 @@ def get_genome(taxa):
28
28
 
29
29
  if taxa not in genome.keys(): genome[taxa] = {}
30
30
  if 'genes' in genome[taxa].keys(): return genome[taxa]['genes']
31
- genome[taxa]['genes'] = pandas.read_table(
32
- os.path.join(basepath, f'{taxa}', 'genome.tsv.gz'),
33
- # set low memory to false to allow correct adjustment to mixed dtype.
34
- index_col = '.ugene', dtype = {'.seqid': str}, low_memory = False
31
+ genome[taxa]['genes'] = pandas.read_feather(
32
+ os.path.join(basepath, f'{taxa}', 'genome.feather')
35
33
  )
36
34
 
35
+ genome[taxa]['genes'].index = genome[taxa]['genes']['uid'].tolist()
37
36
  return genome[taxa]['genes']
38
37
 
39
38
 
40
- def get_genome_size(assembly):
39
+ def get_genome_size(assembly, as_dataframe = False):
41
40
 
42
41
  import json
43
42
  taxa = cfg['taxa.reference'][assembly.lower()]
44
43
  path = os.path.join(basepath, taxa, 'assemblies', assembly.lower(), 'size.json')
45
44
  with open(path, 'r', encoding = 'utf-8') as f:
46
45
  sizes = json.load(f)
47
- return sizes
46
+
47
+ if as_dataframe: return pandas.DataFrame({
48
+ 'seqname': sizes.keys(),
49
+ 'len': [sizes[k] for k in sizes.keys()]
50
+ })
51
+
52
+ else: return sizes
48
53
 
49
54
 
50
55
  def get_genome_gff_fname(assembly):
@@ -80,12 +85,13 @@ def get_genome_ranges(assembly, fname, as_grange = False):
80
85
  taxa = cfg['taxa.reference'][assembly.lower()]
81
86
  path = os.path.join(basepath, taxa, 'assemblies', assembly.lower(), f'{fname}.feather')
82
87
  feather = pandas.read_feather(path)
88
+ feather = feather.loc[feather['end'] - feather['start'] > 0, :].copy()
83
89
 
84
90
  if as_grange:
85
91
  import genomicranges
86
92
  return genomicranges.GenomicRanges.from_pandas(
87
- feather[['ucsc', 'start', 'end', 'strand', 'gene']].rename(
88
- columns = {'ucsc': 'seqnames', 'start': 'starts', 'end': 'ends'}
93
+ feather[['chr', 'start', 'end', 'strand', 'gene']].rename(
94
+ columns = {'chr': 'seqnames', 'start': 'starts', 'end': 'ends'}
89
95
  ))
90
96
  else: return feather
91
97
 
@@ -185,7 +191,7 @@ def get_mapper_ensembl(taxa):
185
191
  else:
186
192
 
187
193
  gtable = get_genome(taxa)
188
- ensembl_list = gtable[['ensembl']].values.transpose()[0].tolist()
194
+ ensembl_list = gtable[['id']].values.transpose()[0].tolist()
189
195
  id_list = gtable.index.tolist()
190
196
  ensembl_finder = {}
191
197
 
@@ -59,13 +59,13 @@ def translate_id(taxa, genes, idfrom = 'entrez', idto = 'ugene', keep_nones = Tr
59
59
 
60
60
  # construct multi-platform convertion table.
61
61
  gtable = get_genome(taxa)
62
- gtable = gtable[['ensembl', 'gene']].copy()
62
+ gtable = gtable[['id', 'gene']].copy()
63
63
  gtable['ugene'] = gtable.index.tolist()
64
- gtable.index = gtable['ensembl'].tolist()
64
+ gtable.index = gtable['id'].tolist()
65
65
  gtable['uppercase'] = gtable['gene'].str.upper().tolist()
66
66
 
67
67
  # deduplicate
68
- gtable = gtable.loc[~ gtable['ensembl'].duplicated(), :].copy()
68
+ gtable = gtable.loc[~ gtable['id'].duplicated(), :].copy()
69
69
  gtable['ugene'] = taxa + ':' + gtable['ugene']
70
70
 
71
71
  entrez = pandas.read_table(
@@ -40,5 +40,40 @@ g2m_genesets = {
40
40
 
41
41
  preset_genesets = {
42
42
  's': s_gene_sets,
43
- 'g2m': g2m_genesets
43
+ 'g2m': g2m_genesets,
44
+ 'custom': {
45
+ 'mmu': {
46
+ 't': [
47
+ 'Cd3d', 'Cd8a', 'Cd4', 'Sell',
48
+ 'Il7r', 'Tcf7', 'Ifng', 'Gzmb',
49
+ 'Tox', 'Pdcd1', 'Havcr2', 'Lag3',
50
+ 'Mki67', 'Icos', 'Foxp3', 'Id2',
51
+ 'Id3', 'Gata3', 'Tbx21', 'Cd69',
52
+ 'Cxcr5', 'Bach1', 'Cxcr5', 'Xcl1',
53
+ 'Etv6', 'Ikzf3', 'Zbed2', 'Batf',
54
+ 'Klrb1c', 'Klrg1', 'Prf1'
55
+ ],
56
+ 'chemokines': {
57
+ "CCL": [
58
+ "Ccl1", "Ccr1l1", "Ccl2", "Ccl3", "Ccl4", "Ccl5", "Ccl6",
59
+ "Ccl7", "Ccl17", "Ccl8", "Ccl9", "Ccl11", "Ccl12", "Ccl19",
60
+ "Ccl19-ps2", "Ccl20", "Ccl22", "Ccl24", "Ccl25", "Ccl26",
61
+ "Ccl27a", "Ccl28",
62
+ ],
63
+ "CCR": [
64
+ "Ccr1", "Ccr2", "Ccr3", "Ccr4", "Ccr5", "Ccr6",
65
+ "Ccr7", "Ccr8", "Ccr9", "Ccr10",
66
+ ],
67
+ "CXCL": [
68
+ "Cxcl1", "Cxcl2", "Cxcl3", "Cxcl5", "Cxcl9", "Cxcl10", "Cxcl11",
69
+ "Cxcl12", "Cxcl13", "Cxcl14", "Cxcl15", "Cxcl16", "Cxcl17",
70
+ ],
71
+ "CXCR": ["Cxcr1", "Cxcr2", "Cxcr3", "Cxcr4", "Cxcr5", "Cxcr6"],
72
+ "XCL": ["Xcl1"],
73
+ "XCR": ["Xcr1"],
74
+ "CX3CL": ["Cx3cl1"],
75
+ "CX3CR": ["Cx3cr1"],
76
+ }
77
+ }
78
+ }
44
79
  }
@@ -9,7 +9,7 @@ import numpy as np
9
9
  import pandas as pd
10
10
  from boltons.iterutils import chunked
11
11
  from exprmat.descriptive.recovery import enrich_cells
12
- from rich.progress import track
12
+ from exprmat import pprog
13
13
 
14
14
  # to reduce the memory footprint of a ranking matrix we use unsigned 32bit
15
15
  # integers which provides a range from 0 through 4,294,967,295. this should be
@@ -96,7 +96,7 @@ def aucell4r(
96
96
  module.noweights() if noweights else module,
97
97
  auc_threshold = auc_threshold,
98
98
  )
99
- for module in track(signatures, description = 'auc')
99
+ for module in pprog(signatures, desc = 'auc')
100
100
  ]
101
101
  ).unstack("regulon")
102
102
  aucs.columns = aucs.columns.droplevel(0)
@@ -3,11 +3,10 @@ import os
3
3
  from multiprocessing import Manager
4
4
  from threading import Thread
5
5
  from joblib import delayed, Parallel
6
- from rich.progress import TextColumn, BarColumn, TimeRemainingColumn, TimeElapsedColumn
7
6
 
8
7
  import numpy as np
9
8
  from scipy.sparse import issparse, spmatrix
10
- from exprmat.ansi import error, warning, info
9
+ from exprmat.ansi import error, warning, info, pprog
11
10
 
12
11
 
13
12
  def get_n_jobs(n_jobs):
@@ -67,10 +66,10 @@ def parallelize(
67
66
  Whether to show a progress bar.
68
67
  """
69
68
 
70
- if show_progress_bar: from rich.progress import Progress as progress
69
+ if show_progress_bar: progress = pprog
71
70
  else: progress = None
72
71
 
73
- def update(pbar, task, queue, n_total):
72
+ def update(pbar, queue, n_total):
74
73
 
75
74
  n_finished = 0
76
75
  while n_finished < n_total:
@@ -83,32 +82,17 @@ def parallelize(
83
82
  assert res in (None, (1, None), 1) # (None, 1) means only 1 job
84
83
  if res == (1, None):
85
84
  n_finished += 1
86
- if pbar is not None: pbar.advance(task, advance = 1)
85
+ if pbar is not None: pbar.update(1)
87
86
  elif res is None: n_finished += 1
88
- elif pbar is not None: pbar.advance(task, advance = 1)
89
-
90
- if pbar is not None:
91
- pbar.stop()
87
+ elif pbar is not None: pbar.update(1)
92
88
 
93
89
 
94
90
  def wrapper(*args, **kwargs):
95
91
 
96
92
  if pass_queue and show_progress_bar:
97
- pbar = None if progress is None else progress(
98
- TextColumn("[progress.description]"),
99
- BarColumn(),
100
- TextColumn("[progress.percentage]{task.percentage:>4.1f}%"),
101
- TimeRemainingColumn(),
102
- TimeElapsedColumn()
103
- )
104
-
105
- pbartask = None
106
- if pbar is not None:
107
- pbartask = pbar.add_task(description = "", total = col_len)
108
- pbar.start()
109
-
93
+ pbar = None if progress is None else progress(total = col_len)
110
94
  queue = Manager().Queue()
111
- thread = Thread(target = update, args = (pbar, pbartask, queue, len(collections)))
95
+ thread = Thread(target = update, args = (pbar, queue, len(collections)))
112
96
  thread.start()
113
97
 
114
98
  else: pbar, queue, thread = None, None, None
@@ -6,11 +6,10 @@ from functools import partial
6
6
  from multiprocessing import Pool, cpu_count
7
7
  from pathlib import PurePath
8
8
  import pandas as pd
9
- from rich.progress import track
10
9
 
11
10
  from exprmat.utils import choose_layer
12
11
  from exprmat.data.tf import get_tfs
13
- from exprmat.ansi import info, warning, error
12
+ from exprmat.ansi import info, warning, error, pprog
14
13
  from exprmat.grn.regressors import (
15
14
  EARLY_STOP_WINDOW_LENGTH,
16
15
  kwargs_random_forest,
@@ -67,7 +66,7 @@ def adjacencies(
67
66
 
68
67
  with Pool(ncpus) as p:
69
68
  adjs = list(
70
- track(
69
+ pprog(
71
70
  p.imap(
72
71
  partial(
73
72
  run_infer_partial_network,
@@ -82,7 +81,7 @@ def adjacencies(
82
81
  chunksize = 1,
83
82
  ),
84
83
  total = len(gene_names),
85
- description = 'inferring partial network '
84
+ desc = 'inferring partial network'
86
85
  )
87
86
  )
88
87
 
@@ -4,10 +4,9 @@ from numpy import log10, finfo, exp
4
4
  from numpy import union1d
5
5
  import anndata
6
6
  import numpy as np
7
- from tqdm import tqdm
8
7
 
9
8
  from joblib import Parallel, delayed
10
- from exprmat.ansi import warning, error
9
+ from exprmat.ansi import warning, error, pprog
11
10
 
12
11
 
13
12
  class default_params():
@@ -211,7 +210,7 @@ def generate_perms_cube(X, n_perms, labels_mask, seed, agg_fun, n_jobs, verbose)
211
210
  results = Parallel(n_jobs = n_jobs)(
212
211
  delayed(permute_and_aggregate)
213
212
  (perm, rng.permutation(idx), X, labels_mask, agg_fun)
214
- for perm in tqdm(range(n_perms), disable = not verbose, ncols = 80)
213
+ for perm in pprog(range(n_perms), disable = not verbose)
215
214
  )
216
215
 
217
216
  # unpack results