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

Uploaded Source

Built Distributions

pyFlowSOM-0.1.6-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.6-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (510.9 kB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ ARM64

pyFlowSOM-0.1.6-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.6-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.6-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.6-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.6-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.6-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.6.tar.gz.

File metadata

  • Download URL: pyFlowSOM-0.1.6.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.6.tar.gz
Algorithm Hash digest
SHA256 e11085f0b2c2e1ecdbf965a9ce8f9c336726c20e079385bcdfede0f5f209033d
MD5 674766f75020f608e82823256ff7b966
BLAKE2b-256 c97dd87ae9837c975f42c656220c3e3f5e03d764c72de900da929a66b81736f7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyFlowSOM-0.1.6-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 687355ce00091e10a410b917917729c57d17d4682377ceb6c7bbdd88630afb54
MD5 48b769a5cee99367a10d4302ca89f926
BLAKE2b-256 20fc2eca3e167506eb1d5a1d9a92950bf62e845e56fe509cd61d3747ffdd2df8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyFlowSOM-0.1.6-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 77676198c958d4405e5fe00cc0a297ef48dc9af6eb7da81ae219066a3e4ab477
MD5 9f8943a28d9f45b06692a29ff7b29aa4
BLAKE2b-256 57bc9ec1bc28750769e2ed0cef00f17b7c4b729f1867696ac074354e3596060a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyFlowSOM-0.1.6-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b0d3b0f629a659e482be89d3dfe9ebe401f6418392dbf4ac61a36f334345992d
MD5 8b76a1c51754c9adf27308c4643645aa
BLAKE2b-256 f4dfb447656cf43201f63fd1707c270926b72d3bd423d45d0305cf47fd042ab1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyFlowSOM-0.1.6-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 c243c05651e81db0397d251eb44953be935800c99c16f6ef5f211e7014909c94
MD5 6466a27c749af144608c7e33ab947e33
BLAKE2b-256 1d60463485c3bd34056b08acacdb07b1cbe62ad93f2b7dfe1df5e4b7478b7042

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyFlowSOM-0.1.6-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5a4c6fdf5a071733f44b18aea79c556f0007a59dc5a62e875cb57a5d01a4b68a
MD5 77e99c610b0c60e0478329bf0fb8168f
BLAKE2b-256 fe2935987ff9bd5664e95e3cc9ef0abce45f671d2794a71896318f30350292c3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyFlowSOM-0.1.6-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 a4e1afaea8c18f967348b931777e6ce2d29bdcb203c7ea1dead7b054beefb40c
MD5 5b1962775c3b39453565c59d28116df5
BLAKE2b-256 c294dde30a56592b40d5a6357e9e1a48dccc1e66eb5bd7fa2523dd03c91c8861

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyFlowSOM-0.1.6-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e9cc1a82c1688649551ba6b73d1e2c6c037b6cd61785a3d660d609fb0705e8cb
MD5 82c241979ea40f3c8cd4747da2837db3
BLAKE2b-256 bdf92d06af9bc384598e59111a9d5e7377682c084f013511f796fd90ec84df31

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyFlowSOM-0.1.6-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 db19b60e857547bcd62765cf537a1dfca7a2f923f68b0afed9fc4487be5fc79c
MD5 8f7ff77a016232e0aa55dc9fb68dc95d
BLAKE2b-256 e7b2b8f212b4964a5d710a1cfec31d118a18f9264d04b9a5eeea164c535a7483

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