log1p
log1p ¶
log1p(
data,
targetLayer="log",
outputDir=None,
chunk_size=10000,
maxWorkers=None,
verbose=True,
streamData=False,
sdataTable=None,
)
Log-transform the expression matrix into a layer.
Applies log1p to .raw.X and stores the result in layers[targetLayer], so
the original values stay available. Intensities from imaging are heavily
right-skewed; most visualisation and clustering behaves better on the log scale.
The transform runs in row chunks across a ThreadPoolExecutor, and in streaming
mode each chunk is read, transformed, and written without the whole matrix ever
being resident.
An existing layer of the same name is overwritten.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
(AnnData | SpatialData | str, required)
|
The cell table. An |
required |
targetLayer
|
str
|
Name of the layer the transformed matrix is written to. |
'log'
|
outputDir
|
str
|
Directory to write the updated object to. With |
None
|
chunk_size
|
int
|
Rows per chunk. Lower it if memory is tight. |
10000
|
maxWorkers
|
int
|
Threads to transform with. Defaults to |
None
|
verbose
|
bool
|
Print progress messages and warnings. |
True
|
streamData
|
bool
|
Run out of core against an |
False
|
sdataTable
|
str
|
Which |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
adata |
AnnData | SpatialData | None
|
The updated object with |