scatrans.store_raw_counts

scatrans.store_raw_counts#

scatrans.store_raw_counts(adata, layer='counts', save_raw=False, overwrite=False)[source]#

Store raw counts and the original spliced/unspliced (or mature/nascent) layers early in the analysis, right after loading and basic QC, but BEFORE HVG selection, normalization, or log1p.

This is critical for scATrans because: - Memento and PyDESeq2 need raw counts for proper modeling. - Velocity / active transcription analysis (active_score) needs the original

spliced/unspliced matrices on as many genes as possible.

By default we only save to the given layer (save_raw defaults to False so we do not automatically touch adata.raw unless you explicitly ask for it).

We automatically save any existing velocity layers under “raw_spliced”, “raw_unspliced” (or “raw_mature”, “raw_nascent”). These raw_* layers are subject to the normal AnnData behavior: if you later gene-subset the object (e.g. to HVGs), the layers are subsetted as well. They do not magically retain the original full-gene matrices after subsetting.

If you need the full-gene raw velocity data after HVG-based visualization, either:

  • call store_raw_counts() on the full object and keep the full object for DE / active_score / enrichment while using a copy for visualization, or

  • use save_raw=True (which sets adata.raw).

Recommended early call:

scat.store_raw_counts(adata, layer=”counts”, save_raw=False)

Parameters:
Return type:

None