exprmat 0.1.12__tar.gz → 0.1.15__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 (193) hide show
  1. {exprmat-0.1.12 → exprmat-0.1.15}/PKG-INFO +4 -1
  2. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/__init__.py +1 -1
  3. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/ansi.py +12 -30
  4. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/data/finders.py +5 -2
  5. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/data/hsa/mapping-ensembl.pkl +0 -0
  6. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/data/hsa/mapping-name.pkl +0 -0
  7. exprmat-0.1.15/exprmat/data/mmu/genome.tsv.gz +0 -0
  8. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/data/mmu/mapping-ensembl.pkl +0 -0
  9. exprmat-0.1.15/exprmat/data/mmu/mapping-name.pkl +0 -0
  10. exprmat-0.1.15/exprmat/data/presets.py +44 -0
  11. exprmat-0.1.15/exprmat/descriptive/tcr.py +108 -0
  12. exprmat-0.1.15/exprmat/dynamics/__init__.py +51 -0
  13. exprmat-0.1.15/exprmat/dynamics/generank.py +372 -0
  14. exprmat-0.1.15/exprmat/dynamics/linreg.py +144 -0
  15. exprmat-0.1.15/exprmat/dynamics/moments.py +106 -0
  16. exprmat-0.1.15/exprmat/dynamics/optimization.py +202 -0
  17. exprmat-0.1.15/exprmat/dynamics/parallel.py +148 -0
  18. exprmat-0.1.15/exprmat/dynamics/preprocess.py +337 -0
  19. exprmat-0.1.15/exprmat/dynamics/pseudotime.py +459 -0
  20. exprmat-0.1.15/exprmat/dynamics/transition.py +231 -0
  21. exprmat-0.1.15/exprmat/dynamics/utils.py +617 -0
  22. exprmat-0.1.15/exprmat/dynamics/velocity.py +1145 -0
  23. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/plotting/expression.py +20 -1
  24. exprmat-0.1.15/exprmat/plotting/sankey.py +184 -0
  25. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/plotting/summary.py +14 -13
  26. exprmat-0.1.15/exprmat/plotting/utils.py +1 -0
  27. exprmat-0.1.15/exprmat/plotting/velocity.py +595 -0
  28. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/reader/experiment.py +577 -64
  29. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/reader/matcher.py +273 -68
  30. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/reduction/mde.py +39 -2
  31. exprmat-0.1.15/exprmat/reduction/outliers.py +185 -0
  32. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/reduction/plot.py +60 -31
  33. exprmat-0.1.15/exprmat/transfer/__init__.py +0 -0
  34. exprmat-0.1.15/exprmat/transfer/atlas.py +233 -0
  35. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat.egg-info/PKG-INFO +4 -1
  36. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat.egg-info/SOURCES.txt +21 -3
  37. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat.egg-info/requires.txt +3 -0
  38. {exprmat-0.1.12 → exprmat-0.1.15}/setup.py +5 -2
  39. exprmat-0.1.12/exprmat/data/mmu/genome.tsv.gz +0 -0
  40. exprmat-0.1.12/exprmat/data/mmu/mapping-name.pkl +0 -0
  41. exprmat-0.1.12/exprmat/reduction/pumap.py +0 -593
  42. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/clustering/__init__.py +0 -0
  43. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/clustering/leiden.py +0 -0
  44. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/clustering/rogue.py +0 -0
  45. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/clustering/spectral.py +0 -0
  46. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/clustering/utils.py +0 -0
  47. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/cnv/__init__.py +0 -0
  48. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/cnv/cnvscore.py +0 -0
  49. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/cnv/infercnv.py +0 -0
  50. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/configuration.py +0 -0
  51. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/data/__init__.py +0 -0
  52. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/data/delim.py +0 -0
  53. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/data/geneset.py +0 -0
  54. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/data/gff.py +0 -0
  55. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/data/hsa/entrez.tsv.gz +0 -0
  56. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/data/hsa/genesets/all.gmt +0 -0
  57. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/data/hsa/genesets/bp.gmt +0 -0
  58. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/data/hsa/genesets/cancer-modules.gmt +0 -0
  59. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/data/hsa/genesets/cancer-neighborhoods.gmt +0 -0
  60. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/data/hsa/genesets/cancer.gmt +0 -0
  61. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/data/hsa/genesets/cc.gmt +0 -0
  62. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/data/hsa/genesets/chemical-perturb.gmt +0 -0
  63. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/data/hsa/genesets/hallmark.gmt +0 -0
  64. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/data/hsa/genesets/human-phenotype-ontology.gmt +0 -0
  65. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/data/hsa/genesets/immune-perturb.gmt +0 -0
  66. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/data/hsa/genesets/kegg.gmt +0 -0
  67. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/data/hsa/genesets/mf.gmt +0 -0
  68. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/data/hsa/genesets/microrna.gmt +0 -0
  69. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/data/hsa/genesets/oncogenic.gmt +0 -0
  70. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/data/hsa/genesets/pathways.gmt +0 -0
  71. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/data/hsa/genesets/positional.gmt +0 -0
  72. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/data/hsa/genesets/single-cell.gmt +0 -0
  73. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/data/hsa/genesets/transcript-factors.gmt +0 -0
  74. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/data/hsa/genesets/vaccine.gmt +0 -0
  75. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/data/hsa/genome.tsv.gz +0 -0
  76. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/data/hsa/lr/baccin2019 +0 -0
  77. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/data/hsa/lr/cellcall +0 -0
  78. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/data/hsa/lr/cellchatdb +0 -0
  79. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/data/hsa/lr/cellinker +0 -0
  80. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/data/hsa/lr/cellphonedb +0 -0
  81. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/data/hsa/lr/celltalkdb +0 -0
  82. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/data/hsa/lr/connectomedb2020 +0 -0
  83. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/data/hsa/lr/consensus +0 -0
  84. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/data/hsa/lr/embrace +0 -0
  85. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/data/hsa/lr/guide2pharma +0 -0
  86. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/data/hsa/lr/hpmr +0 -0
  87. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/data/hsa/lr/icellnet +0 -0
  88. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/data/hsa/lr/italk +0 -0
  89. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/data/hsa/lr/kirouac2010 +0 -0
  90. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/data/hsa/lr/lrdb +0 -0
  91. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/data/hsa/lr/ramilowski2015 +0 -0
  92. /exprmat-0.1.12/exprmat/data/hsa/orthologs/aca.gz → /exprmat-0.1.15/exprmat/data/hsa/orthologs/aca.tsv.gz +0 -0
  93. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/data/hsa/orthologs/bta.tsv.gz +0 -0
  94. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/data/hsa/orthologs/cel.tsv.gz +0 -0
  95. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/data/hsa/orthologs/clu.tsv.gz +0 -0
  96. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/data/hsa/orthologs/dme.tsv.gz +0 -0
  97. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/data/hsa/orthologs/dre.tsv.gz +0 -0
  98. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/data/hsa/orthologs/eca.tsv.gz +0 -0
  99. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/data/hsa/orthologs/fca.tsv.gz +0 -0
  100. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/data/hsa/orthologs/gga.tsv.gz +0 -0
  101. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/data/hsa/orthologs/mdo.tsv.gz +0 -0
  102. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/data/hsa/orthologs/mmu.tsv.gz +0 -0
  103. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/data/hsa/orthologs/mmul.gz +0 -0
  104. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/data/hsa/orthologs/oan.tsv.gz +0 -0
  105. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/data/hsa/orthologs/ptr.tsv.gz +0 -0
  106. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/data/hsa/orthologs/rno.tsv.gz +0 -0
  107. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/data/hsa/orthologs/sce.tsv.gz +0 -0
  108. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/data/hsa/orthologs/spo.tsv.gz +0 -0
  109. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/data/hsa/orthologs/ssc.tsv.gz +0 -0
  110. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/data/hsa/orthologs/xla.tsv.gz +0 -0
  111. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/data/hsa/taxa +0 -0
  112. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/data/lr.py +0 -0
  113. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/data/mmu/entrez.tsv.gz +0 -0
  114. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/data/mmu/genesets/all.gmt +0 -0
  115. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/data/mmu/genesets/azimuth.gmt +0 -0
  116. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/data/mmu/genesets/biocarta.gmt +0 -0
  117. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/data/mmu/genesets/bp.gmt +0 -0
  118. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/data/mmu/genesets/cc.gmt +0 -0
  119. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/data/mmu/genesets/chemical-perturb.gmt +0 -0
  120. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/data/mmu/genesets/hallmark.gmt +0 -0
  121. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/data/mmu/genesets/kegg.gmt +0 -0
  122. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/data/mmu/genesets/m2.gmt +0 -0
  123. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/data/mmu/genesets/markers.gmt +0 -0
  124. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/data/mmu/genesets/mf.gmt +0 -0
  125. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/data/mmu/genesets/microrna.gmt +0 -0
  126. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/data/mmu/genesets/mpt.gmt +0 -0
  127. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/data/mmu/genesets/positional.gmt +0 -0
  128. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/data/mmu/genesets/reactome.gmt +0 -0
  129. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/data/mmu/genesets/transcript-factors.gmt +0 -0
  130. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/data/mmu/genesets/wikipathway.gmt +0 -0
  131. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/data/mmu/lr/consensus +0 -0
  132. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/data/mmu/taxa +0 -0
  133. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/data/private.py +0 -0
  134. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/data/ranges.py +0 -0
  135. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/descriptive/__init__.py +0 -0
  136. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/descriptive/aggregate.py +0 -0
  137. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/descriptive/de.py +0 -0
  138. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/descriptive/gse.py +0 -0
  139. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/descriptive/kde.py +0 -0
  140. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/descriptive/summary.py +0 -0
  141. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/lr/__init__.py +0 -0
  142. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/lr/aggregate.py +0 -0
  143. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/lr/method.py +0 -0
  144. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/lr/methods/__init__.py +0 -0
  145. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/lr/methods/cellchat.py +0 -0
  146. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/lr/methods/cellphonedb.py +0 -0
  147. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/lr/methods/connectome.py +0 -0
  148. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/lr/methods/geomean.py +0 -0
  149. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/lr/methods/logfc.py +0 -0
  150. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/lr/methods/natmi.py +0 -0
  151. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/lr/methods/rank_aggregate.py +0 -0
  152. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/lr/methods/scseqcomm.py +0 -0
  153. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/lr/methods/singlecellsignalr.py +0 -0
  154. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/lr/pipeline.py +0 -0
  155. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/lr/preprocess.py +0 -0
  156. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/lr/resources.py +0 -0
  157. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/lr/utils.py +0 -0
  158. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/plotting/__init__.py +0 -0
  159. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/plotting/cnv.py +0 -0
  160. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/plotting/de.py +0 -0
  161. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/plotting/gse.py +0 -0
  162. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/plotting/lr.py +0 -0
  163. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/plotting/palettes.py +0 -0
  164. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/preprocessing/__init__.py +0 -0
  165. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/preprocessing/doublets/__init__.py +0 -0
  166. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/preprocessing/doublets/composite.py +0 -0
  167. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/preprocessing/doublets/scrublet.py +0 -0
  168. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/preprocessing/filter.py +0 -0
  169. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/preprocessing/integrate.py +0 -0
  170. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/preprocessing/linear.py +0 -0
  171. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/preprocessing/normal.py +0 -0
  172. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/preprocessing/plot.py +0 -0
  173. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/preprocessing/qc.py +0 -0
  174. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/preprocessing/sctransform/__init__.py +0 -0
  175. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/preprocessing/sctransform/estimate.py +0 -0
  176. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/preprocessing/sctransform/ksmooth.py +0 -0
  177. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/preprocessing/sctransform/residual.py +0 -0
  178. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/preprocessing/sctransform/transform.py +0 -0
  179. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/preprocessing/sparse.py +0 -0
  180. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/preprocessing/uniform.py +0 -0
  181. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/reader/__init__.py +0 -0
  182. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/reader/metadata.py +0 -0
  183. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/reduction/__init__.py +0 -0
  184. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/reduction/forceatlas.py +0 -0
  185. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/reduction/nn.py +0 -0
  186. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/reduction/pca.py +0 -0
  187. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/reduction/tsne.py +0 -0
  188. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/reduction/umap.py +0 -0
  189. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat/utils.py +0 -0
  190. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat.egg-info/dependency_links.txt +0 -0
  191. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat.egg-info/not-zip-safe +0 -0
  192. {exprmat-0.1.12 → exprmat-0.1.15}/exprmat.egg-info/top_level.txt +0 -0
  193. {exprmat-0.1.12 → exprmat-0.1.15}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: exprmat
3
- Version: 0.1.12
3
+ Version: 0.1.15
4
4
  Summary: routines to process expression matrices
5
5
  Home-page: https://github.com/yang-z-03/exprmat
6
6
  Author: Zheng Yang
@@ -31,6 +31,9 @@ Requires-Dist: gseapy
31
31
  Requires-Dist: metacells
32
32
  Requires-Dist: sh
33
33
  Requires-Dist: networkx
34
+ Requires-Dist: palantir
35
+ Requires-Dist: scfates
36
+ Requires-Dist: rich
34
37
  Dynamic: author
35
38
  Dynamic: author-email
36
39
  Dynamic: home-page
@@ -4,4 +4,4 @@ import anndata as ad
4
4
 
5
5
  mu.set_options(pull_on_update = False)
6
6
 
7
- def version(): print('exprmat 0.1.12 [revision 1] [dev]')
7
+ def version(): return 'exprmat 0.1.15-1 [dev]'
@@ -1,17 +1,8 @@
1
1
 
2
- # ./shared/ansi.py:
3
- # provides basic ansi console coloring and cursor manipulation support.
4
- # considering adding later another alternative implementation of the same
5
- # interface for terminal/emulators that do not support ansi.
6
- #
7
- # license: gplv3. <https://www.gnu.org/licenses>
8
- # contact: yang-z <xornent at outlook dot com>
9
-
10
2
  import re
