https://github.com/alexpreynolds/flow-cytometry-visualization
Flow cytometry visualization demo using Jupyter, Plotly, and fcsparser
https://github.com/alexpreynolds/flow-cytometry-visualization
Science Score: 13.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
○.zenodo.json file
-
○DOI references
-
○Academic publication links
-
○Committers with academic emails
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (15.0%) to scientific vocabulary
Keywords
Repository
Flow cytometry visualization demo using Jupyter, Plotly, and fcsparser
Basic Info
- Host: GitHub
- Owner: alexpreynolds
- Language: Jupyter Notebook
- Default Branch: master
- Homepage: https://nbviewer.jupyter.org/github/alexpreynolds/flow-cytometry-visualization/blob/master/FlowCytometryVisualization.ipynb
- Size: 16.6 MB
Statistics
- Stars: 0
- Watchers: 2
- Forks: 2
- Open Issues: 0
- Releases: 0
Topics
Metadata Files
README.md
flow-cytometry-visualization
This project demonstrates visualizing flow cytometry datasets, using Jupyter, Plotly, and fcsparser.
A command-line script is included called batchFCSPlot.py that does batch conversion of FCS files to PNG-formatted scatterplots. This script makes uses of Google Puppeteer and Chromium, in addition to Plotly and fcsparser.
Jupyter notebook
To run this quickly, you may view the Jupyter notebook in nbviewer:
https://nbviewer.jupyter.org/github/alexpreynolds/flow-cytometry-visualization/blob/master/FlowCytometryVisualization.ipynb
It can be useful to run this locally, to make tweaks and see how things work.
First, install required Python libraries:
$ pip install fcsparser
$ pip install jupyter
$ pip install plotly
$ pip install numpy
Installing these libraries could take a few minutes, depending on what is already installed.
The fcsparser library is used to open and process FCS files. The other libraries are used for processing and visualizing the data.
Open the notebook file FlowCytometryVisualization.ipynb:
$ jupyter notebook FlowCytometryVisualization.ipynb
This will open the notebook in your default web browser.
Note: If you run into IOPub errors, adjust jupyter settings when loading the notebook:
``` $ jupyter notebook --NotebookApp.iopubdatarate_limit=1.0e10 FlowCytometryVisualization.ipynb
```
Make a couple adjustments, as needed, to load local data and select desired datasets:
- Adjust the value of the
fcsBaseFnvariable to point to a locally-saved copy of your FCS file. The desired FCS file could be put into thedatasubdirectory in this notebook's directory. - Adjust the desired column names in the
colsOfInterest; these are used to render the three axes of the scatterplot.
After making adjustments, re-run the Jupyter notebook. To do this, pull down the Kernel menu and select Restart & Run All.
The scatterplot is available at the bottom of the notebook and can be interacted with click-and-drag and scrollwheel actions, which rotate and zoom the plot.
A PNG file of the scatterplot can be exported by clicking on the camera icon in the top-right corner of the scatterplot window.
Batch plot generation
Prerequisites
Batch generation requires the additional installation of the pyppeteer Python library, which will in turn install Chromium, a version of Google Chrome that is used here to generate and export PNG files:
$ pip install pyppeteer
Usage
$ ./batchFCSPlot.py --inputDir <directory-of-FCS-files> --outputDir <directory-for-image-files> --fcsColumns <list-of-column-headers> [ --gateX <float> --gateY <float> --gateZ <float>] [ --xRangeMin <float> --xRangeMax <float> --yRangeMin <float> --yRangeMax <float> --zRangeMin <float> --zRangeMax <float> ]
The first time the batchFCSPlot.py script is run, you may be prompted to grant permissions for Chromium to access your screen display. Just click on the "Allow" button for the script to proceed. You should only need to do this once; afterwards, the browser will make screenshots in the background.
Gate values --gateX, --gateY, and --gateZ are optional and are set initially to defaults of 3.55, 3.2, and 3.02, respectively.
Each pair of --xRangeMin, --xRangeMax, --yRangeMin, --yRangeMax, --zRangeMin, and --zRangeMax is set to a default minimum of 0 and a maximum of 6, respectively.
Example
When run from within this project directory:
$ ./batchFCSPlot.py --inputDir data --outputDir /tmp/fcsImages --fcsColumns "APC-H,PB450-H,ECD-H"
Debug: Writing [/tmp/fcsImages/01-TripDay5-E2-Untreated/index.html] and [/tmp/fcsImages/01-TripDay5-E2-Untreated/figure.png]...
Debug: Writing [/tmp/fcsImages/01-TripDay5-B1-PD1/index.html] and [/tmp/fcsImages/01-TripDay5-B1-PD1/figure.png]...
Debug: Writing [/tmp/fcsImages/01-TripDay5-C1-TIM3/index.html] and [/tmp/fcsImages/01-TripDay5-C1-TIM3/figure.png]...
Debug: Writing [/tmp/fcsImages/01-TripDay5-E1-Untreated/index.html] and [/tmp/fcsImages/01-TripDay5-E1-Untreated/figure.png]...
Debug: Writing [/tmp/fcsImages/01-TripDay5-B2-PD1/index.html] and [/tmp/fcsImages/01-TripDay5-B2-PD1/figure.png]...
Debug: Writing [/tmp/fcsImages/01-TripDay5-A3-unstained/index.html] and [/tmp/fcsImages/01-TripDay5-A3-unstained/figure.png]...
Debug: Writing [/tmp/fcsImages/01-TripDay5-D2-LAG3/index.html] and [/tmp/fcsImages/01-TripDay5-D2-LAG3/figure.png]...
Debug: Writing [/tmp/fcsImages/01-TripDay5-A2-multiplex/index.html] and [/tmp/fcsImages/01-TripDay5-A2-multiplex/figure.png]...
Debug: Writing [/tmp/fcsImages/01-TripDay5-C2-TIM3/index.html] and [/tmp/fcsImages/01-TripDay5-C2-TIM3/figure.png]...
Debug: Writing [/tmp/fcsImages/01-TripDay5-A1/index.html] and [/tmp/fcsImages/01-TripDay5-A1/figure.png]...
Debug: Writing [/tmp/fcsImages/01-TripDay5-D1-LAG3/index.html] and [/tmp/fcsImages/01-TripDay5-D1-LAG3/figure.png]...
In this example, each of the subfolders /tmp/fcsImages/<FCS-dataset> contain index.html and figure.png.
The following, for instance, will open a PNG file in your default image viewer:
$ open /tmp/fcsImages/01-TripDay5-B1-PD1/figure.png
Owner
- Name: Alex Reynolds
- Login: alexpreynolds
- Kind: user
- Location: Seattle, WA USA
- Company: Altius Institute for Biomedical Sciences
- Website: bitsumma.com
- Repositories: 92
- Profile: https://github.com/alexpreynolds
Pug caregiver, curler, cyclist, gardener, beginning French scholar
GitHub Events
Total
Last Year
Committers
Last synced: 9 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| Alex Reynolds | a****s@g****m | 19 |
Issues and Pull Requests
Last synced: 9 months ago
All Time
- Total issues: 0
- Total pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Total issue authors: 0
- Total pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 0
- Pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0