Skip to main content

A Python implementation of the SOM training functionality of FlowSOM

Project description

Build Status Coverage Status

pyFlowSOM

Python runner for the FlowSOM library.

Basic usage:

import pandas as pd
from pyFlowSOM import map_data_to_nodes, som

df = pd.read_csv('examples/example_som_input.csv')
example_som_input_arr = df.to_numpy()
node_output = som(example_som_input_arr, xdim=10, ydim=10, rlen=10)
clusters, dists = map_data_to_nodes(node_output, example_som_input_arr)

To put the data back into dataframes:

eno = pd.DataFrame(data=node_output, columns=df.columns)
eco = pd.DataFrame(data=clusters, columns=["cluster"])

To export to csv:

eno.to_csv('examples/example_node_output.csv', index=False)
eco.to_csv('examples/example_clusters_output.csv', index=False)

To plot the output as a heatmap:

import seaborn as sns

# Append results to the input data
example_som_input_df['cluster'] = clusters

# Find mean of each cluster
df_mean = example_som_input_df.groupby(['cluster']).mean()

# Make heatmap
sns_plot = sns.clustermap(df_mean, z_score=1, cmap="vlag", center=0, yticklabels=True)
sns_plot.figure.savefig(f"example_cluster_heatmap.png")

Develop

Continually build and test while developing. This will automatically create your virtual env

./build.sh && ./test.sh

The C code (pyFlowSOM/flosom.c) is wrapped using Cython (pyFlowSOM/cyFlowSOM.c).

Tests do an approximate exact comparison to cluster id groundtruth and an approximate comparison to node values only because of floating point differences. All randomness has stubbed out in in the y2kbugger/FlowSOM fork and works in tandem to the deterministic flag to the som function.

To regenerate test data, which may be required if you changed any sources of randomness:

python -m pyFlowSOM.generate_test_outputs

To generate heatmaps for manual comparison:

python -m pyFlowSOM.generate_test_heatmaps

To bump the version and deploy to pypi:

Just add the tag which matches the version you want to deploy:

git tag v0.1.4
git push --tags

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyFlowSOM-0.1.8.tar.gz (7.2 MB view details)

Uploaded Source

Built Distributions

pyFlowSOM-0.1.8-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (518.9 kB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

pyFlowSOM-0.1.8-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (511.0 kB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ ARM64

pyFlowSOM-0.1.8-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (485.1 kB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

pyFlowSOM-0.1.8-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (477.6 kB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ ARM64

pyFlowSOM-0.1.8-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (491.9 kB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

pyFlowSOM-0.1.8-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (490.3 kB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ ARM64

pyFlowSOM-0.1.8-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (494.0 kB view details)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

pyFlowSOM-0.1.8-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (487.6 kB view details)

Uploaded CPython 3.8 manylinux: glibc 2.17+ ARM64

File details

Details for the file pyFlowSOM-0.1.8.tar.gz.

File metadata

  • Download URL: pyFlowSOM-0.1.8.tar.gz
  • Upload date:
  • Size: 7.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.6

File hashes

Hashes for pyFlowSOM-0.1.8.tar.gz
Algorithm Hash digest
SHA256 c43e4b6ad4f7868ed1143672f75e0a5181342b6c9551b1bc6fdde41c232b54d7
MD5 f2c696b26c904c2296918a22d3d59536
BLAKE2b-256 65eed958a7beae582eaff203c491568be305c9ff4f21b7aa961f10a9de4855cc

See more details on using hashes here.

File details

Details for the file pyFlowSOM-0.1.8-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyFlowSOM-0.1.8-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3138d0cd26cfba444f88175d2bb5431117e7789886b6456b18cbcf7564822fa9
MD5 32391db13677dc5c9b755da34654892f
BLAKE2b-256 5d166ce94848a75d80daa269c7b9cc2d227dae6c31d779e68a2cee92b8177df6

See more details on using hashes here.

File details

Details for the file pyFlowSOM-0.1.8-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyFlowSOM-0.1.8-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 80b56526232c884487d99032fcb824433f74ece53596396a53742ae7f5dc3daf
MD5 13d321c0a36310802610324598477876
BLAKE2b-256 fe90b725420230bced18e11beed20a04dbf8f3e743f80693e8024d2e73473985

See more details on using hashes here.

File details

Details for the file pyFlowSOM-0.1.8-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyFlowSOM-0.1.8-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2801b47b5363869365b664e6fffb0608d80ea44d276073faacdd63d4850a6714
MD5 ee1ea08aac223cd4e749f07ed6caedc2
BLAKE2b-256 8c23fc872ecd5eb4d12bdc0dd0bb32e7a79fec3dafad11112fcd5f02efb657e4

See more details on using hashes here.

File details

Details for the file pyFlowSOM-0.1.8-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyFlowSOM-0.1.8-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 6e163790657206d5c8b43a9d2c2a38f4c3f524c5f26ce5ae5e3fe4d74db26e8e
MD5 ca0f2327dd1ab81d75d07f9441e251c8
BLAKE2b-256 f38b14ea121391a96b2f7aee26ebb2671cfa40da0379b008c7c1524385dea838

See more details on using hashes here.

File details

Details for the file pyFlowSOM-0.1.8-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyFlowSOM-0.1.8-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3c5c6eecaa686f8a701cf471a7225cee2e7aba34c87bec04aea588078a8653ea
MD5 fb54c32a656f3293e5cc1dd6d738d4c8
BLAKE2b-256 beff9cfc78795f84bc3d7db77374d0884a4f09e9ed2357763db8df5ddfe15c39

See more details on using hashes here.

File details

Details for the file pyFlowSOM-0.1.8-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyFlowSOM-0.1.8-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 94d9838162d396dcec6d9375b4e403f8a54e0c6a0aa8220c7c8d50b1ecb02440
MD5 91147f62be9cfd26c513765748c8c749
BLAKE2b-256 ff28bc18a7634f3d7733b09afea2fd521f9d077e07e1d453acf1a8cf23681fc0

See more details on using hashes here.

File details

Details for the file pyFlowSOM-0.1.8-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyFlowSOM-0.1.8-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f85f9f33b70941d2b23f87d3d0e2152b14e4389ba660fad824da5dd4a98eb802
MD5 d0d6c4caf2896cdd34451a7f4c52c1cb
BLAKE2b-256 4d3ea8307e5c06b49a782a4c8a99af96cf8dd493c320f984c504e1858ad5fc38

See more details on using hashes here.

File details

Details for the file pyFlowSOM-0.1.8-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyFlowSOM-0.1.8-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 717ac62a8295605798864254458dc93bf2ff5fff8f15032c53e349d1d9566571
MD5 88c12175465f77b82614678c42160e78
BLAKE2b-256 cd0d22136fc0af094626182a95ac3a40d6f41b88ae1cc6f6d326deb04af85747

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page