11
3
  import os
12
4
  import sys
13
5
 
14
- # foregrounds -----------------------------------------------------------------
15
6
 
16
7
  def fore_black() -> None:
17
8
  print('\033[30m', end = '')
@@ -40,13 +31,11 @@ def fore_white() -> None:
40
31
  def fore_gray() -> None:
41
32
  print('\033[8m', end = '')
42
33
 
43
- # reset ansi controls ---------------------------------------------------------
44
-
34
+
45
35
  def ansi_reset() -> None:
46
36
  print('\033[0m', end = '')
47
37
 
48
- # backgrounds -----------------------------------------------------------------
49
-
38
+
50
39
  def back_black() -> None:
51
40
  print('\033[40m', end = '')
52
41
 
@@ -71,7 +60,6 @@ def back_cyan() -> None:
71
60
  def back_white() -> None:
72
61
  print('\033[47m', end = '')
73
62
 
74
- # cursor operations
75
63
 
76
64
  def ansi_move_cursor(line: int, col: int) -> None:
77
65
  if line == 0: pass
@@ -82,8 +70,6 @@ def ansi_move_cursor(line: int, col: int) -> None:
82
70
  elif col > 0: print('\033[{0}C'.format(str(col)), end = '', flush = True) # moves right
83
71
  elif col < 0: print('\033[{0}D'.format(str(-col)), end = '', flush = True) # moves left
