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

Uploaded Source

Built Distributions

pyFlowSOM-0.1.11-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.11-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.11-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.11-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.11-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.11-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.11-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.11-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.11.tar.gz.

File metadata

  • Download URL: pyFlowSOM-0.1.11.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.11.tar.gz
Algorithm Hash digest
SHA256 62eda128a00727e821cd7f72d04772a877767f379ea16fb1d447115446f91fd4
MD5 f470418a63fcfce089571b50d1166c38
BLAKE2b-256 28cf364abe29614384963aa7a7c3c38ddac4f1fa2046876a4d498b6257dc60d2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyFlowSOM-0.1.11-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 eca0ea3b61620ae931cccf81517305b7ac8fb4fbf33fde944f6752cbf2f40998
MD5 c3224197196e01f9785578e6a7d2f64d
BLAKE2b-256 85b4648d23ced10fc5859ac2186e47bf88c0131298bfba8fcdd630e052ad6956

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyFlowSOM-0.1.11-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 8e4e65bc2c6e98e898c12881d91699ad2d8f7bf348a8d5febb8e02bee941f174
MD5 3cff7643deddfe4b5a2d6102c1f797cb
BLAKE2b-256 b56e512f4b488bda8d54938cc67b59afff92e29ede30d88f490392348b4003eb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyFlowSOM-0.1.11-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 bc6d06605c284fe57a32594d55d18b2139cd68135d36574a6cdf6dac4e59721f
MD5 312cf61b28feb8acbe584d1113188c06
BLAKE2b-256 b50c2772fa8ea12a149ff8b604eec6090a3a8aea3d5adc1dbfcae14a89e68176

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyFlowSOM-0.1.11-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 f19e7cb6644fbf8b252d51a212abdf09d3048ee4d06e3893a60490d3c90f817a
MD5 123c9f919269ee142ac961cce08690db
BLAKE2b-256 7f0274db310acc73c0b45e3944add32a6bfd82817b80de149f418fe2ac0c3b0b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyFlowSOM-0.1.11-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b427c899040f2fdd73000237f0c6bcaf372cacee33466a23fd269562bee3f949
MD5 cc83b92a386a68a37b73b4cd7df4807c
BLAKE2b-256 5c5dd87f913935161934d681d42d043e9c2ca503ffce6354ba7a30124f61fe71

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyFlowSOM-0.1.11-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 cb795cc9f3f7ee93db931d27905c3f800265a3ff4f4213e7bce1c31141ba5e76
MD5 0688d4e23e770fd725126fce05b04a00
BLAKE2b-256 5be3a5444f25018fd6805e70cfd2a75184788a7bb0c291101649f2378e66007e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyFlowSOM-0.1.11-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 aa88e0fb86185af87ded3c2edf36b46a82fc2644cd06503e5701b6e0006ddb84
MD5 a27b9326f96c900c30f593a0cfae75dc
BLAKE2b-256 1fe1eb667459ea15fd7fc01368caf8960b6600fc8de32d52a28d83274e61d15f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyFlowSOM-0.1.11-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 afb16583e45ebc1919c423b3edacf7f0fbf568e4a908e73b4a903135ba78cc51
MD5 70f514cfc9e5dcffa4011939f4e45f5c
BLAKE2b-256 6dfa2adf557fa0a5c58e9a171f18817de4f52f72d7fb27900a3503fa52990cd2

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