snapatac2.metrics.tsse#
- snapatac2.metrics.tsse(adata, gene_anno, *, exclude_chroms=['chrM', 'M'], inplace=True, n_jobs=8)[source]#
Compute the TSS enrichment score (TSSe) for each cell.
import_datamust be ran first in order to use this function.- Parameters:
adata (
AnnData|list[AnnData]) – The (annotated) data matrix of shapen_obsxn_vars. Rows correspond to cells and columns to regions.adatacould also be a list of AnnData objects. In this case, the function will be applied to each AnnData object in parallel.gene_anno (
Genome|Path) – AGenomeobject or a GTF/GFF file containing the gene annotation.exclude_chroms (
list[str] |str|None) – A list of chromosomes to exclude.inplace (
bool) – Whether to add the results toadata.obsor return it as a dictionary.n_jobs (
int) – Number of jobs to run in parallel whenadatais a list. Ifn_jobs=-1, all CPUs will be used.
- Returns:
If
inplace = True, directly adds the results toadata.obs['tsse']. Otherwise return the results.- Return type:
np.ndarray | list[np.ndarray] | None
Examples
>>> import snapatac2 as snap >>> data = snap.pp.import_data(snap.datasets.pbmc500(downsample=True), chrom_sizes=snap.genome.hg38, sorted_by_barcode=False) >>> snap.metrics.tsse(data, snap.genome.hg38) >>> print(data.obs['tsse'].head()) AAACTGCAGACTCGGA-1 32.129514 AAAGATGCACCTATTT-1 22.052786 AAAGATGCAGATACAA-1 27.109808 AAAGGGCTCGCTCTAC-1 24.990329 AAATGAGAGTCCCGCA-1 33.264463 Name: tsse, dtype: float64