84
72
 
85
- def fill_blank(blanks: int) -> None:
86
- print(' ' * blanks, end = '', flush = True)
87
73
 
88
74
  def common_length(string: str, limit: int) -> str:
89
75
 
@@ -109,34 +95,27 @@ def common_length(string: str, limit: int) -> str:
109
95
 
110
96
  else: return ('{:<' + str(limit - cn_length) + '}').format(string)
111
97
 
98
+
112
99
  def fill_blank(blanks: int, string: str) -> None:
113
100
  print(common_length(string, blanks), end = '', flush = True)
114
101
 
115
- def line_start() -> None:
116
- print('\r', end = '')
117
102
 
118
- def print_message(color, title, path, overwrite = True):
119
- if overwrite:
120
- print('\r{0}[{1}]\033[0m'.format(color, title), common_length(path, 70), end = '')
121
- return '{0}[{1}]\033[0m'.format(color, title) + ' ' + common_length(path, 70)
122
- else:
123
- print('{0}[{1}]\033[0m'.format(color, title), common_length(path, 70))
124
- return '{0}[{1}]\033[0m'.format(color, title) + ' ' + common_length(path, 70)
125
-
126
103
  def format_file_size(size):
127
104
  for suffix in ['B', 'KiB', 'MiB', 'GiB', 'TiB']:
