exprmat 0.1.15__tar.gz → 0.1.16__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.15 → exprmat-0.1.16}/PKG-INFO +1 -1
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/__init__.py +1 -1
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/data/hsa/mapping-ensembl.pkl +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/data/hsa/mapping-name.pkl +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/data/mmu/mapping-ensembl.pkl +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/data/mmu/mapping-name.pkl +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/dynamics/__init__.py +40 -1
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/plotting/expression.py +69 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/plotting/gse.py +17 -4
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/preprocessing/qc.py +6 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/reader/experiment.py +103 -31
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/reader/matcher.py +19 -11
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/reduction/plot.py +108 -56
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat.egg-info/PKG-INFO +1 -1
- {exprmat-0.1.15 → exprmat-0.1.16}/setup.py +1 -1
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/ansi.py +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/clustering/__init__.py +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/clustering/leiden.py +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/clustering/rogue.py +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/clustering/spectral.py +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/clustering/utils.py +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/cnv/__init__.py +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/cnv/cnvscore.py +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/cnv/infercnv.py +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/configuration.py +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/data/__init__.py +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/data/delim.py +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/data/finders.py +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/data/geneset.py +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/data/gff.py +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/data/hsa/entrez.tsv.gz +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/data/hsa/genesets/all.gmt +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/data/hsa/genesets/bp.gmt +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/data/hsa/genesets/cancer-modules.gmt +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/data/hsa/genesets/cancer-neighborhoods.gmt +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/data/hsa/genesets/cancer.gmt +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/data/hsa/genesets/cc.gmt +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/data/hsa/genesets/chemical-perturb.gmt +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/data/hsa/genesets/hallmark.gmt +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/data/hsa/genesets/human-phenotype-ontology.gmt +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/data/hsa/genesets/immune-perturb.gmt +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/data/hsa/genesets/kegg.gmt +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/data/hsa/genesets/mf.gmt +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/data/hsa/genesets/microrna.gmt +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/data/hsa/genesets/oncogenic.gmt +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/data/hsa/genesets/pathways.gmt +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/data/hsa/genesets/positional.gmt +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/data/hsa/genesets/single-cell.gmt +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/data/hsa/genesets/transcript-factors.gmt +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/data/hsa/genesets/vaccine.gmt +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/data/hsa/genome.tsv.gz +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/data/hsa/lr/baccin2019 +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/data/hsa/lr/cellcall +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/data/hsa/lr/cellchatdb +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/data/hsa/lr/cellinker +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/data/hsa/lr/cellphonedb +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/data/hsa/lr/celltalkdb +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/data/hsa/lr/connectomedb2020 +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/data/hsa/lr/consensus +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/data/hsa/lr/embrace +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/data/hsa/lr/guide2pharma +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/data/hsa/lr/hpmr +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/data/hsa/lr/icellnet +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/data/hsa/lr/italk +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/data/hsa/lr/kirouac2010 +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/data/hsa/lr/lrdb +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/data/hsa/lr/ramilowski2015 +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/data/hsa/orthologs/aca.tsv.gz +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/data/hsa/orthologs/bta.tsv.gz +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/data/hsa/orthologs/cel.tsv.gz +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/data/hsa/orthologs/clu.tsv.gz +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/data/hsa/orthologs/dme.tsv.gz +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/data/hsa/orthologs/dre.tsv.gz +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/data/hsa/orthologs/eca.tsv.gz +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/data/hsa/orthologs/fca.tsv.gz +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/data/hsa/orthologs/gga.tsv.gz +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/data/hsa/orthologs/mdo.tsv.gz +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/data/hsa/orthologs/mmu.tsv.gz +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/data/hsa/orthologs/mmul.gz +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/data/hsa/orthologs/oan.tsv.gz +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/data/hsa/orthologs/ptr.tsv.gz +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/data/hsa/orthologs/rno.tsv.gz +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/data/hsa/orthologs/sce.tsv.gz +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/data/hsa/orthologs/spo.tsv.gz +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/data/hsa/orthologs/ssc.tsv.gz +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/data/hsa/orthologs/xla.tsv.gz +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/data/hsa/taxa +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/data/lr.py +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/data/mmu/entrez.tsv.gz +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/data/mmu/genesets/all.gmt +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/data/mmu/genesets/azimuth.gmt +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/data/mmu/genesets/biocarta.gmt +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/data/mmu/genesets/bp.gmt +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/data/mmu/genesets/cc.gmt +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/data/mmu/genesets/chemical-perturb.gmt +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/data/mmu/genesets/hallmark.gmt +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/data/mmu/genesets/kegg.gmt +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/data/mmu/genesets/m2.gmt +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/data/mmu/genesets/markers.gmt +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/data/mmu/genesets/mf.gmt +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/data/mmu/genesets/microrna.gmt +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/data/mmu/genesets/mpt.gmt +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/data/mmu/genesets/positional.gmt +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/data/mmu/genesets/reactome.gmt +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/data/mmu/genesets/transcript-factors.gmt +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/data/mmu/genesets/wikipathway.gmt +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/data/mmu/genome.tsv.gz +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/data/mmu/lr/consensus +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/data/mmu/taxa +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/data/presets.py +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/data/private.py +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/data/ranges.py +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/descriptive/__init__.py +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/descriptive/aggregate.py +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/descriptive/de.py +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/descriptive/gse.py +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/descriptive/kde.py +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/descriptive/summary.py +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/descriptive/tcr.py +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/dynamics/generank.py +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/dynamics/linreg.py +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/dynamics/moments.py +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/dynamics/optimization.py +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/dynamics/parallel.py +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/dynamics/preprocess.py +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/dynamics/pseudotime.py +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/dynamics/transition.py +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/dynamics/utils.py +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/dynamics/velocity.py +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/lr/__init__.py +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/lr/aggregate.py +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/lr/method.py +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/lr/methods/__init__.py +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/lr/methods/cellchat.py +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/lr/methods/cellphonedb.py +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/lr/methods/connectome.py +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/lr/methods/geomean.py +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/lr/methods/logfc.py +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/lr/methods/natmi.py +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/lr/methods/rank_aggregate.py +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/lr/methods/scseqcomm.py +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/lr/methods/singlecellsignalr.py +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/lr/pipeline.py +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/lr/preprocess.py +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/lr/resources.py +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/lr/utils.py +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/plotting/__init__.py +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/plotting/cnv.py +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/plotting/de.py +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/plotting/lr.py +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/plotting/palettes.py +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/plotting/sankey.py +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/plotting/summary.py +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/plotting/utils.py +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/plotting/velocity.py +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/preprocessing/__init__.py +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/preprocessing/doublets/__init__.py +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/preprocessing/doublets/composite.py +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/preprocessing/doublets/scrublet.py +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/preprocessing/filter.py +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/preprocessing/integrate.py +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/preprocessing/linear.py +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/preprocessing/normal.py +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/preprocessing/plot.py +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/preprocessing/sctransform/__init__.py +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/preprocessing/sctransform/estimate.py +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/preprocessing/sctransform/ksmooth.py +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/preprocessing/sctransform/residual.py +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/preprocessing/sctransform/transform.py +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/preprocessing/sparse.py +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/preprocessing/uniform.py +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/reader/__init__.py +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/reader/metadata.py +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/reduction/__init__.py +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/reduction/forceatlas.py +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/reduction/mde.py +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/reduction/nn.py +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/reduction/outliers.py +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/reduction/pca.py +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/reduction/tsne.py +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/reduction/umap.py +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/transfer/__init__.py +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/transfer/atlas.py +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat/utils.py +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat.egg-info/SOURCES.txt +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat.egg-info/dependency_links.txt +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat.egg-info/not-zip-safe +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat.egg-info/requires.txt +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/exprmat.egg-info/top_level.txt +0 -0
- {exprmat-0.1.15 → exprmat-0.1.16}/setup.cfg +0 -0
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -48,4 +48,43 @@ def run_velocity(
|
|
|
48
48
|
terminal_states(adata, vkey = velocity_key, neighbor_key = neighbor_key, **kwargs_terminal_state)
|
|
49
49
|
velocity_pseudotime(adata, vkey = velocity_key, neighbor_key = neighbor_key, **kwargs_pseudotime)
|
|
50
50
|
velocity_confidence(adata, vkey = velocity_key, neighbor_key = neighbor_key)
|
|
51
|
-
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def clean_velocity_results(adata, vkey = 'velocity'):
|
|
54
|
+
|
|
55
|
+
for x in list(adata.obs.keys()):
|
|
56
|
+
if x in [
|
|
57
|
+
'root.cells',
|
|
58
|
+
'endpoints',
|
|
59
|
+
'n.umi.spliced',
|
|
60
|
+
'n.umi.unspliced',
|
|
61
|
+
'velocity.pseudotime'
|
|
62
|
+
]: del adata.obs[x]
|
|
63
|
+
elif x.startswith(f'{vkey}.'): del adata.obs[x]
|
|
64
|
+
|
|
65
|
+
for x in list(adata.var.keys()):
|
|
66
|
+
if x.startswith(f'{vkey}.'): del adata.var[x]
|
|
67
|
+
elif x in ['gene.count.corr']: del adata.var[x]
|
|
68
|
+
|
|
69
|
+
for x in list(adata.layers.keys()):
|
|
70
|
+
if x in ['ms', 'mu', vkey, f'variance.{vkey}']: del adata.layers[x]
|
|
71
|
+
elif ('spliced.counts' in adata.layers.keys()) and x == 'spliced':
|
|
72
|
+
del adata.layers['spliced']
|
|
73
|
+
adata.layers['spliced'] = adata.layers['spliced.counts'].copy()
|
|
74
|
+
del adata.layers['spliced.counts']
|
|
75
|
+
elif ('unspliced.counts' in adata.layers.keys()) and x == 'unspliced':
|
|
76
|
+
del adata.layers['unspliced']
|
|
77
|
+
adata.layers['unspliced'] = adata.layers['unspliced.counts'].copy()
|
|
78
|
+
del adata.layers['unspliced.counts']
|
|
79
|
+
|
|
80
|
+
for x in list(adata.obsm.keys()):
|
|
81
|
+
if x.startswith(f'{vkey}.'): del adata.obsm[x]
|
|
82
|
+
elif x.startswith('vdiff.'): del adata.obsm[x]
|
|
83
|
+
elif x == 'vdiff': del adata.obsm[x]
|
|
84
|
+
|
|
85
|
+
for x in list(adata.uns.keys()):
|
|
86
|
+
if x in [
|
|
87
|
+
f'{vkey}.graph',
|
|
88
|
+
f'{vkey}.graph.neg',
|
|
89
|
+
f'{vkey}.params'
|
|
90
|
+
]: del adata.uns[x]
|
|
@@ -148,4 +148,73 @@ def matrix(
|
|
|
148
148
|
ax.set_xticks(range(len(var)), labels = var, rotation = 90, ha = "right", va = 'center', rotation_mode = "anchor")
|
|
149
149
|
ax.set_yticks(range(len(obs)), labels = obs)
|
|
150
150
|
|
|
151
|
+
return fig
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
def volcano(
|
|
155
|
+
adata, de_slot = 'deg', label = [],
|
|
156
|
+
show_all = False, min_pct = 0, max_pct_reference = 1,
|
|
157
|
+
min_lfc = -25, max_lfc = 25, remove_zero_pval = False,
|
|
158
|
+
highlight_min_logp = 5, highlight_min_lfc = 1.5,
|
|
159
|
+
xlim = 5, ylim = 100,
|
|
160
|
+
figsize = (3, 3), dpi = 100
|
|
161
|
+
):
|
|
162
|
+
|
|
163
|
+
import numpy as np
|
|
164
|
+
import matplotlib.pyplot as plt
|
|
165
|
+
from adjustText import adjust_text
|
|
166
|
+
from exprmat.reader.experiment import experiment
|
|
167
|
+
|
|
168
|
+
pvals = []
|
|
169
|
+
fc = []
|
|
170
|
+
names = []
|
|
171
|
+
|
|
172
|
+
plots = experiment.rna_get_markers(
|
|
173
|
+
adata, de_slot = de_slot,
|
|
174
|
+
min_pct = min_pct, max_pct_reference = max_pct_reference,
|
|
175
|
+
min_lfc = min_lfc, max_lfc = max_lfc,
|
|
176
|
+
remove_zero_pval = remove_zero_pval
|
|
177
|
+
)
|
|
178
|
+
|
|
179
|
+
pvals = plots['log10.q'].tolist()
|
|
180
|
+
fc = plots['lfc'].tolist()
|
|
181
|
+
names = plots['gene'].tolist()
|
|
182
|
+
|
|
183
|
+
fig, axes = plt.subplots(1, 1, figsize = figsize, dpi = dpi)
|
|
184
|
+
axes.scatter(fc, pvals, c = 'k', s = 4)
|
|
185
|
+
|
|
186
|
+
sig_pvals = []
|
|
187
|
+
sig_fc = []
|
|
188
|
+
sig_names = []
|
|
189
|
+
|
|
190
|
+
for p, f, nm in zip(pvals, fc, names):
|
|
191
|
+
if nm in label:
|
|
192
|
+
sig_pvals += [p]
|
|
193
|
+
sig_fc += [f]
|
|
194
|
+
sig_names += [nm]
|
|
195
|
+
|
|
196
|
+
if (p > highlight_min_logp and abs(f) >= highlight_min_lfc) and show_all:
|
|
197
|
+
sig_pvals += [p]
|
|
198
|
+
sig_fc += [f]
|
|
199
|
+
sig_names += [nm]
|
|
200
|
+
|
|
201
|
+
texts = []
|
|
202
|
+
for p, f, nm in zip(sig_pvals, sig_fc, sig_names):
|
|
203
|
+
texts += [axes.text(f, p, nm, va = 'top', ha = 'center')]
|
|
204
|
+
|
|
205
|
+
adjust_text(texts)
|
|
206
|
+
axes.scatter(sig_fc, sig_pvals, c = 'r', s = 10)
|
|
207
|
+
axes.grid(False)
|
|
208
|
+
|
|
209
|
+
xlim = min(np.abs(np.array(fc)).max(), xlim)
|
|
210
|
+
ylim = min(ylim, np.max(np.array(pvals)))
|
|
211
|
+
axes.set_xlim([-xlim, xlim])
|
|
212
|
+
axes.set_ylim([-ylim / 20, ylim])
|
|
213
|
+
|
|
214
|
+
axes.vlines(x = [0], ymin = [0], ymax = [ylim], linestyles = 'dashed', color = 'gray', linewidth = 0.6)
|
|
215
|
+
axes.set_yticks([])
|
|
216
|
+
axes.set_xlabel('Log-2 fold changes')
|
|
217
|
+
for pos in ['right', 'top', 'left']:
|
|
218
|
+
axes.spines[pos].set_visible(False)
|
|
219
|
+
|
|
151
220
|
return fig
|
|
@@ -504,6 +504,7 @@ class dotplot(object):
|
|
|
504
504
|
y_order: Optional[List[str]] = None,
|
|
505
505
|
thresh: float = 0.05,
|
|
506
506
|
n_terms: int = 10,
|
|
507
|
+
terms = None,
|
|
507
508
|
title: str = "",
|
|
508
509
|
ax: Optional[plt.Axes] = None,
|
|
509
510
|
figsize: Tuple[float, float] = (6, 5.5),
|
|
@@ -525,6 +526,7 @@ class dotplot(object):
|
|
|
525
526
|
self.scale = dot_scale
|
|
526
527
|
self.title = title
|
|
527
528
|
self.n_terms = n_terms
|
|
529
|
+
self.terms = terms
|
|
528
530
|
self.thresh = thresh
|
|
529
531
|
self.data = self.process(df)
|
|
530
532
|
|
|
@@ -569,19 +571,26 @@ class dotplot(object):
|
|
|
569
571
|
self.cbar_title = f'-log({self.colname})'
|
|
570
572
|
self.colname = "p_inv"
|
|
571
573
|
|
|
574
|
+
if self.terms is not None:
|
|
575
|
+
if 'term' in df.columns:
|
|
576
|
+
df = df.loc[[x in self.terms for x in df['term']], :].copy()
|
|
577
|
+
elif 'name' in df.columns:
|
|
578
|
+
df = df.loc[[x in self.terms for x in df['name']], :].copy()
|
|
579
|
+
df = df.sort_values(by = self.colname)
|
|
580
|
+
|
|
572
581
|
# get top terms; sort ascending
|
|
573
|
-
|
|
582
|
+
elif ((self.x is not None)
|
|
574
583
|
and (self.x in df.columns)
|
|
575
584
|
and (not all(df[self.x].map(self.isfloat)))
|
|
576
585
|
):
|
|
577
586
|
|
|
578
587
|
df = ( # if x is numeric column, get top term of each group
|
|
579
588
|
df.groupby(self.x)
|
|
580
|
-
|
|
581
|
-
|
|
589
|
+
.apply(lambda _x: _x.sort_values(by = self.colname).tail(self.n_terms))
|
|
590
|
+
.reset_index(drop=True)
|
|
582
591
|
)
|
|
583
592
|
|
|
584
|
-
else: df = df.sort_values(by=self.colname).tail(self.n_terms) # acending
|
|
593
|
+
else: df = df.sort_values(by = self.colname).tail(self.n_terms) # acending
|
|
585
594
|
|
|
586
595
|
# get scatter area
|
|
587
596
|
if df.columns.isin(["overlap", "tag"]).any():
|
|
@@ -794,6 +803,7 @@ def gsea_dotplot(
|
|
|
794
803
|
title: str = "",
|
|
795
804
|
cutoff: float = 0.05,
|
|
796
805
|
top_term: int = 10,
|
|
806
|
+
terms = None,
|
|
797
807
|
size: float = 5,
|
|
798
808
|
ax: Optional[plt.Axes] = None,
|
|
799
809
|
figsize: Tuple[float, float] = (4, 6),
|
|
@@ -816,6 +826,7 @@ def gsea_dotplot(
|
|
|
816
826
|
title = title,
|
|
817
827
|
thresh = cutoff,
|
|
818
828
|
n_terms = int(top_term),
|
|
829
|
+
terms = terms,
|
|
819
830
|
dot_scale = size,
|
|
820
831
|
ax = ax,
|
|
821
832
|
figsize = figsize,
|
|
@@ -848,6 +859,7 @@ def opa_dotplot(
|
|
|
848
859
|
title: str = "",
|
|
849
860
|
cutoff: float = 0.05,
|
|
850
861
|
top_term: int = 10,
|
|
862
|
+
terms = None,
|
|
851
863
|
size: float = 5,
|
|
852
864
|
ax: Optional[plt.Axes] = None,
|
|
853
865
|
figsize: Tuple[float, float] = (4, 6),
|
|
@@ -870,6 +882,7 @@ def opa_dotplot(
|
|
|
870
882
|
title = title,
|
|
871
883
|
thresh = cutoff,
|
|
872
884
|
n_terms = int(top_term),
|
|
885
|
+
terms = terms,
|
|
873
886
|
dot_scale = size,
|
|
874
887
|
ax = ax,
|
|
875
888
|
figsize = figsize,
|
|
@@ -123,10 +123,14 @@ def rna_qc(
|
|
|
123
123
|
adata.obs['pct.ribo'] = adata.obs['n.ribo'] / adata.obs['n.umi']
|
|
124
124
|
|
|
125
125
|
# detect outliers
|
|
126
|
+
max_genes = None
|
|
126
127
|
if outlier_mode == 'mads':
|
|
127
128
|
umi_lower, umi_upper = mads(adata.obs['n.umi'].to_numpy(), nmads = outlier_n)
|
|
128
129
|
elif outlier_mode == 'tukey':
|
|
129
130
|
umi_lower, umi_upper = tukey(adata.obs['n.umi'].to_numpy(), n = outlier_n)
|
|
131
|
+
elif isinstance(outlier_mode, int):
|
|
132
|
+
umi_lower, umi_upper = 200, 100000
|
|
133
|
+
max_genes = outlier_mode
|
|
130
134
|
else: umi_lower, umi_upper = 200, 100000
|
|
131
135
|
|
|
132
136
|
f_obs = \
|
|
@@ -134,6 +138,8 @@ def rna_qc(
|
|
|
134
138
|
(adata.obs['pct.mito'] < mt_percent) & \
|
|
135
139
|
(adata.obs['n.umi'] >= umi_lower) & \
|
|
136
140
|
(adata.obs['n.genes'] >= min_genes)
|
|
141
|
+
if max_genes is not None:
|
|
142
|
+
f_obs = f_obs & (adata.obs['n.genes'] <= max_genes)
|
|
137
143
|
|
|
138
144
|
if ribo_percent is not None:
|
|
139
145
|
f_obs = f_obs & (adata.obs['pct.ribo'] < ribo_percent)
|
|
@@ -34,7 +34,12 @@ from exprmat.ansi import warning, info, error, red, green
|
|
|
34
34
|
|
|
35
35
|
class experiment:
|
|
36
36
|
|
|
37
|
-
def __init__(
|
|
37
|
+
def __init__(
|
|
38
|
+
self, meta : metadata,
|
|
39
|
+
eccentric = None,
|
|
40
|
+
mudata = None, modalities = {},
|
|
41
|
+
dump = '.', subset = None
|
|
42
|
+
):
|
|
38
43
|
|
|
39
44
|
# TODO: we support rna only at present.
|
|
40
45
|
table = meta.dataframe.to_dict(orient = 'list')
|
|
@@ -81,7 +86,7 @@ class experiment:
|
|
|
81
86
|
|
|
82
87
|
self.modalities['rna'][i_sample] = read_table_rna(
|
|
83
88
|
src = i_loc, metadata = meta, sample = i_sample,
|
|
84
|
-
raw = False, default_taxa = i_taxa
|
|
89
|
+
raw = False, default_taxa = i_taxa, eccentric = eccentric
|
|
85
90
|
)
|
|
86
91
|
|
|
87
92
|
elif i_loc.endswith('.h5') or i_loc.endswith('.h5ad'):
|
|
@@ -94,7 +99,7 @@ class experiment:
|
|
|
94
99
|
else:
|
|
95
100
|
self.modalities['rna'][i_sample] = read_mtx_rna(
|
|
96
101
|
src = i_loc, prefix = '', metadata = meta, sample = i_sample,
|
|
97
|
-
raw = False, default_taxa = i_taxa
|
|
102
|
+
raw = False, default_taxa = i_taxa, eccentric = eccentric
|
|
98
103
|
)
|
|
99
104
|
|
|
100
105
|
self.modalities['rna'][i_sample].var = \
|
|
@@ -158,33 +163,27 @@ class experiment:
|
|
|
158
163
|
|
|
159
164
|
else: warning(f'sample {i_sample} have no supported modalities')
|
|
160
165
|
|
|
161
|
-
# construct variable name table: note that this variable table represent the
|
|
162
|
-
# all available set, and should be a superset of the merged table.
|
|
163
|
-
|
|
164
|
-
self.build_variables()
|
|
165
|
-
|
|
166
166
|
pass
|
|
167
167
|
|
|
168
168
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
self.
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
if 'rna' in self.mudata.mod.keys():
|
|
176
|
-
self.variables['rna'] = self.mudata['rna'].var
|
|
177
|
-
|
|
178
|
-
return
|
|
169
|
+
@property
|
|
170
|
+
def obs(self):
|
|
171
|
+
self.check_merged()
|
|
172
|
+
self.pull()
|
|
173
|
+
return self.mudata.obs
|
|
174
|
+
|
|
179
175
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
pass
|
|
176
|
+
@property
|
|
177
|
+
def var(self):
|
|
178
|
+
self.check_merged()
|
|
179
|
+
return self.mudata.var
|
|
180
|
+
|
|
187
181
|
|
|
182
|
+
@property
|
|
183
|
+
def shape(self):
|
|
184
|
+
self.check_merged()
|
|
185
|
+
return (self.mudata.n_obs, self.mudata.n_vars)
|
|
186
|
+
|
|
188
187
|
|
|
189
188
|
@staticmethod
|
|
190
189
|
def search_genes(genes):
|
|
@@ -508,6 +507,47 @@ class experiment:
|
|
|
508
507
|
subset.write_h5mu(os.path.join(self.directory, 'subsets', subset_name + '.h5mu'))
|
|
509
508
|
|
|
510
509
|
|
|
510
|
+
def build_subsample(
|
|
511
|
+
self, subset_name, slot = 'rna',
|
|
512
|
+
key = None, n = 3000
|
|
513
|
+
):
|
|
514
|
+
self.check_merged(slot)
|
|
515
|
+
self.pull()
|
|
516
|
+
from exprmat.dynamics.utils import indices_to_bool
|
|
517
|
+
|
|
518
|
+
if key is None:
|
|
519
|
+
if n > self.mudata.n_obs:
|
|
520
|
+
n = self.mudata.n_obs
|
|
521
|
+
warning('subsample n > obs. returning all indices')
|
|
522
|
+
else: info(f'randomly selects {n} cells from {self.mudata.n_obs}.')
|
|
523
|
+
rind = np.random.choice(self.mudata.n_obs, size = n, replace = False)
|
|
524
|
+
mask = indices_to_bool(rind, self.mudata.n_obs)
|
|
525
|
+
|
|
526
|
+
elif isinstance(n, dict):
|
|
527
|
+
values = self.mudata.obs[f'{slot}:{key}'].unique().tolist()
|
|
528
|
+
rind = np.array([])
|
|
529
|
+
for val in values:
|
|
530
|
+
indices = np.argwhere(self.mudata.obs[f'{slot}:{key}'] == val).flatten()
|
|
531
|
+
if str(val) in n.keys(): _n = n[str(val)]
|
|
532
|
+
else: continue
|
|
533
|
+
if _n == '*': _n = len(indices)
|
|
534
|
+
|
|
535
|
+
if _n > len(indices):
|
|
536
|
+
_n = len(indices)
|
|
537
|
+
warning(f'subsample n > len({val}). returning all indices')
|
|
538
|
+
else: info(f'randomly selects {_n} cells from [{val}] ({len(indices)}).')
|
|
539
|
+
rind = np.append(rind, np.random.choice(indices, size = _n, replace = False))
|
|
540
|
+
mask = indices_to_bool(rind, self.mudata.n_obs)
|
|
541
|
+
|
|
542
|
+
subset = self.mudata[mask, :].copy()
|
|
543
|
+
info(f'selected {mask.sum()} observations from {len(mask)}.')
|
|
544
|
+
|
|
545
|
+
if not os.path.exists(os.path.join(self.directory, 'subsets')):
|
|
546
|
+
os.makedirs(os.path.join(self.directory, 'subsets'))
|
|
547
|
+
|
|
548
|
+
subset.write_h5mu(os.path.join(self.directory, 'subsets', subset_name + '.h5mu'))
|
|
549
|
+
|
|
550
|
+
|
|
511
551
|
def annotate(
|
|
512
552
|
self, slot = 'rna', annotation = 'cell.type',
|
|
513
553
|
mapping = {}, cluster = 'leiden'
|
|
@@ -673,7 +713,7 @@ class experiment:
|
|
|
673
713
|
ls = self.mudata[slot].obs[annotation].tolist()
|
|
674
714
|
mask = [x not in remove for x in ls]
|
|
675
715
|
orig = self.mudata.n_obs
|
|
676
|
-
self.mudata = self.mudata[mask, :]
|
|
716
|
+
self.mudata = self.mudata[mask, :].copy()
|
|
677
717
|
info(f'keep {self.mudata.n_obs} observations from {orig}.')
|
|
678
718
|
|
|
679
719
|
|
|
@@ -1326,6 +1366,11 @@ class experiment:
|
|
|
1326
1366
|
from exprmat.reduction.plot import gene_gene
|
|
1327
1367
|
return gene_gene(adata, sample_name = sample_name, **kwargs)
|
|
1328
1368
|
|
|
1369
|
+
@staticmethod
|
|
1370
|
+
def rna_plot_gene_gene_regress(adata, sample_name, **kwargs):
|
|
1371
|
+
from exprmat.reduction.plot import gene_gene_regress
|
|
1372
|
+
return gene_gene_regress(adata, sample_name = sample_name, **kwargs)
|
|
1373
|
+
|
|
1329
1374
|
|
|
1330
1375
|
@staticmethod
|
|
1331
1376
|
def rna_plot_markers(adata, sample_name, figsize, dpi, **kwargs):
|
|
@@ -1735,26 +1780,29 @@ class experiment:
|
|
|
1735
1780
|
@staticmethod
|
|
1736
1781
|
def rna_plot_gsea_dotplot(
|
|
1737
1782
|
adata, sample_name, gsea_key, max_fdr = 1, max_p = 0.05, top_term: int = 100,
|
|
1738
|
-
colour = 'p', title = "", cmap = 'turbo', figsize = (3, 2), cutoff = 1, ptsize = 5
|
|
1783
|
+
colour = 'p', title = "", cmap = 'turbo', figsize = (3, 2), cutoff = 1, ptsize = 5,
|
|
1784
|
+
terms = None
|
|
1739
1785
|
):
|
|
1740
1786
|
from exprmat.plotting.gse import gsea_dotplot
|
|
1741
1787
|
return gsea_dotplot(
|
|
1742
1788
|
experiment.rna_get_gsea(adata, gsea_key, max_fdr = max_fdr, max_p = max_p),
|
|
1743
1789
|
column = colour, x = 'nes', y = 'name', title = gsea_key if title is None else title,
|
|
1744
|
-
cmap = cmap, size = ptsize, figsize = figsize, cutoff = cutoff, top_term = top_term
|
|
1790
|
+
cmap = cmap, size = ptsize, figsize = figsize, cutoff = cutoff, top_term = top_term,
|
|
1791
|
+
terms = terms
|
|
1745
1792
|
)
|
|
1746
1793
|
|
|
1747
1794
|
|
|
1748
1795
|
@staticmethod
|
|
1749
1796
|
def rna_plot_opa_dotplot(
|
|
1750
|
-
adata, sample_name, opa_key, max_fdr = 1, max_p = 0.05, top_term: int = 100,
|
|
1797
|
+
adata, sample_name, opa_key, max_fdr = 1, max_p = 0.05, top_term: int = 100, terms = None,
|
|
1751
1798
|
colour = 'fdr', title = None, cmap = 'turbo', figsize = (3, 2), cutoff = 1, ptsize = 5
|
|
1752
1799
|
):
|
|
1753
1800
|
from exprmat.plotting.gse import opa_dotplot
|
|
1754
1801
|
return opa_dotplot(
|
|
1755
1802
|
experiment.rna_get_opa(adata, opa_key, max_fdr = max_fdr, max_p = max_p),
|
|
1756
1803
|
column = colour, x = 'or', y = 'term', title = opa_key if title is None else title,
|
|
1757
|
-
cmap = cmap, size = ptsize, figsize = figsize, cutoff = cutoff, top_term = top_term
|
|
1804
|
+
cmap = cmap, size = ptsize, figsize = figsize, cutoff = cutoff, top_term = top_term,
|
|
1805
|
+
terms = terms
|
|
1758
1806
|
)
|
|
1759
1807
|
|
|
1760
1808
|
|
|
@@ -1776,6 +1824,25 @@ class experiment:
|
|
|
1776
1824
|
return heatmap(adata = adata, uns_key = lr_key, **kwargs)
|
|
1777
1825
|
|
|
1778
1826
|
|
|
1827
|
+
@staticmethod
|
|
1828
|
+
def rna_plot_volcano(
|
|
1829
|
+
adata, sample_name, de_slot = 'deg', label = [],
|
|
1830
|
+
show_all = False, min_pct = 0, max_pct_reference = 1,
|
|
1831
|
+
min_lfc = -25, max_lfc = 25, remove_zero_pval = False,
|
|
1832
|
+
highlight_min_logp = 5, highlight_min_lfc = 1.5,
|
|
1833
|
+
xlim = 5, ylim = 100,
|
|
1834
|
+
figsize = (3, 3), dpi = 100, **kwargs):
|
|
1835
|
+
from exprmat.plotting.expression import volcano
|
|
1836
|
+
return volcano(
|
|
1837
|
+
adata = adata, de_slot = de_slot, label = label,
|
|
1838
|
+
show_all = show_all, min_pct = min_pct, max_pct_reference = max_pct_reference,
|
|
1839
|
+
min_lfc = min_lfc, max_lfc = max_lfc, remove_zero_pval = remove_zero_pval,
|
|
1840
|
+
highlight_min_logp = highlight_min_logp, highlight_min_lfc = highlight_min_lfc,
|
|
1841
|
+
xlim = xlim, ylim = ylim,
|
|
1842
|
+
figsize = figsize, dpi = dpi, **kwargs
|
|
1843
|
+
)
|
|
1844
|
+
|
|
1845
|
+
|
|
1779
1846
|
@staticmethod
|
|
1780
1847
|
def rna_plot_spliced_proportions(adata, sample_name, **kwargs):
|
|
1781
1848
|
from exprmat.plotting.velocity import proportions
|
|
@@ -2107,6 +2174,9 @@ class experiment:
|
|
|
2107
2174
|
|
|
2108
2175
|
def plot_rna_gene_gene(self, run_on_samples = False, **kwargs):
|
|
2109
2176
|
return self.plot_for_rna(run_on_samples, experiment.rna_plot_gene_gene, **kwargs)
|
|
2177
|
+
|
|
2178
|
+
def plot_rna_gene_gene_regress(self, run_on_samples = False, **kwargs):
|
|
2179
|
+
return self.plot_for_rna(run_on_samples, experiment.rna_plot_gene_gene_regress, **kwargs)
|
|
2110
2180
|
|
|
2111
2181
|
def plot_rna_gene_gene_multiple(self, run_on_samples = False, **kwargs):
|
|
2112
2182
|
return self.plot_for_rna(run_on_samples, experiment.rna_plot_multiple_gene_gene, **kwargs)
|
|
@@ -2184,6 +2254,9 @@ class experiment:
|
|
|
2184
2254
|
def plot_rna_lr_circleplot(self, run_on_samples = False, **kwargs):
|
|
2185
2255
|
return self.plot_for_rna(run_on_samples, experiment.rna_plot_lr_circleplot, **kwargs)
|
|
2186
2256
|
|
|
2257
|
+
def plot_rna_volcano(self, run_on_samples = False, **kwargs):
|
|
2258
|
+
return self.plot_for_rna(run_on_samples, experiment.rna_plot_volcano, **kwargs)
|
|
2259
|
+
|
|
2187
2260
|
def plot_rna_spliced_proportions(self, run_on_samples = False, **kwargs):
|
|
2188
2261
|
return self.plot_for_rna(run_on_samples, experiment.rna_plot_spliced_proportions, **kwargs)
|
|
2189
2262
|
|
|
@@ -2531,5 +2604,4 @@ def load_experiment(direc, load_samples = True, load_subset = None):
|
|
|
2531
2604
|
subset = subset
|
|
2532
2605
|
)
|
|
2533
2606
|
|
|
2534
|
-
expr.build_variables()
|
|
2535
2607
|
return expr
|
|
@@ -62,7 +62,7 @@ def refine_finder(features_fpath, taxa = 'mmu'):
|
|
|
62
62
|
save_genome_changes(taxa)
|
|
63
63
|
|
|
64
64
|
|
|
65
|
-
def adjust_features(path, refine_finder = False, default_taxa = 'mmu'):
|
|
65
|
+
def adjust_features(path, refine_finder = False, default_taxa = 'mmu', eccentric = None):
|
|
66
66
|
'''
|
|
67
67
|
There are three main types of features table that may occur in the matrix data folder.
|
|
68
68
|
|
|
@@ -121,6 +121,7 @@ def adjust_features(path, refine_finder = False, default_taxa = 'mmu'):
|
|
|
121
121
|
# and indices in multi-species joint analysis. if there is no such prefix detected
|
|
122
122
|
# this means the gene comes from the default taxa.
|
|
123
123
|
|
|
124
|
+
if eccentric is not None: ens = eccentric(ens)
|
|
124
125
|
if '_' in ens:
|
|
125
126
|
reference_name = ens.split('_')[0]
|
|
126
127
|
pure_ens = ens.replace(reference_name + '_', '')
|
|
@@ -164,7 +165,8 @@ def adjust_features(path, refine_finder = False, default_taxa = 'mmu'):
|
|
|
164
165
|
query_ensembl = []
|
|
165
166
|
n_not_found = 0
|
|
166
167
|
for x in query_gname:
|
|
167
|
-
|
|
168
|
+
|
|
169
|
+
if eccentric is not None: x = eccentric(x)
|
|
168
170
|
if '_' in x:
|
|
169
171
|
|
|
170
172
|
reference_name = x.split('_')[0]
|
|
@@ -219,10 +221,10 @@ def adjust_features(path, refine_finder = False, default_taxa = 'mmu'):
|
|
|
219
221
|
|
|
220
222
|
|
|
221
223
|
def read_mtx_rna(
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
224
|
+
src: str, prefix: str,
|
|
225
|
+
metadata: metadata, sample: str, raw: bool = False,
|
|
226
|
+
default_taxa = 'mmu', eccentric = None
|
|
227
|
+
):
|
|
226
228
|
'''
|
|
227
229
|
Formalize the three components in the matrix directory, and read the folder with gene
|
|
228
230
|
expression data only.
|
|
@@ -251,7 +253,7 @@ def read_mtx_rna(
|
|
|
251
253
|
|
|
252
254
|
# try:
|
|
253
255
|
|
|
254
|
-
adjust_features(src, refine_finder = True, default_taxa = default_taxa)
|
|
256
|
+
adjust_features(src, refine_finder = True, default_taxa = default_taxa, eccentric = eccentric)
|
|
255
257
|
|
|
256
258
|
import warnings
|
|
257
259
|
warnings.filterwarnings('ignore')
|
|
@@ -261,6 +263,9 @@ def read_mtx_rna(
|
|
|
261
263
|
prefix = prefix
|
|
262
264
|
)
|
|
263
265
|
|
|
266
|
+
if eccentric is not None:
|
|
267
|
+
adata.var_names = [eccentric(x) for x in adata.var_names]
|
|
268
|
+
|
|
264
269
|
# except Exception as ex:
|
|
265
270
|
# warning('error occurs when reading matrix files:')
|
|
266
271
|
# warning(str(ex))
|
|
@@ -278,10 +283,10 @@ def read_mtx_rna(
|
|
|
278
283
|
|
|
279
284
|
|
|
280
285
|
def read_table_rna(
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
286
|
+
src: str,
|
|
287
|
+
metadata: metadata, sample: str, raw: bool = False,
|
|
288
|
+
default_taxa = 'mmu', eccentric = None
|
|
289
|
+
):
|
|
285
290
|
'''
|
|
286
291
|
Read from compressed or plain text tables.
|
|
287
292
|
|
|
@@ -311,6 +316,9 @@ def read_table_rna(
|
|
|
311
316
|
src, delimiter = '\t', first_column_names = True, dtype = 'float32'
|
|
312
317
|
).T
|
|
313
318
|
|
|
319
|
+
if eccentric is not None:
|
|
320
|
+
adata.var_names = [eccentric(x) for x in adata.var_names]
|
|
321
|
+
|
|
314
322
|
# except Exception as ex:
|
|
315
323
|
# warning('error occurs when reading matrix files:')
|
|
316
324
|
# warning(str(ex))
|