Skip to content

Instantly share code, notes, and snippets.

@xiamaz
Last active May 28, 2018 09:45
Show Gist options
  • Save xiamaz/13bfe9d493903187256d533a0b67e628 to your computer and use it in GitHub Desktop.
Save xiamaz/13bfe9d493903187256d533a0b67e628 to your computer and use it in GitHub Desktop.
Use $PnE data for flow cytometry data loaded with fcsparser to transform linearized log marker channels according to FCS3.1 specification
# code snipplet to implement PnE based transformation of flow data in python
data = FCSLogTransform().transform(data)
def logTransform(data):
transCols = [c for c in data.columns if "LIN" not in c]
for col, f in channel_info.items():
if f["f1"]:
data[col] = 10 ** (f["f1"] * data[col] / f["range"]) * f["f2"]
print(transCols)
print(data.min(axis=0), data.max(axis=0))
data[transCols] = np.log10(data[transCols])
return data
# data = logTransform(data)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment