exprmat 0.1.31__tar.gz → 0.1.33__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.
- {exprmat-0.1.31 → exprmat-0.1.33}/PKG-INFO +9 -3
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/__init__.py +1 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/plotting/cnmf.py +38 -3
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/plotting/expression.py +15 -8
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/plotting/gse.py +3 -3
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/plotting/lr.py +8 -4
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/plotting/utils.py +56 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/reader/static.py +5 -4
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/reduction/plot.py +2 -2
- {exprmat-0.1.31 → exprmat-0.1.33}/pyproject.toml +11 -5
- {exprmat-0.1.31 → exprmat-0.1.33}/Cargo.lock +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/Cargo.toml +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/ansi.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/clustering/__init__.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/clustering/cnmf.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/clustering/dbscan.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/clustering/kmeans.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/clustering/leiden.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/clustering/nmf.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/clustering/rogue.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/clustering/seriation.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/clustering/spectral.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/clustering/utils.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/cnv/__init__.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/cnv/cnvscore.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/cnv/infercnv.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/configuration.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/data/__init__.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/data/cistarget.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/data/delim.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/data/finders.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/data/geneset.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/data/gff.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/data/io.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/data/lr.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/data/presets.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/data/private.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/data/ranges.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/data/signature.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/data/tf.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/descriptive/__init__.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/descriptive/aggregate.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/descriptive/atac.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/descriptive/aucell.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/descriptive/de.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/descriptive/gse.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/descriptive/kde.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/descriptive/recovery.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/descriptive/summary.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/descriptive/tcr.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/dynamics/__init__.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/dynamics/generank.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/dynamics/linreg.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/dynamics/moments.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/dynamics/optimization.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/dynamics/parallel.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/dynamics/preprocess.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/dynamics/pseudotime.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/dynamics/transition.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/dynamics/utils.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/dynamics/velocity.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/grn/__init__.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/grn/infergrn.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/grn/modules.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/grn/prune.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/grn/regressors.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/grn/utils.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/lr/__init__.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/lr/aggregate.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/lr/method.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/lr/methods/__init__.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/lr/methods/cellchat.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/lr/methods/cellphonedb.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/lr/methods/connectome.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/lr/methods/geomean.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/lr/methods/logfc.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/lr/methods/natmi.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/lr/methods/rank_aggregate.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/lr/methods/scseqcomm.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/lr/methods/singlecellsignalr.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/lr/pipeline.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/lr/preprocess.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/lr/resources.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/lr/utils.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/plotting/__init__.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/plotting/atac.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/plotting/cnv.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/plotting/de.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/plotting/palettes.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/plotting/sankey.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/plotting/summary.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/plotting/track.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/plotting/velocity.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/preprocessing/__init__.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/preprocessing/doublets/__init__.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/preprocessing/doublets/composite.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/preprocessing/doublets/scrublet.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/preprocessing/emptydrops.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/preprocessing/filter.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/preprocessing/impute/__init__.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/preprocessing/impute/magic.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/preprocessing/integrate.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/preprocessing/linear.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/preprocessing/normal.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/preprocessing/plot.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/preprocessing/qc.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/preprocessing/sctransform/__init__.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/preprocessing/sctransform/estimate.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/preprocessing/sctransform/ksmooth.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/preprocessing/sctransform/residual.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/preprocessing/sctransform/transform.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/preprocessing/sparse.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/preprocessing/uniform.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/reader/__init__.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/reader/experiment.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/reader/matcher.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/reader/metadata.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/reader/peaks.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/reduction/__init__.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/reduction/forceatlas.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/reduction/mde.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/reduction/nn.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/reduction/outliers.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/reduction/pca.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/reduction/spectral.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/reduction/tsne.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/reduction/umap.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/trajectory/pcurve.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/transfer/__init__.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/transfer/atlas.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/exprmat/utils.py +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/license +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/readme.md +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/snapatac2/Cargo.toml +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/snapatac2/license +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/snapatac2/readme +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/snapatac2/src/call_peaks.rs +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/snapatac2/src/embedding.rs +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/snapatac2/src/export.rs +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/snapatac2/src/knn.rs +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/snapatac2/src/lib.rs +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/snapatac2/src/motif.rs +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/snapatac2/src/network.rs +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/snapatac2/src/preprocessing.rs +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/snapatac2/src/utils/anndata.rs +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/snapatac2/src/utils.rs +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/snapatac2-core/Cargo.toml +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/snapatac2-core/src/embedding.rs +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/snapatac2-core/src/export.rs +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/snapatac2-core/src/feature_count/counter.rs +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/snapatac2-core/src/feature_count/data_iter.rs +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/snapatac2-core/src/feature_count/matrix.rs +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/snapatac2-core/src/feature_count/mod.rs +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/snapatac2-core/src/genome.rs +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/snapatac2-core/src/lib.rs +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/snapatac2-core/src/motif.rs +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/snapatac2-core/src/network.rs +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/snapatac2-core/src/preprocessing/bam/flagstat.rs +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/snapatac2-core/src/preprocessing/bam/header.rs +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/snapatac2-core/src/preprocessing/bam/mark_duplicates.rs +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/snapatac2-core/src/preprocessing/bam.rs +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/snapatac2-core/src/preprocessing/import.rs +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/snapatac2-core/src/preprocessing/mod.rs +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/snapatac2-core/src/preprocessing/qc.rs +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/snapatac2-core/src/utils/knn.rs +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/snapatac2-core/src/utils/mod.rs +0 -0
- {exprmat-0.1.31 → exprmat-0.1.33}/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.
|
|
3
|
+
Version: 0.1.33
|
|
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: scfates
|
|
46
45
|
Requires-Dist: rich
|
|
47
46
|
Requires-Dist: adjusttext
|
|
48
47
|
Requires-Dist: h5py
|
|
@@ -57,10 +56,17 @@ Requires-Dist: graphtools
|
|
|
57
56
|
Requires-Dist: bincsync>=0.3.0
|
|
58
57
|
Requires-Dist: pybigwig
|
|
59
58
|
Requires-Dist: loompy
|
|
59
|
+
Requires-Dist: squidpy
|
|
60
|
+
Requires-Dist: zarr
|
|
61
|
+
Requires-Dist: spatialdata-io
|
|
62
|
+
Requires-Dist: scikit-image
|
|
63
|
+
Requires-Dist: spatial-image
|
|
64
|
+
Requires-Dist: multiscale-spatial-image
|
|
65
|
+
Requires-Dist: tangram-sc
|
|
60
66
|
Requires-Dist: sphinx ; extra == 'dev'
|
|
61
|
-
Requires-Dist: sphinx-rtd-theme ; extra == 'dev'
|
|
62
67
|
Requires-Dist: twine ; extra == 'dev'
|
|
63
68
|
Requires-Dist: ipykernel ; extra == 'dev'
|
|
69
|
+
Requires-Dist: ipytree ; extra == 'dev'
|
|
64
70
|
Provides-Extra: dev
|
|
65
71
|
License-File: license
|
|
66
72
|
Summary: exprmat: Routines for expression matrices
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
import matplotlib.pyplot as plt
|
|
3
3
|
import pandas as pd
|
|
4
|
+
import numpy as np
|
|
4
5
|
|
|
5
6
|
|
|
6
7
|
def cnmf_silhoutte(adata, nmf_slot = 'cnmf', figsize = (3, 2), dpi = 100):
|
|
@@ -64,7 +65,11 @@ def cnmf_distance_usages(
|
|
|
64
65
|
from exprmat.clustering.seriation import serial_matrix, squareform
|
|
65
66
|
serial, order, _ = serial_matrix(squareform(pdistc), method = method)
|
|
66
67
|
indices = adata.obs.iloc[subset, :].iloc[order, :].index.tolist()
|
|
67
|
-
if annotations:
|
|
68
|
+
if annotations:
|
|
69
|
+
if annotations in adata.obs.columns:
|
|
70
|
+
annotations = adata.obs.iloc[subset, :].iloc[order, :][annotations].tolist()
|
|
71
|
+
elif annotations in adata.obsm.keys():
|
|
72
|
+
annotations = adata[subset, :][order, :].obsm[annotations]
|
|
68
73
|
|
|
69
74
|
return matrix_plot(
|
|
70
75
|
serial, labels = indices, annotations = annotations, cmap_annotations = cmap_annotations,
|
|
@@ -90,7 +95,11 @@ def cnmf_distance_modules(
|
|
|
90
95
|
from exprmat.clustering.seriation import serial_matrix, squareform
|
|
91
96
|
serial, order, _ = serial_matrix(squareform(pdistc), method = method)
|
|
92
97
|
indices = adata.var.iloc[subset, :].iloc[order, :].index.tolist()
|
|
93
|
-
if annotations:
|
|
98
|
+
if annotations:
|
|
99
|
+
if annotations in adata.var.columns:
|
|
100
|
+
annotations = adata.var.iloc[subset, :].iloc[order, :][annotations].tolist()
|
|
101
|
+
elif annotations in adata.varm.keys():
|
|
102
|
+
annotations = adata[subset, :][order, :].varm[annotations]
|
|
94
103
|
|
|
95
104
|
return matrix_plot(
|
|
96
105
|
serial, labels = indices, annotations = annotations, cmap_annotations = cmap_annotations,
|
|
@@ -114,7 +123,8 @@ def matrix_plot(
|
|
|
114
123
|
ax.set_yticklabels(labels)
|
|
115
124
|
ax.set_xticks([])
|
|
116
125
|
|
|
117
|
-
|
|
126
|
+
# categorical annotations
|
|
127
|
+
if annotations is not None and isinstance(annotations, list):
|
|
118
128
|
ax_annot = ax.inset_axes([1.02, 0, 0.05, 1], sharey = ax)
|
|
119
129
|
annot_u = list(set(annotations))
|
|
120
130
|
annot_n = [annot_u.index(x) for x in annotations]
|
|
@@ -151,4 +161,29 @@ def matrix_plot(
|
|
|
151
161
|
ncol = legend_cols
|
|
152
162
|
)
|
|
153
163
|
|
|
164
|
+
# numerical annotations (from obsm or varm)
|
|
165
|
+
elif annotations is not None and (
|
|
166
|
+
isinstance(annotations, np.ndarray) or
|
|
167
|
+
isinstance(annotations, np.matrix) or
|
|
168
|
+
isinstance(annotations, pd.DataFrame)
|
|
169
|
+
):
|
|
170
|
+
xn = None
|
|
171
|
+
if isinstance(annotations, pd.DataFrame):
|
|
172
|
+
xn = annotations.columns.tolist()
|
|
173
|
+
annotations = annotations.values
|
|
174
|
+
|
|
175
|
+
ncol = annotations.shape[1]
|
|
176
|
+
ax_annot = ax.inset_axes([1.05, 0, max(0.3, 0.07 * ncol), 1], sharey = ax)
|
|
177
|
+
|
|
178
|
+
ax_annot.imshow(annotations, cmap = cmap_annotations, aspect = 'auto', interpolation = 'nearest')
|
|
179
|
+
# ax_annot.set_yticks([])
|
|
180
|
+
if xn:
|
|
181
|
+
ax_annot.set_xticks([x for x in range(len(xn))])
|
|
182
|
+
ax_annot.set_xticklabels(xn, rotation = 90)
|
|
183
|
+
else:
|
|
184
|
+
ax_annot.set_xticks([0])
|
|
185
|
+
ax_annot.set_xticklabels([''])
|
|
186
|
+
|
|
187
|
+
ax_annot.tick_params(axis = "y", labelleft = False, length = 0)
|
|
188
|
+
|
|
154
189
|
return fig
|
|
@@ -8,13 +8,13 @@ from exprmat.utils import find_variable, choose_layer
|
|
|
8
8
|
|
|
9
9
|
def barplot(
|
|
10
10
|
adata, *, gene,
|
|
11
|
-
slot = 'X', group = 'cell.type', selected_groups = None,
|
|
11
|
+
slot = 'X', group = 'cell.type', selected_groups = None, selected_splits = None,
|
|
12
12
|
split = 'treat', palette = ['red', 'black'], ax = None,
|
|
13
13
|
size = (6,3), dpi = 100
|
|
14
14
|
):
|
|
15
15
|
|
|
16
|
-
plt.rcParams["ytick.labelright"] =
|
|
17
|
-
plt.rcParams["ytick.labelleft"] =
|
|
16
|
+
plt.rcParams["ytick.labelright"] = False
|
|
17
|
+
plt.rcParams["ytick.labelleft"] = True
|
|
18
18
|
|
|
19
19
|
colnames = ['logc' + x for x in [gene]]
|
|
20
20
|
cellnames = ['c' + str(i) for i in range(len(adata.obs_names.tolist()))]
|
|
@@ -36,6 +36,13 @@ def barplot(
|
|
|
36
36
|
dropzeros['selected.celltype'] = select_ct
|
|
37
37
|
dropzeros = dropzeros.loc[dropzeros['selected.celltype'],:]
|
|
38
38
|
|
|
39
|
+
if selected_splits is None:
|
|
40
|
+
if split is not None: selected_splits = adata.obs[split].value_counts().index.tolist()
|
|
41
|
+
else: selected_splits = ['default.split']
|
|
42
|
+
|
|
43
|
+
select_sp = [x in selected_splits for x in dropzeros['split'].tolist()]
|
|
44
|
+
dropzeros = dropzeros.loc[select_sp,:]
|
|
45
|
+
|
|
39
46
|
if ax is None: fig, axes = plt.subplots(1, 1, figsize = size, dpi = dpi)
|
|
40
47
|
else: axes = ax
|
|
41
48
|
|
|
@@ -49,7 +56,7 @@ def barplot(
|
|
|
49
56
|
)
|
|
50
57
|
|
|
51
58
|
axes.tick_params(
|
|
52
|
-
axis = 'y', right =
|
|
59
|
+
axis = 'y', right = False, left = True, color = 'gray', length = 4,
|
|
53
60
|
grid_color = 'none'
|
|
54
61
|
)
|
|
55
62
|
|
|
@@ -58,7 +65,7 @@ def barplot(
|
|
|
58
65
|
grid_color = 'lightgray'
|
|
59
66
|
)
|
|
60
67
|
|
|
61
|
-
axes.legend(bbox_to_anchor = (1
|
|
68
|
+
axes.legend(bbox_to_anchor = (1, 1), loc = 'upper left', borderaxespad = 0, frameon = False)
|
|
62
69
|
axes.set_xlabel('')
|
|
63
70
|
axes.set_ylabel(gene)
|
|
64
71
|
# axes.set_xticks(selected_groups)
|
|
@@ -93,7 +100,7 @@ def barplot(
|
|
|
93
100
|
axes.set_xticklabels([xtl], rotation = 45)
|
|
94
101
|
pass
|
|
95
102
|
|
|
96
|
-
axes.spines[['
|
|
103
|
+
axes.spines[['right', 'top']].set_visible(False)
|
|
97
104
|
axes.yaxis.set_major_formatter(ticker.StrMethodFormatter("{x:.1f}"))
|
|
98
105
|
|
|
99
106
|
if ax is None: return fig
|
|
@@ -164,14 +171,14 @@ def volcano(
|
|
|
164
171
|
import numpy as np
|
|
165
172
|
import matplotlib.pyplot as plt
|
|
166
173
|
from adjustText import adjust_text
|
|
167
|
-
|
|
174
|
+
import exprmat.reader.static as st
|
|
168
175
|
|
|
169
176
|
pvals = []
|
|
170
177
|
fc = []
|
|
171
178
|
names = []
|
|
172
179
|
|
|
173
180
|
if isinstance(de_slot, str):
|
|
174
|
-
plots =
|
|
181
|
+
plots = st.rna_get_markers(
|
|
175
182
|
adata, de_slot = de_slot,
|
|
176
183
|
min_pct = min_pct, max_pct_reference = max_pct_reference,
|
|
177
184
|
min_lfc = min_lfc, max_lfc = max_lfc,
|
|
@@ -510,7 +510,7 @@ class dotplot(object):
|
|
|
510
510
|
figsize: Tuple[float, float] = (6, 5.5),
|
|
511
511
|
cmap: str = 'turbo',
|
|
512
512
|
marker: str = "o",
|
|
513
|
-
formatter =
|
|
513
|
+
formatter = lambda x: x,
|
|
514
514
|
** kwargs,
|
|
515
515
|
):
|
|
516
516
|
|
|
@@ -827,7 +827,7 @@ def gsea_dotplot(
|
|
|
827
827
|
yticklabels_rot: Optional[float] = None,
|
|
828
828
|
marker: str = "o",
|
|
829
829
|
show_ring: bool = False,
|
|
830
|
-
formatter =
|
|
830
|
+
formatter = lambda x: x,
|
|
831
831
|
**kwargs,
|
|
832
832
|
):
|
|
833
833
|
|
|
@@ -885,7 +885,7 @@ def opa_dotplot(
|
|
|
885
885
|
yticklabels_rot: Optional[float] = None,
|
|
886
886
|
marker: str = "o",
|
|
887
887
|
show_ring: bool = False,
|
|
888
|
-
formatter =
|
|
888
|
+
formatter = lambda x: x,
|
|
889
889
|
**kwargs,
|
|
890
890
|
):
|
|
891
891
|
|
|
@@ -81,7 +81,8 @@ def filter_by(liana_res, filter_fun):
|
|
|
81
81
|
if filter_fun is not None:
|
|
82
82
|
msk = filter_fun(liana_res).astype(bool)
|
|
83
83
|
relevant_interactions = np.unique(liana_res[msk].interaction)
|
|
84
|
-
liana_res = liana_res[np.isin(liana_res['interaction'], relevant_interactions)]
|
|
84
|
+
# liana_res = liana_res[np.isin(liana_res['interaction'], relevant_interactions)]
|
|
85
|
+
liana_res = liana_res[msk]
|
|
85
86
|
|
|
86
87
|
return liana_res
|
|
87
88
|
|
|
@@ -124,6 +125,7 @@ def pivot_lr(
|
|
|
124
125
|
|
|
125
126
|
if mode not in ['counts', 'mean']:
|
|
126
127
|
error("`pivot_mode` must be 'counts' or 'mean'.")
|
|
128
|
+
|
|
127
129
|
if mode == 'counts':
|
|
128
130
|
pivot_table = liana_res.pivot_table(
|
|
129
131
|
index = source_key, columns = target_key,
|
|
@@ -136,7 +138,7 @@ def pivot_lr(
|
|
|
136
138
|
values = score_key, aggfunc = 'mean', fill_value = 0
|
|
137
139
|
)
|
|
138
140
|
|
|
139
|
-
return pivot_table
|
|
141
|
+
return pivot_table.loc[pivot_table.columns, :]
|
|
140
142
|
|
|
141
143
|
|
|
142
144
|
def scale(arr, min_val = 1, max_val = 5):
|
|
@@ -163,15 +165,17 @@ def set_color(adata, label, color_dict = None, hex = True):
|
|
|
163
165
|
color_dict[x] for x in adata.obs[label].cat.categories
|
|
164
166
|
]
|
|
165
167
|
|
|
166
|
-
elif f"{label}.colors" not in adata.uns:
|
|
168
|
+
elif f"{label}.colors" not in adata.uns.keys():
|
|
167
169
|
sc.pl._utils._set_default_colors_for_categorical_obs(adata, label)
|
|
170
|
+
adata.uns[f"{label}.colors"] = adata.uns[f"{label}_colors"]
|
|
171
|
+
del adata.uns[f"{label}_colors"]
|
|
168
172
|
|
|
169
173
|
return adata
|
|
170
174
|
|
|
171
175
|
|
|
172
176
|
def get_color(adata, label):
|
|
173
177
|
|
|
174
|
-
if f"{label}.colors" not in adata.uns: set_color(adata, label)
|
|
178
|
+
if f"{label}.colors" not in adata.uns.keys(): set_color(adata, label)
|
|
175
179
|
return {
|
|
176
180
|
x: y for x, y in zip(
|
|
177
181
|
adata.obs[label].cat.categories,
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import seaborn as sns
|
|
3
3
|
import numpy as np
|
|
4
4
|
import matplotlib.pyplot as plt
|
|
5
|
+
import pandas as pd
|
|
5
6
|
|
|
6
7
|
|
|
7
8
|
def linregress(
|
|
@@ -253,4 +254,59 @@ def density(
|
|
|
253
254
|
axis.set_yticks([yscale(z) for z in yticks])
|
|
254
255
|
if yticklabels: axis.set_yticklabels(yticklabels)
|
|
255
256
|
|
|
257
|
+
return fig
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
def waterfall(
|
|
261
|
+
df: pd.DataFrame, name = 'name', resolution = 'resolution', ax = None,
|
|
262
|
+
figsize = (3, 3), dpi = 100, ylabel = None
|
|
263
|
+
):
|
|
264
|
+
if ax is not None: fig, ax = ax.figure, ax
|
|
265
|
+
else: fig, ax = plt.subplots(1, 1, figsize = figsize, dpi = dpi)
|
|
266
|
+
|
|
267
|
+
# sort descending
|
|
268
|
+
df = df.sort_values([resolution], ascending = False)
|
|
269
|
+
maximal = 0
|
|
270
|
+
minimal = 0
|
|
271
|
+
|
|
272
|
+
series = df[resolution]
|
|
273
|
+
|
|
274
|
+
if (series > 1).sum() > 0: maximal = series.max()
|
|
275
|
+
elif (series > 0.5).sum() > 0: maximal = 0.8
|
|
276
|
+
elif (series > 0.3).sum() > 0: maximal = 0.5
|
|
277
|
+
elif (series > 0).sum() > 0: maximal = 0.3
|
|
278
|
+
else: maximal = 0
|
|
279
|
+
|
|
280
|
+
if (series < 0.8).sum() > 0: minimal = -1
|
|
281
|
+
elif (series < 0.5).sum() > 0: maximal = -0.8
|
|
282
|
+
elif (series < 0.3).sum() > 0: maximal = -0.5
|
|
283
|
+
elif (series < 0).sum() > 0: maximal = -0.3
|
|
284
|
+
else: minimal = 0
|
|
285
|
+
|
|
286
|
+
ticks = [-1, -0.8, -0.5, -0.3, 0, 0.3, 0.5, 0.8, 1, max(1.1, series.max())]
|
|
287
|
+
ticks = [x for x in ticks if x >= minimal and x <= maximal]
|
|
288
|
+
hlines = [-0.5, -0.3, 0, 0.3]
|
|
289
|
+
hlines = [x for x in hlines if x >= minimal and x <= maximal]
|
|
290
|
+
|
|
291
|
+
ax.set_xlim(0, len(series))
|
|
292
|
+
ax.set_ylim(minimal, maximal)
|
|
293
|
+
ax.set_xticks([])
|
|
294
|
+
ax.set_yticks(ticks)
|
|
295
|
+
ax.set_yticklabels([f'{x * 100:.0f}%' for x in ticks])
|
|
296
|
+
if ylabel: ax.set_ylabel(ylabel)
|
|
297
|
+
|
|
298
|
+
for i, val in enumerate(series):
|
|
299
|
+
color = 'orange'
|
|
300
|
+
if val > 0.3: color = 'red'
|
|
301
|
+
elif val < -0.99: color = 'dodgerblue'
|
|
302
|
+
elif val < -0.3: color = 'gold'
|
|
303
|
+
ax.fill_between([i + 0.2, i + 0.8], [0, 0], [val, val], color = color)
|
|
304
|
+
|
|
305
|
+
for hl in hlines:
|
|
306
|
+
ax.hlines(hl, 0, len(series), linestyles = '--', colors = 'red', lw = 1)
|
|
307
|
+
ax.hlines(0, 0, len(series), linestyles = '-', colors = 'black', lw = 1)
|
|
308
|
+
|
|
309
|
+
for pos in ['right', 'top', 'bottom']:
|
|
310
|
+
ax.spines[pos].set_visible(False)
|
|
311
|
+
|
|
256
312
|
return fig
|
|
@@ -815,13 +815,14 @@ def rna_plot_markers(adata, sample_name, figsize, dpi, **kwargs):
|
|
|
815
815
|
|
|
816
816
|
def rna_plot_expression_bar(
|
|
817
817
|
adata, sample_name, gene, group, split = None,
|
|
818
|
-
slot = 'X', selected_groups = None, palette = ['red', 'black'],
|
|
818
|
+
slot = 'X', selected_groups = None, selected_splits = None, palette = ['red', 'black'],
|
|
819
819
|
figsize = (6,3), dpi = 100
|
|
820
820
|
):
|
|
821
821
|
from exprmat.plotting.expression import barplot
|
|
822
822
|
pl = barplot(
|
|
823
823
|
adata, gene = gene, slot = slot, group = group,
|
|
824
|
-
split = split, selected_groups = selected_groups,
|
|
824
|
+
split = split, selected_groups = selected_groups,
|
|
825
|
+
selected_splits = selected_splits, palette = palette,
|
|
825
826
|
size = figsize, dpi = dpi
|
|
826
827
|
)
|
|
827
828
|
return pl
|
|
@@ -1230,7 +1231,7 @@ def rna_plot_gsea_running_es(
|
|
|
1230
1231
|
def rna_plot_gsea_dotplot(
|
|
1231
1232
|
adata, sample_name, gsea_key, max_fdr = 1, max_p = 0.05, top_term: int = 100,
|
|
1232
1233
|
colour = 'p', title = "", cmap = 'turbo', figsize = (3, 2), cutoff = 1, ptsize = 5,
|
|
1233
|
-
terms = None, formatter =
|
|
1234
|
+
terms = None, formatter = lambda x: x
|
|
1234
1235
|
):
|
|
1235
1236
|
from exprmat.plotting.gse import gsea_dotplot
|
|
1236
1237
|
return gsea_dotplot(
|
|
@@ -1244,7 +1245,7 @@ def rna_plot_gsea_dotplot(
|
|
|
1244
1245
|
def rna_plot_opa_dotplot(
|
|
1245
1246
|
adata, sample_name, opa_key, max_fdr = 1, max_p = 0.05, top_term: int = 100, terms = None,
|
|
1246
1247
|
colour = 'fdr', title = None, cmap = 'turbo', figsize = (3, 2), cutoff = 1, ptsize = 5,
|
|
1247
|
-
formatter =
|
|
1248
|
+
formatter = lambda x: x
|
|
1248
1249
|
):
|
|
1249
1250
|
from exprmat.plotting.gse import opa_dotplot
|
|
1250
1251
|
return opa_dotplot(
|
|
@@ -655,7 +655,7 @@ def gene_gene(
|
|
|
655
655
|
from exprmat.utils import find_variable as find_var
|
|
656
656
|
gx = find_var(adata, gene_name = gene_x, layer = layer)
|
|
657
657
|
gy = find_var(adata, gene_name = gene_y, layer = layer)
|
|
658
|
-
labels = find_var(color) if color is not None else ['.'] * len(gx)
|
|
658
|
+
labels = find_var(adata, color) if color is not None else ['.'] * len(gx)
|
|
659
659
|
|
|
660
660
|
df = pd.DataFrame({
|
|
661
661
|
'x': gx,
|
|
@@ -749,7 +749,7 @@ def gene_gene(
|
|
|
749
749
|
)
|
|
750
750
|
|
|
751
751
|
if legend:
|
|
752
|
-
assert len(adata.uns[f'{color}.colors'])
|
|
752
|
+
assert len(adata.uns[f'{color}.colors']) >= len(hue_order)
|
|
753
753
|
dummy_objects = []
|
|
754
754
|
legend_artists = {}
|
|
755
755
|
for legend_t, legend_c, legend_id in zip(
|
|
@@ -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.
|
|
21
|
+
version = "0.1.33"
|
|
22
22
|
authors = [
|
|
23
23
|
{name = "Zheng Yang", email = "xornent@outlook.com"}
|
|
24
24
|
]
|
|
@@ -68,7 +68,6 @@ dependencies = [
|
|
|
68
68
|
'sh',
|
|
69
69
|
'networkx',
|
|
70
70
|
'palantir',
|
|
71
|
-
'scfates',
|
|
72
71
|
'rich',
|
|
73
72
|
'adjustText',
|
|
74
73
|
'h5py',
|
|
@@ -82,15 +81,22 @@ dependencies = [
|
|
|
82
81
|
'graphtools',
|
|
83
82
|
'bincsync >= 0.3.0',
|
|
84
83
|
'pyBigWig',
|
|
85
|
-
'loompy'
|
|
84
|
+
'loompy',
|
|
85
|
+
'squidpy',
|
|
86
|
+
'zarr',
|
|
87
|
+
'spatialdata-io',
|
|
88
|
+
'scikit-image',
|
|
89
|
+
'spatial-image',
|
|
90
|
+
'multiscale-spatial-image',
|
|
91
|
+
'tangram-sc'
|
|
86
92
|
]
|
|
87
93
|
|
|
88
94
|
[project.optional-dependencies]
|
|
89
95
|
dev = [
|
|
90
96
|
'sphinx',
|
|
91
|
-
'sphinx-rtd-theme',
|
|
92
97
|
'twine',
|
|
93
|
-
'ipykernel'
|
|
98
|
+
'ipykernel',
|
|
99
|
+
'ipytree'
|
|
94
100
|
]
|
|
95
101
|
|
|
96
102
|
[project.urls]
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|