Preprocessing
scyan.preprocess.auto_logicle_transform(adata, q=0.05, m=4.5, quantile_clip=1e-05)
Auto-logicle transformation implementation. We recommend it for flow cytometry or spectral flow cytometry data.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
adata |
AnnData
|
An |
required |
q |
float
|
See logicle article. Defaults to 0.05. |
0.05
|
m |
float
|
See logicle article. Defaults to 4.5. |
4.5
|
Source code in scyan/preprocess.py
scyan.preprocess.asinh_transform(adata, translation=0, cofactor=5)
Asinh transformation for cell-expressions: \(asinh((x - translation)/cofactor)\).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
adata |
AnnData
|
An |
required |
translation |
float
|
Constant substracted to the marker expression before division by the cofactor. |
0
|
cofactor |
float
|
Scaling factor before computing the asinh. |
5
|
Source code in scyan/preprocess.py
scyan.preprocess.inverse_transform(adata, obsm=None, obsm_names=None, transformation=None)
Inverses the transformation function, i.e. either scyan.preprocess.auto_logicle_transform or scyan.preprocess.asinh_transform. It requires to have run have of these before.
Note
If you scaled your data, the complete inverse consists in running scyan.preprocess.unscale first, and then this function.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
adata |
AnnData
|
An |
required |
obsm |
Optional[str]
|
Name of the anndata obsm to consider. If |
None
|
obsm_names |
Optional[List[str]]
|
Names of the ordered markers from obsm. It is required if obsm is not |
None
|
transformation |
Optional[str]
|
Name of the transformation to inverse: one of |
None
|
Returns:
Type | Description |
---|---|
ndarray
|
Inverse transformed expressions array of shape \((N, M)\). |
Source code in scyan/preprocess.py
scyan.preprocess.scale(adata, max_value=10, center=None)
Tranforms the data such as (i) std=1
, and (ii) either 0
is sent to -1
(for CyTOF data) or means=0
(for flow or spectral flow data); except if center
is set (which overwrites the default behavior).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
adata |
AnnData
|
An |
required |
max_value |
float
|
Clip to this value after scaling. |
10
|
center |
Optional[bool]
|
If |
None
|
Source code in scyan/preprocess.py
scyan.preprocess.unscale(adata, obsm=None, obsm_names=None)
Reverse standardisation. It requires to have run scyan.preprocess.scale before.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
adata |
AnnData
|
An |
required |
obsm |
Optional[str]
|
Name of the adata obsm to consider. If |
None
|
obsm_names |
Optional[List[str]]
|
Names of the ordered markers from obsm. It is required if obsm is not |
None
|
Returns:
Type | Description |
---|---|
ndarray
|
Unscaled numpy array of shape \((N, M)\). |
Source code in scyan/preprocess.py
scyan.preprocess.compensate(adata, key_added=None)
Use the spillover matrix in adata.varp["spillover_matrix"]
to correct spillover from adata.X
Parameters:
Name | Type | Description | Default |
---|---|---|---|
adata |
AnnData
|
An |
required |
key_added |
Optional[str]
|
Optional key in |
None
|