exprmat 0.1.28__tar.gz → 0.1.29__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 (167) hide show
  1. {exprmat-0.1.28 → exprmat-0.1.29}/PKG-INFO +3 -2
  2. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/__init__.py +13 -6
  3. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/data/finders.py +1 -1
  4. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/descriptive/kde.py +6 -3
  5. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/plotting/expression.py +1 -1
  6. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/plotting/track.py +52 -2
  7. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/reader/experiment.py +5 -6
  8. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/utils.py +22 -0
  9. {exprmat-0.1.28 → exprmat-0.1.29}/pyproject.toml +3 -2
  10. {exprmat-0.1.28 → exprmat-0.1.29}/Cargo.lock +0 -0
  11. {exprmat-0.1.28 → exprmat-0.1.29}/Cargo.toml +0 -0
  12. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/ansi.py +0 -0
  13. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/clustering/__init__.py +0 -0
  14. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/clustering/cnmf.py +0 -0
  15. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/clustering/dbscan.py +0 -0
  16. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/clustering/kmeans.py +0 -0
  17. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/clustering/leiden.py +0 -0
  18. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/clustering/nmf.py +0 -0
  19. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/clustering/rogue.py +0 -0
  20. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/clustering/seriation.py +0 -0
  21. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/clustering/spectral.py +0 -0
  22. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/clustering/utils.py +0 -0
  23. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/cnv/__init__.py +0 -0
  24. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/cnv/cnvscore.py +0 -0
  25. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/cnv/infercnv.py +0 -0
  26. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/configuration.py +0 -0
  27. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/data/__init__.py +0 -0
  28. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/data/cistarget.py +0 -0
  29. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/data/delim.py +0 -0
  30. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/data/geneset.py +0 -0
  31. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/data/gff.py +0 -0
  32. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/data/io.py +0 -0
  33. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/data/lr.py +0 -0
  34. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/data/presets.py +0 -0
  35. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/data/private.py +0 -0
  36. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/data/ranges.py +0 -0
  37. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/data/signature.py +0 -0
  38. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/data/tf.py +0 -0
  39. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/descriptive/__init__.py +0 -0
  40. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/descriptive/aggregate.py +0 -0
  41. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/descriptive/atac.py +0 -0
  42. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/descriptive/aucell.py +0 -0
  43. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/descriptive/de.py +0 -0
  44. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/descriptive/gse.py +0 -0
  45. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/descriptive/recovery.py +0 -0
  46. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/descriptive/summary.py +0 -0
  47. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/descriptive/tcr.py +0 -0
  48. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/dynamics/__init__.py +0 -0
  49. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/dynamics/generank.py +0 -0
  50. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/dynamics/linreg.py +0 -0
  51. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/dynamics/moments.py +0 -0
  52. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/dynamics/optimization.py +0 -0
  53. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/dynamics/parallel.py +0 -0
  54. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/dynamics/preprocess.py +0 -0
  55. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/dynamics/pseudotime.py +0 -0
  56. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/dynamics/transition.py +0 -0
  57. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/dynamics/utils.py +0 -0
  58. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/dynamics/velocity.py +0 -0
  59. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/grn/__init__.py +0 -0
  60. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/grn/infergrn.py +0 -0
  61. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/grn/modules.py +0 -0
  62. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/grn/prune.py +0 -0
  63. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/grn/regressors.py +0 -0
  64. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/grn/utils.py +0 -0
  65. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/lr/__init__.py +0 -0
  66. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/lr/aggregate.py +0 -0
  67. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/lr/method.py +0 -0
  68. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/lr/methods/__init__.py +0 -0
  69. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/lr/methods/cellchat.py +0 -0
  70. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/lr/methods/cellphonedb.py +0 -0
  71. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/lr/methods/connectome.py +0 -0
  72. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/lr/methods/geomean.py +0 -0
  73. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/lr/methods/logfc.py +0 -0
  74. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/lr/methods/natmi.py +0 -0
  75. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/lr/methods/rank_aggregate.py +0 -0
  76. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/lr/methods/scseqcomm.py +0 -0
  77. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/lr/methods/singlecellsignalr.py +0 -0
  78. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/lr/pipeline.py +0 -0
  79. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/lr/preprocess.py +0 -0
  80. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/lr/resources.py +0 -0
  81. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/lr/utils.py +0 -0
  82. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/plotting/__init__.py +0 -0
  83. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/plotting/atac.py +0 -0
  84. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/plotting/cnmf.py +0 -0
  85. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/plotting/cnv.py +0 -0
  86. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/plotting/de.py +0 -0
  87. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/plotting/gse.py +0 -0
  88. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/plotting/lr.py +0 -0
  89. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/plotting/palettes.py +0 -0
  90. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/plotting/sankey.py +0 -0
  91. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/plotting/summary.py +0 -0
  92. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/plotting/utils.py +0 -0
  93. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/plotting/velocity.py +0 -0
  94. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/preprocessing/__init__.py +0 -0
  95. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/preprocessing/doublets/__init__.py +0 -0
  96. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/preprocessing/doublets/composite.py +0 -0
  97. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/preprocessing/doublets/scrublet.py +0 -0
  98. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/preprocessing/emptydrops.py +0 -0
  99. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/preprocessing/filter.py +0 -0
  100. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/preprocessing/impute/__init__.py +0 -0
  101. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/preprocessing/impute/magic.py +0 -0
  102. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/preprocessing/integrate.py +0 -0
  103. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/preprocessing/linear.py +0 -0
  104. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/preprocessing/normal.py +0 -0
  105. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/preprocessing/plot.py +0 -0
  106. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/preprocessing/qc.py +0 -0
  107. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/preprocessing/sctransform/__init__.py +0 -0
  108. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/preprocessing/sctransform/estimate.py +0 -0
  109. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/preprocessing/sctransform/ksmooth.py +0 -0
  110. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/preprocessing/sctransform/residual.py +0 -0
  111. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/preprocessing/sctransform/transform.py +0 -0
  112. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/preprocessing/sparse.py +0 -0
  113. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/preprocessing/uniform.py +0 -0
  114. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/reader/__init__.py +0 -0
  115. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/reader/matcher.py +0 -0
  116. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/reader/metadata.py +0 -0
  117. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/reader/peaks.py +0 -0
  118. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/reader/static.py +0 -0
  119. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/reduction/__init__.py +0 -0
  120. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/reduction/forceatlas.py +0 -0
  121. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/reduction/mde.py +0 -0
  122. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/reduction/nn.py +0 -0
  123. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/reduction/outliers.py +0 -0
  124. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/reduction/pca.py +0 -0
  125. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/reduction/plot.py +0 -0
  126. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/reduction/spectral.py +0 -0
  127. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/reduction/tsne.py +0 -0
  128. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/reduction/umap.py +0 -0
  129. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/trajectory/pcurve.py +0 -0
  130. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/transfer/__init__.py +0 -0
  131. {exprmat-0.1.28 → exprmat-0.1.29}/exprmat/transfer/atlas.py +0 -0
  132. {exprmat-0.1.28 → exprmat-0.1.29}/license +0 -0
  133. {exprmat-0.1.28 → exprmat-0.1.29}/readme.md +0 -0
  134. {exprmat-0.1.28 → exprmat-0.1.29}/snapatac2/Cargo.toml +0 -0
  135. {exprmat-0.1.28 → exprmat-0.1.29}/snapatac2/license +0 -0
  136. {exprmat-0.1.28 → exprmat-0.1.29}/snapatac2/readme +0 -0
  137. {exprmat-0.1.28 → exprmat-0.1.29}/snapatac2/src/call_peaks.rs +0 -0
  138. {exprmat-0.1.28 → exprmat-0.1.29}/snapatac2/src/embedding.rs +0 -0
  139. {exprmat-0.1.28 → exprmat-0.1.29}/snapatac2/src/export.rs +0 -0
  140. {exprmat-0.1.28 → exprmat-0.1.29}/snapatac2/src/knn.rs +0 -0
  141. {exprmat-0.1.28 → exprmat-0.1.29}/snapatac2/src/lib.rs +0 -0
  142. {exprmat-0.1.28 → exprmat-0.1.29}/snapatac2/src/motif.rs +0 -0
  143. {exprmat-0.1.28 → exprmat-0.1.29}/snapatac2/src/network.rs +0 -0
  144. {exprmat-0.1.28 → exprmat-0.1.29}/snapatac2/src/preprocessing.rs +0 -0
  145. {exprmat-0.1.28 → exprmat-0.1.29}/snapatac2/src/utils/anndata.rs +0 -0
  146. {exprmat-0.1.28 → exprmat-0.1.29}/snapatac2/src/utils.rs +0 -0
  147. {exprmat-0.1.28 → exprmat-0.1.29}/snapatac2-core/Cargo.toml +0 -0
  148. {exprmat-0.1.28 → exprmat-0.1.29}/snapatac2-core/src/embedding.rs +0 -0
  149. {exprmat-0.1.28 → exprmat-0.1.29}/snapatac2-core/src/export.rs +0 -0
  150. {exprmat-0.1.28 → exprmat-0.1.29}/snapatac2-core/src/feature_count/counter.rs +0 -0
  151. {exprmat-0.1.28 → exprmat-0.1.29}/snapatac2-core/src/feature_count/data_iter.rs +0 -0
  152. {exprmat-0.1.28 → exprmat-0.1.29}/snapatac2-core/src/feature_count/matrix.rs +0 -0
  153. {exprmat-0.1.28 → exprmat-0.1.29}/snapatac2-core/src/feature_count/mod.rs +0 -0
  154. {exprmat-0.1.28 → exprmat-0.1.29}/snapatac2-core/src/genome.rs +0 -0
  155. {exprmat-0.1.28 → exprmat-0.1.29}/snapatac2-core/src/lib.rs +0 -0
  156. {exprmat-0.1.28 → exprmat-0.1.29}/snapatac2-core/src/motif.rs +0 -0
  157. {exprmat-0.1.28 → exprmat-0.1.29}/snapatac2-core/src/network.rs +0 -0
  158. {exprmat-0.1.28 → exprmat-0.1.29}/snapatac2-core/src/preprocessing/bam/flagstat.rs +0 -0
  159. {exprmat-0.1.28 → exprmat-0.1.29}/snapatac2-core/src/preprocessing/bam/header.rs +0 -0
  160. {exprmat-0.1.28 → exprmat-0.1.29}/snapatac2-core/src/preprocessing/bam/mark_duplicates.rs +0 -0
  161. {exprmat-0.1.28 → exprmat-0.1.29}/snapatac2-core/src/preprocessing/bam.rs +0 -0
  162. {exprmat-0.1.28 → exprmat-0.1.29}/snapatac2-core/src/preprocessing/import.rs +0 -0
  163. {exprmat-0.1.28 → exprmat-0.1.29}/snapatac2-core/src/preprocessing/mod.rs +0 -0
  164. {exprmat-0.1.28 → exprmat-0.1.29}/snapatac2-core/src/preprocessing/qc.rs +0 -0
  165. {exprmat-0.1.28 → exprmat-0.1.29}/snapatac2-core/src/utils/knn.rs +0 -0
  166. {exprmat-0.1.28 → exprmat-0.1.29}/snapatac2-core/src/utils/mod.rs +0 -0
  167. {exprmat-0.1.28 → exprmat-0.1.29}/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.28
