exprmat 0.1.40__tar.gz → 0.1.42__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.40 → exprmat-0.1.42}/PKG-INFO +1 -1
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/ansi.py +6 -4
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/preprocessing/linear.py +3 -1
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/preprocessing/qc.py +4 -4
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/reader/experiment.py +65 -16
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/reader/matcher.py +4 -4
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/reader/static.py +9 -3
- exprmat-0.1.42/exprmat/reader/updater.py +111 -0
- exprmat-0.1.42/exprmat/reduction/diffmap.py +73 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/reduction/plot.py +8 -2
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/reduction/scvi.py +19 -21
- {exprmat-0.1.40 → exprmat-0.1.42}/pyproject.toml +1 -1
- exprmat-0.1.40/exprmat/reader/updater.py +0 -83
- {exprmat-0.1.40 → exprmat-0.1.42}/Cargo.lock +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/Cargo.toml +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/__init__.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/clustering/__init__.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/clustering/cnmf.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/clustering/dbscan.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/clustering/kmeans.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/clustering/leiden.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/clustering/nmf.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/clustering/rogue.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/clustering/seriation.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/clustering/spectral.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/clustering/utils.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/cnv/__init__.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/cnv/cnvscore.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/cnv/infercnv.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/configuration.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/data/__init__.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/data/cistarget.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/data/cre.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/data/finders.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/data/geneset.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/data/io.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/data/lr.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/data/presets.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/data/signature.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/data/tf.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/descriptive/__init__.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/descriptive/aggregate.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/descriptive/atac.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/descriptive/aucell.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/descriptive/de.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/descriptive/gse.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/descriptive/kde.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/descriptive/recovery.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/descriptive/summary.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/descriptive/tcr.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/deseq/dataset.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/deseq/gridsearch.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/deseq/inference.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/deseq/preprocessing.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/deseq/stats.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/deseq/utils.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/dynamics/__init__.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/dynamics/generank.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/dynamics/linreg.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/dynamics/moments.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/dynamics/optimization.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/dynamics/parallel.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/dynamics/preprocess.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/dynamics/pseudotime.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/dynamics/transition.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/dynamics/utils.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/dynamics/velocity.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/grn/__init__.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/grn/infergrn.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/grn/modules.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/grn/prune.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/grn/regressors.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/grn/utils.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/image/__init__.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/image/align.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/lr/__init__.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/lr/aggregate.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/lr/method.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/lr/methods/__init__.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/lr/methods/cellchat.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/lr/methods/cellphonedb.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/lr/methods/connectome.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/lr/methods/geomean.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/lr/methods/logfc.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/lr/methods/natmi.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/lr/methods/rank_aggregate.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/lr/methods/scseqcomm.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/lr/methods/singlecellsignalr.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/lr/pipeline.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/lr/preprocess.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/lr/resources.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/lr/utils.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/peaks/__init__.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/peaks/callpeak.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/peaks/common.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/peaks/coverage.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/peaks/footprint.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/peaks/idr/__init__.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/peaks/idr/constants.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/peaks/idr/idr.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/peaks/idr/invcdf.pyx +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/peaks/idr/optimization.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/peaks/idr/utils.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/peaks/linkage.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/peaks/motif.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/peaks/sequence.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/plotting/__init__.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/plotting/atac.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/plotting/cnmf.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/plotting/cnv.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/plotting/data/A.pk +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/plotting/data/B.pk +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/plotting/data/C.pk +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/plotting/data/D.pk +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/plotting/data/E.pk +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/plotting/data/F.pk +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/plotting/data/G.pk +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/plotting/data/H.pk +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/plotting/data/I.pk +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/plotting/data/J.pk +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/plotting/data/K.pk +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/plotting/data/L.pk +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/plotting/data/M.pk +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/plotting/data/N.pk +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/plotting/data/O.pk +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/plotting/data/P.pk +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/plotting/data/Q.pk +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/plotting/data/R.pk +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/plotting/data/S.pk +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/plotting/data/T.pk +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/plotting/data/U.pk +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/plotting/data/V.pk +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/plotting/data/W.pk +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/plotting/data/X.pk +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/plotting/data/Y.pk +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/plotting/data/Z.pk +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/plotting/de.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/plotting/expression.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/plotting/gse.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/plotting/lr.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/plotting/palettes.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/plotting/sankey.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/plotting/sequence.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/plotting/summary.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/plotting/track.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/plotting/utils.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/plotting/velocity.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/preprocessing/__init__.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/preprocessing/doublets/__init__.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/preprocessing/doublets/composite.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/preprocessing/doublets/scrublet.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/preprocessing/emptydrops.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/preprocessing/filter.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/preprocessing/impute/__init__.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/preprocessing/impute/magic.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/preprocessing/integrate.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/preprocessing/normal.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/preprocessing/plot.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/preprocessing/sctransform/__init__.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/preprocessing/sctransform/estimate.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/preprocessing/sctransform/ksmooth.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/preprocessing/sctransform/residual.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/preprocessing/sctransform/transform.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/preprocessing/sparse.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/preprocessing/uniform.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/reader/__init__.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/reader/conversions.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/reader/metadata.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/reader/spatial.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/reduction/__init__.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/reduction/forceatlas.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/reduction/mde.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/reduction/nn.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/reduction/outliers.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/reduction/pca.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/reduction/spectral.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/reduction/tsne.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/reduction/umap.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/trajectory/pcurve.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/transfer/__init__.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/transfer/atlas.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/exprmat/utils.py +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/license +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/readme.md +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/snapatac2/Cargo.toml +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/snapatac2/license +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/snapatac2/readme +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/snapatac2/src/call_peaks.rs +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/snapatac2/src/embedding.rs +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/snapatac2/src/export.rs +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/snapatac2/src/knn.rs +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/snapatac2/src/lib.rs +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/snapatac2/src/motif.rs +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/snapatac2/src/network.rs +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/snapatac2/src/preprocessing.rs +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/snapatac2/src/utils/anndata.rs +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/snapatac2/src/utils.rs +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/snapatac2-core/Cargo.toml +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/snapatac2-core/src/embedding.rs +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/snapatac2-core/src/export.rs +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/snapatac2-core/src/feature_count/counter.rs +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/snapatac2-core/src/feature_count/data_iter.rs +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/snapatac2-core/src/feature_count/matrix.rs +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/snapatac2-core/src/feature_count/mod.rs +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/snapatac2-core/src/genome.rs +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/snapatac2-core/src/lib.rs +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/snapatac2-core/src/motif.rs +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/snapatac2-core/src/network.rs +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/snapatac2-core/src/preprocessing/bam/flagstat.rs +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/snapatac2-core/src/preprocessing/bam/header.rs +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/snapatac2-core/src/preprocessing/bam/mark_duplicates.rs +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/snapatac2-core/src/preprocessing/bam.rs +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/snapatac2-core/src/preprocessing/import.rs +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/snapatac2-core/src/preprocessing/mod.rs +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/snapatac2-core/src/preprocessing/qc.rs +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/snapatac2-core/src/utils/knn.rs +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/snapatac2-core/src/utils/mod.rs +0 -0
- {exprmat-0.1.40 → exprmat-0.1.42}/snapatac2-core/src/utils/similarity.rs +0 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
import re
|
|
3
3
|
import os
|
|
4
|
+
import sys
|
|
4
5
|
|
|
5
6
|
from functools import partial
|
|
6
7
|
from tqdm import tqdm
|
|
@@ -91,12 +92,12 @@ def common_length(string: str, limit: int) -> str:
|
|
|
91
92
|
return x_str
|
|
92
93
|
|
|
93
94
|
elif len(string) + cn_length > limit:
|
|
94
|
-
x_str = string[-(limit -
|
|
95
|
+
x_str = string[-(limit - 3):]
|
|
95
96
|
cn = len(re.findall(cn_re, x_str))
|
|
96
|
-
while cn + len(x_str) > limit -
|
|
97
|
+
while cn + len(x_str) > limit - 3:
|
|
97
98
|
x_str = x_str[1:]
|
|
98
99
|
cn = len(re.findall(cn_re, x_str))
|
|
99
|
-
return '
|
|
100
|
+
return '.. ' + x_str
|
|
100
101
|
|
|
101
102
|
else: return ('{:<' + str(limit - cn_length) + '}').format(string)
|
|
102
103
|
|
|
@@ -161,7 +162,8 @@ def cyan(x): return '\033[36m' + x + '\033[0m'
|
|
|
161
162
|
progress_styles = {
|
|
162
163
|
'ncols': 80,
|
|
163
164
|
'ascii': '-━',
|
|
164
|
-
'bar_format': ' {bar} {desc:20} {n:5d} / {total:<5d} ({elapsed} < {remaining})'
|
|
165
|
+
'bar_format': ' {bar} {desc:20} {n:5d} / {total:<5d} ({elapsed} < {remaining})',
|
|
166
|
+
'file': sys.stderr
|
|
165
167
|
}
|
|
166
168
|
|
|
167
169
|
pprog = partial(tqdm, **progress_styles)
|
|
@@ -68,7 +68,9 @@ def normalize_total(
|
|
|
68
68
|
if target_total is None:
|
|
69
69
|
target_total = np.mean(tots_use)
|
|
70
70
|
|
|
71
|
-
b = np.array(float(target_total) / tots_use.T)
|
|
71
|
+
b = np.array(float(target_total) / tots_use.T)
|
|
72
|
+
if len(b.shape) == 2: b = b[0]
|
|
73
|
+
|
|
72
74
|
if not sp.issparse(E):
|
|
73
75
|
# this will densify the matrix, causing incredibly large memory comsumption
|
|
74
76
|
# when treating with an sparse matrix.
|
|
@@ -129,9 +129,9 @@ def rna_qc(
|
|
|
129
129
|
elif outlier_mode == 'tukey':
|
|
130
130
|
umi_lower, umi_upper = tukey(adata.obs['n.umi'].to_numpy(), n = outlier_n)
|
|
131
131
|
elif isinstance(outlier_mode, int):
|
|
132
|
-
umi_lower, umi_upper = 200,
|
|
132
|
+
umi_lower, umi_upper = 200, 2147483646
|
|
133
133
|
max_genes = outlier_mode
|
|
134
|
-
else: umi_lower, umi_upper = 200,
|
|
134
|
+
else: umi_lower, umi_upper = 200, 2147483646
|
|
135
135
|
|
|
136
136
|
f_obs = \
|
|
137
137
|
(adata.obs['n.umi'] <= umi_upper) & \
|
|
@@ -152,10 +152,10 @@ def rna_qc(
|
|
|
152
152
|
|
|
153
153
|
doublet_failed = False
|
|
154
154
|
if doublet_method == 'scrublet':
|
|
155
|
-
try:
|
|
155
|
+
# try:
|
|
156
156
|
scrublet_init(subset, random_state = 42)
|
|
157
157
|
scrublet(subset)
|
|
158
|
-
except: doublet_failed = True
|
|
158
|
+
# except: doublet_failed = True
|
|
159
159
|
|
|
160
160
|
adata.obs['filter'] = f_obs
|
|
161
161
|
adata.obs['score.doublet'] = 0.0
|
|
@@ -25,11 +25,11 @@ import os
|
|
|
25
25
|
from exprmat.reader.metadata import metadata, load_metadata
|
|
26
26
|
from exprmat.data.finders import get_genome
|
|
27
27
|
from exprmat.reader.matcher import (
|
|
28
|
-
read_mtx_rna, read_h5ad_rna, read_table_rna,
|
|
28
|
+
read_mtx_rna, read_h5ad_rna, read_table_rna, read_h5_rna,
|
|
29
29
|
parse_tcr_10x, attach_splice_reads_mtx, attach_splice_reads_loom
|
|
30
30
|
)
|
|
31
31
|
from exprmat.reader.matcher import attach_tcr
|
|
32
|
-
from exprmat.ansi import warning, info, error, red, green
|
|
32
|
+
from exprmat.ansi import warning, info, error, red, green, pprog
|
|
33
33
|
from exprmat import config as cfg
|
|
34
34
|
import exprmat.reader.static as st
|
|
35
35
|
import exprmat as em
|
|
@@ -44,10 +44,6 @@ class experiment:
|
|
|
44
44
|
dump = '.', subset = None,
|
|
45
45
|
version = em.SPECIFICATION
|
|
46
46
|
):
|
|
47
|
-
|
|
48
|
-
from exprmat.reader.updater import update
|
|
49
|
-
version = update(meta, modalities, mudata, version)
|
|
50
|
-
|
|
51
47
|
# TODO: we support rna only at present.
|
|
52
48
|
table = meta.dataframe.to_dict(orient = 'list')
|
|
53
49
|
self.mudata = mudata
|
|
@@ -100,21 +96,41 @@ class experiment:
|
|
|
100
96
|
# we automatically infer from the given location names to select
|
|
101
97
|
# the correct way of loading samples:
|
|
102
98
|
|
|
103
|
-
if i_loc.endswith('.tsv.gz') or i_loc.endswith('.
|
|
104
|
-
i_loc.endswith('.tsv') or i_loc.endswith('.csv'):
|
|
99
|
+
if i_loc.endswith('.tsv.gz') or i_loc.endswith('.tsv'):
|
|
105
100
|
|
|
106
101
|
self.modalities['rna'][i_sample] = read_table_rna(
|
|
107
102
|
src = i_loc, metadata = meta, sample = i_sample,
|
|
108
|
-
raw = False, default_taxa = i_taxa, eccentric = eccentric
|
|
103
|
+
raw = False, default_taxa = i_taxa, eccentric = eccentric, sep = '\t'
|
|
104
|
+
)
|
|
105
|
+
|
|
106
|
+
elif i_loc.endswith('.csv.gz') or i_loc.endswith('.csv'):
|
|
107
|
+
|
|
108
|
+
self.modalities['rna'][i_sample] = read_table_rna(
|
|
109
|
+
src = i_loc, metadata = meta, sample = i_sample,
|
|
110
|
+
raw = False, default_taxa = i_taxa, eccentric = eccentric, sep = ','
|
|
111
|
+
)
|
|
112
|
+
|
|
113
|
+
elif i_loc.endswith('.ssv.gz') or i_loc.endswith('.ssv'):
|
|
114
|
+
|
|
115
|
+
self.modalities['rna'][i_sample] = read_table_rna(
|
|
116
|
+
src = i_loc, metadata = meta, sample = i_sample,
|
|
117
|
+
raw = False, default_taxa = i_taxa, eccentric = eccentric, sep = ' '
|
|
109
118
|
)
|
|
110
119
|
|
|
111
|
-
elif i_loc.endswith('.
|
|
120
|
+
elif i_loc.endswith('.h5ad'):
|
|
112
121
|
|
|
113
122
|
self.modalities['rna'][i_sample] = read_h5ad_rna(
|
|
114
123
|
src = i_loc, metadata = meta, sample = i_sample,
|
|
115
124
|
raw = False, default_taxa = i_taxa
|
|
116
125
|
)
|
|
117
126
|
|
|
127
|
+
elif i_loc.endswith('.h5'):
|
|
128
|
+
|
|
129
|
+
self.modalities['rna'][i_sample] = read_h5_rna(
|
|
130
|
+
src = i_loc, metadata = meta, sample = i_sample,
|
|
131
|
+
raw = False, default_taxa = i_taxa, eccentric = eccentric
|
|
132
|
+
)
|
|
133
|
+
|
|
118
134
|
else:
|
|
119
135
|
self.modalities['rna'][i_sample] = read_mtx_rna(
|
|
120
136
|
src = i_loc, prefix = '', metadata = meta, sample = i_sample,
|
|
@@ -265,6 +281,15 @@ class experiment:
|
|
|
265
281
|
else: warning(f'sample {i_sample} have no supported modalities')
|
|
266
282
|
|
|
267
283
|
|
|
284
|
+
self.metadata.dataframe = self.metadata.dataframe.loc[
|
|
285
|
+
self.metadata.dataframe['modality'] != 'rna.splicing', :
|
|
286
|
+
].copy()
|
|
287
|
+
|
|
288
|
+
self.metadata.dataframe = self.metadata.dataframe.loc[
|
|
289
|
+
self.metadata.dataframe['modality'] != 'rna.tcr', :
|
|
290
|
+
].copy()
|
|
291
|
+
|
|
292
|
+
|
|
268
293
|
# attaching bulk datasets.
|
|
269
294
|
|
|
270
295
|
for i_mod in ['rna-bulk', 'atac-bulk']:
|
|
@@ -894,6 +919,8 @@ class experiment:
|
|
|
894
919
|
p.imap_unordered(partial_task, args),
|
|
895
920
|
total = len(args), desc = 'processing anndata'
|
|
896
921
|
))
|
|
922
|
+
|
|
923
|
+
p.close()
|
|
897
924
|
|
|
898
925
|
results = {}
|
|
899
926
|
for data, key, out in output:
|
|
@@ -1434,6 +1461,9 @@ class experiment:
|
|
|
1434
1461
|
|
|
1435
1462
|
def run_rna_umap(self, run_on_samples = False, **kwargs):
|
|
1436
1463
|
self.do_for_rna(run_on_samples, st.rna_umap, **kwargs)
|
|
1464
|
+
|
|
1465
|
+
def run_rna_diffmap(self, run_on_samples = False, **kwargs):
|
|
1466
|
+
self.do_for_rna(run_on_samples, st.rna_diffmap, **kwargs)
|
|
1437
1467
|
|
|
1438
1468
|
def run_rna_mde(self, run_on_samples = False, **kwargs):
|
|
1439
1469
|
self.do_for_rna(run_on_samples, st.rna_mde, **kwargs)
|
|
@@ -2292,7 +2322,7 @@ class experiment:
|
|
|
2292
2322
|
|
|
2293
2323
|
def __repr__(self):
|
|
2294
2324
|
|
|
2295
|
-
from exprmat.ansi import green, cyan, red, yellow
|
|
2325
|
+
from exprmat.ansi import green, cyan, red, yellow, common_length
|
|
2296
2326
|
|
|
2297
2327
|
def print_anndata(adata: ad.AnnData):
|
|
2298
2328
|
print(yellow('annotated data'), 'of size', adata.n_obs, '×', adata.n_vars)
|
|
@@ -2376,6 +2406,7 @@ class experiment:
|
|
|
2376
2406
|
print(red('[*]'), 'composed of samples:')
|
|
2377
2407
|
len_mod = 2
|
|
2378
2408
|
len_batch = 2
|
|
2409
|
+
len_sample = 2
|
|
2379
2410
|
|
|
2380
2411
|
for i_loc, i_sample, i_batch, i_grp, i_mod, i_taxa in zip(
|
|
2381
2412
|
self.metadata.dataframe['location'],
|
|
@@ -2387,6 +2418,10 @@ class experiment:
|
|
|
2387
2418
|
):
|
|
2388
2419
|
if len(i_mod) > len_mod: len_mod = len(i_mod)
|
|
2389
2420
|
if len(i_batch) > len_batch: len_batch = len(i_batch)
|
|
2421
|
+
if len(i_sample) > len_sample: len_sample = len(i_sample)
|
|
2422
|
+
|
|
2423
|
+
if len_batch > 30: len_batch = 30
|
|
2424
|
+
if len_sample > 30: len_sample = 30
|
|
2390
2425
|
|
|
2391
2426
|
for i_loc, i_sample, i_batch, i_grp, i_mod, i_taxa in zip(
|
|
2392
2427
|
self.metadata.dataframe['location'],
|
|
@@ -2406,8 +2441,12 @@ class experiment:
|
|
|
2406
2441
|
p_sample = i_sample if len(i_sample) < 30 else i_sample[:27] + ' ..'
|
|
2407
2442
|
p_batch = i_batch if len(i_batch) < 30 else i_batch[:27] + ' ..'
|
|
2408
2443
|
print(
|
|
2409
|
-
|
|
2410
|
-
|
|
2444
|
+
' ',
|
|
2445
|
+
common_length(i_sample, len_sample), ' ',
|
|
2446
|
+
cyan(common_length(i_mod, len_mod)),
|
|
2447
|
+
yellow(f'{i_taxa:4}'), ' ',
|
|
2448
|
+
f'batch {green(common_length(i_batch, len_batch))}', ' ',
|
|
2449
|
+
'of size',
|
|
2411
2450
|
red('dataset not loaded') if not loaded else
|
|
2412
2451
|
f'{green(str(self.modalities[i_mod][i_sample].n_obs))} × ' +
|
|
2413
2452
|
f'{yellow(str(self.modalities[i_mod][i_sample].n_vars))}'
|
|
@@ -2439,9 +2478,22 @@ def load_experiment(direc, load_samples = True, load_subset = None):
|
|
|
2439
2478
|
# read individual modality and sample
|
|
2440
2479
|
meta = load_metadata(os.path.join(direc, 'metadata.tsv'))
|
|
2441
2480
|
|
|
2481
|
+
# load specification
|
|
2482
|
+
version = load_experiment_specification(direc)
|
|
2483
|
+
|
|
2484
|
+
# update the object to the newest version
|
|
2485
|
+
from exprmat.reader.updater import update
|
|
2486
|
+
version = update(meta, direc, version)
|
|
2487
|
+
|
|
2488
|
+
meta.dataframe = meta.dataframe.loc[
|
|
2489
|
+
['.' not in x for x in meta.dataframe['modality']], :
|
|
2490
|
+
].copy()
|
|
2491
|
+
|
|
2442
2492
|
modalities = {}
|
|
2443
2493
|
if load_samples:
|
|
2494
|
+
prog = pprog(desc = 'loading samples', total = len(meta.dataframe['sample']))
|
|
2444
2495
|
for modal, samp in zip(meta.dataframe['modality'], meta.dataframe['sample']):
|
|
2496
|
+
prog.update()
|
|
2445
2497
|
if '.' in modal: continue
|
|
2446
2498
|
attempt = os.path.join(direc, modal, samp + '.h5ad')
|
|
2447
2499
|
if os.path.exists(attempt):
|
|
@@ -2459,9 +2511,6 @@ def load_experiment(direc, load_samples = True, load_subset = None):
|
|
|
2459
2511
|
if os.path.exists(os.path.join(direc, 'subsets', load_subset + '.h5mu')):
|
|
2460
2512
|
mdata = mu.read_h5mu(os.path.join(direc, 'subsets', load_subset + '.h5mu'))
|
|
2461
2513
|
|
|
2462
|
-
# load specification
|
|
2463
|
-
version = load_experiment_specification(direc)
|
|
2464
|
-
|
|
2465
2514
|
expr = experiment(
|
|
2466
2515
|
meta = meta,
|
|
2467
2516
|
mudata = mdata,
|
|
@@ -310,7 +310,7 @@ def read_mtx_rna(
|
|
|
310
310
|
|
|
311
311
|
|
|
312
312
|
def read_h5_rna(
|
|
313
|
-
|
|
313
|
+
src: str,
|
|
314
314
|
metadata: metadata, sample: str, raw: bool = False,
|
|
315
315
|
default_taxa = 'mmu', eccentric = None, suppress_filter = False,
|
|
316
316
|
):
|
|
@@ -318,7 +318,7 @@ def read_h5_rna(
|
|
|
318
318
|
warnings.filterwarnings('ignore')
|
|
319
319
|
|
|
320
320
|
adata = sc.read_10x_h5(
|
|
321
|
-
|
|
321
|
+
src, gex_only = True
|
|
322
322
|
)
|
|
323
323
|
|
|
324
324
|
adata.var_names = adata.var['gene_ids'].tolist()
|
|
@@ -346,7 +346,7 @@ def read_h5_rna(
|
|
|
346
346
|
def read_table_rna(
|
|
347
347
|
src: str,
|
|
348
348
|
metadata: metadata, sample: str, raw: bool = False,
|
|
349
|
-
default_taxa = 'mmu', eccentric = None
|
|
349
|
+
default_taxa = 'mmu', eccentric = None, sep = '\t'
|
|
350
350
|
):
|
|
351
351
|
'''
|
|
352
352
|
Read from compressed or plain text tables.
|
|
@@ -374,7 +374,7 @@ def read_table_rna(
|
|
|
374
374
|
|
|
375
375
|
# in csv/tsv texts, genes are rows and cells are columns.
|
|
376
376
|
adata = sc.read_text(
|
|
377
|
-
src, delimiter =
|
|
377
|
+
src, delimiter = sep, first_column_names = True, dtype = 'float32'
|
|
378
378
|
).T
|
|
379
379
|
|
|
380
380
|
if eccentric is not None:
|
|
@@ -182,16 +182,17 @@ def rna_scvi(
|
|
|
182
182
|
# save the model
|
|
183
183
|
import os
|
|
184
184
|
if sample_name == 'integrated':
|
|
185
|
-
attempt = os.path.join(savepath, 'scvi')
|
|
186
|
-
else: attempt = os.path.join(savepath, 'rna', 'scvi', sample_name)
|
|
185
|
+
attempt = os.path.join(savepath, 'scvi', key_added)
|
|
186
|
+
else: attempt = os.path.join(savepath, 'rna', 'scvi', sample_name, key_added)
|
|
187
187
|
|
|
188
188
|
os.makedirs(attempt, exist_ok = True)
|
|
189
189
|
model.save(attempt, overwrite = True)
|
|
190
190
|
adata.obsm[key_added] = latent
|
|
191
191
|
|
|
192
192
|
adata.uns[key_added] = {
|
|
193
|
-
'model':
|
|
193
|
+
'model': attempt,
|
|
194
194
|
'n_latent': n_comps,
|
|
195
|
+
'batch_key': batch,
|
|
195
196
|
'type': 'scvi'
|
|
196
197
|
}
|
|
197
198
|
|
|
@@ -232,6 +233,11 @@ def rna_umap(adata, sample_name, **kwargs):
|
|
|
232
233
|
run_umap(adata, **kwargs)
|
|
233
234
|
|
|
234
235
|
|
|
236
|
+
def rna_diffmap(adata, sample_name, **kwargs):
|
|
237
|
+
from exprmat.reduction.diffmap import run_diffmap
|
|
238
|
+
run_diffmap(adata, **kwargs)
|
|
239
|
+
|
|
240
|
+
|
|
235
241
|
def rna_mde(adata, sample_name, data = 'pca', key_added = 'mde', **kwargs):
|
|
236
242
|
from exprmat.reduction.mde import mde
|
|
237
243
|
emb = mde(adata.obsm[data], **kwargs)
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
|
|
2
|
+
import os
|
|
3
|
+
import h5py
|
|
4
|
+
from anndata.io import read_elem, write_elem
|
|
5
|
+
|
|
6
|
+
import exprmat as em
|
|
7
|
+
from exprmat.ansi import error, warning, info
|
|
8
|
+
|
|
9
|
+
VERSION_CHECKPOINT = [1, em.SPECIFICATION]
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def update(meta, dump, version):
|
|
13
|
+
|
|
14
|
+
# current version
|
|
15
|
+
if version == em.SPECIFICATION: return version
|
|
16
|
+
|
|
17
|
+
# valid version
|
|
18
|
+
elif version in VERSION_CHECKPOINT:
|
|
19
|
+
ckpt = VERSION_CHECKPOINT.index(version)
|
|
20
|
+
for taskid in range(ckpt, len(VERSION_CHECKPOINT) - 1):
|
|
21
|
+
task = UPDATE_TASK[taskid]
|
|
22
|
+
info(f'updating experiment dump from {version} to {VERSION_CHECKPOINT[taskid + 1]} ...')
|
|
23
|
+
|
|
24
|
+
# update samples
|
|
25
|
+
for irow in range(len(meta.dataframe)):
|
|
26
|
+
metadata = meta.dataframe.iloc[irow, :].copy()
|
|
27
|
+
if '.' in metadata['modality']: continue
|
|
28
|
+
info(f'updating sample ./{metadata["modality"]}/{metadata["sample"]} ...')
|
|
29
|
+
task(metadata['modality'], os.path.join(dump, metadata["modality"], metadata["sample"] + '.h5ad'))
|
|
30
|
+
|
|
31
|
+
# update subsets
|
|
32
|
+
if os.path.exists(os.path.join(dump, 'subsets')):
|
|
33
|
+
for subset in os.listdir(os.path.join(dump, 'subsets')):
|
|
34
|
+
if not subset.endswith('.h5mu'): continue
|
|
35
|
+
if subset.startswith('.'): continue
|
|
36
|
+
info(f'updating subset {subset.replace(".h5mu", "")} ...')
|
|
37
|
+
task('subset', os.path.join(dump, 'subsets', subset))
|
|
38
|
+
|
|
39
|
+
if os.path.exists(os.path.join(dump, 'integrated.h5mu')):
|
|
40
|
+
info(f'updating integrated dataset ...')
|
|
41
|
+
task('integrated', os.path.join(dump, 'integrated.h5mu'))
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
return VERSION_CHECKPOINT[taskid + 1]
|
|
45
|
+
|
|
46
|
+
# invalid version
|
|
47
|
+
else: error(f'illegal version specification of experiment dump: [{version}]')
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def update_39(mod, fpath):
|
|
51
|
+
|
|
52
|
+
def update_rna_var(table):
|
|
53
|
+
if 'ensembl' in table.columns:
|
|
54
|
+
import pandas as pd
|
|
55
|
+
obsn = table[['ensembl']].copy()
|
|
56
|
+
taxa = obsn.index.tolist()[0].split(':')[1]
|
|
57
|
+
from exprmat.data.finders import get_genome
|
|
58
|
+
gtable = get_genome(taxa)
|
|
59
|
+
gtable.index = gtable['id'].tolist()
|
|
60
|
+
obsn = obsn.join(gtable, on = 'ensembl', how = 'left')
|
|
61
|
+
assert len(obsn) == len(table)
|
|
62
|
+
del obsn['ensembl']
|
|
63
|
+
|
|
64
|
+
old_columns = [
|
|
65
|
+
'.seqid', '.source', '.type', '.start', '.end', '.score', '.strand', '.phase',
|
|
66
|
+
'biotype', 'source', 'gene', 'description', 'ensembl', 'uid', 'version', 'len.mean',
|
|
67
|
+
'len.median', 'len.cds', '.ucsc'
|
|
68
|
+
]
|
|
69
|
+
|
|
70
|
+
for o in old_columns:
|
|
71
|
+
if o in table.columns: del table[o]
|
|
72
|
+
return pd.concat([obsn, table], axis = 1)
|
|
73
|
+
|
|
74
|
+
def update_atac_var(table):
|
|
75
|
+
return table.rename(columns = {
|
|
76
|
+
'.seqid': 'chr',
|
|
77
|
+
'.start': 'start',
|
|
78
|
+
'.end': 'end',
|
|
79
|
+
}, inplace = False)
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
file = h5py.File(fpath, 'r+')
|
|
83
|
+
|
|
84
|
+
if mod in ['subset', 'integrated']:
|
|
85
|
+
for m in list(file['mod'].keys()):
|
|
86
|
+
if m in ['rna', 'rnasp-b', 'rnasp-c', 'rnasp-s', 'atac-g']:
|
|
87
|
+
table = read_elem(file['mod'][m]['var'])
|
|
88
|
+
table = update_rna_var(table)
|
|
89
|
+
write_elem(file['mod'][m], 'var', table)
|
|
90
|
+
|
|
91
|
+
elif m in ['atac', 'atac-p']:
|
|
92
|
+
table = read_elem(file['mod'][m]['var'])
|
|
93
|
+
table = update_atac_var(table)
|
|
94
|
+
write_elem(file['mod'][m], 'var', table)
|
|
95
|
+
|
|
96
|
+
if mod in ['rna', 'rnasp-b', 'rnasp-c', 'rnasp-s', 'atac-g']:
|
|
97
|
+
table = read_elem(file['var'])
|
|
98
|
+
table = update_rna_var(table)
|
|
99
|
+
write_elem(file, 'var', table)
|
|
100
|
+
|
|
101
|
+
elif mod in ['atac', 'atac-p']:
|
|
102
|
+
table = read_elem(file['var'])
|
|
103
|
+
table = update_atac_var(table)
|
|
104
|
+
write_elem(file, 'var', table)
|
|
105
|
+
|
|
106
|
+
file.close()
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
UPDATE_TASK = [
|
|
110
|
+
update_39
|
|
111
|
+
]
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
def run_diffmap(
|
|
4
|
+
adata, *, neighbors_key = None, key_added = 'diffmap',
|
|
5
|
+
n_comps = 3, sort = 'decrease', density_normalize = True,
|
|
6
|
+
use_gpu = False
|
|
7
|
+
):
|
|
8
|
+
|
|
9
|
+
if use_gpu:
|
|
10
|
+
|
|
11
|
+
import cupy as cp
|
|
12
|
+
from cupyx.scipy import sparse
|
|
13
|
+
from cupyx.scipy.sparse import linalg
|
|
14
|
+
from scipy.sparse import issparse
|
|
15
|
+
|
|
16
|
+
if neighbors_key:
|
|
17
|
+
connectivities = adata.obsp[adata.uns[neighbors_key]['connectivities_key']]
|
|
18
|
+
else: connectivities = adata.obsp["connectivities"]
|
|
19
|
+
|
|
20
|
+
if issparse(connectivities):
|
|
21
|
+
W = sparse.csr_matrix(connectivities, dtype = cp.float32)
|
|
22
|
+
else: W = cp.asarray(connectivities)
|
|
23
|
+
|
|
24
|
+
if density_normalize:
|
|
25
|
+
# q[i] is an estimate for the sampling density at point i
|
|
26
|
+
# it's also the degree of the underlying graph
|
|
27
|
+
q = cp.asarray(W.sum(axis=0))
|
|
28
|
+
if not sparse.issparse(W): Q = cp.diag(1.0 / q)
|
|
29
|
+
else: Q = sparse.spdiags(1.0 / q, 0, W.shape[0], W.shape[0])
|
|
30
|
+
K = Q @ W @ Q
|
|
31
|
+
|
|
32
|
+
else: K = W
|
|
33
|
+
|
|
34
|
+
# z[i] is the square root of the row sum of K
|
|
35
|
+
z = cp.sqrt(cp.asarray(K.sum(axis=0)))
|
|
36
|
+
|
|
37
|
+
if not sparse.issparse(K): Z = cp.diag(1.0 / z)
|
|
38
|
+
else: Z = sparse.spdiags(1.0 / z, 0, K.shape[0], K.shape[0])
|
|
39
|
+
matrix = Z @ K @ Z
|
|
40
|
+
|
|
41
|
+
if n_comps == 0: evals, evecs = linalg.eigsh(matrix)
|
|
42
|
+
|
|
43
|
+
else:
|
|
44
|
+
n_comps = min(matrix.shape[0] - 1, n_comps)
|
|
45
|
+
# ncv = max(2 * n_comps + 1, int(np.sqrt(matrix.shape[0])))
|
|
46
|
+
ncv = None
|
|
47
|
+
which = "LM" if sort == "decrease" else "SM"
|
|
48
|
+
# it pays off to increase the stability with a bit more precision
|
|
49
|
+
matrix = matrix.astype(cp.float64)
|
|
50
|
+
evals, evecs = linalg.eigsh(matrix, k=n_comps, which=which, ncv=ncv)
|
|
51
|
+
evals, evecs = evals.astype(cp.float32), evecs.astype(cp.float32)
|
|
52
|
+
|
|
53
|
+
if sort == "decrease":
|
|
54
|
+
evals = evals[::-1]
|
|
55
|
+
evecs = evecs[:, ::-1]
|
|
56
|
+
|
|
57
|
+
adata.uns[key_added] = evals.get()
|
|
58
|
+
adata.obsm[key_added] = evecs.get()
|
|
59
|
+
del W, Q, Z, K, evals, evecs, matrix, z
|
|
60
|
+
|
|
61
|
+
else:
|
|
62
|
+
|
|
63
|
+
import scanpy as sc
|
|
64
|
+
sc.tl.diffmap(
|
|
65
|
+
adata, n_comps = n_comps,
|
|
66
|
+
neighbors_key = neighbors_key
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
adata.obsm[key_added] = adata.obsm['X_diffmap']
|
|
70
|
+
del adata.obsm['X_diffmap']
|
|
71
|
+
|
|
72
|
+
adata.uns[key_added] = adata.uns['diffmap_evals']
|
|
73
|
+
del adata.uns['diffmap_evals']
|
|
@@ -58,6 +58,7 @@ class index_object_handler:
|
|
|
58
58
|
|
|
59
59
|
def embedding_atlas(
|
|
60
60
|
adata, basis, color,
|
|
61
|
+
embedding_dims = [0, 1],
|
|
61
62
|
hue_order = None,
|
|
62
63
|
title = None, figsize = (4, 4), ax = None,
|
|
63
64
|
cmap = 'turbo', cmap_reverse = False, cmap_lower = '#000000',
|
|
@@ -76,6 +77,10 @@ def embedding_atlas(
|
|
|
76
77
|
|
|
77
78
|
cvs = ds.Canvas(plot_width = int(figsize[0] * dpi * res_factor), plot_height = int(figsize[1] * dpi * res_factor))
|
|
78
79
|
embedding = adata.obsm[basis]
|
|
80
|
+
if isinstance(embedding, pd.DataFrame):
|
|
81
|
+
embedding = embedding.iloc[:, embedding_dims].copy()
|
|
82
|
+
else: embedding = embedding[:, embedding_dims].copy()
|
|
83
|
+
|
|
79
84
|
df = pd.DataFrame(embedding, columns=['x', 'y'])
|
|
80
85
|
|
|
81
86
|
if color in adata.obs.columns:
|
|
@@ -287,7 +292,7 @@ def embedding_atlas(
|
|
|
287
292
|
|
|
288
293
|
def embedding(
|
|
289
294
|
adata, basis, color,
|
|
290
|
-
slot = 'X',
|
|
295
|
+
slot = 'X', embedding_dims = [0, 1],
|
|
291
296
|
|
|
292
297
|
# query plotting options
|
|
293
298
|
ptsize = 8,
|
|
@@ -343,7 +348,8 @@ def embedding(
|
|
|
343
348
|
embedding = basis.data
|
|
344
349
|
elif isinstance(basis, np.matrix) or isinstance(basis, np.ndarray):
|
|
345
350
|
embedding = basis
|
|
346
|
-
|
|
351
|
+
|
|
352
|
+
embedding = embedding[:, embedding_dims].copy()
|
|
347
353
|
df = pd.DataFrame(embedding, columns = ['x', 'y'])
|
|
348
354
|
|
|
349
355
|
if color in adata.obs.columns:
|
|
@@ -57,29 +57,27 @@ def scvi(
|
|
|
57
57
|
)
|
|
58
58
|
|
|
59
59
|
import warnings
|
|
60
|
-
import contextlib
|
|
61
60
|
with warnings.catch_warnings():
|
|
62
61
|
warnings.simplefilter('ignore')
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
)
|
|
62
|
+
model.train(
|
|
63
|
+
max_epochs = max_epochs,
|
|
64
|
+
accelerator = accelerator,
|
|
65
|
+
devices = devices,
|
|
66
|
+
train_size = train_size,
|
|
67
|
+
validation_size = validation_size,
|
|
68
|
+
shuffle_set_split = shuffle_set_split,
|
|
69
|
+
load_sparse_tensor = load_sparse_tensor,
|
|
70
|
+
batch_size = batch_size,
|
|
71
|
+
early_stopping = early_stopping,
|
|
72
|
+
datasplitter_kwargs = datasplitter_kwargs,
|
|
73
|
+
plan_kwargs = plan_kwargs,
|
|
74
|
+
datamodule = datamodule,
|
|
75
|
+
enable_progress_bar = enable_progress_bar,
|
|
76
|
+
progress_bar_refresh_rate = progress_bar_refresh_rate,
|
|
77
|
+
simple_progress_bar = simple_progress_bar,
|
|
78
|
+
logger = logger,
|
|
79
|
+
log_every_n_steps = log_every_n_steps,
|
|
80
|
+
)
|
|
83
81
|
|
|
84
82
|
latent = model.get_latent_representation()
|
|
85
83
|
return model, latent
|
|
@@ -20,7 +20,7 @@ description = "exprmat: Routines for expression matrices"
|
|
|
20
20
|
readme = "readme.md"
|
|
21
21
|
license = {file = "license"}
|
|
22
22
|
requires-python = ">=3.9, <3.13"
|
|
23
|
-
version = "0.1.
|
|
23
|
+
version = "0.1.42"
|
|
24
24
|
authors = [
|
|
25
25
|
{name = "Zheng Yang", email = "xornent@outlook.com"}
|
|
26
26
|
]
|