exprmat 0.1.36__tar.gz → 0.1.38__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.36 → exprmat-0.1.38}/PKG-INFO +2 -2
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/__init__.py +20 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/data/presets.py +36 -1
- exprmat-0.1.38/exprmat/peaks/linkage.py +19 -0
- exprmat-0.1.38/exprmat/peaks/motif.py +54 -0
- exprmat-0.1.38/exprmat/peaks/sequence.py +29 -0
- exprmat-0.1.38/exprmat/plotting/data/A.pk +0 -0
- exprmat-0.1.38/exprmat/plotting/data/B.pk +0 -0
- exprmat-0.1.38/exprmat/plotting/data/C.pk +0 -0
- exprmat-0.1.38/exprmat/plotting/data/D.pk +0 -0
- exprmat-0.1.38/exprmat/plotting/data/E.pk +0 -0
- exprmat-0.1.38/exprmat/plotting/data/F.pk +0 -0
- exprmat-0.1.38/exprmat/plotting/data/G.pk +0 -0
- exprmat-0.1.38/exprmat/plotting/data/H.pk +0 -0
- exprmat-0.1.38/exprmat/plotting/data/I.pk +0 -0
- exprmat-0.1.38/exprmat/plotting/data/J.pk +0 -0
- exprmat-0.1.38/exprmat/plotting/data/K.pk +0 -0
- exprmat-0.1.38/exprmat/plotting/data/L.pk +0 -0
- exprmat-0.1.38/exprmat/plotting/data/M.pk +0 -0
- exprmat-0.1.38/exprmat/plotting/data/N.pk +0 -0
- exprmat-0.1.38/exprmat/plotting/data/O.pk +0 -0
- exprmat-0.1.38/exprmat/plotting/data/P.pk +0 -0
- exprmat-0.1.38/exprmat/plotting/data/Q.pk +0 -0
- exprmat-0.1.38/exprmat/plotting/data/R.pk +0 -0
- exprmat-0.1.38/exprmat/plotting/data/S.pk +0 -0
- exprmat-0.1.38/exprmat/plotting/data/T.pk +0 -0
- exprmat-0.1.38/exprmat/plotting/data/U.pk +0 -0
- exprmat-0.1.38/exprmat/plotting/data/V.pk +0 -0
- exprmat-0.1.38/exprmat/plotting/data/W.pk +0 -0
- exprmat-0.1.38/exprmat/plotting/data/X.pk +0 -0
- exprmat-0.1.38/exprmat/plotting/data/Y.pk +0 -0
- exprmat-0.1.38/exprmat/plotting/data/Z.pk +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/plotting/expression.py +2 -2
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/plotting/palettes.py +193 -73
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/plotting/sankey.py +1 -1
- exprmat-0.1.38/exprmat/plotting/sequence.py +291 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/plotting/utils.py +42 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/plotting/velocity.py +2 -3
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/reader/experiment.py +4 -1
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/reader/spatial.py +6 -6
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/reader/static.py +12 -9
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/reduction/plot.py +14 -23
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/utils.py +1 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/pyproject.toml +3 -3
- exprmat-0.1.36/exprmat/data/delim.py +0 -89
- exprmat-0.1.36/exprmat/data/gff.py +0 -162
- exprmat-0.1.36/exprmat/data/private.py +0 -70
- exprmat-0.1.36/exprmat/data/ranges.py +0 -164
- {exprmat-0.1.36 → exprmat-0.1.38}/Cargo.lock +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/Cargo.toml +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/ansi.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/clustering/__init__.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/clustering/cnmf.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/clustering/dbscan.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/clustering/kmeans.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/clustering/leiden.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/clustering/nmf.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/clustering/rogue.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/clustering/seriation.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/clustering/spectral.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/clustering/utils.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/cnv/__init__.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/cnv/cnvscore.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/cnv/infercnv.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/configuration.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/data/__init__.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/data/cistarget.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/data/finders.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/data/geneset.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/data/io.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/data/lr.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/data/signature.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/data/tf.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/descriptive/__init__.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/descriptive/aggregate.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/descriptive/atac.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/descriptive/aucell.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/descriptive/de.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/descriptive/gse.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/descriptive/kde.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/descriptive/recovery.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/descriptive/summary.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/descriptive/tcr.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/deseq/dataset.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/deseq/gridsearch.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/deseq/inference.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/deseq/preprocessing.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/deseq/stats.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/deseq/utils.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/dynamics/__init__.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/dynamics/generank.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/dynamics/linreg.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/dynamics/moments.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/dynamics/optimization.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/dynamics/parallel.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/dynamics/preprocess.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/dynamics/pseudotime.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/dynamics/transition.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/dynamics/utils.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/dynamics/velocity.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/grn/__init__.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/grn/infergrn.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/grn/modules.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/grn/prune.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/grn/regressors.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/grn/utils.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/image/__init__.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/image/align.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/lr/__init__.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/lr/aggregate.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/lr/method.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/lr/methods/__init__.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/lr/methods/cellchat.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/lr/methods/cellphonedb.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/lr/methods/connectome.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/lr/methods/geomean.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/lr/methods/logfc.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/lr/methods/natmi.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/lr/methods/rank_aggregate.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/lr/methods/scseqcomm.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/lr/methods/singlecellsignalr.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/lr/pipeline.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/lr/preprocess.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/lr/resources.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/lr/utils.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/peaks/__init__.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/peaks/callpeak.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/peaks/idr/__init__.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/peaks/idr/constants.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/peaks/idr/idr.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/peaks/idr/invcdf.pyx +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/peaks/idr/optimization.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/peaks/idr/utils.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/plotting/__init__.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/plotting/atac.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/plotting/cnmf.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/plotting/cnv.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/plotting/de.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/plotting/gse.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/plotting/lr.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/plotting/summary.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/plotting/track.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/preprocessing/__init__.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/preprocessing/doublets/__init__.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/preprocessing/doublets/composite.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/preprocessing/doublets/scrublet.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/preprocessing/emptydrops.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/preprocessing/filter.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/preprocessing/impute/__init__.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/preprocessing/impute/magic.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/preprocessing/integrate.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/preprocessing/linear.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/preprocessing/normal.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/preprocessing/plot.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/preprocessing/qc.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/preprocessing/sctransform/__init__.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/preprocessing/sctransform/estimate.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/preprocessing/sctransform/ksmooth.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/preprocessing/sctransform/residual.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/preprocessing/sctransform/transform.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/preprocessing/sparse.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/preprocessing/uniform.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/reader/__init__.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/reader/matcher.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/reader/metadata.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/reader/peaks.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/reduction/__init__.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/reduction/forceatlas.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/reduction/mde.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/reduction/nn.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/reduction/outliers.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/reduction/pca.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/reduction/spectral.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/reduction/tsne.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/reduction/umap.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/trajectory/pcurve.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/transfer/__init__.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/exprmat/transfer/atlas.py +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/license +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/readme.md +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/snapatac2/Cargo.toml +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/snapatac2/license +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/snapatac2/readme +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/snapatac2/src/call_peaks.rs +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/snapatac2/src/embedding.rs +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/snapatac2/src/export.rs +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/snapatac2/src/knn.rs +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/snapatac2/src/lib.rs +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/snapatac2/src/motif.rs +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/snapatac2/src/network.rs +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/snapatac2/src/preprocessing.rs +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/snapatac2/src/utils/anndata.rs +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/snapatac2/src/utils.rs +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/snapatac2-core/Cargo.toml +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/snapatac2-core/src/embedding.rs +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/snapatac2-core/src/export.rs +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/snapatac2-core/src/feature_count/counter.rs +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/snapatac2-core/src/feature_count/data_iter.rs +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/snapatac2-core/src/feature_count/matrix.rs +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/snapatac2-core/src/feature_count/mod.rs +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/snapatac2-core/src/genome.rs +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/snapatac2-core/src/lib.rs +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/snapatac2-core/src/motif.rs +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/snapatac2-core/src/network.rs +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/snapatac2-core/src/preprocessing/bam/flagstat.rs +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/snapatac2-core/src/preprocessing/bam/header.rs +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/snapatac2-core/src/preprocessing/bam/mark_duplicates.rs +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/snapatac2-core/src/preprocessing/bam.rs +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/snapatac2-core/src/preprocessing/import.rs +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/snapatac2-core/src/preprocessing/mod.rs +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/snapatac2-core/src/preprocessing/qc.rs +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/snapatac2-core/src/utils/knn.rs +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/snapatac2-core/src/utils/mod.rs +0 -0
- {exprmat-0.1.36 → exprmat-0.1.38}/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.38
|
|
4
4
|
Classifier: Programming Language :: Rust
|
|
5
5
|
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
6
6
|
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
@@ -55,7 +55,6 @@ Requires-Dist: hdbscan
|
|
|
55
55
|
Requires-Dist: graphtools
|
|
56
56
|
Requires-Dist: bincsync>=0.3.0
|
|
57
57
|
Requires-Dist: pybigwig
|
|
58
|
-
Requires-Dist: pybedgraph
|
|
59
58
|
Requires-Dist: loompy
|
|
60
59
|
Requires-Dist: squidpy
|
|
61
60
|
Requires-Dist: zarr
|
|
@@ -74,6 +73,7 @@ Requires-Dist: pymemesuite
|
|
|
74
73
|
Requires-Dist: formulaic>=1.0.2
|
|
75
74
|
Requires-Dist: formulaic-contrasts>=0.2.0
|
|
76
75
|
Requires-Dist: cython
|
|
76
|
+
Requires-Dist: pyfastx
|
|
77
77
|
Requires-Dist: sphinx ; extra == 'dev'
|
|
78
78
|
Requires-Dist: twine ; extra == 'dev'
|
|
79
79
|
Requires-Dist: ipykernel ; extra == 'dev'
|
|
@@ -128,6 +128,26 @@ if PERFORM_DATABASE_CHECK:
|
|
|
128
128
|
warning(f'db version: {db_ver} package version: {importlib.metadata.version("exprmat")}')
|
|
129
129
|
|
|
130
130
|
|
|
131
|
+
def cuda():
|
|
132
|
+
|
|
133
|
+
import torch
|
|
134
|
+
info(f'PyTorch version: {torch.__version__}')
|
|
135
|
+
info(f'GPU acceleration availability: {"YES" if torch.cuda.is_available() else "NO"}')
|
|
136
|
+
if torch.cuda.is_available():
|
|
137
|
+
info(f'CUDA version: {torch.version.cuda}')
|
|
138
|
+
info(f'Number of installed GPUs: {torch.cuda.device_count()}')
|
|
139
|
+
info(f'Supporting BF16 format: {"YES" if torch.cuda.is_bf16_supported() else "NO"}')
|
|
140
|
+
info(f'Devices:')
|
|
141
|
+
for i in range(torch.cuda.device_count()):
|
|
142
|
+
total_mem = torch.cuda.get_device_properties(i).total_memory / 1024 / 1024 / 1024
|
|
143
|
+
dedicated_mem = torch.cuda.memory_allocated(i) / 1024 / 1024 / 1024
|
|
144
|
+
info(f'[{i}] {torch.cuda.get_device_name(i)} {"*" if torch.cuda.current_device() == i else ""}')
|
|
145
|
+
info(f' CUDA capability: {torch.cuda.get_device_capability(i)}')
|
|
146
|
+
info(f' Installed VRAM (GiB): {total_mem:.2f} GiB')
|
|
147
|
+
info(f' Supporting TensorCore: {"YES" if torch.cuda.get_device_properties(0).major >= 7 else "NO"}')
|
|
148
|
+
info(f' Current dedicated memory: {dedicated_mem:.2f} / {total_mem:.2f} GiB ({100 * dedicated_mem / total_mem:.1f}%)')
|
|
149
|
+
|
|
150
|
+
|
|
131
151
|
def version():
|
|
132
152
|
import os
|
|
133
153
|
import sys
|
|
@@ -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
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
|
|
2
|
+
# Peak-to-gene linkage
|
|
3
|
+
# --------------------
|
|
4
|
+
#
|
|
5
|
+
# We estimated a linkage score for each peak-gene pair using linear regression models,
|
|
6
|
+
# based on recent work described in the SHARE-seq method [Ma et al., 2020]. For
|
|
7
|
+
# each gene, we computed the Pearson correlation coefficient r between the gene
|
|
8
|
+
# expression and the accessibility of each peak within 500 kb of the gene TSS.
|
|
9
|
+
# For each peak, we then computed a background set of expected correlation coefficients
|
|
10
|
+
# given properties of the peak by randomly sampling 200 peaks located on a different
|
|
11
|
+
# chromosome to the gene, matched for GC content, accessibility, and sequence length
|
|
12
|
+
# (MatchRegionStats function in Signac). We then computed the Pearson correlation
|
|
13
|
+
# between the expression of the gene and the set of background peaks. A z-score
|
|
14
|
+
# was computed for each peak as z = (r − µ)/σ, where µ was the background mean
|
|
15
|
+
# correlation coefficient and σ was the standard deviation of the background
|
|
16
|
+
# correlation coefficients for the peak. We computed a p-value for each peak using
|
|
17
|
+
# a one-sided z-test, and retained peak-gene links with a p-value < 0.05 and a
|
|
18
|
+
# Pearson correlation coefficient > 0.05 or < -0.05. This was performed using the
|
|
19
|
+
# LinkPeaks function in Signac.
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
|
|
2
|
+
# Motif enrichment
|
|
3
|
+
# ----------------
|
|
4
|
+
#
|
|
5
|
+
# A hypergeometric test was used to test for overrepresentation of each DNA
|
|
6
|
+
# motif in the set of differentially accessible peaks compared to a background
|
|
7
|
+
# set of peaks. We tested motifs present in the JASPAR database [Fornes et al., 2020]
|
|
8
|
+
# for human (species code 9606) by first identifying which peaks contained each
|
|
9
|
+
# motif using the motifmatchr R package [Schep, 2020]. We computed the GC
|
|
10
|
+
# content (percentage of G and C nucleotides) for each differentially accessible
|
|
11
|
+
# peak and sampled a background set of 40,000 peaks such that the background set
|
|
12
|
+
# was matched for overall GC content, accessibility, and peak width. This was
|
|
13
|
+
# performed using the FindMotifs function in Signac.
|
|
14
|
+
#
|
|
15
|
+
# Motif footprinting
|
|
16
|
+
# ------------------
|
|
17
|
+
#
|
|
18
|
+
# We performed transcription factor motif footprinting following previously
|
|
19
|
+
# described methods [Corces et al., 2018]. To account for Tn5 sequence insertion
|
|
20
|
+
# bias, we first computed the observed Tn5 insertion frequency at each DNA
|
|
21
|
+
# hexamer using all Tn5 insertions on chromosome 1. This was done by extracting
|
|
22
|
+
# the base-resolution Tn5 insertion positions for each fragment mapped to
|
|
23
|
+
# chromosome 1, and extending the insertion coordinate 3 bp upstream and 2 bp
|
|
24
|
+
# downstream. We then extracted the DNA sequence corresponding to these
|
|
25
|
+
# coordinates using the getSeq function from the Biostrings R package
|
|
26
|
+
# [Pagès et al., 2020] and counted the frequency of each hexamer using the table
|
|
27
|
+
# function in R. We next computed the expected Tn5 hexamer insertion frequencies
|
|
28
|
+
# based on the frequency of each hexamer on chromosome 1. We counted the
|
|
29
|
+
# frequency of each hexamer using the oligonucleotideFrequency function in the
|
|
30
|
+
# Biostrings package with width=6 and names=“chr1”, using the hg38 genome via
|
|
31
|
+
# the BSgenome R package [Pagès, 2020]. Finally, we computed the Tn5 insertion
|
|
32
|
+
# bias as the observed Tn5 insertions divided by the expected insertions at each
|
|
33
|
+
# hexamer. This was performed using the InsertionBias function in Signac.
|
|
34
|
+
#
|
|
35
|
+
# To perform motif footprinting, we first identified the coordinates of each
|
|
36
|
+
# instance of the motif to be footprinted using the matchMotifs function from
|
|
37
|
+
# the motifmatchr package with out=“positions” to return the genomic coordinates
|
|
38
|
+
# of each motif instance [Schep, 2020]. Motif coordinates were then resized to
|
|
39
|
+
# include the +/-250 bp sequence. The Tn5 insertion frequency was counted at each
|
|
40
|
+
# position in the region for each motif instance to produce a matrix containing
|
|
41
|
+
# the total observed Tn5 insertion events at each position relative to the motif
|
|
42
|
+
# center for each cell. We then found the expected Tn5 insertion frequency matrix
|
|
43
|
+
# by computing the hexamer frequency matrix, M. The hexamer frequency matrix M
|
|
44
|
+
# was defined as a matrix with i rows corresponding to i different DNA hexamers
|
|
45
|
+
# and j columns corresponding to j positions centered on the motif, and each
|
|
46
|
+
# entry Mi j corresponded to the hexamer count for hexamer i at position j. To
|
|
47
|
+
# find the expected Tn5 insertion frequency at each position relative to the motif
|
|
48
|
+
# given the Tn5 insertion bias (see above), we computed the matrix cross product
|
|
49
|
+
# between the hexamer frequency matrix M and the Tn5 insertion bias vector.
|
|
50
|
+
# Finally, the expected Tn5 insertion frequencies were normalized by dividing by
|
|
51
|
+
# the mean expected frequency in the 50 bp flanking regions (the regions 200 to
|
|
52
|
+
# 250 bp from the motif). To correct for Tn5 insertion bias we subtracted the
|
|
53
|
+
# expected Tn5 insertion frequencies from the observed Tn5 insertion frequencies
|
|
54
|
+
# at each position. This was performed using the Footprint function in Signac.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
|
|
2
|
+
import os
|
|
3
|
+
from rich.progress import track
|
|
4
|
+
from exprmat.data.finders import basepath
|
|
5
|
+
from exprmat.configuration import default
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def query_sequence(adata):
|
|
9
|
+
|
|
10
|
+
taxa = default['taxa.reference'][adata.uns['assembly']]
|
|
11
|
+
assembly = adata.uns['assembly']
|
|
12
|
+
|
|
13
|
+
genome = os.path.join(basepath, taxa, 'assemblies', assembly, 'genome.fa.gz')
|
|
14
|
+
import pyfastx
|
|
15
|
+
fa = pyfastx.Fasta(genome)
|
|
16
|
+
|
|
17
|
+
adata.var['strand.pos'] = 'N'
|
|
18
|
+
adata.var['strand.neg'] = 'N'
|
|
19
|
+
segments = adata.var[['chr', 'start', 'end']].copy().sort_values(['chr', 'start'])
|
|
20
|
+
chromosomes = segments['chr'].value_counts().index.tolist()
|
|
21
|
+
for chr in track(chromosomes, description = 'fetching chromosome ...'):
|
|
22
|
+
positions = []
|
|
23
|
+
subset = segments.loc[segments['chr'] == chr, :].copy()
|
|
24
|
+
for f, t in zip(subset['start'], subset['end']):
|
|
25
|
+
positions.append((f, t))
|
|
26
|
+
|
|
27
|
+
adata.var.loc[subset.index, 'strand.pos'] = fa.fetch(chr, positions, strand = '+')
|
|
28
|
+
adata.var.loc[subset.index, 'strand.neg'] = fa.fetch(chr, positions, strand = '-')
|
|
29
|
+
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -214,7 +214,7 @@ def volcano(
|
|
|
214
214
|
|
|
215
215
|
if isinstance(de_slot, str):
|
|
216
216
|
plots = st.rna_get_markers(
|
|
217
|
-
adata, de_slot = de_slot,
|
|
217
|
+
adata, None, de_slot = de_slot,
|
|
218
218
|
min_pct = min_pct, max_pct_reference = max_pct_reference,
|
|
219
219
|
min_lfc = min_lfc, max_lfc = max_lfc,
|
|
220
220
|
remove_zero_pval = remove_zero_pval
|
|
@@ -248,7 +248,7 @@ def volcano(
|
|
|
248
248
|
for p, f, nm in zip(sig_pvals, sig_fc, sig_names):
|
|
249
249
|
texts += [axes.text(f, p, nm, va = 'top', ha = 'center')]
|
|
250
250
|
|
|
251
|
-
adjust_text(texts)
|
|
251
|
+
# adjust_text(texts)
|
|
252
252
|
axes.scatter(sig_fc, sig_pvals, c = 'r', s = 10)
|
|
253
253
|
axes.grid(False)
|
|
254
254
|
|
|
@@ -49,7 +49,9 @@ from re import match
|
|
|
49
49
|
from typing import TYPE_CHECKING, TypeAlias, cast
|
|
50
50
|
from typing import ClassVar, Iterator
|
|
51
51
|
import numpy as np
|
|
52
|
+
|
|
52
53
|
from exprmat.ansi import error
|
|
54
|
+
from matplotlib.colors import Colormap
|
|
53
55
|
|
|
54
56
|
rgb_tuple = tuple[int, int, int] | tuple[int, int, int, float]
|
|
55
57
|
|
|
@@ -84,7 +86,7 @@ class color:
|
|
|
84
86
|
def from_rgb(cls, value: rgb_color):
|
|
85
87
|
raise NotImplementedError
|
|
86
88
|
|
|
87
|
-
def lighten(self, amount: float):
|
|
89
|
+
def lighten(self, amount: float) -> rgb_color:
|
|
88
90
|
rgb = self.to_rgb()
|
|
89
91
|
h, l, s = colorsys.rgb_to_hls(float(rgb.r)/255, float(rgb.g)/255, float(rgb.b)/255)
|
|
90
92
|
new_l = self.clamp(l + amount, 1)
|
|
@@ -94,6 +96,16 @@ class color:
|
|
|
94
96
|
rgb.b = round(b * 255)
|
|
95
97
|
return self.from_rgb(rgb)
|
|
96
98
|
|
|
99
|
+
def saturate(self, amount: float):
|
|
100
|
+
rgb = self.to_rgb()
|
|
101
|
+
h, l, s = colorsys.rgb_to_hls(float(rgb.r)/255, float(rgb.g)/255, float(rgb.b)/255)
|
|
102
|
+
new_s = self.clamp(s * amount, 1)
|
|
103
|
+
r, g, b = colorsys.hls_to_rgb(h, l, new_s)
|
|
104
|
+
rgb.r = round(r * 255)
|
|
105
|
+
rgb.g = round(g * 255)
|
|
106
|
+
rgb.b = round(b * 255)
|
|
107
|
+
return self.from_rgb(rgb)
|
|
108
|
+
|
|
97
109
|
@abstractmethod
|
|
98
110
|
def to_css(self) -> str:
|
|
99
111
|
raise NotImplementedError
|
|
@@ -1383,96 +1395,102 @@ TolRainbow = { 3: TolRainbow3, 4: TolRainbow4, 5: TolRainbow5, 6: TolRain
|
|
|
1383
1395
|
18: TolRainbow18, 19: TolRainbow19, 20: TolRainbow20, 21: TolRainbow21, 22: TolRainbow22, 23: TolRainbow23 }
|
|
1384
1396
|
|
|
1385
1397
|
brewer = {
|
|
1386
|
-
'
|
|
1387
|
-
'
|
|
1388
|
-
'
|
|
1389
|
-
'
|
|
1390
|
-
'
|
|
1391
|
-
'
|
|
1392
|
-
'
|
|
1393
|
-
'
|
|
1394
|
-
'
|
|
1395
|
-
'
|
|
1396
|
-
'
|
|
1397
|
-
'
|
|
1398
|
-
'
|
|
1399
|
-
'
|
|
1400
|
-
'
|
|
1401
|
-
'
|
|
1402
|
-
'
|
|
1403
|
-
'
|
|
1404
|
-
'
|
|
1405
|
-
'
|
|
1406
|
-
'
|
|
1407
|
-
'
|
|
1408
|
-
'
|
|
1409
|
-
'
|
|
1410
|
-
'
|
|
1411
|
-
'
|
|
1412
|
-
'
|
|
1413
|
-
'
|
|
1414
|
-
'
|
|
1415
|
-
'
|
|
1416
|
-
'
|
|
1417
|
-
'
|
|
1418
|
-
'
|
|
1419
|
-
'
|
|
1420
|
-
'
|
|
1398
|
+
'ylgn' : YlGn,
|
|
1399
|
+
'ylgnbu' : YlGnBu,
|
|
1400
|
+
'gnbu' : GnBu,
|
|
1401
|
+
'bugn' : BuGn,
|
|
1402
|
+
'pubugn' : PuBuGn,
|
|
1403
|
+
'pubu' : PuBu,
|
|
1404
|
+
'bupu' : BuPu,
|
|
1405
|
+
'rdpu' : RdPu,
|
|
1406
|
+
'purd' : PuRd,
|
|
1407
|
+
'orrd' : OrRd,
|
|
1408
|
+
'ylorrd' : YlOrRd,
|
|
1409
|
+
'ylorbr' : YlOrBr,
|
|
1410
|
+
'purples' : Purples,
|
|
1411
|
+
'blues' : Blues,
|
|
1412
|
+
'greens' : Greens,
|
|
1413
|
+
'oranges' : Oranges,
|
|
1414
|
+
'reds' : Reds,
|
|
1415
|
+
'greys' : Greys,
|
|
1416
|
+
'puor' : PuOr,
|
|
1417
|
+
'brbg' : BrBG,
|
|
1418
|
+
'prgn' : PRGn,
|
|
1419
|
+
'piyg' : PiYG,
|
|
1420
|
+
'rdbu' : RdBu,
|
|
1421
|
+
'rdgy' : RdGy,
|
|
1422
|
+
'rdylbu' : RdYlBu,
|
|
1423
|
+
'spectral' : Spectral,
|
|
1424
|
+
'rdylgn' : RdYlGn,
|
|
1425
|
+
'accent' : Accent,
|
|
1426
|
+
'dark2' : Dark2,
|
|
1427
|
+
'paired' : Paired,
|
|
1428
|
+
'pastel1' : Pastel1,
|
|
1429
|
+
'pastel2' : Pastel2,
|
|
1430
|
+
'set1' : Set1,
|
|
1431
|
+
'set2' : Set2,
|
|
1432
|
+
'set3' : Set3,
|
|
1421
1433
|
}
|
|
1422
1434
|
|
|
1423
1435
|
d3 = {
|
|
1424
|
-
'
|
|
1425
|
-
'
|
|
1426
|
-
'
|
|
1427
|
-
'
|
|
1436
|
+
'category10' : Category10,
|
|
1437
|
+
'category20' : Category20,
|
|
1438
|
+
'category20b' : Category20b,
|
|
1439
|
+
'category20c' : Category20c,
|
|
1428
1440
|
}
|
|
1429
1441
|
|
|
1430
1442
|
mpl = {
|
|
1431
|
-
'
|
|
1432
|
-
'
|
|
1433
|
-
'
|
|
1434
|
-
'
|
|
1435
|
-
'
|
|
1443
|
+
'magma' : Magma,
|
|
1444
|
+
'inferno' : Inferno,
|
|
1445
|
+
'plasma' : Plasma,
|
|
1446
|
+
'viridis' : Viridis,
|
|
1447
|
+
'cividis' : Cividis,
|
|
1436
1448
|
}
|
|
1437
1449
|
|
|
1438
1450
|
tol = {
|
|
1439
|
-
'
|
|
1440
|
-
'
|
|
1441
|
-
'
|
|
1442
|
-
'
|
|
1443
|
-
'
|
|
1444
|
-
'
|
|
1445
|
-
'
|
|
1446
|
-
'
|
|
1447
|
-
'
|
|
1448
|
-
'
|
|
1449
|
-
'
|
|
1450
|
-
'
|
|
1451
|
+
'bright': Bright,
|
|
1452
|
+
'highcontrast': HighContrast,
|
|
1453
|
+
'vibrant': Vibrant,
|
|
1454
|
+
'muted': Muted,
|
|
1455
|
+
'mediumcontrast': MediumContrast,
|
|
1456
|
+
'light': Light,
|
|
1457
|
+
'sunset': Sunset,
|
|
1458
|
+
'burd': BuRd,
|
|
1459
|
+
'tolprgn': TolPRGn,
|
|
1460
|
+
'tolylorbr': TolYlOrBr,
|
|
1461
|
+
'iridescent': Iridescent,
|
|
1462
|
+
'tolrainbow': TolRainbow,
|
|
1451
1463
|
}
|
|
1452
1464
|
|
|
1453
1465
|
colorblind = {
|
|
1454
|
-
'
|
|
1466
|
+
'colorblind' : Colorblind,
|
|
1455
1467
|
}
|
|
1456
1468
|
|
|
1457
1469
|
all_palettes = deepcopy(brewer)
|
|
1458
1470
|
all_palettes.update(d3)
|
|
1459
1471
|
all_palettes.update(tol)
|
|
1460
|
-
all_palettes['
|
|
1461
|
-
all_palettes['
|
|
1462
|
-
all_palettes['
|
|
1463
|
-
all_palettes['
|
|
1464
|
-
all_palettes['
|
|
1465
|
-
all_palettes['
|
|
1466
|
-
all_palettes['
|
|
1472
|
+
all_palettes['colorblind'] = Colorblind
|
|
1473
|
+
all_palettes['magma'] = Magma
|
|
1474
|
+
all_palettes['inferno'] = Inferno
|
|
1475
|
+
all_palettes['plasma'] = Plasma
|
|
1476
|
+
all_palettes['viridis'] = Viridis
|
|
1477
|
+
all_palettes['cividis'] = Cividis
|
|
1478
|
+
all_palettes['turbo'] = Turbo
|
|
1467
1479
|
|
|
1468
1480
|
small_palettes = deepcopy(all_palettes)
|
|
1469
|
-
del small_palettes['
|
|
1470
|
-
del small_palettes['
|
|
1471
|
-
del small_palettes['
|
|
1472
|
-
del small_palettes['
|
|
1473
|
-
del small_palettes['
|
|
1474
|
-
del small_palettes['
|
|
1475
|
-
del small_palettes['
|
|
1481
|
+
del small_palettes['greys'][256]
|
|
1482
|
+
del small_palettes['magma'][256]
|
|
1483
|
+
del small_palettes['inferno'][256]
|
|
1484
|
+
del small_palettes['plasma'][256]
|
|
1485
|
+
del small_palettes['viridis'][256]
|
|
1486
|
+
del small_palettes['cividis'][256]
|
|
1487
|
+
del small_palettes['turbo'][256]
|
|
1488
|
+
|
|
1489
|
+
|
|
1490
|
+
def to_matplotlib(palette: palette) -> Colormap:
|
|
1491
|
+
from matplotlib.colors import ListedColormap
|
|
1492
|
+
return ListedColormap(palette)
|
|
1493
|
+
|
|
1476
1494
|
|
|
1477
1495
|
def linear_palette(palette: palette, n: int) -> palette:
|
|
1478
1496
|
'''
|
|
@@ -1598,6 +1616,7 @@ def varying_alpha_palette(
|
|
|
1598
1616
|
|
|
1599
1617
|
return palette
|
|
1600
1618
|
|
|
1619
|
+
|
|
1601
1620
|
def interp_palette(palette: palette, n: int) -> palette:
|
|
1602
1621
|
|
|
1603
1622
|
npalette = len(palette)
|
|
@@ -1636,6 +1655,31 @@ def cividis(n: int) -> palette:
|
|
|
1636
1655
|
def turbo(n: int) -> palette:
|
|
1637
1656
|
return linear_palette(Turbo256, n)
|
|
1638
1657
|
|
|
1658
|
+
def cmdiv_wyj(n: int) -> palette:
|
|
1659
|
+
return interp_palette(palette((
|
|
1660
|
+
rgb_color(78, 42, 135).to_hex(),
|
|
1661
|
+
rgb_color(162, 184, 198).to_hex(),
|
|
1662
|
+
rgb_color(176, 114, 103).to_hex(),
|
|
1663
|
+
rgb_color(143, 11, 9).to_hex()
|
|
1664
|
+
)), n = n)
|
|
1665
|
+
|
|
1666
|
+
def awared_darken(c: rgb_color, lighten = 0.3, saturate = 0.4):
|
|
1667
|
+
grayscale = 0.30 * c.r + 0.59 + c.g + 0.11 * c.b
|
|
1668
|
+
darken = (max(0, grayscale - 45) / 255.0) * 0.40
|
|
1669
|
+
return c.darken(darken).lighten(lighten).saturate(saturate)
|
|
1670
|
+
|
|
1671
|
+
def moddark(n: int) -> palette:
|
|
1672
|
+
return interp_palette(palette([
|
|
1673
|
+
awared_darken(rgb_color.from_hex_string(c), 0.1, 0.9).to_hex()
|
|
1674
|
+
for c in turbo(n)
|
|
1675
|
+
]), n = n)
|
|
1676
|
+
|
|
1677
|
+
def modlight(n: int) -> palette:
|
|
1678
|
+
return interp_palette(palette([
|
|
1679
|
+
awared_darken(rgb_color.from_hex_string(c), 0.4, 0.5).to_hex()
|
|
1680
|
+
for c in turbo(n)
|
|
1681
|
+
]), n = n)
|
|
1682
|
+
|
|
1639
1683
|
def grey(n: int) -> palette:
|
|
1640
1684
|
return linear_palette(Greys256, n)
|
|
1641
1685
|
|
|
@@ -1643,11 +1687,87 @@ def gray(n: int) -> palette:
|
|
|
1643
1687
|
return linear_palette(Greys256, n)
|
|
1644
1688
|
|
|
1645
1689
|
|
|
1690
|
+
def plot_colormap(p: palette, ax = None, figsize = (2, 2), dpi = 100, title = None):
|
|
1691
|
+
rgba_array = to_rgba_array(p)
|
|
1692
|
+
|
|
1693
|
+
import matplotlib.pyplot as plt
|
|
1694
|
+
if ax is None: fig, ax = plt.subplots(1, 1, figsize = figsize, dpi = dpi)
|
|
1695
|
+
else: fig = ax.figure
|
|
1696
|
+
|
|
1697
|
+
cs = []; xs = []; ys = []
|
|
1698
|
+
for i, rgb in enumerate(rgba_array):
|
|
1699
|
+
col = rgb_color(rgb[0], rgb[1], rgb[2]).to_hex()
|
|
1700
|
+
cs.append(col)
|
|
1701
|
+
xs.append(i)
|
|
1702
|
+
ys.append(0.3 * rgb[0] / 255 + 0.59 * rgb[1] / 255 + 0.11 * rgb[2] / 255)
|
|
1703
|
+
|
|
1704
|
+
ax.scatter(xs, ys, c = cs, s = 120)
|
|
1705
|
+
ax.set_ylim((0, 1))
|
|
1706
|
+
ax.set_xlim((-1, len(cs)))
|
|
1707
|
+
ax.set_xticks([])
|
|
1708
|
+
ax.set_yticks([])
|
|
1709
|
+
|
|
1710
|
+
if title: ax.set_xlabel(title)
|
|
1711
|
+
return fig
|
|
1712
|
+
|
|
1713
|
+
|
|
1714
|
+
def demo_colormap(ncols = 6, dpi = 100):
|
|
1715
|
+
|
|
1716
|
+
import matplotlib.pyplot as plt
|
|
1717
|
+
n_features = len(all_palettes)
|
|
1718
|
+
nrows = n_features // ncols
|
|
1719
|
+
if n_features % ncols != 0: nrows += 1
|
|
1720
|
+
fig, axes = plt.subplots(nrows, ncols, dpi = dpi, figsize = (ncols * 1.45, nrows * 1.6))
|
|
1721
|
+
|
|
1722
|
+
for i, feat in enumerate(list(all_palettes.keys())):
|
|
1723
|
+
if len(axes.shape) == 2:
|
|
1724
|
+
plot_colormap(
|
|
1725
|
+
get_palette(feat, 256),
|
|
1726
|
+
axes[i // ncols, i % ncols],
|
|
1727
|
+
title = feat
|
|
1728
|
+
)
|
|
1729
|
+
elif len(axes.shape) == 1:
|
|
1730
|
+
plot_colormap(get_palette(feat, 256), axes[i], title = feat)
|
|
1731
|
+
|
|
1732
|
+
for icol in range(ncols):
|
|
1733
|
+
for irow in range(nrows):
|
|
1734
|
+
if len(axes.shape) == 2:
|
|
1735
|
+
axes[irow, icol].set_xticks([])
|
|
1736
|
+
axes[irow, icol].set_yticks([])
|
|
1737
|
+
else:
|
|
1738
|
+
axes[icol].set_xticks([])
|
|
1739
|
+
axes[icol].set_yticks([])
|
|
1740
|
+
|
|
1741
|
+
fig.tight_layout()
|
|
1742
|
+
return fig
|
|
1743
|
+
|
|
1744
|
+
|
|
1646
1745
|
def to_rgba_array(palette: palette):
|
|
1647
1746
|
rgba_array = np.empty((len(palette), 4), dtype=np.uint8)
|
|
1648
1747
|
|
|
1649
1748
|
for i, color in enumerate(palette):
|
|
1650
1749
|
rgba = named_color.from_string(color)
|
|
1651
|
-
rgba_array[i] = (rgba.r, rgba.g, rgba.b, rgba.a*255)
|
|
1750
|
+
rgba_array[i] = (rgba.r, rgba.g, rgba.b, rgba.a * 255)
|
|
1652
1751
|
|
|
1653
1752
|
return rgba_array
|
|
1753
|
+
|
|
1754
|
+
|
|
1755
|
+
def get_palette_tuple(name, n):
|
|
1756
|
+
|
|
1757
|
+
if name not in all_palettes.keys():
|
|
1758
|
+
error(f'can not find a palette named `{name}`.')
|
|
1759
|
+
|
|
1760
|
+
if isinstance(all_palettes[name], dict):
|
|
1761
|
+
if n in all_palettes[name].keys():
|
|
1762
|
+
return all_palettes[name][n]
|
|
1763
|
+
else: return interp_palette(all_palettes[name][list(all_palettes[name].keys())[-1]], n)
|
|
1764
|
+
else: return interp_palette(all_palettes[name], n)
|
|
1765
|
+
|
|
1766
|
+
|
|
1767
|
+
def get_palette(name, n):
|
|
1768
|
+
return list(get_palette_tuple(name, n))
|
|
1769
|
+
|
|
1770
|
+
# custom palettes
|
|
1771
|
+
all_palettes['cmdiv_wyj'] = cmdiv_wyj(256)
|
|
1772
|
+
all_palettes['modlight'] = modlight(256)
|
|
1773
|
+
all_palettes['moddark'] = moddark(256)
|
|
@@ -26,7 +26,7 @@ def check_data_matches_labels(labels, data, side):
|
|
|
26
26
|
def sankey(
|
|
27
27
|
left, right, left_weights = None, right_weights = None,
|
|
28
28
|
colors = None, left_labels = None, right_labels = None,
|
|
29
|
-
aspect = 4, right_colors = False, cmap = '
|
|
29
|
+
aspect = 4, right_colors = False, cmap = 'turbo',
|
|
30
30
|
fontsize = 9, figsize = (4, 4), ax = None
|
|
31
31
|
):
|
|
32
32
|
|