128
105
  if size < 1024.0 or suffix == 'TiB': break
129
106
  size /= 1024.0
130
107
  return f"{size:.2f} {suffix}"
131
108
 
132
- # prompt messages -------------------------------------------------------------
133
-
134
- def error(text: str) -> None:
109
+
110
+ def error(text: str, error = None) -> None:
135
111
  fore_red()
136
112
  print('[error]', end = ' ')
137
113
  ansi_reset()
138
114
  print(text)
139
- raise Exception()
115
+
116
+ if error is None: raise Exception(text)
117
+ else: raise Exception(text) from error
118
+
140
119
 
141
120
  def warning(text: str) -> None:
142
121
  fore_yellow()
@@ -145,6 +124,7 @@ def warning(text: str) -> None:
145
124
  print(text)
146
125
  ansi_reset()
147
126
 
127
+
148
128
  def info(text: str) -> None:
149
129
  fore_cyan()
150
130
  print('[i]', end = ' ')
@@ -152,6 +132,7 @@ def info(text: str) -> None:
152
132
  print(text)
153
133
  ansi_reset()
154
134
 
135
+
155
136
  def clear():
156
137
  # for windows
157
138
  if os.name == 'nt':
@@ -160,6 +141,7 @@ def clear():
160
141
  # for mac and linux(here, os.name is 'posix')
161
142
  else: os.system('clear')
162
143
 
144
+
163
145
  def red(x): return '\033[31m' + x + '\033[0m'
164
146
  def green(x): return '\033[32m' + x + '\033[0m'
165
147
  def yellow(x): return '\033[33m' + x + '\033[0m'
@@ -31,7 +31,7 @@ def get_genome(taxa):
31
31
  genome[taxa]['genes'] = pandas.read_table(
32
32
  os.path.join(basepath, f'{taxa}', 'genome.tsv.gz'),
33
33
  # set low memory to false to allow correct adjustment to mixed dtype.
34
- index_col = '.ugene', dtype = {'.seqid': str}
34
+ index_col = '.ugene', dtype = {'.seqid': str}, low_memory = False
35
35
  )
36
36
 
37
37
  return genome[taxa]['genes']
@@ -142,7 +142,10 @@ def update_mapper(taxa, name, ens):
142
142
  if (name not in genome[taxa]['mapper.name'].keys()):
143
143
  if (ens in genome[taxa]['mapper.ensembl'].keys()):
144
144
  genome[taxa]['mapper.name'][name] = genome[taxa]['mapper.ensembl'][ens]
145
- else: info(f'{ens} -> {name} pair could not be established.')
145
+ else:
146
+ # info(f'{ens} -> {name} pair could not be established.')
147
+ # this info log is too noisy.
148
+ pass
146
149
 
147
150
  else:
148
151
  if (ens not in genome[taxa]['mapper.ensembl'].keys()):