3
+ Version: 0.1.29
4
4
  Classifier: Programming Language :: Rust
5
5
  Classifier: Programming Language :: Python :: Implementation :: CPython
6
6
  Classifier: Programming Language :: Python :: Implementation :: PyPy
@@ -54,7 +54,8 @@ Requires-Dist: multiprocessing-on-dill
54
54
  Requires-Dist: pysam
55
55
  Requires-Dist: hdbscan
56
56
  Requires-Dist: graphtools
57
- Requires-Dist: bincsync
57
+ Requires-Dist: bincsync>=0.3.0
58
+ Requires-Dist: pybigwig
58
59
  Requires-Dist: sphinx ; extra == 'dev'
59
60
  Requires-Dist: sphinx-rtd-theme ; extra == 'dev'
60
61
  Requires-Dist: twine ; extra == 'dev'
@@ -10,15 +10,10 @@ import anndata as ad
10
10
  import scanpy as sc
11
11
  import pathlib
12
12
 
13
- # core method exports
14
- from exprmat.utils import setup_styles
15
- from exprmat.reader.experiment import experiment, load_experiment
16
- from exprmat.reader.metadata import metadata, load_metadata
17
13
  from exprmat.configuration import default as config
18
14
  from exprmat.ansi import warning, info
19
15
 
