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.12.tar.gz (7.2 MB view details)

Uploaded Source

Built Distributions

pyFlowSOM-0.1.12-cp311-cp311-win_amd64.whl (76.1 kB view details)

Uploaded CPython 3.11 Windows x86-64

pyFlowSOM-0.1.12-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.12-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.12-cp310-cp310-win_amd64.whl (77.1 kB view details)

Uploaded CPython 3.10 Windows x86-64

pyFlowSOM-0.1.12-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (485.2 kB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

pyFlowSOM-0.1.12-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.12-cp39-cp39-win_amd64.whl (78.9 kB view details)

Uploaded CPython 3.9 Windows x86-64

pyFlowSOM-0.1.12-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.12-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.12-cp38-cp38-win_amd64.whl (78.8 kB view details)

Uploaded CPython 3.8 Windows x86-64

pyFlowSOM-0.1.12-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.12-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.12.tar.gz.

File metadata

  • Download URL: pyFlowSOM-0.1.12.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.12.tar.gz
Algorithm Hash digest
SHA256 56f4816a3e69e0fa7b39f890ccd476bfe40b5489c329f55cdbd266f1e1d6ab05
MD5 562bca5aba2c76c66088a0ca7385a681
BLAKE2b-256 e5a6a40dea63fef292577d2bfb0e4648686feb4a244ceede2e7292318f95c407

See more details on using hashes here.

File details

Details for the file pyFlowSOM-0.1.12-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyFlowSOM-0.1.12-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 227609ff594f1dcd3b3ceb8e94939d33a417fbbb0101818d6a231f4819155e29
MD5 09c17bf64e03298fca4db92635822bdc
BLAKE2b-256 fcbf7cf790054f13cb67b47c71e095dfbcb54883d07f6d04f809d2eebcc5ad42

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyFlowSOM-0.1.12-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9ed62475cbba2eaf6ea5213a6eca5e6664232cc53a685de20809970b6040ad94
MD5 74b98579ff1182e01d08c7e9a3b83867
BLAKE2b-256 c7c2d82a16ae53af4e64cf80ccd622452aa4c3a8981b746f402755616efa6797

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyFlowSOM-0.1.12-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 5bbcd57c0e28a66b610a7332d90ce1900ed2804a53e474ad88541bc7836ff226
MD5 eaa4478500a54b99f26595d85831ba4b
BLAKE2b-256 4b088b3c59d78506ec429f5a6c9b765e14a3d15228ca436cefbeafdeca49de19

See more details on using hashes here.

File details

Details for the file pyFlowSOM-0.1.12-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyFlowSOM-0.1.12-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 baec107b67ba070b5343bb2411386198e4f2daff446b237350695b1bcf791796
MD5 b6551aa710bbca8121740e2dcb85290d
BLAKE2b-256 6e273afd6e0e445c8bc6e1bb0b0255d9346375faa5d45a711e2d003d2e3f62b7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyFlowSOM-0.1.12-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1d34dab16298c3588962a3f8e0124cd98d350b499e91dfc24c5a8a1efbb832c4
MD5 d280d7b7e1be771bcff1efc719c354c0
BLAKE2b-256 617d6d548e0af2a8409cf1939e0cc9fb6818f1fd7319539377229d1c98562ab6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyFlowSOM-0.1.12-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 ae7bfc57e07482e74ea16c9cf858b05d5d995fafe60af55797923ad36f5ac7e1
MD5 02185d241e2c99eb6a439142d8d362a7
BLAKE2b-256 3914229a990629f962ae5479686aebaf6462773a96d41de7ce7e52ed5a65c16e

See more details on using hashes here.

File details

Details for the file pyFlowSOM-0.1.12-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for pyFlowSOM-0.1.12-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 4d97c3492d8acf124789a61f4a58db12a7b16052e3217dceba158973e09359dd
MD5 052e2c2a22056e698c6a9c0782e5d404
BLAKE2b-256 d62c713ddc4905ebf8d002a17d1d0ee7b81455ff9f8b3c6779c6d27c0489800d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyFlowSOM-0.1.12-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 853791d6bc3681472806fdfe76dfdcb8df1cbff13676cd1525e4221503811623
MD5 f7be076578812577fd4b89d4a6d60cc3
BLAKE2b-256 d899579a1c4514e379897def67c6a82725060f82540df4347042846703ebf05e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyFlowSOM-0.1.12-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 8186715fd3c5a867a822a3455c9ca5d3e434d5d9ef78f1195604f9affba42c52
MD5 46b21fc318b34969f790912da4a3d1fc
BLAKE2b-256 22dc5bc04d32e9593333eea6073eb582648233e7366fba494ec558d291f93638

See more details on using hashes here.

File details

Details for the file pyFlowSOM-0.1.12-cp38-cp38-win_amd64.whl.

File metadata

File hashes

Hashes for pyFlowSOM-0.1.12-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 0990b59f6c77b369536661d33f68e7b845613de4286b9d0b1eb9c935ca062bc2
MD5 d1ba4d8b1c4ebaf064e00c4969f74bfc
BLAKE2b-256 fbdbb920f731fe584927109c3663e77fb530707abee0934759b18c7c641f12ab

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyFlowSOM-0.1.12-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 292322477322dfb814eaa7cbedc554fc870145172151210f78dc89ffbfb7d2e7
MD5 e6449ad88e131868c354f7d075ee551f
BLAKE2b-256 f976737e4eb26bfdc23465127b767d2d88848fef6a23ce25fc63ea66474e10cf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyFlowSOM-0.1.12-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 884064383ea53dafd5350fb1bcc009fb37a034b5e69937319a23a194d208d744
MD5 4cb18e6e484198b887b26f1a7e29316e
BLAKE2b-256 ef0608fa9dff8ee00cf806a5523ddb159faf5c08100df355f7d60e01dc22b43d

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