@@ -0,0 +1,44 @@
1
+
2
+ s_gene_sets = {
3
+ 'mmu': [ # the original list
4
+ 'Atad2', 'Blm', 'Brip1', 'Casp8ap2', 'Ccne2', 'Cdc45', 'Cdc6', 'Cdca7',
5
+ 'Chaf1b', 'Clspn', 'Dscc1', 'Dtl', 'E2f8', 'Exo1', 'Fen1', 'Gins2', 'Gmnn',
6
+ 'Hells', 'Mcm2', 'Mcm4', 'Mcm5', 'Mcm6', 'Msh2', 'Nasp', 'Pcna', 'Pola1',
7
+ 'Pold3', 'Prim1', 'Rad51', 'Rad51ap1', 'Rfc2', 'Rpa2', 'Rrm1', 'Rrm2',
8
+ 'Slbp', 'Tipin', 'Tyms', 'Ubr7', 'Uhrf1', 'Ung', 'Usp1', 'Wdr76'
9
+ ],
10
+ 'hsa': [ # translated from mice
11
+ 'MCM5', 'PCNA', 'TYMS', 'FEN1', 'MCM2', 'MCM4', 'RRM1', 'UNG', 'GINS2',
12
+ 'MCM6', 'CDCA7', 'DTL', 'PRIM1', 'UHRF1', 'MLF1IP', 'HELLS', 'RFC2',
13
+ 'RPA2', 'NASP', 'RAD51AP1', 'GMNN', 'WDR76', 'SLBP', 'CCNE2', 'UBR7',
14
+ 'POLD3', 'MSH2', 'ATAD2', 'RAD51', 'RRM2', 'CDC45', 'CDC6', 'EXO1',
15
+ 'TIPIN', 'DSCC1', 'BLM', 'CASP8AP2', 'USP1', 'CLSPN', 'POLA1', 'CHAF1B',
16
+ 'BRIP1', 'E2F8'
17
+ ]
18
+ }
19
+
20
+ g2m_genesets = {
21
+ 'mmu': [
22
+ 'Anln', 'Anp32e', 'Aurka', 'Aurkb', 'Birc5', 'Bub1', 'Cbx5', 'Ccnb2',
23
+ 'Cdc20', 'Cdc25c', 'Cdca2', 'Cdca3', 'Cdca8', 'Cdk1', 'Cenpa', 'Cenpe',
24
+ 'Cenpf', 'Ckap2', 'Ckap2l', 'Ckap5', 'Cks1b', 'Cks2', 'Ctcf', 'Dlgap5',
25
+ 'Ect2', 'G2e3', 'Gas2l3', 'Gtse1', 'Hjurp', 'Hmgb2', 'Hmmr', 'Kif11',
26
+ 'Kif20b', 'Kif23', 'Kif2c', 'Lbr', 'Mki67', 'Ncapd2', 'Ndc80', 'Nek2',
27
+ 'Nuf2', 'Nusap1', 'Psrc1', 'Rangap1', 'Smc4', 'Tacc3', 'Tmpo', 'Top2a',
28
+ 'Tpx2', 'Ttk', 'Tubb4b', 'Ube2c'
29
+ ],
30
+ 'hsa': [
31
+ 'HMGB2', 'CDK1', 'NUSAP1', 'UBE2C', 'BIRC5', 'TPX2', 'TOP2A', 'NDC80',
32
+ 'CKS2', 'NUF2', 'CKS1B', 'MKI67', 'TMPO', 'CENPF', 'TACC3', 'FAM64A',
33
+ 'SMC4', 'CCNB2', 'CKAP2L', 'CKAP2', 'AURKB', 'BUB1', 'KIF11', 'ANP32E',
34
+ 'TUBB4B', 'GTSE1', 'KIF20B', 'HJURP', 'CDCA3', 'HN1', 'CDC20', 'TTK',
35
+ 'CDC25C', 'KIF2C', 'RANGAP1', 'NCAPD2', 'DLGAP5', 'CDCA2', 'CDCA8',
36
+ 'ECT2', 'KIF23', 'HMMR', 'AURKA', 'PSRC1', 'ANLN', 'LBR', 'CKAP5', 'CENPE',
37
+ 'CTCF', 'NEK2', 'G2E3', 'GAS2L3', 'CBX5', 'CENPA'
38
+ ]
39
+ }
40
+
41
+ preset_genesets = {
42
+ 's': s_gene_sets,
43
+ 'g2m': g2m_genesets
44
+ }
@@ -0,0 +1,108 @@
1
+
2
+ import numpy as np
3
+ from exprmat.ansi import error, warning
4
+
5
+
6
+ # expansion index for cluster.
7
+ # maximal value if the cluster is `dominant` for a single clonotype e.g. mait cells.
8
+
9
+ def clone_cluster_matrix(adata, clonotype = 'clone.id', cluster = 'leiden'):
10
+
11
+ clono_ids = adata.obs[clonotype].value_counts().index.tolist()
12
+ clust_ids = adata.obs[cluster].value_counts().index.tolist()
13
+ clono_col = adata.obs[clonotype]
14
+ clust_col = adata.obs[cluster]
15
+ mat = np.ndarray(shape = (len(clono_ids), len(clust_ids)), dtype = np.float32)
16
+
17
+ for j, cs in enumerate(clust_ids):
18
+ specific_cluster = clono_col[clust_col == cs].copy()
19
+ clono_stat = specific_cluster.value_counts()
20
+
21
+ for i, cl in enumerate(clono_ids):
22
+ if cl in clono_stat.index: mat[i, j] = clono_stat[cl]
23
+ else: mat[i, j] = 0
24
+
25
+ return mat, clono_ids, clust_ids
26
+
27
+
28
+ def expansion(adata, clonotype = 'clone.id', cluster = 'leiden', key = 'tcr.cluster.expansion'):
29
+
30
+ mat, clono_ids, clust_ids = clone_cluster_matrix(adata, clonotype = clonotype, cluster = cluster)
31
+ adata.obs[key] = 0
32
+
33
+ for j, cs in enumerate(clust_ids):
34
+ props = mat[:, j] / np.sum(mat[:, j])
35
+ props = props[np.nonzero(mat[:, j])]
36
+
37
+ if np.sum(mat[:, j]) < 5:
38
+ adata.obs.loc[adata.obs[cluster] == cs, key] = 0
39
+ else:
40
+ shannon_e = - np.sum(props * np.log2(props))
41
+ adata.obs.loc[adata.obs[cluster] == cs, key] = 1 - (shannon_e / np.log2(len(props)))
42
+
43
+
44
+ def plasticity(adata, clonotype = 'clone.id', cluster = 'leiden', key = 'tcr.cluster.plasticity'):
45
+
46
+ mat, clono_ids, clust_ids = clone_cluster_matrix(adata, clonotype = clonotype, cluster = cluster)
47
+ adata.obs[key] = 0
48
+
49
+ for j, cs in enumerate(clust_ids):
50
+ # select all clones that present in this cluster
51
+ submat = mat[mat[:, j] > 0, :]
52
+ submat = (submat.T / submat.sum(axis = 1)).T # row normalize
53
+ overall = submat.sum(axis = 0)
54
+ overall = overall / overall.sum()
55
+ overall = overall[np.nonzero(overall)]
56
+ # completely deterministic, 0. completely random, 1.
57
+
58
+ if np.sum(mat[:, j]) < 5:
59
+ adata.obs.loc[adata.obs[cluster] == cs, key] = 0
60
+ else:
61
+ shannon_e = - np.sum(overall * np.log2(overall))
62
+ adata.obs.loc[adata.obs[cluster] == cs, key] = shannon_e
63
+
64
+
65
+ def pairwise_transition(
66
+ adata, base, clonotype = 'clone.id', cluster = 'leiden',
67
+ key = 'tcr.cluster.ptrans'
68
+ ):
69
+
70
+ mat, clono_ids, clust_ids = clone_cluster_matrix(adata, clonotype = clonotype, cluster = cluster)
71
+ adata.obs[key] = 0
72
+ baseid = clust_ids.index(base)
73
+
74
+ for j, cs in enumerate(clust_ids):
75
+ if j == baseid: continue
76
+
77
+ # select all clones that present in this cluster
78
+ submat = mat[mat[:, j] + mat[:, baseid] > 0, :]
79
+ submat = submat[:, [baseid, j]]
80
+ either_zero = (submat[:, 0] == 0) | (submat[:, 1] == 0)
81
+ weights = submat[:, 0] + submat[:, 1]
82
+ weights = weights / weights.sum()
83
+ submat = (submat.T / submat.sum(axis = 1)).T # row normalize
84
+
85
+ shannon_e = -(submat[:, 0] * np.log2(submat[:, 0]) + submat[:, 1] * np.log2(submat[:, 1]))
86
+ shannon_e[either_zero] = 0
87
+ adata.obs.loc[adata.obs[cluster] == cs, key] = np.sum(shannon_e * weights)
88
+
89
+
90
+ # per clone statistics
91
+
92
+ def transition(adata, clonotype = 'clone.id', cluster = 'leiden', key = 'tcr.clone.trans'):
93
+
94
+ mat, clono_ids, clust_ids = clone_cluster_matrix(adata, clonotype = clonotype, cluster = cluster)
95
+ adata.obs[key] = 0
96
+
97
+ for i, cl in enumerate(clono_ids):
98
+ props = mat[i, :] / np.sum(mat[i, :])
99
+ props = props[np.nonzero(mat[i, :])]
100
+ shannon_e = - np.sum(props * np.log2(props))
101
+ adata.obs.loc[adata.obs[clonotype] == cl, key] = shannon_e
102
+
103
+
104
+
105
+
106
+ def migration(adata, clonotype = 'clone.id', cluster = 'tissue', key = 'tcr.clone.migr'):
107
+ # completely the same.
108
+ transition(adata, clonotype = clonotype, cluster = cluster, key = key)
@@ -0,0 +1,51 @@
1
+
2
+ from exprmat.dynamics.preprocess import filter_and_normalize
3
+ from exprmat.dynamics.pseudotime import velocity_pseudotime, terminal_states
4
+ from exprmat.dynamics.transition import transition_matrix
5
+ from exprmat.dynamics.moments import moments
6
+ from exprmat.dynamics.velocity import velocity, velocity_confidence, velocity_embedding, velocity_graph
7
+ from exprmat.dynamics.generank import rank_velocity_genes
8
+
9
+
10
+ def run_velocity(
11
+ adata,
12
+ neighbor_key = 'neighbors', neighbor_connectivity = 'connectivities', n_neighbors = 35,
13
+ hvg = 'vst.norm',
14
+ velocity_key = 'velocity',
15
+ n_cpus = None,
16
+ kwargs_filter = { 'enforce': False },
17
+ kwargs_velocity = {},
18
+ kwargs_velocity_graph = {},
19
+ kwargs_terminal_state = {},
20
+ kwargs_pseudotime = { 'save_diffmap': True },
21
+ ):
22
+ if (
23
+ ('spliced.counts' not in adata.layers.keys()) and
24
+ ('unspliced.counts' not in adata.layers.keys())
25
+ ):
26
+ filter_and_normalize(adata, **kwargs_filter)
27
+
28
+ moments(adata, neighbor_key = neighbor_key, mode = neighbor_connectivity)
29
+
30
+ velocity(
31
+ adata,
32
+ vkey = velocity_key,
33
+ use_highly_variable = hvg,
34
+ neighbor_key = neighbor_key,
35
+ **kwargs_velocity
36
+ )
37
+
38
+ velocity_graph(
39
+ adata,
40
+ n_jobs = n_cpus,
41
+ vkey = velocity_key,
42
+ neighbor_key = neighbor_key,
43
+ mode_neighbors = neighbor_connectivity,
44
+ n_neighbors = n_neighbors,
45
+ **kwargs_velocity_graph
46
+ )
47
+
48
+ terminal_states(adata, vkey = velocity_key, neighbor_key = neighbor_key, **kwargs_terminal_state)
49
+ velocity_pseudotime(adata, vkey = velocity_key, neighbor_key = neighbor_key, **kwargs_pseudotime)
50
+ velocity_confidence(adata, vkey = velocity_key, neighbor_key = neighbor_key)
51
+