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

Uploaded Source

Built Distributions

pyFlowSOM-0.1.5-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.5-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.5-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.5-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.5-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.5-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.5-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.5-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.5.tar.gz.

File metadata

  • Download URL: pyFlowSOM-0.1.5.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.5.tar.gz
Algorithm Hash digest
SHA256 f76fb7fb533663396532e14a2a257da3721aca2e63e9bae80d840e5b07574fb8
MD5 ee13c0cd0685798c9cd773a9317d85a0
BLAKE2b-256 7cd89a58879ae209c986c593c22b1c56aea28277aac3d152af20bacb9a439954

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyFlowSOM-0.1.5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1c70421bc4bb2bbdceb481b34986a69e511cac58f3a288aebcf92cf02ab0a20f
MD5 28b13c71644bab5facfe054eefda2a82
BLAKE2b-256 4ad253ca3ffbb60f7251149a9ecae6986452c87e0edc1e7da83c2d9a345d2286

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyFlowSOM-0.1.5-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 ae8bea397ca53668ec4ebd6d9b8936a1036c447280c4f9eed94343156b296fa2
MD5 67e8edfb6c9966e1ad9a2681eba6ac29
BLAKE2b-256 a0f3f73cd54704494ee5ceb1116adba4bd48d64addde99087eb8b9ce64864370

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyFlowSOM-0.1.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e8177b0ef4d99fbfaa08df4be30006b3652338578093a7e6346e7758677d9d7d
MD5 2aa09799e0dab8f73df86974b7dac407
BLAKE2b-256 f9b3cc3ed419d3bb6056b90c96cf48948d1f84b23ea2ab1b1ca8c5979259795e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyFlowSOM-0.1.5-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 f2ce61649b8942918b6e406b0977e3627aeb65cdc4610242c201a8a1997d13b2
MD5 b00c31af3c69666667519fdd2d1ec4d3
BLAKE2b-256 d9d9f4e1e4b7f7abfcda8a8690e082e88ef9b2dff893145d5b750c94c712a5c0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyFlowSOM-0.1.5-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0c2160be880e1847a696e058326bd605e35c31c1746c845cd6a505753800172f
MD5 d14fdbfade8d949f76015e4abe36cc0d
BLAKE2b-256 1fd679c6510e10e4fc11c4dd2998f6863559a01d88ecd53884896595e2c4a349

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyFlowSOM-0.1.5-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 a98393393426088b8321a70a2860aea5f0d1a9464362b19e1ca2f4e4bd93cf6d
MD5 fdad329aff9ca0b25cf07a708ab91532
BLAKE2b-256 7977efa7e7c614ac644ebbe1fcf49a9f31bafc5f1e2562479257fdfa43f13d38

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyFlowSOM-0.1.5-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7870a5b7974d11bf9054550d9ea1f8d5f79b83a6a8d8c518f95db6daa75b765b
MD5 911b9e4f45af7f030086dc0e843fad6a
BLAKE2b-256 e939dbe47f9848ce73ddd7b6024a91de0b188746ed9bc3e4e1fd9b8fe126f134

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyFlowSOM-0.1.5-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 2399188db95ae30ab785692c61b44819880519d1eace32a59e87fb95ac2379b9
MD5 8e0ad951a631700664f3b49d4352f153
BLAKE2b-256 c86f4cc9b5b7e76caf3474678d8bf837c673536a230c010c49bcb9426e483be3

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