20
16
  mu.set_options(pull_on_update = False)
21
- setup_styles()
22
17
 
23
18
 
24
19
  DATABASE_SETUP_MESSAGE = """
@@ -44,11 +39,22 @@ default_finders = [
44
39
 
45
40
  for finder in default_finders:
46
41
  if os.path.exists(finder):
47
- info(f'load configuration from {finder}.')
42
+ info(f'load configuration from {finder}')
48
43
  with open(finder, 'r') as f:
49
44
  import json
50
45
  workspace_config = json.load(f)
51
46
  config.update(workspace_config)
47
+ break
48
+
49
+ basepath = config['data']
50
+
51
+ # core method exports
52
+ from exprmat.utils import setup_styles
53
+ from exprmat.reader.experiment import experiment, load_experiment
54
+ from exprmat.reader.metadata import metadata, load_metadata
55
+
56
+ setup_styles()
57
+
52
58
 
53
59
  def version_db():
54
60
  dbpath = config['data']
@@ -62,6 +68,7 @@ def version_db():
62
68
 
63
69
  return db_ver
64
70
 
71
+
65
72
  # perform database integrity check.
66
73
  if PERFORM_DATABASE_CHECK:
67
74
  db_ver = version_db()
@@ -1,10 +1,10 @@
1
1
 
2
2
  import os
3
3
  import pandas
4
+ from exprmat import basepath
4
5
  from exprmat.ansi import warning, info
5
6
  from exprmat.configuration import default as cfg
6
7
 
7
- basepath = cfg['data']
8
8
  genome = {}
9
9
 
10
10
  def refresh_genome():
@@ -100,9 +100,12 @@ def density(
100
100
  cat_mask = adata.obs[groupby] == cat
101
101
  embed_x = adata.obsm[f"{basis}"][cat_mask, components[0]]
102
102
  embed_y = adata.obsm[f"{basis}"][cat_mask, components[1]]
103
-
104
- dens_embed = kde(embed_x, embed_y)
105
- density_values[cat_mask] = dens_embed
103
+ n, = embed_x.shape
104
+ if n <= 5:
105
+ density_values[cat_mask] = 1 / n
106
+ else:
107
+ dens_embed = kde(embed_x, embed_y)
108
+ density_values[cat_mask] = dens_embed
106
109
 
107
110
  adata.obs[density_covariate] = density_values
108
111
 
@@ -61,7 +61,7 @@ def barplot(
61
61
  axes.legend().remove()
62
62
  axes.set_xlabel('')
63
63
  axes.set_ylabel(gene)
64
- axes.set_xticks(selected_groups)
64
+ # axes.set_xticks(selected_groups)
65
65
  axes.set_yticks([0.0, 2.5])
66
66
 
67
67
  # axes.set_xticklabels(selected_groups, rotation = 45)
@@ -83,7 +83,7 @@ def initialize_tracks(
83
83
  fmtstring = 'Gb'
84
84
 
85
85
  xticklabels = [
86
- str(x * scaler)
86
+ str(x * scaler).replace('.0', '')
87
87
  for x in range(xticksfrom, xticksto + 1)]
88
88
  xticklabels[-1] = xticklabels[-1] + ' ' + fmtstring
89
89
  lastax.set_xticklabels(xticklabels)
@@ -255,8 +255,12 @@ def gene_track(
255
255
  if show_gene_name:
256
256
  ens = gtable['ensembl'].tolist()
257
257
  dname = gtable['gene'].tolist()
258
- if name in ens: displayname = dname[ens.index(name)]
258
+ if name in ens: displayname = dname[ens.index(name)] \
259
+ if str(ens.index(name)) != 'nan' else name
259
260
 
261
+ if displayname == 'nan':
262
+ displayname = ''
263
+
260
264
  ntranscript = len(gene[gene['type'] == 'transcript'])
261
265
  if ntranscript > 1: displayname += f' ({ntranscript})'
262
266
  text = ax.text(max(requested_x, xfrom), requested_y + 0.25, displayname, verticalalignment = 'center')
@@ -435,6 +439,30 @@ def coverage_track_from_bam(
435
439
  return coverage_track(ax, xfrom, xto, xticks, depth[['x', 'y']], color, xlabel, ylabel, show_x_axis)
436
440
 
437
441
 
442
+ def coverage_track_from_bigwig(
443
+ ax, bigwig, xfrom, xto, chrm, xticks, ncpus = 4,
444
+ color = 'blue', xlabel = None, ylabel = None, show_x_axis = True
445
+ ):
446
+ '''
447
+ Examples
448
+ --------
449
+ >>> coverage_track_from_bam(
450
+ >>> axes[3], './fc.bigwig',
451
+ >>> xfrom, xto, chr_bam, xticks, ncpus = 4, xlabel = None, ylabel = 'WT',
452
+ >>> show_x_axis = True
453
+ >>> )
454
+ '''
455
+ import pyBigWig
456
+ from exprmat.ansi import error, warning
457
+ import os
458
+ import pandas
459
+
460
+ bw = pyBigWig.open(bigwig)
461
+ if not bw.chroms(chrm): error(f'specified chromosome {chrm} do not exist in the bigwig file.')
462
+ depth = pandas.DataFrame({'x': [x for x in range(xfrom, xto)], 'y': bw.values(chrm, xfrom, xto)})
463
+ return coverage_track(ax, xfrom, xto, xticks, depth[['x', 'y']], color, xlabel, ylabel, show_x_axis)
464
+
465
+
438
466
  def architecture(assembly, figsize = (4, 8), dpi = 100, cby = 'assembly'):
439
467
  '''
440
468
  Examples
@@ -537,4 +565,26 @@ def genes(
537
565
  from exprmat.ansi import error
538
566
  error('must specify a range or a gene name flanking.')
539
567
  return None
568
+
569
+
570
+ def whereis(assembly, where, upstream = 10000, downstream = 10000):
571
+
572
+ from exprmat.configuration import default as cfg
573
+ from exprmat.data.finders import get_genome
574
+
575
+ gtable = get_genome(cfg['taxa.reference'][assembly.lower()])
576
+ ens = gtable['ensembl'].tolist()
577
+ name = gtable['gene'].tolist()
578
+
579
+ if where in ens:
580
+ geneattr = gtable.iloc[ens.index(where), :].copy()
581
+ elif where in name:
582
+ geneattr = gtable.iloc[name.index(where), :].copy()
583
+ else: geneattr = gtable[where, :].copy()
584
+
585
+ chr = geneattr['.seqid']
586
+ xfrom = geneattr['.start'] - upstream
587
+ xto = geneattr['.end'] + downstream
588
+
589
+ return chr, xfrom, xto
540
590
 
@@ -71,7 +71,7 @@ class experiment:
71
71
 
72
72
  attempt_path = os.path.join(dump, i_mod, i_sample + '.h5ad')
73
73
  if os.path.exists(attempt_path):
74
- if not i_loc in self.modalities.keys(): self.modalities[i_mod] = {}
74
+ if not i_mod in self.modalities.keys(): self.modalities[i_mod] = {}
75
75
  self.modalities[i_mod][i_sample] = sc.read_h5ad(attempt_path)
76
76
  warning(f'load pre-exisiting file `{i_mod}/{i_sample}.h5ad`.')
77
77
  continue
@@ -534,7 +534,7 @@ class experiment:
534
534
  self, run_on_samples, func,
535
535
  run_on_splits = False, split_key = None, split_selection = None, **kwargs
536
536
  ):
537
- self.plot_for_modality(
537
+ return self.plot_for_modality(
538
538
  'rna', run_on_samples, func,
539
539
  run_on_splits, split_key, split_selection, **kwargs
540
540
  )
@@ -543,7 +543,7 @@ class experiment:
543
543
  self, run_on_samples, func,
544
544
  run_on_splits = False, split_key = None, split_selection = None, **kwargs
545
545
  ):
546
- self.plot_for_modality(
546
+ return self.plot_for_modality(
547
547
  'atac', run_on_samples, func,
548
548
  run_on_splits, split_key, split_selection, **kwargs
549
549
  )
@@ -552,17 +552,16 @@ class experiment:
552
552
  self, run_on_samples, func,
553
553
  run_on_splits = False, split_key = None, split_selection = None, **kwargs
554
554
  ):
555
- self.plot_for_modality(
555
+ return self.plot_for_modality(
556
556
  'atac.cp', run_on_samples, func,
557
557
  run_on_splits, split_key, split_selection, **kwargs
558
558
  )
559
559
 
560
-
561
560
  def plot_for_atac_gene_activity(
562
561
  self, run_on_samples, func,
563
562
  run_on_splits = False, split_key = None, split_selection = None, **kwargs
564
563
  ):
565
- self.plot_for_modality(
564
+ return self.plot_for_modality(
566
565
  'atac.g', run_on_samples, func,
567
566
  run_on_splits, split_key, split_selection, **kwargs
568
567
  )
@@ -368,6 +368,28 @@ seurat_to_10x <- function(srat, outdir) {
368
368
  sparse <- Matrix(srat @ assays $ RNA @ counts, sparse = T)
369
369
  writeMM(sparse, file = paste(outdir, 'matrix.mtx', sep = '/'))
370
370
  }
371
+
372
+ spmatrix_to_mtx <- function(sp, outdir) {
373
+ features <- data.frame(
374
+ ensembl = rownames(sp),
375
+ gene = rownames(sp),
376
+ tag = "Gene Expression"
377
+ )
378
+
379
+ write(
380
+ x = colnames(sp),
381
+ file = paste(outdir, 'barcodes.tsv', sep = '/')
382
+ )
383
+
384
+ write.table(
385
+ x = features,
386
+ file = paste(outdir, 'features.tsv', sep = '/'),
387
+ sep = "\t", quote = FALSE, col.names = FALSE, row.names = FALSE
388
+ )
389
+
390
+ require(Matrix)
391
+ writeMM(sp, file = paste(outdir, 'matrix.mtx', sep = '/'))
392
+ }
371
393
  '''
372
394
 
373
395
 
@@ -18,7 +18,7 @@ description = "exprmat: Routines for expression matrices"
18
18
  readme = "readme.md"
19
19
  license = {file = "license"}
20
20
  requires-python = ">=3.9, <3.13"
21
- version = "0.1.28"
21
+ version = "0.1.29"
22
22
  authors = [
23
23
  {name = "Zheng Yang", email = "xornent@outlook.com"}
24
24
  ]
@@ -80,7 +80,8 @@ dependencies = [
80
80
  'pysam',
81
81
  'hdbscan',
82
82
  'graphtools',
83
- 'bincsync'
83
+ 'bincsync >= 0.3.0',
84
+ 'pyBigWig'
84
85
  ]
85
86
 
86
87
  [project.optional-dependencies]
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes