Giter VIP home page Giter VIP logo

flowsom's Introduction

FlowSOM

PRs Welcome GitHub license PYPI version

This repository contains a Python implementation of FlowSOM algorithm for clustering and visualizing a mass cytometry data set.

For more details about the algorithm, please check (En|δΈ­)

Installation

Just use pip

pip install FlowSom

Or download this repository to a directory of your choice and then run:

pip install -r requirements.txt

How to use it

Read Files
In order to use FlowSOM you need your data saved as a .csv file or a .fcs file.
file = r'flowmetry.fcs'
Or
file = 'flowmetry.csv'
Import Package
Then you need to import the package.
If you install the package via pip, then you should run
from flowsom import flowsom
If you download the repository, you should run
from flowsom import *
Play Around
Then you can run FlowSOM just as follows:
fsom = flowsom(file) # read the data
fsom.som_mapping(50, 50, 31, sigma=2.5, 
                 learning_rate=0.1, batch_size=100)  # trains SOM with 100 iterations
fsom.meta_clustering(AgglomerativeClustering, min_n=40, 
                     max_n=45, 
                     iter_n=3) # train the meta clustering for cluster in range(40,45)       

Use the trained output

After the training, you will be able to:

  • Get the weights of SOM with method fsom.map_som
  • Get the best number of clustering with method fsom.bestk
  • Get the prediction dataframe with method fsom.df and fsom.tf_df
  • Visualize the final clustering outcome with methodfsom.vis

Examples

The demo code could be found here.

The distance map of SOM trained from a sample flow cytometry data:

Flow example

The visualization example after meta-clustering using Minimal Spanning Tree (MST): MST example

FlowSOM Algorithm

FlowSOM analyzes flow or mass cytometry data using a self-Organizing Map (SOM). Using a two-level clustering and star charts, FlowSOM helps to obtain a clear overview of how all markers are behaving on all cells, and to detect subsets that might be missed otherwise.

The algorithm consists of four steps:

  • reading the data
  • building a Self-Organizing Map
  • building a minimal spanning tree
  • computing a meta-clustering

Self-Organizing Map

SOM is a type of unsupervised Artificial Neural Network able to convert complex, nonlinear statistical relationships between high-dimensional data items into simple geometric relationships on a low-dimensional display. Introduction

Minimum Spanning Tree

A minimum spanning tree (MST) or minimum weight spanning tree is a subset of the edges of a connected, edge-weighted undirected graph that connects all the vertices together, without any cycles and with the minimum possible total edge weight.

Meta-clustering

The meta-clustering technique conducted on the SOM is hierarchical consensus meta-clustering, which clusters the weights of trained SOM into different groups.

Acknowledge

FlowSOM is built based on FlowCytometryTools, MiniSom and Consensus Clustering.

Update pypi: source

flowsom's People

Contributors

hatchin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

flowsom's Issues

Reassigning FlowSOM package

Dear @Hatchin ,

We (original authors of the FlowSOM package) have recently translated the FlowSOM package to R ourselves, including similar options for visualisation as available in R. As your package does not seem maintained anymore (See issue #1, with the release version of the code being broken since 2020), we were wondering if you would be willing to transfer the name to our project, so we could give users the most straight-forward way of installing our package.

Kind regards,
Sofie

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.