-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.tex
6300 lines (5310 loc) · 291 KB
/
index.tex
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
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
% Options for packages loaded elsewhere
\PassOptionsToPackage{unicode}{hyperref}
\PassOptionsToPackage{hyphens}{url}
\PassOptionsToPackage{dvipsnames,svgnames,x11names}{xcolor}
%
\documentclass[
letterpaper,
DIV=11,
numbers=noendperiod]{scrreprt}
\usepackage{amsmath,amssymb}
\usepackage{iftex}
\ifPDFTeX
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{textcomp} % provide euro and other symbols
\else % if luatex or xetex
\usepackage{unicode-math}
\defaultfontfeatures{Scale=MatchLowercase}
\defaultfontfeatures[\rmfamily]{Ligatures=TeX,Scale=1}
\fi
\usepackage{lmodern}
\ifPDFTeX\else
% xetex/luatex font selection
\fi
% Use upquote if available, for straight quotes in verbatim environments
\IfFileExists{upquote.sty}{\usepackage{upquote}}{}
\IfFileExists{microtype.sty}{% use microtype if available
\usepackage[]{microtype}
\UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts
}{}
\makeatletter
\@ifundefined{KOMAClassName}{% if non-KOMA class
\IfFileExists{parskip.sty}{%
\usepackage{parskip}
}{% else
\setlength{\parindent}{0pt}
\setlength{\parskip}{6pt plus 2pt minus 1pt}}
}{% if KOMA class
\KOMAoptions{parskip=half}}
\makeatother
\usepackage{xcolor}
\setlength{\emergencystretch}{3em} % prevent overfull lines
\setcounter{secnumdepth}{5}
% Make \paragraph and \subparagraph free-standing
\makeatletter
\ifx\paragraph\undefined\else
\let\oldparagraph\paragraph
\renewcommand{\paragraph}{
\@ifstar
\xxxParagraphStar
\xxxParagraphNoStar
}
\newcommand{\xxxParagraphStar}[1]{\oldparagraph*{#1}\mbox{}}
\newcommand{\xxxParagraphNoStar}[1]{\oldparagraph{#1}\mbox{}}
\fi
\ifx\subparagraph\undefined\else
\let\oldsubparagraph\subparagraph
\renewcommand{\subparagraph}{
\@ifstar
\xxxSubParagraphStar
\xxxSubParagraphNoStar
}
\newcommand{\xxxSubParagraphStar}[1]{\oldsubparagraph*{#1}\mbox{}}
\newcommand{\xxxSubParagraphNoStar}[1]{\oldsubparagraph{#1}\mbox{}}
\fi
\makeatother
\usepackage{color}
\usepackage{fancyvrb}
\newcommand{\VerbBar}{|}
\newcommand{\VERB}{\Verb[commandchars=\\\{\}]}
\DefineVerbatimEnvironment{Highlighting}{Verbatim}{commandchars=\\\{\}}
% Add ',fontsize=\small' for more characters per line
\usepackage{framed}
\definecolor{shadecolor}{RGB}{241,243,245}
\newenvironment{Shaded}{\begin{snugshade}}{\end{snugshade}}
\newcommand{\AlertTok}[1]{\textcolor[rgb]{0.68,0.00,0.00}{#1}}
\newcommand{\AnnotationTok}[1]{\textcolor[rgb]{0.37,0.37,0.37}{#1}}
\newcommand{\AttributeTok}[1]{\textcolor[rgb]{0.40,0.45,0.13}{#1}}
\newcommand{\BaseNTok}[1]{\textcolor[rgb]{0.68,0.00,0.00}{#1}}
\newcommand{\BuiltInTok}[1]{\textcolor[rgb]{0.00,0.23,0.31}{#1}}
\newcommand{\CharTok}[1]{\textcolor[rgb]{0.13,0.47,0.30}{#1}}
\newcommand{\CommentTok}[1]{\textcolor[rgb]{0.37,0.37,0.37}{#1}}
\newcommand{\CommentVarTok}[1]{\textcolor[rgb]{0.37,0.37,0.37}{\textit{#1}}}
\newcommand{\ConstantTok}[1]{\textcolor[rgb]{0.56,0.35,0.01}{#1}}
\newcommand{\ControlFlowTok}[1]{\textcolor[rgb]{0.00,0.23,0.31}{\textbf{#1}}}
\newcommand{\DataTypeTok}[1]{\textcolor[rgb]{0.68,0.00,0.00}{#1}}
\newcommand{\DecValTok}[1]{\textcolor[rgb]{0.68,0.00,0.00}{#1}}
\newcommand{\DocumentationTok}[1]{\textcolor[rgb]{0.37,0.37,0.37}{\textit{#1}}}
\newcommand{\ErrorTok}[1]{\textcolor[rgb]{0.68,0.00,0.00}{#1}}
\newcommand{\ExtensionTok}[1]{\textcolor[rgb]{0.00,0.23,0.31}{#1}}
\newcommand{\FloatTok}[1]{\textcolor[rgb]{0.68,0.00,0.00}{#1}}
\newcommand{\FunctionTok}[1]{\textcolor[rgb]{0.28,0.35,0.67}{#1}}
\newcommand{\ImportTok}[1]{\textcolor[rgb]{0.00,0.46,0.62}{#1}}
\newcommand{\InformationTok}[1]{\textcolor[rgb]{0.37,0.37,0.37}{#1}}
\newcommand{\KeywordTok}[1]{\textcolor[rgb]{0.00,0.23,0.31}{\textbf{#1}}}
\newcommand{\NormalTok}[1]{\textcolor[rgb]{0.00,0.23,0.31}{#1}}
\newcommand{\OperatorTok}[1]{\textcolor[rgb]{0.37,0.37,0.37}{#1}}
\newcommand{\OtherTok}[1]{\textcolor[rgb]{0.00,0.23,0.31}{#1}}
\newcommand{\PreprocessorTok}[1]{\textcolor[rgb]{0.68,0.00,0.00}{#1}}
\newcommand{\RegionMarkerTok}[1]{\textcolor[rgb]{0.00,0.23,0.31}{#1}}
\newcommand{\SpecialCharTok}[1]{\textcolor[rgb]{0.37,0.37,0.37}{#1}}
\newcommand{\SpecialStringTok}[1]{\textcolor[rgb]{0.13,0.47,0.30}{#1}}
\newcommand{\StringTok}[1]{\textcolor[rgb]{0.13,0.47,0.30}{#1}}
\newcommand{\VariableTok}[1]{\textcolor[rgb]{0.07,0.07,0.07}{#1}}
\newcommand{\VerbatimStringTok}[1]{\textcolor[rgb]{0.13,0.47,0.30}{#1}}
\newcommand{\WarningTok}[1]{\textcolor[rgb]{0.37,0.37,0.37}{\textit{#1}}}
\providecommand{\tightlist}{%
\setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}\usepackage{longtable,booktabs,array}
\usepackage{calc} % for calculating minipage widths
% Correct order of tables after \paragraph or \subparagraph
\usepackage{etoolbox}
\makeatletter
\patchcmd\longtable{\par}{\if@noskipsec\mbox{}\fi\par}{}{}
\makeatother
% Allow footnotes in longtable head/foot
\IfFileExists{footnotehyper.sty}{\usepackage{footnotehyper}}{\usepackage{footnote}}
\makesavenoteenv{longtable}
\usepackage{graphicx}
\makeatletter
\newsavebox\pandoc@box
\newcommand*\pandocbounded[1]{% scales image to fit in text height/width
\sbox\pandoc@box{#1}%
\Gscale@div\@tempa{\textheight}{\dimexpr\ht\pandoc@box+\dp\pandoc@box\relax}%
\Gscale@div\@tempb{\linewidth}{\wd\pandoc@box}%
\ifdim\@tempb\p@<\@tempa\p@\let\@tempa\@tempb\fi% select the smaller of both
\ifdim\@tempa\p@<\p@\scalebox{\@tempa}{\usebox\pandoc@box}%
\else\usebox{\pandoc@box}%
\fi%
}
% Set default figure placement to htbp
\def\fps@figure{htbp}
\makeatother
% definitions for citeproc citations
\NewDocumentCommand\citeproctext{}{}
\NewDocumentCommand\citeproc{mm}{%
\begingroup\def\citeproctext{#2}\cite{#1}\endgroup}
\makeatletter
% allow citations to break across lines
\let\@cite@ofmt\@firstofone
% avoid brackets around text for \cite:
\def\@biblabel#1{}
\def\@cite#1#2{{#1\if@tempswa , #2\fi}}
\makeatother
\newlength{\cslhangindent}
\setlength{\cslhangindent}{1.5em}
\newlength{\csllabelwidth}
\setlength{\csllabelwidth}{3em}
\newenvironment{CSLReferences}[2] % #1 hanging-indent, #2 entry-spacing
{\begin{list}{}{%
\setlength{\itemindent}{0pt}
\setlength{\leftmargin}{0pt}
\setlength{\parsep}{0pt}
% turn on hanging indent if param 1 is 1
\ifodd #1
\setlength{\leftmargin}{\cslhangindent}
\setlength{\itemindent}{-1\cslhangindent}
\fi
% set entry spacing
\setlength{\itemsep}{#2\baselineskip}}}
{\end{list}}
\usepackage{calc}
\newcommand{\CSLBlock}[1]{\hfill\break\parbox[t]{\linewidth}{\strut\ignorespaces#1\strut}}
\newcommand{\CSLLeftMargin}[1]{\parbox[t]{\csllabelwidth}{\strut#1\strut}}
\newcommand{\CSLRightInline}[1]{\parbox[t]{\linewidth - \csllabelwidth}{\strut#1\strut}}
\newcommand{\CSLIndent}[1]{\hspace{\cslhangindent}#1}
\KOMAoption{captions}{tableheading}
\makeatletter
\@ifpackageloaded{bookmark}{}{\usepackage{bookmark}}
\makeatother
\makeatletter
\@ifpackageloaded{caption}{}{\usepackage{caption}}
\AtBeginDocument{%
\ifdefined\contentsname
\renewcommand*\contentsname{Table of contents}
\else
\newcommand\contentsname{Table of contents}
\fi
\ifdefined\listfigurename
\renewcommand*\listfigurename{List of Figures}
\else
\newcommand\listfigurename{List of Figures}
\fi
\ifdefined\listtablename
\renewcommand*\listtablename{List of Tables}
\else
\newcommand\listtablename{List of Tables}
\fi
\ifdefined\figurename
\renewcommand*\figurename{Figure}
\else
\newcommand\figurename{Figure}
\fi
\ifdefined\tablename
\renewcommand*\tablename{Table}
\else
\newcommand\tablename{Table}
\fi
}
\@ifpackageloaded{float}{}{\usepackage{float}}
\floatstyle{ruled}
\@ifundefined{c@chapter}{\newfloat{codelisting}{h}{lop}}{\newfloat{codelisting}{h}{lop}[chapter]}
\floatname{codelisting}{Listing}
\newcommand*\listoflistings{\listof{codelisting}{List of Listings}}
\makeatother
\makeatletter
\makeatother
\makeatletter
\@ifpackageloaded{caption}{}{\usepackage{caption}}
\@ifpackageloaded{subcaption}{}{\usepackage{subcaption}}
\makeatother
\usepackage{bookmark}
\IfFileExists{xurl.sty}{\usepackage{xurl}}{} % add URL line breaks if available
\urlstyle{same} % disable monospaced font for URLs
\hypersetup{
pdftitle={spicyPlayBook},
pdfauthor={Alex Qin},
colorlinks=true,
linkcolor={blue},
filecolor={Maroon},
citecolor={Blue},
urlcolor={Blue},
pdfcreator={LaTeX via pandoc}}
\title{spicyPlayBook}
\author{Alex Qin}
\date{2024-11-11}
\begin{document}
\maketitle
\renewcommand*\contentsname{Table of contents}
{
\hypersetup{linkcolor=}
\setcounter{tocdepth}{2}
\tableofcontents
}
\bookmarksetup{startatroot}
\chapter*{Overview}\label{overview}
\addcontentsline{toc}{chapter}{Overview}
\markboth{Overview}{Overview}
\section*{Welcome!}\label{welcome}
\addcontentsline{toc}{section}{Welcome!}
\markright{Welcome!}
Recent advances in highly multiplexed cell imaging technologies such as
\emph{PhenoCycler, IMC, CosMx, Xenium, and MERFISH (and many more)} have
fundamentally revolutionized our ability to observe complex cellular
relationships in tissue. Where previous immunohistochemistry protocols
only allowed the visualization of cells that could be characterized by
two or three surface proteins, cutting-edge technologies characterize
cells with upwards of 50 proteins or 1000s of RNA in situ. These
technologies enable precise classification of cell sub-types and provide
an unprecedented depiction of cellular heterogeneity in a tissue
environment. These technical developments have necessitated the
development of a variety of new analytical approaches that are required
to harness these new imaging technologies. On this website we will
demonstrate how packages in
\href{https://sydneybiox.github.io/scdney/}{scdney} can be used to
provide new insights into complex biological systems and diseases.
\section*{Packages}\label{packages}
\addcontentsline{toc}{section}{Packages}
\markright{Packages}
\subsection*{MoleculeExperiment}\label{moleculeexperiment}
\addcontentsline{toc}{subsection}{MoleculeExperiment}
MoleculeExperiment contains functions to create and work with objects
from the new MoleculeExperiment class. We introduce this class for
analysing molecule-based spatial transcriptomics data (e.g., Xenium by
10X, Cosmx SMI by Nanostring, and Merscope by Vizgen). This allows
researchers to analyse spatial transcriptomics data at the molecule
level, and to have standardised data formats accross vendors.
Peters Couto B, Robertson N, Patrick E, Ghazanfar S (2024).
MoleculeExperiment: Prioritising a molecule-level storage of Spatial
Transcriptomics Data. R package version 1.6.0.
\subsection*{simpleSeg}\label{simpleseg}
\addcontentsline{toc}{subsection}{simpleSeg}
Image segmentation is the process of identifying the borders of
individual objects (in this case cells) within an image. This allows for
the features of cells such as marker expression and morphology to be
extracted, stored and analysed. simpleSeg provides functionality for
user friendly, watershed based segmentation on multiplexed cellular
images in R based on the intensity of user specified protein marker
channels. simpleSeg can also be used for the normalization of single
cell data obtained from multiple images.
Canete N, Nicholls A, Patrick E (2024). simpleSeg: A package to perform
simple cell segmentation. R package version 1.8.0.
\subsection*{scMerge}\label{scmerge}
\addcontentsline{toc}{subsection}{scMerge}
Like all gene expression data, single-cell data suffers from batch
effects and other unwanted variations that makes accurate biological
interpretations difficult. The scMerge method leverages factor analysis,
stably expressed genes (SEGs) and (pseudo-) replicates to remove
unwanted variations and merge multiple single-cell data. This package
contains all the necessary functions in the scMerge pipeline, including
the identification of SEGs, replication-identification methods, and
merging of single-cell data.
Lin Y, Ghazanfar S, Wang K, Gagnon-Bartsch J, Lo K, Su X, Han Z, Ormerod
J, Speed T, Yang P, Yang J (2019). ``scMerge leverages factor analysis,
stable expression, and pseudoreplication to merge multiple single-cell
RNA-seq datasets.'' Proceedings of the National Academy of Sciences.
doi:10.1073/pnas.1820006116.
\subsection*{FuseSOM}\label{fusesom}
\addcontentsline{toc}{subsection}{FuseSOM}
A correlation-based multiview self-organizing map for the
characterization of cell types in highly multiplexed in situ imaging
cytometry assays (\texttt{FuseSOM}) is a tool for unsupervised
clustering. \texttt{FuseSOM} is robust and achieves high accuracy by
combining a \texttt{Self\ Organizing\ Map} architecture and a
\texttt{Multiview} integration of correlation based metrics. This allows
FuseSOM to cluster highly multiplexed in situ imaging cytometry assays.
\textless0-length citation\textgreater{}
\subsection*{treekoR}\label{treekor}
\addcontentsline{toc}{subsection}{treekoR}
treekoR is a novel framework that aims to utilise the hierarchical
nature of single cell cytometry data to find robust and interpretable
associations between cell subsets and patient clinical end points. These
associations are aimed to recapitulate the nested proportions prevalent
in workflows inovlving manual gating, which are often overlooked in
workflows using automatic clustering to identify cell populations. We
developed treekoR to: Derive a hierarchical tree structure of cell
clusters; quantify a cell types as a proportion relative to all cells in
a sample (\%total), and, as the proportion relative to a parent
population (\%parent); perform significance testing using the calculated
proportions; and provide an interactive html visualisation to help
highlight key results.
Chan A (2024). treekoR: Cytometry Cluster Hierarchy and
Cellular-to-phenotype Associations. R package version 1.14.0.
\subsection*{scFeatures}\label{scfeatures}
\addcontentsline{toc}{subsection}{scFeatures}
scFeatures constructs multi-view representations of single-cell and
spatial data. scFeatures is a tool that generates multi-view
representations of single-cell and spatial data through the construction
of a total of 17 feature types. These features can then be used for a
variety of analyses using other software in Biocondutor.
Cao,Y., Lin,Y., Patrick,E., Yang,P., Yang,J.Y.H. \& (2022).
``scFeatures: multi-view representations of single-cell and spatial data
for disease outcome prediction.'' Bioinformatics, 38(20), 4745-4753.
ISSN 1367-4803, doi:10.1093/bioinformatics/btac590.
\subsection*{scHOT}\label{schot}
\addcontentsline{toc}{subsection}{scHOT}
Single cell Higher Order Testing (scHOT) is an R package that
facilitates testing changes in higher order structure of gene expression
along either a developmental trajectory or across space. scHOT is
general and modular in nature, can be run in multiple data contexts such
as along a continuous trajectory, between discrete groups, and over
spatial orientations; as well as accommodate any higher order
measurement such as variability or correlation. scHOT meaningfully adds
to first order effect testing, such as differential expression, and
provides a framework for interrogating higher order interactions from
single cell data.
Ghazanfar S, Lin Y (2024). scHOT: single-cell higher order testing. R
package version 1.18.0.
\subsection*{spicyR}\label{spicyr}
\addcontentsline{toc}{subsection}{spicyR}
The spicyR package provides a framework for performing inference on
changes in spatial relationships between pairs of cell types for
cell-resolution spatial omics technologies. spicyR consists of three
primary steps: (i) summarizing the degree of spatial localization
between pairs of cell types for each image; (ii) modelling the
variability in localization summary statistics as a function of cell
counts and (iii) testing for changes in spatial localizations associated
with a response variable.
Canete N, Iyengar S, Ormerod J, Baharlou H, Harman A, Patrick E (2022).
``spicyR: spatial analysis of in situ cytometry data in R.''
Bioinformatics, 38(11), 3099--3105. doi:10.1093/bioinformatics/btac268.
\subsection*{Statial}\label{statial}
\addcontentsline{toc}{subsection}{Statial}
Statial is a suite of functions for identifying changes in cell state.
The functionality provided by Statial provides robust quantification of
cell type localisation which are invariant to changes in tissue
structure. In addition to this Statial uncovers changes in marker
expression associated with varying levels of localisation. These
features can be used to explore how the structure and function of
different cell types may be altered by the agents they are surrounded
with.
Ameen F, Robertson N, Lin D, Ghazanfar S, Patrick E (2024).
``Kontextual: Reframing analysis of spatial omics data reveals
consistent cell relationships across images.'' bioRxiv.
doi:10.1101/2024.09.03.611109.
\subsection*{lisaClust}\label{lisaclust}
\addcontentsline{toc}{subsection}{lisaClust}
lisaClust provides a series of functions to identify and visualise
regions of tissue where spatial associations between cell-types is
similar. This package can be used to provide a high-level summary of
cell-type colocalization in multiplexed imaging data that has been
segmented at a single-cell resolution.
Patrick E, Canete N (2024). lisaClust: lisaClust: Clustering of Local
Indicators of Spatial Association. R package version 1.14.4.
\subsection*{ClassifyR}\label{classifyr}
\addcontentsline{toc}{subsection}{ClassifyR}
The software formalises a framework for classification and survival
model evaluation in R. There are four stages; Data transformation,
feature selection, model training, and prediction. The requirements of
variable types and variable order are fixed, but specialised variables
for functions can also be provided. The framework is wrapped in a driver
loop that reproducibly carries out a number of cross-validation schemes.
Functions for differential mean, differential variability, and
differential distribution are included. Additional functions may be
developed by the user, by creating an interface to the framework.
Strbenac D, Mann GJ, Ormerod JT, Yang JYH (2015). ``ClassifyR: an R
package for performance assessment of classification with applications
to transcriptomics.'' Bioinformatics, 31(11), 1851-1853.
This guide presents a comprehensive workflow for analysing spatial omics
data, featuring examples sorted by different technologies as described
below. The workflow covers cell segmentation, data normalisation,
various tests of proportion and spatial localisation, microenvironment
estimation and patient prediction. We encourage focusing on the
biological questions these methods can address rather than the specific
technologies used.
\begin{longtable}[]{@{}
>{\centering\arraybackslash}p{(\linewidth - 18\tabcolsep) * \real{0.1000}}
>{\centering\arraybackslash}p{(\linewidth - 18\tabcolsep) * \real{0.1000}}
>{\centering\arraybackslash}p{(\linewidth - 18\tabcolsep) * \real{0.1000}}
>{\centering\arraybackslash}p{(\linewidth - 18\tabcolsep) * \real{0.1000}}
>{\centering\arraybackslash}p{(\linewidth - 18\tabcolsep) * \real{0.1000}}
>{\centering\arraybackslash}p{(\linewidth - 18\tabcolsep) * \real{0.1000}}
>{\centering\arraybackslash}p{(\linewidth - 18\tabcolsep) * \real{0.1000}}
>{\centering\arraybackslash}p{(\linewidth - 18\tabcolsep) * \real{0.1000}}
>{\centering\arraybackslash}p{(\linewidth - 18\tabcolsep) * \real{0.1000}}
>{\centering\arraybackslash}p{(\linewidth - 18\tabcolsep) * \real{0.1000}}@{}}
\toprule\noalign{}
\begin{minipage}[b]{\linewidth}\centering
Disease
\end{minipage} & \begin{minipage}[b]{\linewidth}\centering
Technology
\end{minipage} & \begin{minipage}[b]{\linewidth}\centering
Title
\end{minipage} & \begin{minipage}[b]{\linewidth}\centering
Segmentation
\end{minipage} & \begin{minipage}[b]{\linewidth}\centering
Alignment
\end{minipage} & \begin{minipage}[b]{\linewidth}\centering
Clustering
\end{minipage} & \begin{minipage}[b]{\linewidth}\centering
Localisation
\end{minipage} & \begin{minipage}[b]{\linewidth}\centering
Microenvironments
\end{minipage} & \begin{minipage}[b]{\linewidth}\centering
Patient Classification
\end{minipage} & \begin{minipage}[b]{\linewidth}\centering
\end{minipage} \\
\midrule\noalign{}
\endhead
\bottomrule\noalign{}
\endlastfoot
Breast cancer & MIBI-TOF & Keren\_2018 & & & & X & X & X & \\
Breast cancer & MIBI-TOF & Risom\_2022 & X & X & X & X & X & X & \\
Mouse organogenesis & seqFISH & Lohoff\_2022 & & X & & X & & & \\
\end{longtable}
\section*{Datasets}\label{datasets}
\addcontentsline{toc}{section}{Datasets}
\markright{Datasets}
Through the course of this spicyWorkBook, we will take advantage of
several different spatial datasets that are publicly available. These
datasets are all accessible within our
\href{https://www.bioconductor.org/packages/release/data/experiment/html/SpatialDatasets.html}{SpatialDatasets}
package on bioconductor. We will demonstrate several questions that
could be answered or explored for each of these datasets using the
available information.
\subsection*{Spatial Proteomics -
MIBITOF}\label{spatial-proteomics---mibitof}
\addcontentsline{toc}{subsection}{Spatial Proteomics - MIBITOF}
MIBI-TOF (multiplexed ion beam imaging by time of flight) is an
instrument that uses bright ion sources and orthogonal time-of-flight
mass spectrometry to image metal-tagged antibodies at subcellular
resolution in clinical tissue sections. It is capable of imaging
approximately 40 labelled antibodies and image fields of about \(1mm^2\)
at resolutions down to \(260nm\).
\subsubsection*{\texorpdfstring{\href{datasets/Keren_2018/Keren_2018.qmd}{Triple
Negative Breast Cancer -
Keren\_2018}}{Triple Negative Breast Cancer - Keren\_2018}}\label{triple-negative-breast-cancer---keren_2018}
\addcontentsline{toc}{subsubsection}{\href{datasets/Keren_2018/Keren_2018.qmd}{Triple
Negative Breast Cancer - Keren\_2018}}
This study profiles 36 proteins in tissue samples from 41 patients with
triple-negative breast cancer using MIBI-TOF. We will use this dataset
to demonstrate the functionality of our
\href{https://www.bioconductor.org/packages/release/bioc/html/Statial.html}{Statial}
package, which allows us to identify changes in cell state that are
related to the spatial localisation of cells.
Keren et al.~(2018). A Structured Tumor-Immune Microenvironment in
Triple Negative Breast Cancer Revealed by Multiplexed Ion Beam Imaging.
Cell, 174(6), 1373-1387.e1319.
(\href{https://doi.org/10.1016/j.cell.2018.08.039}{DOI})
\subsubsection*{Ductal carcinoma in situ -
Risom\_2022}\label{ductal-carcinoma-in-situ---risom_2022}
\addcontentsline{toc}{subsubsection}{Ductal carcinoma in situ -
Risom\_2022}
This study uses MIBI-TOF to profile the spatial landscape of ductal
carcinoma in situ (DCIS), a pre-invasive lesion believed to be a
precursor to invasive breast cancer (IBC). A key conclusion of the
manuscript is that spatial information about cells can be leveraged to
predict disease progression in patients. We use the workflow described
in this guide to reach a similar conclusion.
Risom et al.~(2022). Transition to invasive breast cancer is associated
with progressive changes in the structure and composition of tumor
stroma. Cell, 185(2), 299-310.e18
(\href{https://doi.org/10.1016/j.cell.2021.12.023}{DOI})
\subsection*{Spatial Proteomics -
CODEX}\label{spatial-proteomics---codex}
\addcontentsline{toc}{subsection}{Spatial Proteomics - CODEX}
CODEX (Co-detection by indexing) is a highly multiplexed tissue imaging
technique that uses DNA-barcoded antibodies which are later revealed by
fluorescent detector oligonucleotides. It can visualise up to 60
labelled antibodies at subcellular resolution.
\subsubsection*{Colorectal cancer -
Schurch\_2020}\label{colorectal-cancer---schurch_2020}
\addcontentsline{toc}{subsubsection}{Colorectal cancer - Schurch\_2020}
A CODEX dataset which aimed to characterise the immune tumour
microenvironment in advanced-stage colorectal cancer. The dataset
consists of 35 advanced colorectal cancer patients, with 4 images per
patient for a total of 140 images. Each image is marked with a
56-antibody panel to characterise a total of 24 distinct tumour and
immune cell populations. Overall, the dataset contains 240,000 cells
along with clinical information including patient tumour grade, tumour
type, and patient survival.
Schürch et al.~(2020). Coordinated Cellular Neighborhoods Orchestrate
Antitumoral Immunity at the Colorectal Cancer Invasive Front et
al.~(2018). A Coordinated Cellular Neighborhoods Orchestrate Antitumoral
Immunity at the Colorectal Cancer Invasive Front. Cell, 182(5),
1341-1359.e19. (\href{https://doi.org/10.1016/j.cell.2020.07.005}{DOI})
\subsection*{Spatial Proteomics - IMC}\label{spatial-proteomics---imc}
\addcontentsline{toc}{subsection}{Spatial Proteomics - IMC}
IMC (Imaging Mass Cytometry) is an instrument that combines laser
ablation with mass cytometry to image metal-tagged antibodies at
subcellular resolution in clinical tissue sections. The datasets
produced by IMC can image approximately 30--40 labeled antibodies,
covering tissue areas of around \(1mm^2\) with a resolution down to
\(1 \mu m\).
\subsubsection*{Breast cancer -
Ali\_2020}\label{breast-cancer---ali_2020}
\addcontentsline{toc}{subsubsection}{Breast cancer - Ali\_2020}
Also known as the METABRIC dataset, this 37-panel IMC dataset contains
images of 456 primary invasive breast carcinoma patients obtained from
548 samples. Clinical variables in the dataset include age, chemotherapy
(CT), radiotherapy (RT), hormone treatment (HT) indicators, estrogen
receptor (ER) status, and gene expression markers (MKI67, EGFR, PGR, and
ERBB2).
Ali et al.~(2020). Imaging mass cytometry and multiplatform genomics
define the phenogenomic landscape of breast cancer. Nature Cancer, 1,
163-175. (\href{https://doi.org/10.1038/s43018-020-0026-6}{DOI})
\subsubsection*{Head and neck squamous cell carcinoma -
Ferguson\_2020}\label{head-and-neck-squamous-cell-carcinoma---ferguson_2020}
\addcontentsline{toc}{subsubsection}{Head and neck squamous cell
carcinoma - Ferguson\_2020}
This study uses IMC to map the immune landscape and identify differences
between high-risk primary head and neck cancer (HNcSCC) tumors that did
not progress and those that developed metastases (progressing tumours).
The key conclusion of this manuscript (amongst others) is that spatial
information about cells and the immune environment can be used to
predict primary tumour progression or metastases in patients. We will
use our spicyWorkflow to reach a similar conclusion.
Ferguson et al.~(2022). High-Dimensional and Spatial Analysis Reveals
Immune Landscape--Dependent Progression in Cutaneous Squamous Cell
Carcinoma. Clinical Cancer Research, 28(21), 4677-4688.
(\href{https://doi.org/10.1158/1078-0432.CCR-22-1332}{DOI})
\subsection*{Spatial Transcriptomics -
seqFISH}\label{spatial-transcriptomics---seqfish}
\addcontentsline{toc}{subsection}{Spatial Transcriptomics - seqFISH}
\href{https://spatial.caltech.edu/seqfish}{SeqFISH} (sequential
Fluorescence In Situ Hybridization) is a technology that enables the
identification of thousands of molecules like RNA, DNA, and proteins
directly in single cells with their spatial context preserved. seqFISH
can multiplex over 10,000 molecules and integrate multiple modalities.
\subsubsection*{\texorpdfstring{\href{datasets/Lohoff_2022/Lohoff_2022.qmd}{Mouse
organogenesis -
Lohoff\_2022}}{Mouse organogenesis - Lohoff\_2022}}\label{mouse-organogenesis---lohoff_2022}
\addcontentsline{toc}{subsubsection}{\href{datasets/Lohoff_2022/Lohoff_2022.qmd}{Mouse
organogenesis - Lohoff\_2022}}
This study uses seqFISH to spatially profile the expression of 387 genes
in mouse embryos. A comprehensive spatially resolved map of gene
expression was created by integrating the seqFISH data with existing
scRNAseq data. This integration facilitated the exploration of cellular
relationships across different regions of the embryo.
Lohoff et al.~(2022). Integration of spatial and single-cell
transcriptomic data elucidates mouse organogenesis. Nature Biotechnology
40, 74--85 (\href{https://doi.org/10.1038/s41587-021-01006-2}{DOI}).
\bookmarksetup{startatroot}
\chapter{Processing}\label{processing}
In this section, we will describe how to read in and pre-process images
obtained through various imaging technologies for downstream analysis.
Steps:
\begin{enumerate}
\def\labelenumi{\arabic{enumi}.}
\tightlist
\item
How to read in data with cytomapper
\item
How to segment data with simpleSeg
\item
How to segment data with BIDCell
\item
How to read in spot-based data with MoleculeExperiment
\end{enumerate}
\section{Reading in images}\label{reading-in-images}
\begin{Shaded}
\begin{Highlighting}[]
\FunctionTok{library}\NormalTok{(cytomapper)}
\FunctionTok{library}\NormalTok{(ggplot2)}
\FunctionTok{library}\NormalTok{(simpleSeg)}
\end{Highlighting}
\end{Shaded}
It is convenient to set the number of cores for running code in
parallel. Please choose a number that is appropriate for your resources.
A minimum of 2 cores is suggested since running this workflow is rather
computationally intensive.
If you would like to use parallel processing for the rest of the
vignette, set the \texttt{use\_mc} flag to \texttt{TRUE}.
\begin{Shaded}
\begin{Highlighting}[]
\NormalTok{use\_mc }\OtherTok{\textless{}{-}} \ConstantTok{TRUE}
\ControlFlowTok{if}\NormalTok{ (use\_mc) \{}
\NormalTok{ nCores }\OtherTok{\textless{}{-}} \FunctionTok{max}\NormalTok{(parallel}\SpecialCharTok{::}\FunctionTok{detectCores}\NormalTok{()}\SpecialCharTok{/}\DecValTok{2}\NormalTok{, }\DecValTok{1}\NormalTok{)}
\NormalTok{\} }\ControlFlowTok{else}\NormalTok{ \{}
\NormalTok{ nCores }\OtherTok{\textless{}{-}} \DecValTok{2}
\NormalTok{\}}
\NormalTok{BPPARAM }\OtherTok{\textless{}{-}}\NormalTok{ simpleSeg}\SpecialCharTok{:::}\FunctionTok{generateBPParam}\NormalTok{(nCores)}
\FunctionTok{theme\_set}\NormalTok{(}\FunctionTok{theme\_classic}\NormalTok{())}
\end{Highlighting}
\end{Shaded}
We will be using the Ferguson 2022 dataset to demonstrate how to perform
pre-processing and cell segmentation. This dataset can be accessed
through the \texttt{SpatialDatasets} package. The \texttt{loadImages()}
function form the \texttt{cytomapper} package can be used to load all
the TIFF images into a \texttt{CytoImageList} object and store the
images as h5 file on-disk in a temporary directory using the
\texttt{h5FilesPath\ =\ HDF5Array::getHDF5DumpDir()} parameter.
We will also assign the metadata columns of the \texttt{CytoImageList}
object using the \texttt{mcols()} function.
\begin{Shaded}
\begin{Highlighting}[]
\NormalTok{pathToImages }\OtherTok{\textless{}{-}}\NormalTok{ SpatialDatasets}\SpecialCharTok{::}\FunctionTok{Ferguson\_Images}\NormalTok{()}
\end{Highlighting}
\end{Shaded}
\begin{verbatim}
see ?SpatialDatasets and browseVignettes('SpatialDatasets') for documentation
\end{verbatim}
\begin{verbatim}
loading from cache
\end{verbatim}
\begin{Shaded}
\begin{Highlighting}[]
\NormalTok{tmp }\OtherTok{\textless{}{-}} \FunctionTok{tempfile}\NormalTok{()}
\FunctionTok{unzip}\NormalTok{(pathToImages, }\AttributeTok{exdir =}\NormalTok{ tmp)}
\CommentTok{\# Store images in a CytoImageList on\_disk as h5 files to save memory.}
\NormalTok{images }\OtherTok{\textless{}{-}}\NormalTok{ cytomapper}\SpecialCharTok{::}\FunctionTok{loadImages}\NormalTok{(}
\NormalTok{ tmp,}
\AttributeTok{single\_channel =} \ConstantTok{TRUE}\NormalTok{,}
\AttributeTok{on\_disk =} \ConstantTok{TRUE}\NormalTok{,}
\AttributeTok{h5FilesPath =}\NormalTok{ HDF5Array}\SpecialCharTok{::}\FunctionTok{getHDF5DumpDir}\NormalTok{(),}
\AttributeTok{BPPARAM =}\NormalTok{ BPPARAM}
\NormalTok{)}
\FunctionTok{mcols}\NormalTok{(images) }\OtherTok{\textless{}{-}}\NormalTok{ S4Vectors}\SpecialCharTok{::}\FunctionTok{DataFrame}\NormalTok{(}\AttributeTok{imageID =} \FunctionTok{names}\NormalTok{(images))}
\end{Highlighting}
\end{Shaded}
As we're reading the image channels directly from the names of the TIFF
image, often these channel names will need to be cleaned for ease of
downstream processing.
The channel names can be accessed from the \texttt{CytoImageList} object
using the \texttt{channelNames()} function.
\begin{Shaded}
\begin{Highlighting}[]
\FunctionTok{channelNames}\NormalTok{(images) }\OtherTok{\textless{}{-}} \FunctionTok{channelNames}\NormalTok{(images) }\SpecialCharTok{|\textgreater{}}
\CommentTok{\# Remove preceding letters}
\FunctionTok{sub}\NormalTok{(}\AttributeTok{pattern =} \StringTok{".*\_"}\NormalTok{, }\AttributeTok{replacement =} \StringTok{""}\NormalTok{, }\AttributeTok{x =}\NormalTok{ \_) }\SpecialCharTok{|\textgreater{}}
\CommentTok{\# Remove the .ome}
\FunctionTok{sub}\NormalTok{(}\AttributeTok{pattern =} \StringTok{".ome"}\NormalTok{, }\AttributeTok{replacement =} \StringTok{""}\NormalTok{, }\AttributeTok{x =}\NormalTok{ \_)}
\end{Highlighting}
\end{Shaded}
Similarly, the image names will be taken from the folder name containing
the individual TIFF images for each channel. These will often also need
to be cleaned.
\begin{Shaded}
\begin{Highlighting}[]
\NormalTok{split\_names }\OtherTok{\textless{}{-}} \ControlFlowTok{function}\NormalTok{(x) \{}
\FunctionTok{sapply}\NormalTok{(}\FunctionTok{strsplit}\NormalTok{(x, }\StringTok{"\_"}\NormalTok{), }\StringTok{\textasciigrave{}}\AttributeTok{[}\StringTok{\textasciigrave{}}\NormalTok{, }\DecValTok{3}\NormalTok{)}
\NormalTok{\}}
\FunctionTok{names}\NormalTok{(images) }\OtherTok{\textless{}{-}} \FunctionTok{names}\NormalTok{(images) }\SpecialCharTok{|\textgreater{}} \FunctionTok{split\_names}\NormalTok{()}
\FunctionTok{mcols}\NormalTok{(images) }\OtherTok{\textless{}{-}}\NormalTok{ S4Vectors}\SpecialCharTok{::}\FunctionTok{DataFrame}\NormalTok{(}\AttributeTok{imageID =} \FunctionTok{names}\NormalTok{(images))}
\end{Highlighting}
\end{Shaded}
\section{Cell segmentation with
simpleSeg}\label{cell-segmentation-with-simpleseg}
The
\href{https://www.bioconductor.org/packages/release/bioc/html/simpleSeg.html}{simpleSeg}
package provides functionality to perform cell segmentation on
multiplexed imaging data. The \texttt{simpleSeg()} function can be used
to perform a simple cell segmentation process that traces out the nuclei
using a specified channel.
In the particular example below, we have asked \texttt{simpleSeg} to do
the following:
\begin{itemize}
\tightlist
\item
\texttt{nucleus\ =\ c("HH3")}: trace out the nuclei signal in the
images using the HH3 channel.
\item
\texttt{pca\ =\ TRUE}: segment out the nuclei mask using a principal
component analysis of all channels and using the principal components
most aligned with the nuclei channel, in this case, HH3.
\item
\texttt{cellBody\ =\ "dilate"}: use a dilation strategy of
segmentation, expanding out from the nucleus by a specified
\texttt{discSize}. In this case, \texttt{discSize\ =\ 3}, which means
simpleSeg dilates out from the nucleus by 3 pixels.
\item
\texttt{sizeSelection\ =\ 20}: ensure that only cells with a size
greater than 20 pixels will be used.
\item
\texttt{transform\ =\ "sqrt"}: perform square root transformation on
each of the channels prior to segmentation.
\item
\texttt{tissue\ =\ c("panCK",\ "CD45",\ "HH3")}: use the specified
tissue mask to filter out all background noise outside the tissue
mask. This allows us to ignore background noise which happens outside
of the tumour core.
\end{itemize}
There are many other parameters that can be specified in simpleSeg
(\texttt{smooth}, \texttt{watershed}, \texttt{tolerance}, and
\texttt{ext}), and we encourage the user to select the best parameters
which suit their biological context.
\begin{Shaded}
\begin{Highlighting}[]
\NormalTok{masks }\OtherTok{\textless{}{-}} \FunctionTok{simpleSeg}\NormalTok{(images,}
\AttributeTok{nucleus =} \FunctionTok{c}\NormalTok{(}\StringTok{"HH3"}\NormalTok{),}
\AttributeTok{pca =} \ConstantTok{TRUE}\NormalTok{,}
\AttributeTok{cellBody =} \StringTok{"dilate"}\NormalTok{,}
\AttributeTok{discSize =} \DecValTok{3}\NormalTok{,}
\AttributeTok{sizeSelection =} \DecValTok{20}\NormalTok{,}
\AttributeTok{transform =} \StringTok{"sqrt"}\NormalTok{,}
\AttributeTok{tissue =} \FunctionTok{c}\NormalTok{(}\StringTok{"panCK"}\NormalTok{, }\StringTok{"CD45"}\NormalTok{, }\StringTok{"HH3"}\NormalTok{),}
\AttributeTok{cores =}\NormalTok{ nCores}
\NormalTok{ )}
\end{Highlighting}
\end{Shaded}
\subsection{Visualise separation}\label{visualise-separation}
The \texttt{display()} and \texttt{colorLabels()} functions in the
\texttt{EBImage} packagemake it very easy to examine the performance of
the cell segmentation. If used in an interactive session,
\texttt{display()} allows you to zoom in and out of the image.
\begin{Shaded}
\begin{Highlighting}[]
\NormalTok{EBImage}\SpecialCharTok{::}\FunctionTok{display}\NormalTok{(}\FunctionTok{colorLabels}\NormalTok{(masks[[}\DecValTok{1}\NormalTok{]]))}
\end{Highlighting}
\end{Shaded}
\pandocbounded{\includegraphics[keepaspectratio]{01-processing_files/figure-pdf/visualise segmentation-1.pdf}}
\subsection{Visualise outlines}\label{visualise-outlines}
The \texttt{plotPixels} function in \texttt{cytomapper} makes it easy to
overlay the mask on top of the nucleus intensity marker to see how well
our segmentation process has performed. Here we can see that the
segmentation appears to be performing reasonably.
If you see over or under-segmentation of your images, \texttt{discSize}
is a key parameter in \texttt{simpleSeg()} for optimising the size of
the dilation disc after segmenting out the nuclei.
\begin{Shaded}
\begin{Highlighting}[]
\FunctionTok{plotPixels}\NormalTok{(}\AttributeTok{image =}\NormalTok{ images[}\StringTok{"F3"}\NormalTok{], }
\AttributeTok{mask =}\NormalTok{ masks[}\StringTok{"F3"}\NormalTok{],}
\AttributeTok{img\_id =} \StringTok{"imageID"}\NormalTok{, }
\AttributeTok{colour\_by =} \FunctionTok{c}\NormalTok{(}\StringTok{"HH3"}\NormalTok{), }
\AttributeTok{display =} \StringTok{"single"}\NormalTok{,}
\AttributeTok{colour =} \FunctionTok{list}\NormalTok{(}\AttributeTok{HH3 =} \FunctionTok{c}\NormalTok{(}\StringTok{"black"}\NormalTok{,}\StringTok{"blue"}\NormalTok{)),}
\AttributeTok{legend =} \ConstantTok{NULL}\NormalTok{,}
\AttributeTok{bcg =} \FunctionTok{list}\NormalTok{(}
\AttributeTok{HH3 =} \FunctionTok{c}\NormalTok{(}\DecValTok{1}\NormalTok{, }\DecValTok{1}\NormalTok{, }\DecValTok{2}\NormalTok{)}
\NormalTok{ ))}
\end{Highlighting}
\end{Shaded}
\pandocbounded{\includegraphics[keepaspectratio]{01-processing_files/figure-pdf/unnamed-chunk-4-1.pdf}}
We can also visualise multiple markers at once instead of just the HH3
marker to see how the segmentation mask performs. Below, we can see that
our segmentation mask has done a good job of capturing the CD31 signal,
but perhaps not such a good job of capturing the FXIIIA signal, which
often lies outside of our dilated nuclear mask. This could suggest that
we might need to increase the \texttt{discSize} or other parameters of
\texttt{simpleSeg}.
\begin{Shaded}
\begin{Highlighting}[]
\FunctionTok{plotPixels}\NormalTok{(}\AttributeTok{image =}\NormalTok{ images[}\StringTok{"F3"}\NormalTok{], }
\AttributeTok{mask =}\NormalTok{ masks[}\StringTok{"F3"}\NormalTok{],}
\AttributeTok{img\_id =} \StringTok{"imageID"}\NormalTok{, }
\AttributeTok{colour\_by =} \FunctionTok{c}\NormalTok{(}\StringTok{"HH3"}\NormalTok{, }\StringTok{"CD31"}\NormalTok{, }\StringTok{"FX111A"}\NormalTok{), }
\AttributeTok{display =} \StringTok{"single"}\NormalTok{,}
\AttributeTok{colour =} \FunctionTok{list}\NormalTok{(}\AttributeTok{HH3 =} \FunctionTok{c}\NormalTok{(}\StringTok{"black"}\NormalTok{,}\StringTok{"blue"}\NormalTok{),}
\AttributeTok{CD31 =} \FunctionTok{c}\NormalTok{(}\StringTok{"black"}\NormalTok{, }\StringTok{"red"}\NormalTok{),}
\AttributeTok{FX111A =} \FunctionTok{c}\NormalTok{(}\StringTok{"black"}\NormalTok{, }\StringTok{"green"}\NormalTok{) ),}
\AttributeTok{legend =} \ConstantTok{NULL}\NormalTok{,}
\AttributeTok{bcg =} \FunctionTok{list}\NormalTok{(}
\AttributeTok{HH3 =} \FunctionTok{c}\NormalTok{(}\DecValTok{1}\NormalTok{, }\DecValTok{1}\NormalTok{, }\DecValTok{2}\NormalTok{),}
\AttributeTok{CD31 =} \FunctionTok{c}\NormalTok{(}\DecValTok{0}\NormalTok{, }\DecValTok{1}\NormalTok{, }\DecValTok{2}\NormalTok{),}
\AttributeTok{FX111A =} \FunctionTok{c}\NormalTok{(}\DecValTok{0}\NormalTok{, }\DecValTok{1}\NormalTok{, }\FloatTok{1.5}\NormalTok{)}
\NormalTok{ ))}
\end{Highlighting}
\end{Shaded}
\pandocbounded{\includegraphics[keepaspectratio]{01-processing_files/figure-pdf/unnamed-chunk-5-1.pdf}}
In particular, the \texttt{cellBody} and \texttt{watershed} parameters
can strongly influence the way cells are segmented using
\texttt{simpleSeg()}. We've provided further details on how the user may
specify cell body identification and watershedding in the tables below.
\subsubsection{\texorpdfstring{\texttt{cellBody}
Parameters}{cellBody Parameters}}\label{cellbody-parameters}
\begin{longtable}[]{@{}
>{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.2500}}
>{\centering\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.3750}}
>{\centering\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.3750}}@{}}
\toprule\noalign{}
\begin{minipage}[b]{\linewidth}\raggedright
Method
\end{minipage} & \begin{minipage}[b]{\linewidth}\centering
Description
\end{minipage} & \begin{minipage}[b]{\linewidth}\centering
\end{minipage} \\
\midrule\noalign{}
\endhead
\bottomrule\noalign{}
\endlastfoot
{``distance''} & {Performs watershedding on a distance map of the
thresholded nuclei signal. With a pixels distance being defined as the
distance from the closest background signal.} & \\
{``intensity''} & {Performs watershedding using the intensity of the
nuclei marker.} & \\
{``combine''} & {Combines the previous two methods by multiplying the
distance map by the nuclei marker intensity.} & \\
\end{longtable}
\subsubsection{\texorpdfstring{\texttt{watershed}
Parameters}{watershed Parameters}}\label{watershed-parameters}
\begin{longtable}[]{@{}
>{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.2500}}
>{\centering\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.3750}}
>{\centering\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.3750}}@{}}
\toprule\noalign{}
\begin{minipage}[b]{\linewidth}\raggedright
Method
\end{minipage} & \begin{minipage}[b]{\linewidth}\centering
Description
\end{minipage} & \begin{minipage}[b]{\linewidth}\centering
\end{minipage} \\
\midrule\noalign{}
\endhead
\bottomrule\noalign{}
\endlastfoot
{``dilation''} & {Dilates the nuclei by an amount defined by the user.
The size of the dilatation in pixels may be specified with the
\texttt{discDize} argument.} & \\
{``discModel''} & {Uses all the markers to predict the presence of
dilated `discs' around the nuclei. The model therefore learns which
markers are typically present in the cell cytoplasm and generates a mask
based on this.} & \\
{``marker''} & {The user may specify one or multiple dedicated cytoplasm
markers to predict the cytoplasm. This can be done using
\texttt{cellBody\ =\ "marker\ name"/"index"}} & \\
{``None''} & {The nuclei mask is returned directly.} & \\
\end{longtable}
\section{Cell segmentation with
BIDCell}\label{cell-segmentation-with-bidcell}
\section{Visual comparison of
segmentations}\label{visual-comparison-of-segmentations}
plotPixels can plot multiple images \textless-- use this to visualise
multiple images at once after you have BIDCell ready.
\section{Summarise cell features}\label{summarise-cell-features}
In order to characterise the phenotypes of each of the segmented cells,
\texttt{measureObjects()} from \texttt{cytomapper} will calculate the
average intensity of each channel within each cell as well as a few
morphological features. By default, the \texttt{measureObjects()}
function will return a \texttt{SingleCellExperiment} object, where the
channel intensities are stored in the \texttt{counts} assay and the
spatial location of each cell is stored in \texttt{colData} in the
\texttt{m.cx} and \texttt{m.cy} columns.