farkkilab / tribus

Cell type based analysis of multiplexed imaging data
MIT License
3 stars 1 forks source link

Tribus: Semi-automated panel-informed discovery of cell identities and phenotypes from multiplexed imaging and proteomic dataimg

Installation

conda env create --file=tribus_environment.yml
# This environment allows you to run Tribus and repeat all the analyzes in the manuscript. 
conda activate tribus

cd tribus/
python setup.py develop
pip install  -e ./

Now you are ready to use Tribus!

Usage instructions

Tribus for cell type classification

Input dataset

CellID Marker 1 Marker 2 ... Marker N Eccentricity Cell Area
1 ...
2 ...

Logic table

Here is an example of 1-level logic table. The logic table is designed based on the marker panel following some rules:

Marker Cancer Stromal CD.4.Tcell CD8.T.cell CD11c.Myeloid IBA1.Myeloid
CK7 1 -1 -1 -1 -1 -1
PAX8 1 0 0 0 0 0
Vimentin -1 1 0 0 0 0
CD4 0 -1 1 -1 -1 -1
CD8a 0 -1 -1 1 -1 -1
IBA1 0 0 0 0 0 1
CD11c 0 0 0 0 1 0

Tribus Parameter

# set random seed to ensure reproducity
depth = 1
labels, scores = tribus.run_tribus(np.arcsinh(sample_data[cols]/5.0), logic, depth=depth, normalization=z_score, 
                            tuning=0, sigma=1, learning_rate=1, 
                            clustering_threshold=100, undefined_threshold=0.0005, other_threshold=0.4, random_state=42)

Tribus visualization

Tribus provide some visualization functions. You can find examples in example Tribus_run.ipynb in this repository.

Napari plugin for fast user interaction

We provide Fast_masking_v2_colors_fixed.ipynb to run Napari plugin. Run the chunks in the notebook and a napari window will pop out. You can check the quality of cell type calling and adjust the logic table correspondingly.

img

We are also providing an Napari interface to run Tribus (function under testing now)! Here is the full interface.

img

Folder structure

Here is an example of folder structure: P.S. The input data and gate logic could be anywhere else in the computer as long as we specify the correct path when running Tribus.

    cool_project_name/
    |_ date_logic.xlsx
    |_ input_data/
    |   |_ each file here belongs to a separate slide (windsord-normalization is done by slide)
    |_ tribus_results/
        |_ 2021-11-02_13-40/
        |    |_ gates_2021-11-02_13-40.xlsx
        |    |_ labels_2021-11-02_13-40.csv
        |_ 2021-11-02_13-12/
            |_ gates_2021-11-02_13-12.xlsx
            |_ labels_2021-11-02_13-12.csv

Citing Tribus

If you used Tribus in your research, please consider cite us: https://doi.org/10.1101/2024.03.13.584767