1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
|
%global _empty_manifest_terminate_build 0
Name: python-jinxif
Version: 0.0.49
Release: 1
Summary: A python3-based image analysis package to achieve fully-documented and reproducible visualization and analysis of bio-medical microscopy images. This is a fork from Jennifer Eng`s mplex_image software library.
License: GPL>=3
URL: https://gitlab.com/bue/jinxif
Source0: https://mirrors.nju.edu.cn/pypi/web/packages/5d/89/ba0c58831636543d4a103dfe5c858f497e31bd858cf72b0065cd2dd3dc90/jinxif-0.0.49.tar.gz
BuildArch: noarch
Requires: python3-aicsimageio
Requires: python3-cellpose
Requires: python3-imagecodecs
Requires: python3-matplotlib
Requires: python3-numpy
Requires: python3-numba
Requires: python3-ome-types
Requires: python3-opencv-python
Requires: python3-pandas
Requires: python3-pillow
Requires: python3-scikit-image
Requires: python3-scipy
Requires: python3-seaborn
Requires: python3-torch
%description
# cmIF fork: jinxIF
+ Author: engje, bue
+ Date: 2020-11-01
+ License: GPLv3
+ Language: Python3
Description: jinxIF is a fork from Jennifer Eng's original cmIF mplex\_image software library (https://gitlab.com/engje/cmif).
cmIF is a Python3 library for automated image processing and analysis of multiplex immunofluorescence images.
Source: the latest version of this user manual can be found at https://gitlab.com/bue/jinxif/-/blob/master/README.md
## HowTo
### HowTo - Installation Jixif
**Python version:**
A cornerstone of jinxif is **cellpose**, which is used for segmentation.
Cellpose requires at the moment of this writing python version 3.8.
We set the python requirement for jinxif accordingly in the setup.py.
You can check if these requirements are still true (https://github.com/MouseLand/cellpose/blob/master/environment.yml).
If this has changes, please drop us a line, that we can adjust the setup.py file. Thank you!
**Python environment:**
We recommend installing jinxif in an own python environment.
Iff you run miniconda (or anaconda) you can generate a jinxif python environment like this:
```bash
conda create -n jinxif python=3.8
```
You can activate the generated jinxif environment like this:
```bash
conda activate jinxif
```
**CPU based installation:**
1. Install some basics.
```bash
pip install ipython jupyterlab
```
2. Install torch.
Check out the pytorch side (https://pytorch.org/get-started/locally/),
if you want to install torch with pip or from source, rather than with conda.
Installing pytorch is enough. There is no need to install torchaudio and torchvision.
```bash
conda install pytorch
```
3. Install cellpose.
```bash
pip install cellpose
```
4. Install jinxif.
```bash
pip install jinxif
pip install aicsimageio[czi] # if you deal with carl zeiss images.
pip install imagecodecs # if you deal with miltenyi macsima images.
```
5. Initialize a local config file.
Open a python shell and type:
```python
from jinxif import configure
configure.link_local_config()
exit()
```
The local jinxif configuration file can be found at: `~/.jinxif/config.py`.
Use your favorite [text editor](https://en.wikipedia.org/wiki/Text_editor) to edit the jinxif config file.
**Nvidia GPU based installation:**
1. Install some basics.
```bash
conda install ipython jupyterlab
```
2. Install torch.
Note: For running touch on a GPU, you have to know which **cuda toolkit** version you have installed on your machine.
How depends on your operating system. We leave it your homework to figure out how to do that.
Check out the pytourch side (https://pytorch.org/get-started/locally/), to figure out how to install the latest version of torch, for your os, python package distro, and cuda toolkit.
Installing pytorch is enough. There is no need to install torchaudio and torchvision.
The final installation command will look something like below.
```bash
conda install pytorch cudatoolkit=nn.n -c pytorch
```
3. Install cellpose.
This is a bit special because we want to install cellpose without dependencies so that the CPU focused pip version of pytorch does not get installed!
You should use the same --no-deps --upgarde parameter when you try to update cellpose.
```bash
pip install --no-deps cellpose --upgrade
```
4. Install jinxif.
```bash
pip install jinxif
pip install aicsimageio[czi] # if you deal with carl zeiss images.
pip install imagecodecs # if you deal with miltenyi macsima images.
```
5. Initialize a local config file.
Open a python shell and type:
```python
from jinxif import configure
configure.link_local_config()
exit()
```
The local jinxif configuration file can be found at: `~/.jinxif/config.py`.
Use your favorite [text editor](https://en.wikipedia.org/wiki/Text_editor) to edit the jinxif config file.
### HowTo - Update Jinxif
After an update, it is important to re-link your local jinxif configuration file.
1. Update jinxif.
```bash
pip install -U jinxif
```
2. Link the local config file.
Open a python shell and type:
```python
from jinxif import configure
configure.link_local_config()
exit()
```
### HowTo - Run a Data Extraction Pipeline
The data extraction pipeline [jupyter notebooks](https://en.wikipedia.org/wiki/Project_Jupyter) are in the jupyter folder.
+ mpleximage_data_extraction_pipeline.ipynb: most elaborate data extraction notebook.
+ codex_data_extraction_pipeline.ipynb: notebook to process [codex](https://help.codex.bio/codex/cim/overview) data.
+ mics_data_extraction_pipeline.ipynb: notebook to process [miltenyi](https://www.miltenyibiotec.com/US-en/products/macsima-imaging-system.html) macsima data.
Download the raw version of this notebook.
Open then notebook in [**Jupyter**](https://jupyter.org/) to process your data.
For each step in the pipleine there is a detailed description in the notebook.
Besides, all functions have a [docstring](https://en.wikipedia.org/wiki/Docstring).
To receive additional help for a particular function, in the python shell type:
```
help(function)
```
### HowTo - Protein Marker
All biomarker used in the assay have to be specified in the local jinxif configuration file that can be found at: `~/.jinxif/config.py`.
DAPI, quenching round, blank, and empty markers have to be specified in the `es_markerdapiblank_standard` variable.
Proteins have to be specified in the `es_markerpartition_standard` variable.
With the protein name, you have as well to specify where the protein in the cell is expressed.
Possible partitions are: nucleus, nucleus membrane, ring (which is the cytoplasm), and cell membrane.
If proteins are expressed in more than one cell partition, then they can be specified more than once.
This is biological knowledge that becomes important in the feature extraction step of the pipeline.
To check where the proteins are exactly expressed, we recommend consulting the [human protein atlas](https://www.proteinatlas.org/).
Proteins that are used for cell segmentation have to be specified as keys in the `des_cytoplasmmarker_standard` variable.
These proteins are usually specific for a sudden cell type, or some cell types, but not all cell types.
E.g. Ecad is expressed in cytoplasm of cancer cells and tonsil and can be used as cell segmentation marker.
For one cell type, more than one segmentation marker can be defined.
In the values part of the dictionary, all protein markers have to be specified that might be expressed in the cytoplasm of this particular cell type.
E.g. CK5 might be expressed in the cytoplasm of cancer cells.
You can define as many cell types as you want.
This is biological knowledge that becomes important in the feature extraction step of the pipeline.
All the protein markers mentioned in the `des_cytoplasmmarker_standard` have also to be specified as ring partition protein in the `es_markerpartition_standard` variable.
### HowTo - Naming Convention
The naming conventions are specified in the local jinxif configuration file that can be found at: `~/.jinxif/config.py`.
The standard naming convention is influenced by our use of axioscan and the zen software (both from [zeiss](https://www.zeiss.com/microscopy/int/home.html).
It is totally possible to adjust this setting to own needs.
The most crucial variables to look at are:
Basic setting:
+ d_nconv['s_round_axio']: how is in the filename the staining cycle round defined.
+ d_nconv['s_quenching_axio']: how is in the filename a quenching round specified.
+ d_nconv['s_color_dapi_axio']: how is in the filename the actual microscopy channel specified.
+ d_nconv['ls_color_order_axio']: a by wavelength sorter list of microscopy channel labels.
+ d_nconv['s_sep_marker_axio']: character used in the filename to separate markes.
Czi image file name:
+ d_nconv['s_czidir']: directory name where the raw czi images (with microscopy metadata) are stored.
+ d_nconv['s_format_czidir_original']: string to specify the subfolder structure, e.g. one folder per slide, in the czi directory.
+ d_nconv['s_regex_czi_original']: regular expression string to extract information from the czi filename.
+ d_nconv['di_regex_czi_original']: dictionary to map the extracted information.
Raw tiff image file name:
+ d_nconv['s_rawdir']: directory where the raw tiff files, one tiff file per round and marker, are stored.
+ d_nconv['s_regex_tiff_raw']: regular expression string to extract information from the raw tiff filename.
+ d_nconv['s_format_czidir_original']: string to specify the subfolder structure, usually one folder per slide, in the raw directory.
+ d_nconv['di_regex_tiff_raw']: dictionary to map the extracted information.
### HowTo - Slurm
All calculation intensive function offer the option to be processed as [slurm](https://en.wikipedia.org/wiki/Slurm_Workload_Manager) job.
This can be achieved by setting the parameter: `s_type_processing = 'slurm'`.
The default setting is 'non-slurm'.
Use the jupyter lab / Edit / Find ... and Replace All function, to replace them all.
However, the core slurm function, `slurmbatch`, is specified in the local config file that can be found at: `~/.jinxif/config.py`.
If you want run jinxif on a slurm cluster, you might have to modify this function, so that the resulting slurm command fits the scheme required by your super computer.
The crucial parameter to look at and manipulated are: `s_jobname`, `s_partition`, `s_gpu`, `s_mem`, `s_time`, `s_account`.
## Tutorial
The tutorial is here: https://gitlab.com/bue/jinxif/-/blob/master/TUTORIAL.md
## Discussion
Jinxif is a very lightweight and flexible pipeline to process cyclic immunofluorescence images.
Except for the registration code (which is [Matlab](https://en.wikipedia.org/wiki/MATLAB) script), jinxif is entirely written in Python3.
To run jinxif you have to be savvy in the [**Python**](https://en.wikipedia.org/wiki/Python_(programming_language)) language, else you will struggle!
To adjust the file naming convention standard in the config file and the registration function call, you have to be familiar with [**regex**](https://en.wikipedia.org/wiki/Regular_expression).
## References
"Cyclic Multiplexed-Immunofluorescence (cmIF), a Highly Multiplexed Method for Single-Cell Analysis." *Eng J, Thibault G, Luoh SW, Gray JW, Chang YH, Chin K.* Methods Mol Biol. 2020;2055:521-562. https://doi.org/10.1007/978-1-4939-9773-2_24
"cmIF: A Python Library for Scalable Multiplex Imaging Pipelines." *Eng J, Bucher E, Gray E, Campbell LG, Thibault G, Heiser L, Gibbs S, Gray JW, Chin K, Chang YH.* In: Mathematical and Computational Oncology. ISMCO 2019. Lecture Notes in Computer Science, vol 11826. Springer, Cham. https://doi.org/10.1007/978-3-030-35210-3_3
%package -n python3-jinxif
Summary: A python3-based image analysis package to achieve fully-documented and reproducible visualization and analysis of bio-medical microscopy images. This is a fork from Jennifer Eng`s mplex_image software library.
Provides: python-jinxif
BuildRequires: python3-devel
BuildRequires: python3-setuptools
BuildRequires: python3-pip
%description -n python3-jinxif
# cmIF fork: jinxIF
+ Author: engje, bue
+ Date: 2020-11-01
+ License: GPLv3
+ Language: Python3
Description: jinxIF is a fork from Jennifer Eng's original cmIF mplex\_image software library (https://gitlab.com/engje/cmif).
cmIF is a Python3 library for automated image processing and analysis of multiplex immunofluorescence images.
Source: the latest version of this user manual can be found at https://gitlab.com/bue/jinxif/-/blob/master/README.md
## HowTo
### HowTo - Installation Jixif
**Python version:**
A cornerstone of jinxif is **cellpose**, which is used for segmentation.
Cellpose requires at the moment of this writing python version 3.8.
We set the python requirement for jinxif accordingly in the setup.py.
You can check if these requirements are still true (https://github.com/MouseLand/cellpose/blob/master/environment.yml).
If this has changes, please drop us a line, that we can adjust the setup.py file. Thank you!
**Python environment:**
We recommend installing jinxif in an own python environment.
Iff you run miniconda (or anaconda) you can generate a jinxif python environment like this:
```bash
conda create -n jinxif python=3.8
```
You can activate the generated jinxif environment like this:
```bash
conda activate jinxif
```
**CPU based installation:**
1. Install some basics.
```bash
pip install ipython jupyterlab
```
2. Install torch.
Check out the pytorch side (https://pytorch.org/get-started/locally/),
if you want to install torch with pip or from source, rather than with conda.
Installing pytorch is enough. There is no need to install torchaudio and torchvision.
```bash
conda install pytorch
```
3. Install cellpose.
```bash
pip install cellpose
```
4. Install jinxif.
```bash
pip install jinxif
pip install aicsimageio[czi] # if you deal with carl zeiss images.
pip install imagecodecs # if you deal with miltenyi macsima images.
```
5. Initialize a local config file.
Open a python shell and type:
```python
from jinxif import configure
configure.link_local_config()
exit()
```
The local jinxif configuration file can be found at: `~/.jinxif/config.py`.
Use your favorite [text editor](https://en.wikipedia.org/wiki/Text_editor) to edit the jinxif config file.
**Nvidia GPU based installation:**
1. Install some basics.
```bash
conda install ipython jupyterlab
```
2. Install torch.
Note: For running touch on a GPU, you have to know which **cuda toolkit** version you have installed on your machine.
How depends on your operating system. We leave it your homework to figure out how to do that.
Check out the pytourch side (https://pytorch.org/get-started/locally/), to figure out how to install the latest version of torch, for your os, python package distro, and cuda toolkit.
Installing pytorch is enough. There is no need to install torchaudio and torchvision.
The final installation command will look something like below.
```bash
conda install pytorch cudatoolkit=nn.n -c pytorch
```
3. Install cellpose.
This is a bit special because we want to install cellpose without dependencies so that the CPU focused pip version of pytorch does not get installed!
You should use the same --no-deps --upgarde parameter when you try to update cellpose.
```bash
pip install --no-deps cellpose --upgrade
```
4. Install jinxif.
```bash
pip install jinxif
pip install aicsimageio[czi] # if you deal with carl zeiss images.
pip install imagecodecs # if you deal with miltenyi macsima images.
```
5. Initialize a local config file.
Open a python shell and type:
```python
from jinxif import configure
configure.link_local_config()
exit()
```
The local jinxif configuration file can be found at: `~/.jinxif/config.py`.
Use your favorite [text editor](https://en.wikipedia.org/wiki/Text_editor) to edit the jinxif config file.
### HowTo - Update Jinxif
After an update, it is important to re-link your local jinxif configuration file.
1. Update jinxif.
```bash
pip install -U jinxif
```
2. Link the local config file.
Open a python shell and type:
```python
from jinxif import configure
configure.link_local_config()
exit()
```
### HowTo - Run a Data Extraction Pipeline
The data extraction pipeline [jupyter notebooks](https://en.wikipedia.org/wiki/Project_Jupyter) are in the jupyter folder.
+ mpleximage_data_extraction_pipeline.ipynb: most elaborate data extraction notebook.
+ codex_data_extraction_pipeline.ipynb: notebook to process [codex](https://help.codex.bio/codex/cim/overview) data.
+ mics_data_extraction_pipeline.ipynb: notebook to process [miltenyi](https://www.miltenyibiotec.com/US-en/products/macsima-imaging-system.html) macsima data.
Download the raw version of this notebook.
Open then notebook in [**Jupyter**](https://jupyter.org/) to process your data.
For each step in the pipleine there is a detailed description in the notebook.
Besides, all functions have a [docstring](https://en.wikipedia.org/wiki/Docstring).
To receive additional help for a particular function, in the python shell type:
```
help(function)
```
### HowTo - Protein Marker
All biomarker used in the assay have to be specified in the local jinxif configuration file that can be found at: `~/.jinxif/config.py`.
DAPI, quenching round, blank, and empty markers have to be specified in the `es_markerdapiblank_standard` variable.
Proteins have to be specified in the `es_markerpartition_standard` variable.
With the protein name, you have as well to specify where the protein in the cell is expressed.
Possible partitions are: nucleus, nucleus membrane, ring (which is the cytoplasm), and cell membrane.
If proteins are expressed in more than one cell partition, then they can be specified more than once.
This is biological knowledge that becomes important in the feature extraction step of the pipeline.
To check where the proteins are exactly expressed, we recommend consulting the [human protein atlas](https://www.proteinatlas.org/).
Proteins that are used for cell segmentation have to be specified as keys in the `des_cytoplasmmarker_standard` variable.
These proteins are usually specific for a sudden cell type, or some cell types, but not all cell types.
E.g. Ecad is expressed in cytoplasm of cancer cells and tonsil and can be used as cell segmentation marker.
For one cell type, more than one segmentation marker can be defined.
In the values part of the dictionary, all protein markers have to be specified that might be expressed in the cytoplasm of this particular cell type.
E.g. CK5 might be expressed in the cytoplasm of cancer cells.
You can define as many cell types as you want.
This is biological knowledge that becomes important in the feature extraction step of the pipeline.
All the protein markers mentioned in the `des_cytoplasmmarker_standard` have also to be specified as ring partition protein in the `es_markerpartition_standard` variable.
### HowTo - Naming Convention
The naming conventions are specified in the local jinxif configuration file that can be found at: `~/.jinxif/config.py`.
The standard naming convention is influenced by our use of axioscan and the zen software (both from [zeiss](https://www.zeiss.com/microscopy/int/home.html).
It is totally possible to adjust this setting to own needs.
The most crucial variables to look at are:
Basic setting:
+ d_nconv['s_round_axio']: how is in the filename the staining cycle round defined.
+ d_nconv['s_quenching_axio']: how is in the filename a quenching round specified.
+ d_nconv['s_color_dapi_axio']: how is in the filename the actual microscopy channel specified.
+ d_nconv['ls_color_order_axio']: a by wavelength sorter list of microscopy channel labels.
+ d_nconv['s_sep_marker_axio']: character used in the filename to separate markes.
Czi image file name:
+ d_nconv['s_czidir']: directory name where the raw czi images (with microscopy metadata) are stored.
+ d_nconv['s_format_czidir_original']: string to specify the subfolder structure, e.g. one folder per slide, in the czi directory.
+ d_nconv['s_regex_czi_original']: regular expression string to extract information from the czi filename.
+ d_nconv['di_regex_czi_original']: dictionary to map the extracted information.
Raw tiff image file name:
+ d_nconv['s_rawdir']: directory where the raw tiff files, one tiff file per round and marker, are stored.
+ d_nconv['s_regex_tiff_raw']: regular expression string to extract information from the raw tiff filename.
+ d_nconv['s_format_czidir_original']: string to specify the subfolder structure, usually one folder per slide, in the raw directory.
+ d_nconv['di_regex_tiff_raw']: dictionary to map the extracted information.
### HowTo - Slurm
All calculation intensive function offer the option to be processed as [slurm](https://en.wikipedia.org/wiki/Slurm_Workload_Manager) job.
This can be achieved by setting the parameter: `s_type_processing = 'slurm'`.
The default setting is 'non-slurm'.
Use the jupyter lab / Edit / Find ... and Replace All function, to replace them all.
However, the core slurm function, `slurmbatch`, is specified in the local config file that can be found at: `~/.jinxif/config.py`.
If you want run jinxif on a slurm cluster, you might have to modify this function, so that the resulting slurm command fits the scheme required by your super computer.
The crucial parameter to look at and manipulated are: `s_jobname`, `s_partition`, `s_gpu`, `s_mem`, `s_time`, `s_account`.
## Tutorial
The tutorial is here: https://gitlab.com/bue/jinxif/-/blob/master/TUTORIAL.md
## Discussion
Jinxif is a very lightweight and flexible pipeline to process cyclic immunofluorescence images.
Except for the registration code (which is [Matlab](https://en.wikipedia.org/wiki/MATLAB) script), jinxif is entirely written in Python3.
To run jinxif you have to be savvy in the [**Python**](https://en.wikipedia.org/wiki/Python_(programming_language)) language, else you will struggle!
To adjust the file naming convention standard in the config file and the registration function call, you have to be familiar with [**regex**](https://en.wikipedia.org/wiki/Regular_expression).
## References
"Cyclic Multiplexed-Immunofluorescence (cmIF), a Highly Multiplexed Method for Single-Cell Analysis." *Eng J, Thibault G, Luoh SW, Gray JW, Chang YH, Chin K.* Methods Mol Biol. 2020;2055:521-562. https://doi.org/10.1007/978-1-4939-9773-2_24
"cmIF: A Python Library for Scalable Multiplex Imaging Pipelines." *Eng J, Bucher E, Gray E, Campbell LG, Thibault G, Heiser L, Gibbs S, Gray JW, Chin K, Chang YH.* In: Mathematical and Computational Oncology. ISMCO 2019. Lecture Notes in Computer Science, vol 11826. Springer, Cham. https://doi.org/10.1007/978-3-030-35210-3_3
%package help
Summary: Development documents and examples for jinxif
Provides: python3-jinxif-doc
%description help
# cmIF fork: jinxIF
+ Author: engje, bue
+ Date: 2020-11-01
+ License: GPLv3
+ Language: Python3
Description: jinxIF is a fork from Jennifer Eng's original cmIF mplex\_image software library (https://gitlab.com/engje/cmif).
cmIF is a Python3 library for automated image processing and analysis of multiplex immunofluorescence images.
Source: the latest version of this user manual can be found at https://gitlab.com/bue/jinxif/-/blob/master/README.md
## HowTo
### HowTo - Installation Jixif
**Python version:**
A cornerstone of jinxif is **cellpose**, which is used for segmentation.
Cellpose requires at the moment of this writing python version 3.8.
We set the python requirement for jinxif accordingly in the setup.py.
You can check if these requirements are still true (https://github.com/MouseLand/cellpose/blob/master/environment.yml).
If this has changes, please drop us a line, that we can adjust the setup.py file. Thank you!
**Python environment:**
We recommend installing jinxif in an own python environment.
Iff you run miniconda (or anaconda) you can generate a jinxif python environment like this:
```bash
conda create -n jinxif python=3.8
```
You can activate the generated jinxif environment like this:
```bash
conda activate jinxif
```
**CPU based installation:**
1. Install some basics.
```bash
pip install ipython jupyterlab
```
2. Install torch.
Check out the pytorch side (https://pytorch.org/get-started/locally/),
if you want to install torch with pip or from source, rather than with conda.
Installing pytorch is enough. There is no need to install torchaudio and torchvision.
```bash
conda install pytorch
```
3. Install cellpose.
```bash
pip install cellpose
```
4. Install jinxif.
```bash
pip install jinxif
pip install aicsimageio[czi] # if you deal with carl zeiss images.
pip install imagecodecs # if you deal with miltenyi macsima images.
```
5. Initialize a local config file.
Open a python shell and type:
```python
from jinxif import configure
configure.link_local_config()
exit()
```
The local jinxif configuration file can be found at: `~/.jinxif/config.py`.
Use your favorite [text editor](https://en.wikipedia.org/wiki/Text_editor) to edit the jinxif config file.
**Nvidia GPU based installation:**
1. Install some basics.
```bash
conda install ipython jupyterlab
```
2. Install torch.
Note: For running touch on a GPU, you have to know which **cuda toolkit** version you have installed on your machine.
How depends on your operating system. We leave it your homework to figure out how to do that.
Check out the pytourch side (https://pytorch.org/get-started/locally/), to figure out how to install the latest version of torch, for your os, python package distro, and cuda toolkit.
Installing pytorch is enough. There is no need to install torchaudio and torchvision.
The final installation command will look something like below.
```bash
conda install pytorch cudatoolkit=nn.n -c pytorch
```
3. Install cellpose.
This is a bit special because we want to install cellpose without dependencies so that the CPU focused pip version of pytorch does not get installed!
You should use the same --no-deps --upgarde parameter when you try to update cellpose.
```bash
pip install --no-deps cellpose --upgrade
```
4. Install jinxif.
```bash
pip install jinxif
pip install aicsimageio[czi] # if you deal with carl zeiss images.
pip install imagecodecs # if you deal with miltenyi macsima images.
```
5. Initialize a local config file.
Open a python shell and type:
```python
from jinxif import configure
configure.link_local_config()
exit()
```
The local jinxif configuration file can be found at: `~/.jinxif/config.py`.
Use your favorite [text editor](https://en.wikipedia.org/wiki/Text_editor) to edit the jinxif config file.
### HowTo - Update Jinxif
After an update, it is important to re-link your local jinxif configuration file.
1. Update jinxif.
```bash
pip install -U jinxif
```
2. Link the local config file.
Open a python shell and type:
```python
from jinxif import configure
configure.link_local_config()
exit()
```
### HowTo - Run a Data Extraction Pipeline
The data extraction pipeline [jupyter notebooks](https://en.wikipedia.org/wiki/Project_Jupyter) are in the jupyter folder.
+ mpleximage_data_extraction_pipeline.ipynb: most elaborate data extraction notebook.
+ codex_data_extraction_pipeline.ipynb: notebook to process [codex](https://help.codex.bio/codex/cim/overview) data.
+ mics_data_extraction_pipeline.ipynb: notebook to process [miltenyi](https://www.miltenyibiotec.com/US-en/products/macsima-imaging-system.html) macsima data.
Download the raw version of this notebook.
Open then notebook in [**Jupyter**](https://jupyter.org/) to process your data.
For each step in the pipleine there is a detailed description in the notebook.
Besides, all functions have a [docstring](https://en.wikipedia.org/wiki/Docstring).
To receive additional help for a particular function, in the python shell type:
```
help(function)
```
### HowTo - Protein Marker
All biomarker used in the assay have to be specified in the local jinxif configuration file that can be found at: `~/.jinxif/config.py`.
DAPI, quenching round, blank, and empty markers have to be specified in the `es_markerdapiblank_standard` variable.
Proteins have to be specified in the `es_markerpartition_standard` variable.
With the protein name, you have as well to specify where the protein in the cell is expressed.
Possible partitions are: nucleus, nucleus membrane, ring (which is the cytoplasm), and cell membrane.
If proteins are expressed in more than one cell partition, then they can be specified more than once.
This is biological knowledge that becomes important in the feature extraction step of the pipeline.
To check where the proteins are exactly expressed, we recommend consulting the [human protein atlas](https://www.proteinatlas.org/).
Proteins that are used for cell segmentation have to be specified as keys in the `des_cytoplasmmarker_standard` variable.
These proteins are usually specific for a sudden cell type, or some cell types, but not all cell types.
E.g. Ecad is expressed in cytoplasm of cancer cells and tonsil and can be used as cell segmentation marker.
For one cell type, more than one segmentation marker can be defined.
In the values part of the dictionary, all protein markers have to be specified that might be expressed in the cytoplasm of this particular cell type.
E.g. CK5 might be expressed in the cytoplasm of cancer cells.
You can define as many cell types as you want.
This is biological knowledge that becomes important in the feature extraction step of the pipeline.
All the protein markers mentioned in the `des_cytoplasmmarker_standard` have also to be specified as ring partition protein in the `es_markerpartition_standard` variable.
### HowTo - Naming Convention
The naming conventions are specified in the local jinxif configuration file that can be found at: `~/.jinxif/config.py`.
The standard naming convention is influenced by our use of axioscan and the zen software (both from [zeiss](https://www.zeiss.com/microscopy/int/home.html).
It is totally possible to adjust this setting to own needs.
The most crucial variables to look at are:
Basic setting:
+ d_nconv['s_round_axio']: how is in the filename the staining cycle round defined.
+ d_nconv['s_quenching_axio']: how is in the filename a quenching round specified.
+ d_nconv['s_color_dapi_axio']: how is in the filename the actual microscopy channel specified.
+ d_nconv['ls_color_order_axio']: a by wavelength sorter list of microscopy channel labels.
+ d_nconv['s_sep_marker_axio']: character used in the filename to separate markes.
Czi image file name:
+ d_nconv['s_czidir']: directory name where the raw czi images (with microscopy metadata) are stored.
+ d_nconv['s_format_czidir_original']: string to specify the subfolder structure, e.g. one folder per slide, in the czi directory.
+ d_nconv['s_regex_czi_original']: regular expression string to extract information from the czi filename.
+ d_nconv['di_regex_czi_original']: dictionary to map the extracted information.
Raw tiff image file name:
+ d_nconv['s_rawdir']: directory where the raw tiff files, one tiff file per round and marker, are stored.
+ d_nconv['s_regex_tiff_raw']: regular expression string to extract information from the raw tiff filename.
+ d_nconv['s_format_czidir_original']: string to specify the subfolder structure, usually one folder per slide, in the raw directory.
+ d_nconv['di_regex_tiff_raw']: dictionary to map the extracted information.
### HowTo - Slurm
All calculation intensive function offer the option to be processed as [slurm](https://en.wikipedia.org/wiki/Slurm_Workload_Manager) job.
This can be achieved by setting the parameter: `s_type_processing = 'slurm'`.
The default setting is 'non-slurm'.
Use the jupyter lab / Edit / Find ... and Replace All function, to replace them all.
However, the core slurm function, `slurmbatch`, is specified in the local config file that can be found at: `~/.jinxif/config.py`.
If you want run jinxif on a slurm cluster, you might have to modify this function, so that the resulting slurm command fits the scheme required by your super computer.
The crucial parameter to look at and manipulated are: `s_jobname`, `s_partition`, `s_gpu`, `s_mem`, `s_time`, `s_account`.
## Tutorial
The tutorial is here: https://gitlab.com/bue/jinxif/-/blob/master/TUTORIAL.md
## Discussion
Jinxif is a very lightweight and flexible pipeline to process cyclic immunofluorescence images.
Except for the registration code (which is [Matlab](https://en.wikipedia.org/wiki/MATLAB) script), jinxif is entirely written in Python3.
To run jinxif you have to be savvy in the [**Python**](https://en.wikipedia.org/wiki/Python_(programming_language)) language, else you will struggle!
To adjust the file naming convention standard in the config file and the registration function call, you have to be familiar with [**regex**](https://en.wikipedia.org/wiki/Regular_expression).
## References
"Cyclic Multiplexed-Immunofluorescence (cmIF), a Highly Multiplexed Method for Single-Cell Analysis." *Eng J, Thibault G, Luoh SW, Gray JW, Chang YH, Chin K.* Methods Mol Biol. 2020;2055:521-562. https://doi.org/10.1007/978-1-4939-9773-2_24
"cmIF: A Python Library for Scalable Multiplex Imaging Pipelines." *Eng J, Bucher E, Gray E, Campbell LG, Thibault G, Heiser L, Gibbs S, Gray JW, Chin K, Chang YH.* In: Mathematical and Computational Oncology. ISMCO 2019. Lecture Notes in Computer Science, vol 11826. Springer, Cham. https://doi.org/10.1007/978-3-030-35210-3_3
%prep
%autosetup -n jinxif-0.0.49
%build
%py3_build
%install
%py3_install
install -d -m755 %{buildroot}/%{_pkgdocdir}
if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi
if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi
if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi
if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi
pushd %{buildroot}
if [ -d usr/lib ]; then
find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/lib64 ]; then
find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/bin ]; then
find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/sbin ]; then
find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst
fi
touch doclist.lst
if [ -d usr/share/man ]; then
find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst
fi
popd
mv %{buildroot}/filelist.lst .
mv %{buildroot}/doclist.lst .
%files -n python3-jinxif -f filelist.lst
%dir %{python3_sitelib}/*
%files help -f doclist.lst
%{_docdir}/*
%changelog
* Tue May 30 2023 Python_Bot <Python_Bot@openeuler.org> - 0.0.49-1
- Package Spec generated
|