snapatac2.pp.call_cells#
- snapatac2.pp.call_cells(data, use_rep, inplace=True, n_jobs=8)[source]#
Call valid cells from feature counts using the OrdMag algorithm.
Use this function to remove empty or low-signal barcodes after importing fragments and computing a per-barcode count metric. The implementation uses the order-of-magnitude (OrdMag) strategy from Cell Ranger’s cell-calling workflow; EmptyDrops is not implemented.
Anti-Patterns#
Do NOT pass a representation that is missing from
data.obswhenuse_repis a string.Do NOT use this function as a replacement for QC thresholding by TSS enrichment or fragment count; use
filter_cellswhen explicit QC thresholds are required.Do NOT expect a return value when
inplace=True; the object is subset in place and the function returnsNone.
- type data:
AnnData|list[AnnData]- param data:
AnnData object, or list of AnnData objects, to subset to called cells.
- type use_rep:
- param use_rep:
Count representation used for cell calling. If a string, read counts from
data.obs[use_rep]. If an array, use it directly as one count per barcode.- type inplace:
- param inplace:
If
True, subsetdatato called cells and returnNone. IfFalse, return integer indices of called cells without modifyingdata.- type n_jobs:
- param n_jobs:
Number of parallel jobs to use when
datais a list.- returns:
If
inplace=False, returns integer indices of barcodes called as cells. Ifdatais a list, returns one index array per object. Ifinplace=True, returnsNoneand subsetsdatain place.- rtype:
See also
filter_cellsApply explicit QC thresholds to cells.
Examples
>>> import snapatac2 as snap >>> fragments = snap.datasets.pbmc500(downsample=True) >>> data = snap.pp.import_fragments( ... fragments, ... chrom_sizes=snap.genome.hg38, ... sorted_by_barcode=False, ... ) >>> selected = snap.pp.call_cells(data, use_rep="n_fragment", inplace=False) >>> data = data[selected, :]