Skip to content

Commit a96f516

Browse files
committed
move from normalize_estimate_logicle to pm.tl.normalize_autologicle
1 parent 6ffc3cd commit a96f516

3 files changed

Lines changed: 1 addition & 34 deletions

File tree

docs/api.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ For more background information, see the paper for this software package {cite:p
5050
:toctree: generated
5151
5252
pp.aggregate_flowframes
53-
pp.normalize_estimate_logicle
5453
```
5554

5655
## Models

src/flowsom/pp/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
from .fcs_functions import aggregate_flowframes, normalize_estimate_logicle
1+
from .fcs_functions import aggregate_flowframes

src/flowsom/pp/fcs_functions.py

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44

55
import anndata as ad
66
import numpy as np
7-
import pandas as pd
8-
import pytometry as pm
97

108
from flowsom.io import read_FCS
119
from flowsom.tl import get_markers
@@ -54,33 +52,3 @@ def aggregate_flowframes(filenames, c_total, channels=None, keep_order=False):
5452
flow_frame.append(f)
5553
flow_frame = ad.concat(flow_frame, join="outer", uns_merge="first")
5654
return flow_frame
57-
58-
59-
def normalize_estimate_logicle(adata, channels, m=4.5, q=0.05):
60-
"""Normalize and estimate logicle parameters.
61-
62-
:param adata: An AnnData object
63-
:type adata: AnnData
64-
:param channels: Channels/markers to normalize
65-
:type channels: list
66-
:param m: Logicle parameter. Default=4.5
67-
:type m: float
68-
:param q: Quantile to use for negative values. Default=0.05
69-
:type q: float
70-
"""
71-
assert isinstance(adata, ad.AnnData), "Please provide an AnnData object"
72-
assert isinstance(channels, list), "Please provide a list of channels"
73-
channels = list(get_markers(adata, channels).keys())
74-
assert all(i in adata.var_names for i in channels), "Channels should be in the AnnData object"
75-
neg_marker_quantiles = [
76-
np.quantile(adata[:, channel].X[adata[:, channel].X < 0], q) if (adata[:, channel].X < 0).any() else 0.5
77-
for channel in channels
78-
]
79-
neg_marker_quantiles = pd.Series(neg_marker_quantiles, index=channels, dtype=float)
80-
max_range = adata.var["$PnR"][channels].astype(float)
81-
w = (m - np.log10(max_range / np.abs(neg_marker_quantiles))) / 2
82-
for channel in channels:
83-
adata[:, channel].X = pm.tools.normalize_logicle(
84-
adata[:, channel], t=max_range[channel], m=m, a=0, w=w[channel], inplace=False
85-
).X
86-
return adata

0 commit comments

Comments
 (0)