-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFig1_Overview.Rmd
918 lines (789 loc) · 50 KB
/
Fig1_Overview.Rmd
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
---
title: "Fig1_Overview"
author: "Bernard Mulvey"
date: "2024-10-25"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(fig.height = 10, fig.width = 7, include = FALSE)
knitr::opts_chunk$set(fig.width = 7, fig.height = 10)
#### sets tab autocompletion for directories to begin from the directory containing the .Rproj session, instead of the script's directory if different
knitr::opts_knit$set(root.dir = here::here())
library(data.table) # Preferred data manipulation package
library(ggplot2) # Dependency for several plotting functions
library(ggtext) # more character types in ggplots
library(ggrastr) # avoid making raster images one can't even open
library(SpatialExperiment) # Visium data framework
library(SpatialFeatureExperiment) # Xenium data framework
library(spatialLIBD) # one option for plotting cluster assignments, but breaks when the in-tissue portion of a visium area is very un-square.
library(escheR) # alternative spotplotting function, at least for visium
library(viridis) # palettes
library(Polychrome) # better palettes
require(colorout) # Utility for RStudio
library(sf) # define the polygonal boundaries of xenium domains
ColorOut()
# code reformatting in Rstudio
options("styler.addins_style_transformer" = "biocthis::bioc_style()")
# set plotting defaults for ggplot
theme_set(theme_bw() + theme(axis.text.x = element_text(size = 8), axis.title.x = element_text(size = 9), axis.text.y = element_text(size = 8), axis.title.y = element_text(size = 9), plot.title = element_blank(), strip.text = element_text(size = 10), legend.text = element_text(size = 8), legend.title = element_text(size = 8, hjust = 0.5)))
```
## load visium, xenium experiments, cluster labels
```{r}
#### VISIUM ####
hyp2 <- readRDS("spatial_HYP/processed-data/03-QC_filters/hypN10_umi210_gene126_chrm50_spotsweeped_lognorm_rotsNmirrors_072224.RDS")
bscl <- fread("spatial_HYP/processed-data/06-BayesSpace/01-bayesspace60kiter_k15-20-31_out/BSpace_k15_HARMONYlmbna_nnsvg10.txt") # main visium clustering (bs=bayesspace)
setnames(bscl,2,"cl")
bscl[,cl:=paste0("Vis",cl)]
bscl[cl=="Vis7",cl:="VMH.1"]
bscl[cl=="Vis12",cl:="VMH.2"]
bscl[cl=="Vis4",cl:="ARC.1"]
bscl[cl=="Vis6",cl:="ARC.2"]
# WM (optic tract, OT): Clusters 3 5 and 10
bscl[cl=="Vis3",cl:="OT (3)"]
bscl[cl=="Vis10",cl:="OT (3)"]
bscl[cl=="Vis5",cl:="OT (3)"]
# others:
bscl[cl=="Vis1",cl:="GABA (2)"]
bscl[cl=="Vis2",cl:="PeriVN"]
bscl[cl=="Vis9",cl:="Vascular"]
bscl[cl=="Vis8",cl:="SON"]
bscl[cl=="Vis13",cl:="Portal Vasc."]
bscl[cl=="Vis14",cl:="Astro"]
bscl[cl=="Vis15",cl:="GABA (2)"]
## Vis11 is a donor/sample-specific cluster, so remove that one for plotting here.
bscl <- bscl[cl!="Vis11"]
bscl[,dom:=cl]
bscl[dom %in% c("VMH.1","VMH.2"),dom:="VMH"]
bscl[dom %in% c("ARC.1","ARC.2"),dom:="ARC"]
bscl[dom %in% c("OT"),dom:="OT"]
bscl[!(dom %in% c("VMH","ARC","OT")),dom:="Other"]
# subset the visium obj to non-cluster 11 spots for plotting
hyp2 <- hyp2[,colnames(hyp2) %in% bscl$rn]
# append col labels to rest of visium data
bscl<-DataFrame(bscl,row.names=bscl$rn)[colnames(hyp2),]
hyp2$k15dom <- bscl$cl
hyp2$`Visium Domain` <- factor(bscl$dom,levels=c("ARC","VMH","OT","Other"))
```
#### XENIUM setup ####
```{r}
hypx <- readRDS("xenium_HYP/processed-data/05_Banksy_M0lam0_res2_multisamp/01-sfe-in_staggered-coords_genetarg-only_NONlog-norm.RDS")
bksmooth <- fread("xenium_HYP/processed-data/07_Domains-subdomains_by_knnSmoothing_Banksytypes/03b-ARCVMHdomains_2stepsmooth_VMH-k10-0.2-VMH-k200-0.2_ARC-k50-0.1_ARC-k500-0.5.txt") ## xenium domain assignments after smoothing, by xenium cell
## but drop discarded cell clusters, too
bkcl <- fread("xenium_HYP/processed-data/05_Banksy_M0lam0_res2_multisamp/01-BanksyClusts_M0lam0_leiden_multisamp.txt")
setnames(bkcl,2,"cl")
bkanno <- fread("xenium_HYP/processed-data/05_Banksy_M0lam0_res2_multisamp/02-M0l0kg6_topClusMarkers_celltypes_annotated.txt")
## drop sample-specific clusters, append cluster annotations
bkanno <- unique(bkanno[,.(clus,bjm_annot)])
bkanno <- bkanno[bjm_annot!="DISCARD"&bjm_annot!="VMH_4_DISCARD"]
bkcl <- merge.data.table(bkcl,bkanno,by.x="cl",by.y="clus")
## drop excluded clusters from xenium spe
hypx <- hypx[,colnames(hypx) %in% bkcl$rn]
## append cluster annots to xenium spe
bkcl <- DataFrame(bkcl,row.names=bkcl$rn)[colnames(hypx),]
bkcl$rn <- NULL
hypx$banksyclus <- bkcl$bjm_annot
## assign the domain labels to the xenium cells
bksmooth[dualVMHARC4=="other",dualVMHARC4:="Other"]
bksmooth <- DataFrame(bksmooth,row.names=bksmooth$rn)[colnames(hypx),]
hypx$dom <- bksmooth$dualVMHARC4
```
The colors slotted in 1 and 3 are also picked to have the same luminance so that gene expression coloration fill in escheR grayscale doesn't look falsely darker or lighter in one spot type vs. the other
```{r}
pals <- readRDS("manuscript_plot_code/domain_and_xencluster_palettes_CHECKPALNAMESBEFOREUS.RDS")
pal <- pals[[1]]
fullpal <- readRDS("manuscript_plot_code/14color_palette.RDS")
#### FOR PLOTTING INDIVIDUAL VISIUM OT/GABA CLUSTERS, NOT USED: set levels for the domain labels so they appear in the same order
# hyp2$k15dom <- factor(hyp2$k15dom,levels=c("VMH.1","VMH.2","ARC.1","ARC.2","OT.1","OT.2","OT.3","GABA.1","GABA.2","SON","Vascular","Astro","PeriVN","Portal Vasc."))
## subset the 14 color pal to 11 colors (matching the xenium clustergroup palette for oligos (orange) and GABAs (deep pink)) to account for merging OT clusters or GABA clusters together, rename pal and factor the spe cluster column
fullpal <- c(fullpal[c("VMH.1","VMH.2","ARC.1","ARC.2")],
pals[["xen_cellgroups"]][c("Oligo (4)","Other GABAergic Neurons (2)")],
fullpal[c("SON","Vascular","Astro","PeriVN","Portal Vasc.")])
names(fullpal)[c(5,6)] <- c("OT (3)","GABA (2)")
stopifnot(all(names(fullpal) %in% unique(hyp2$k15dom)))
hyp2$k15dom <- factor(hyp2$k15dom,levels=names(fullpal))
### also load manuscript plotting ids
mscriptids <- fread("standardized_sampleids_for_plotting.txt")
```
###### TIP: LEGEND ORDER ######
### i would've been up shit creek without this handy post https://stackoverflow.com/questions/76397512/ggplot-ordering-legends-with-guides-changes-continuous-legend-to-discrete
#################################
Panels A and B are experimental overviews/schematics.
Panel C is an exemplary Visium sample with ALL domain labels.
Our exemplary sample here is V12D05-350_C1 (xen rep Br8741,X99_8741C looks better)
## (another option: V13Y24-346_C1 (Br1225, xenium rep X99_1225B looks better)
```{r}
# panc <- hyp2[,hyp2$sample_id=="V12D05-350_C1"]
panc <- hyp2[,hyp2$sample_id=="V13Y24-346_C1"]
p <- make_escheR(panc)
p <- p |> add_fill("k15dom",size=0.25,point_size = 0.7)
pdf("manuscript_plots/Fig1/1C-V13Y24-346_C1_Visdomains.pdf",height=2,width=2)
p+
scale_fill_manual(values=fullpal,na.value = NA)+
# ggtitle(mscriptids[sample_id==unique(panc$sample_id),manuscript_id])+
guides(color="none",fill=guide_legend(title = NULL,override.aes=list(size=1.5)))+
#labs(fill="Visium\nCluster(s)\n(N if >1)")+
theme(
#plot.title.position = "plot",
#plot.title = element_markdown(size=9,hjust=0.5),
legend.key.size = ggplot2::unit(0.075,"in"),legend.title=element_text(size=7,hjust=0.5),plot.margin = margin(0,0.05,0,-0.05,unit = "in"),legend.margin = margin(0,0,0,-0.14,"in"),legend.text=element_text(size=6))
dev.off()
rm(panc,p)
```
### ## create supercluster labels to group related cell types together and use the previously saved + loaded xenium palette for cell groups for the next panel.
```{r}
bkcl <- as.data.table(bkcl,keep.rownames=T)
bkcl[,supercl:="ifthisisplottedigoofed"]
bkcl[bjm_annot %in% grep(bjm_annot,pattern="VMH",value=T),supercl:="VMH (4)"]
bkcl[bjm_annot %in% grep(bjm_annot,pattern="ARC",value=T),supercl:="ARC (5)"]
bkcl[bjm_annot %in% grep(bjm_annot,pattern="Tanyc|Alar",value=T),supercl:="Tanycytes,<br>Portal Vasc. (4)"]
bkcl[bjm_annot %in% grep(bjm_annot,pattern="Oligo",value=T),supercl:="Oligo (4)"]
bkcl[bjm_annot %in% grep(bjm_annot,pattern="Astro",value=T),supercl:="Astro (2)"]
bkcl[bjm_annot %in% grep(bjm_annot,pattern="Microg",value=T),supercl:="Microglia (3)"]
bkcl[bjm_annot %in% grep(bjm_annot,pattern="Supraopt",value=T),supercl:="SON (2)"]
bkcl[bjm_annot %in% grep(bjm_annot,pattern="Unsure_AVP",value=T),supercl:="Non-SON<br>*AVP*+*OXT*+ (1)"]
bkcl[bjm_annot %in% grep(bjm_annot,pattern="Macrop|Periph|Vascul|Endothel",value=T),supercl:="Vascular, Periph.<br>Immune (5)"]
bkcl[bjm_annot %in% grep(bjm_annot,pattern="GABA",value=T),supercl:="Other GABAergic (2)"]
bkcl[bjm_annot %in% grep(bjm_annot,pattern="Periven",value=T),supercl:="PeriVN<br>(Excitatory) (1)"]
### the parenthetical numbers add up to 33, so we're good.
### lastly, in the case of the xenium spotplot of all cell groups, we need to put them in a specific order for them to fit within the plot space alongside 1225B: VMH, ARC, SON, Astro, Oligo, Microglia, PeriVN, Non-SON AVP+OXT+, Tanycytes n portal, Other GABA, Vasc n periph
levs <- c("VMH (4)","ARC (5)","SON (2)","Astro (2)","Oligo (4)","Microglia (3)","PeriVN<br>(Excitatory) (1)","Non-SON<br>*AVP*+*OXT*+ (1)","Tanycytes,<br>Portal Vasc. (4)","Other GABAergic (2)","Vascular, Periph.<br>Immune (5)")
stopifnot(all(levs %in% unique(bkcl$supercl)))
bkcl$supercl <- factor(bkcl$supercl,levels=c("VMH (4)","ARC (5)","SON (2)","Astro (2)","Oligo (4)","Microglia (3)","PeriVN<br>(Excitatory) (1)","Non-SON<br>*AVP*+*OXT*+ (1)","Tanycytes,<br>Portal Vasc. (4)","Other GABAergic (2)","Vascular, Periph.<br>Immune (5)"))
```
1E previous code to plot usign data.table (results in skewed dimensions; implemented a fix for it here but then switched to escher for consistency with other panels in this figure anyhow.)
```{r}
## make plotting table of spatial coords, super cluster assignments
# panealt <- as.data.table(cbind(colData(hypx[,hypx$sample_id=="X99_1225B"]),spatialCoords(hypx[,hypx$sample_id=="X99_1225B"])))
## zero-base the coordinates
# panealt[,sdimx:=0.1+sdimx-(min(sdimx))]
# panealt[,sdimy:=0.1+sdimy-(min(sdimy))]
# stopifnot(nrow(panealt[sdimx>0&sdimy>0])==nrow(panealt))
# factor supercl here to match the leveling from the source SPE
# panealt[,supercl:=factor(supercl,levels=levs)]
# to plot appropriately, need x and y axes to be same range. since this section is taller than wide, get the difference to tack onto the coordinate limits so that the tissue spots fall in the center of the plot area along the x axis
# halfdiff <- (8000-max(panealt$sdimy))/2
# pdf("manuscript_plots/Fig1/1Ealt-Xenium cell group spotplot.pdf",height=2,width=3.25)
# ggplot(panealt[sdimy<8000],aes(x=sdimx,y=sdimy,col=supercl))+
# #guides(color="none")+
# labs(color="Cell group\n(N clusters)")+
# ggtitle(mscriptids[sample_id=="X99_1225B",manuscript_id])+
# guides(color=guide_legend(override.aes=list(size=1.5)))+
# scale_color_manual(values=xenpal)+
# #scale_x_continuous(limits=c(halfdiff,max(panealt$sdimx)+abs(halfdiff)),expand=c(0,0))+
# # scale_y_continuous(limits=c(0,8000,expand=c(0,0)))+
# theme(panel.grid = element_blank(),
# axis.text.x=element_blank(),
# axis.text.y=element_blank(),
# axis.title.x=element_blank(),
# axis.title.y=element_blank(),
# axis.ticks = element_blank(),
# legend.text = element_markdown(size=6,margin=margin(0,0,0,0,"in")),
# legend.key.size = ggplot2::unit(0.075,"in"),
# legend.title=element_text(size=7,hjust=0.5),
# legend.background = element_blank(),
# # legend.title=element_text(size=7,margin=margin(0,0,0.0525,-0.65,"in"),hjust=0.5),
# legend.box = element_blank(),
# legend.box.spacing = ggplot2::unit(0,"in"),
# legend.key = element_blank(),
# legend.key.height=ggplot2::unit(0.0125,"in"),
# legend.key.width=ggplot2::unit(0.0125,"in"),
# legend.key.spacing.y = ggplot2::unit(0.05,"in"))+
# # legend.position.inside = c(0.19,0.165),
# # legend.position="inside")+
# rasterize(geom_point(size=0.2,stroke=0),layers="Points",dpi=900,dev="cairo_png")
```
1E continued: xenium "spot"plot with superclusters labeled. fix the palette names to match the tweaked names above (done to keep legend from taking up too much width)
```{r}
## make palette names match tweaks from previous block
xenpal <- pals$xen_cellgroups
names(xenpal)[names(xenpal)=="PeriVN (Excitatory) (1)"] <- "PeriVN<br>(Excitatory) (1)"
names(xenpal)[names(xenpal)=="Non-SON AVP+OXT+ (1)"] <- "Non-SON<br>*AVP*+*OXT*+ (1)"
names(xenpal)[names(xenpal)=="Tanycytes, Portal Vasc. (4)"] <- "Tanycytes,<br>Portal Vasc. (4)"
names(xenpal)[names(xenpal)=="Vascular and Peripheral Immune (5)"] <- "Vascular, Periph.<br>Immune (5)"
names(xenpal)[names(xenpal)=="Other GABAergic Neurons (2)"] <- "Other GABAergic (2)"
stopifnot(all(names(xenpal) %in% unique(bkcl$supercl)))
## assign superclusters to SPE
hypx$supercl <- DataFrame(bkcl,row.names=bkcl$rn)[colnames(hypx),]$supercl
# get sample
panealt <- hypx[,hypx$sample_id=="X99_1225B"]
pane <- make_escheR(panealt,y_reverse=FALSE)
pane <- pane |> add_fill("supercl",size=0.2,point_size = 0.2)
pdf("manuscript_plots/Fig1/1Ealt-Xenium cell group spotplot.pdf",height=2,width=3.25)
pane+ #guides(color="none")+
labs(fill="Cell group\n(N clusters)")+
# ggtitle(mscriptids[sample_id=="X99_1225B",manuscript_id])+
guides(fill=guide_legend(override.aes=list(size=1.5)))+
scale_fill_manual(values=xenpal)+
#scale_x_continuous(limits=c(halfdiff,max(panealt$sdimx)+abs(halfdiff)),expand=c(0,0))+
# scale_y_continuous(limits=c(0,8000,expand=c(0,0)))+
theme(panel.grid = element_blank(),
axis.text.x=element_blank(),
axis.text.y=element_blank(),
axis.title.x=element_blank(),
axis.title.y=element_blank(),
axis.ticks = element_blank(),
legend.text = element_markdown(size=6,margin=margin(0,0,0,0,"in")),
legend.key.size = ggplot2::unit(0.075,"in"),
legend.title=element_text(size=7,hjust=0.5),
legend.background = element_blank(),
# legend.title=element_text(size=7,margin=margin(0,0,0.0525,-0.65,"in"),hjust=0.5),
legend.box = element_blank(),
legend.box.spacing = ggplot2::unit(0,"in"),
legend.key = element_blank(),
legend.key.height=ggplot2::unit(0.0125,"in"),
legend.key.width=ggplot2::unit(0.0125,"in"),
legend.key.spacing.y = ggplot2::unit(0.04,"in"))
# legend.position.inside = c(0.19,0.165),
# legend.position="inside")
dev.off()
```
## Panel d: Visium with key domains labeled. Don't show OT.
```{r}
pand <- hyp2[,hyp2$sample_id=="V13Y24-346_C1"]
pand$`Visium Domain` <- as.character(pand$`Visium Domain`)
pand$`Visium Domain`[pand$`Visium Domain`=="OT"] <- "Other"
pand$`Visium Domain` <- factor(pand$`Visium Domain`,levels=c("ARC","VMH","Other"))
p <- make_escheR(pand)
p <- p |> add_fill("Visium Domain",size=0.8,point_size = 0.8)
pdf("manuscript_plots/Fig1/1D-V13Y24-346_C1_keydomains.pdf",height=2,width=2)
p+
scale_fill_manual(values=pal,na.value = NA)+
# ggtitle(mscriptids[sample_id=="V13Y24-346_C1",manuscript_id])+
# guides(color=guide_legend(override.aes=list(size=1.5,stroke=1)))+
guides(fill="none")+
# labs(color="Visium\nDomain")+
theme(legend.text = element_text(size=7),
# plot.title.position = "plot",
# plot.title = element_markdown(size=9,hjust=0.5),
# plot.title = element_text(size=9,hjust=0.5),
# legend.key.size = ggplot2::unit(0.075,"in"),
# legend.title=element_text(size=7.5,hjust=0.5),
plot.margin = margin(0,0,0,0,unit = "in"))
# legend.margin = margin(0,0,0,-0.14,"in"))
dev.off()
rm(p,pand)
```
### Panel F part 1: VMH marker expression (NR5A1). For consistency with the xenium plots, we first want to make an OUTLINE around the domain, rather than fill it in. We want the most precise polygons possible here, so we will not use hull functions and instead use the "Jarvis March" or gift-wrapping algorithm, which exhaustively searches for boundary points that fall within a query set.
# Credit for the approach to github copilot chat on IntelliJ IDEA in response to the prompt "How do I calculate the coordinates of all points defining a 2D polygon boundary from a set of x,y coordinates without needing to tune parameters? I want all points defining the boundary to be from within the set of query points. Concave and convex hull functions, like concaveman, chull, alphahull, and functions from the sf package are not appropriate."
```{r}
## set visium rownames to gene symbols
rownames(hyp2) <- rowData(hyp2)$gene_name
panf <- hyp2["NR5A1",hyp2$sample_id=="V13Y24-346_C1"]
colData(panf)$`log counts` <- as.numeric(logcounts(panf)["NR5A1",])
# drop OT for now
panf$`Visium Domain` <- as.character(panf$`Visium Domain`)
panf$`Visium Domain`[panf$`Visium Domain`=="OT"] <- "Other"
panf$`Visium Domain` <- factor(panf$`Visium Domain`,levels=c("ARC","VMH","Other"))
## now we need to sidetrack and get the points defining the perimeter of the ARC and VMH. modifying some template code from copilot:
# subFunction to find the orientation of the triplet (p, q, r)
# Function to find the orientation of the triplet (p, q, r)
orientation <- function(p, q, r) {
val <- (q[2] - p[2]) * (r[1] - q[1]) - (q[1] - p[1]) * (r[2] - q[2])
if (val == 0) return(0) # collinear
if (val > 0) return(1) # clockwise
return(2) # counterclockwise
}
# Function to check if point q is on segment pr
on_segment <- function(p, q, r) {
if (q[1] <= max(p[1], r[1]) && q[1] >= min(p[1], r[1]) &&
q[2] <= max(p[2], r[2]) && q[2] >= min(p[2], r[2])) {
return(TRUE)
}
return(FALSE)
}
# Function to implement the gift wrapping algorithm allowing for potential concavity in polygons
gift_wrapping_concave <- function(points) {
n <- nrow(points)
if (n < 3) stop("There must be at least 3 points")
# Initialize result
hull <- list()
# Find the leftmost point
l <- which.min(points[, 1])
p <- l
repeat {
# Add current point to result
hull <- append(hull, list(points[p, ]))
# Search for a point 'q' such that orientation(p, q, x) is counterclockwise
q <- (p + 1) %% n
for (i in 1:n) {
if (orientation(points[p, ], points[i, ], points[q, ]) == 2) {
q <- i
}
}
# Now q is the most counterclockwise with respect to p
p <- q
# While we don't come to the first point
if (p == l) break
}
# Convert list to matrix
hull <- do.call(rbind, hull)
# Remove points that are inside the concave polygon
is_inside <- function(pt, hull) {
n <- nrow(hull)
count <- 0
for (i in 1:n) {
next_i <- ifelse(i == n, 1, i + 1)
if (on_segment(hull[i, ], pt, hull[next_i, ])) return(FALSE)
if (orientation(hull[i, ], pt, hull[next_i, ]) == 0) return(FALSE)
if (orientation(hull[i, ], pt, hull[next_i, ]) == 2) count <- count + 1
}
return(count %% 2 == 1)
}
hull <- hull[!apply(points, 1, is_inside, hull = hull), ]
return(hull)
}
## attach the coordinate info to colData so we can subset to VMH points and wrap this gift. it'll take a bit
tmpcoldata <- as.data.table(as.data.frame(cbind(colData(panf),spatialCoords(panf))))
### these end up looking wacky without some stray spots removed, so we need to manually drop a handful of singletons
# tmpcoldata <- tmpcoldata[Visium.Domain %in% c("ARC","VMH")]
# this will be easier to figure out using the array row/col values on a temporary plot with some lines overlaid to help pinpoint array coords to remove from the tracing. this doesn't account for the rotations or mirroring of the visium data, so grab a screenshot and rotate so that the x and y coords are not changed relative to the values we'll use to filter the table.
ggplot(tmpcoldata,aes(x=array_row,y=array_col,color=Visium.Domain))+
geom_point(size=1.5)+
geom_vline(xintercept=seq(0,max(tmpcoldata$array_row),by=5))+
geom_hline(yintercept=seq(0,max(tmpcoldata$array_col),5))+scale_x_reverse()
dev.off()
# ok three conditionals should do it: ARC points that are to the right of an array_row/col line col = 5.8*row - 230 and for array_row>=50 & array_row<=55 or at array_col>40 where array_row<40, or anything with array_col>101 or array_row<20. for VMH, points right of the line 10.8*row-184
tmpcoldata <- rbind(tmpcoldata[Visium.Domain=="ARC"&!((array_row<40&array_col>40)|(array_row>=50&array_row<=55&array_col>5.8*array_row-230)|array_col>101|array_row<21)],
tmpcoldata[Visium.Domain=="VMH"&!(array_col>10.8*array_row-184)])
## for plotting with geom_path, we need to add the first point at the end of the sequence as well. this function is a little glitchy in that it returns a matrix of equal dimensions to the input but now with a bunch of NA rows so dump those after
vhull <- gift_wrapping_concave(as.data.frame(tmpcoldata[Visium.Domain=="VMH",.(array_col,array_row)]))
vhull <- vhull[rowSums(is.na(vhull))==0,]
vhull <- as.data.frame(rbind(vhull,vhull[1,]))
vhull$dom <- "VMH"
rownames(vhull) <- as.numeric(rownames(vhull))
rownames(vhull) <- paste0("pt",seq(1,nrow(vhull),by=1))
ahull <- gift_wrapping_concave(as.data.frame(tmpcoldata[Visium.Domain=="ARC",.(array_col,array_row)]))
ahull <- ahull[rowSums(is.na(ahull))==0,]
# the ARC hull points still come out a little goofy. after array_col 37, array _row 27, we need to add the following points: col40row36,col38row40,col40row42,col45row45,52-49,7454
addpoints <- as.data.frame(cbind(c(40,38,40,45,52,74),c(36,40,42,45,49,54)))
colnames(addpoints) <- c("array_col","array_row")
insertrow <- which(ahull[,1]==37&ahull[,2]==27)
ahull <- rbind(ahull[c(1:insertrow),],addpoints,ahull[c(1+insertrow:nrow(ahull)),])
# then add the first point to the end of the sequence again
ahull <- rbind(ahull,ahull[1,])
ahull$dom <- "ARC"
rownames(ahull) <- paste0("pt",seq((1+nrow(vhull)),nrow(vhull)+nrow(ahull),by=1))
dompoly <- rbind(vhull,ahull)
## get the pixel-resolution values corresponding to these spots as pixel res is what escher uses to plot
dompoly2 <- merge.data.table(as.data.table(dompoly,keep.rownames=T),tmpcoldata,by=c("array_col","array_row"))
dompoly2 <- dompoly2[,.(rn,array_col,array_row,pxl_col_in_fullres,pxl_row_in_fullres,Visium.Domain)]
dompoly2[,rn:=as.numeric(gsub(rn,pattern="pt",replacement=""))]
setorderv(dompoly2,"rn")
rm(vhull,ahull,dompoly,tmpcoldata)
```
now plot it
```{r}
p <- make_escheR(panf)
p <- p |> add_fill("log counts",size=0.8,point_size = 0.8)
# p <- p |> add_ground(var = "Visium Domain",stroke=0.55,point_size = 0.5)
pdf("manuscript_plots/Fig1/1F-V13Y24-346_C1_NR5A1.pdf",height=2,width=2)
p+
geom_path(data=dompoly2,aes(x=pxl_col_in_fullres,y=pxl_row_in_fullres,color=Visium.Domain,group=Visium.Domain),size=0.4)+
scale_color_manual(values=pal,na.value = NA)+
scale_fill_continuous("log\ncounts",low= "#FFFFFF",high="#000000")+
ggtitle("*NR5A1*")+
guides(color=guide_legend(override.aes=list(size=1.5,stroke=1)))+
labs(color="Visium\nDomain")+
guides(color="none")+
theme(plot.title.position = "plot",plot.title = element_markdown(size=9,hjust=0.5),legend.text = element_text(size=7),legend.key.size = ggplot2::unit(0.075,"in"),legend.title=element_text(size=7.5,hjust=0.5),plot.margin = margin(0,0.05,0,-0.05,unit = "in"),legend.margin = margin(0,0,0,-0.14,"in"))
dev.off()
rm(p,panf)
```
# panels G is a representative ARC marker in our Visium sample : POMC
```{r}
## we need to set rownames of the visium object to gene symbols instead of ensembl identifiers for ease here
rownames(hyp2) <- rowData(hyp2)$gene_name
## for escheR, we put the assay value into the colData for it to use
pang <- hyp2["POMC",hyp2$sample_id=="V13Y24-346_C1"]
colData(pang)$`log counts` <- as.numeric(logcounts(pang)["POMC",])
p <- make_escheR(pang)
p <- p |> add_fill("log counts",size=0.8,point_size = 0.8)
# p <- p |> add_ground(var = "Visium Domain",stroke=0.15,point_size = 0.5)
pdf("manuscript_plots/Fig1/1G-V13Y24-346_C1_POMC.pdf",height=2,width=2)
p+
geom_path(data=dompoly2,aes(x=pxl_col_in_fullres,y=pxl_row_in_fullres,color=Visium.Domain,group=Visium.Domain),size=0.4)+
scale_color_manual(values=pal,na.value = NA)+
scale_fill_continuous("log\ncounts",low= "#FFFFFF",high="#000000")+
#scale_fill_grey()+
ggtitle("*POMC*")+
# guides(color=guide_legend(override.aes=list(size=1.5,stroke=1)))+
# labs(color="Visium\nDomain")+
guides(color="none")+
theme(plot.title.position = "plot",plot.title = element_markdown(size=9,hjust=0.5),legend.text = element_text(size=7),legend.key.size = ggplot2::unit(0.075,"in"),legend.title=element_text(size=7.5,hjust=0.5),plot.margin = margin(0,0.05,0,-0.05,unit = "in"),legend.margin = margin(0,0,0,-0.14,"in"))
dev.off()
rm(p,pang)
```
Panel I is the xenium domains in the same donor (Br1225 , sample X99_1225B).
### Panel I: xenium counterpart to C (X99_1225B)
```{r}
pani <- hypx[,hypx$sample_id=="X99_1225B"]
# y_reverse is an argument to unexported escheR internals that we don't want set to TRUE, since we have oriented all the tissue the way we want it already.
p <- make_escheR(pani,y_reverse=FALSE)
p <- p |> add_fill("dom",size=0.05,point_size = 0.2)
pdf("manuscript_plots/Fig1/1I-X99_1225B_Xendomains.pdf",height=2,width=2)
p+
scale_fill_manual(values=pal,na.value = NA)+
# ggtitle(mscriptids[sample_id=="X99_1225B",manuscript_id])+
# guides(color="none",fill=guide_legend(override.aes=list(size=1.5)))+
# labs(fill="Xenium\nDomain")+
guides(color="none",fill="none")+
theme(plot.title.position = "plot",plot.title = element_markdown(size=9,hjust=0.5,margin=margin(0.12,0,-0.10,0,"in")),plot.margin = margin(-0.11,-0.4,-0.12,-0.4,unit = "in"))
dev.off()
rm(pani,p)
```
### xenium panels: no WM "domain" defined, so change the domain color palette to exclude WM. also remove the "other" category, since we only have VMH/ARC outlines colored. (expression is filled with grayscale.)
```{r}
pal <- pal[1:2]
```
### The xenium expression panels (I, J,K) are going to be tricky -- there's so many spots we can't really use the line-color / fill heuristic. we'll have to add an outline around the domain instead.
### J K L are the same genes in the xenium counterpart, X99_1225B
```{r}
panj <- hypx["NR5A1",hypx$sample_id=="X99_1225B"]
#
## attach the coordinate info to colData so we can make an sf object out of this for hull extraction. see well-annotated code from DE benchmarking of domain boundaries in xenium_HYP/code/07/03c-DE benchmarks...
tmpcoldata <- cbind(colData(panj),spatialCoords(panj))
panjv <- st_as_sf(as.data.frame(tmpcoldata[tmpcoldata$dom=="VMH",]),coords = c("sdimx","sdimy"))
panjv <- st_convex_hull(st_union(panjv))
panja <- st_as_sf(as.data.frame(tmpcoldata[tmpcoldata$dom=="ARC",]),coords=c("sdimx","sdimy"))
panja <- st_concave_hull(st_union(panja),ratio = 0.1)
## create the data table we will use for overlaying the boundary polygons
dompoly <- cbind(panjv[[1]][[1]],rep("VMH",nrow(panjv[[1]][[1]])))
dompoly <- rbind(dompoly,cbind(panja[[1]][[1]],rep("ARC",nrow(panja[[1]][[1]]))))
dompoly <- as.data.table(dompoly)
setnames(dompoly,c("xpol","ypol","dompol"))
dompoly[,xpol:=as.numeric(xpol)]
dompoly[,ypol:=as.numeric(ypol)]
rm(panja,panjv)
```
### finally, append the counts for our gene of interest (NR5A1) and make panel J
```{r}
colData(panj)$`log counts` <- as.numeric(logcounts(panj)["NR5A1",])
p <- make_escheR(panj,y_reverse=FALSE)
p <- p |> add_fill("log counts",size=0.2,point_size = 0.225)
pdf("manuscript_plots/Fig1/1J-X99_1225B_NR5A1.pdf",height=2,width=2)
p+
scale_fill_continuous("log\ncounts",low= "#FFFFFF",high="#000000")+
geom_path(data=dompoly,aes(x=xpol,y=ypol,group=dompol,col=dompol),linewidth = 0.25)+
scale_color_manual(values=pal,na.value = NA)+
ggtitle("*NR5A1*")+
guides(color="none")+
# labs(col="Xenium\nDomain")+
theme(plot.title.position = "plot",plot.title = element_markdown(size=9,hjust=0.5,margin=margin(0.12,0,-0.12,0,"in")),legend.text = element_text(size=7),legend.key.size = ggplot2::unit(0.125,"in"),legend.title=element_text(size=7.5,hjust=0.5),plot.margin = margin(-0.11,-0.4,-0.12,-0.4,unit = "in"),legend.margin=margin(0,-0.2,0,0,"in"),legend.background = element_blank(),legend.box = element_blank(),legend.key = element_blank())
dev.off()
# rm(panj,p,tmpcoldata)
```
K: POMC in X99_1225B
```{r}
pank <- hypx["POMC",hypx$sample_id=="X99_1225B"]
colData(pank)$`log counts` <- as.numeric(logcounts(pank)["POMC",])
p <- make_escheR(pank,y_reverse=FALSE)
p <- p |> add_fill("log counts",size=0.2,point_size = 0.225)
pdf("manuscript_plots/Fig1/1K-X99_1225B_POMC.pdf",height=2,width=2)
p+
scale_fill_continuous("log\ncounts",low= "#FFFFFF",high="#000000")+
geom_path(data=dompoly,aes(x=xpol,y=ypol,group=dompol,col=dompol),linewidth = 0.25)+
scale_color_manual(values=pal,na.value = NA)+
ggtitle("*POMC*")+
guides(color="none")+
# labs(col="Xenium\nDomain")+
theme(plot.title.position = "plot",plot.title = element_markdown(size=9,hjust=0.5,margin=margin(0.12,0,-0.12,0,"in")),legend.text = element_text(size=7),legend.key.size = ggplot2::unit(0.125,"in"),legend.title=element_text(size=7.5,hjust=0.5),plot.margin = margin(-0.11,-0.4,-0.12,-0.4,unit = "in"),legend.margin=margin(0,-0.2,0,0,"in"),legend.background = element_blank(),legend.box = element_blank(),legend.key = element_blank())
dev.off()
rm(pank,p)
```
```{r}
sessionInfo()
sessioninfo::session_info()
```
R version 4.4.1 RC (2024-06-06 r86719)
Platform: aarch64-apple-darwin20
Running under: macOS Sonoma 14.5
Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/lib/libRlapack.dylib; LAPACK version 3.12.0
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
time zone: America/Chicago
tzcode source: internal
attached base packages:
[1] stats4 stats graphics grDevices utils datasets methods base
other attached packages:
[1] sf_1.0-16 colorout_1.3-0.2
[3] Polychrome_1.5.1 viridis_0.6.5
[5] viridisLite_0.4.2 escheR_1.4.0
[7] spatialLIBD_1.16.2 SpatialFeatureExperiment_1.6.1
[9] SpatialExperiment_1.14.0 SingleCellExperiment_1.26.0
[11] SummarizedExperiment_1.34.0 Biobase_2.64.0
[13] GenomicRanges_1.56.1 GenomeInfoDb_1.40.1
[15] IRanges_2.38.1 S4Vectors_0.42.1
[17] BiocGenerics_0.50.0 MatrixGenerics_1.16.0
[19] matrixStats_1.3.0 ggrastr_1.0.2
[21] ggtext_0.1.2 ggplot2_3.5.1
[23] data.table_1.15.4 rlang_1.1.4
loaded via a namespace (and not attached):
[1] later_1.3.2 BiocIO_1.14.0 fields_16.2
[4] bitops_1.0-7 filelock_1.0.3 tibble_3.2.1
[7] R.oo_1.26.0 XML_3.99-0.17 lifecycle_1.0.4
[10] edgeR_4.2.0 doParallel_1.0.17 rprojroot_2.0.4
[13] lattice_0.22-6 magrittr_2.0.3 sass_0.4.9
[16] limma_3.60.3 plotly_4.10.4 rmarkdown_2.27
[19] jquerylib_0.1.4 yaml_2.3.9 httpuv_1.6.15
[22] spam_2.10-0 sessioninfo_1.2.2 sp_2.1-4
[25] cowplot_1.1.3 DBI_1.2.3 RColorBrewer_1.1-3
[28] golem_0.4.1 maps_3.4.2 abind_1.4-5
[31] zlibbioc_1.50.0 purrr_1.0.2 R.utils_2.12.3
[34] RCurl_1.98-1.14 rappdirs_0.3.3 GenomeInfoDbData_1.2.12
[37] ggrepel_0.9.5 irlba_2.3.5.1 terra_1.7-78
[40] units_0.8-5 dqrng_0.4.1 commonmark_1.9.1
[43] DelayedMatrixStats_1.26.0 codetools_0.2-20 DropletUtils_1.24.0
[46] DelayedArray_0.30.1 DT_0.33 scuttle_1.14.0
[49] xml2_1.3.6 tidyselect_1.2.1 farver_2.1.2
[52] UCSC.utils_1.0.0 ScaledMatrix_1.12.0 shinyWidgets_0.8.6
[55] BiocFileCache_2.12.0 GenomicAlignments_1.40.0 jsonlite_1.8.8
[58] BiocNeighbors_1.22.0 e1071_1.7-14 scater_1.32.0
[61] iterators_1.0.14 foreach_1.5.2 tools_4.4.1
[64] Rcpp_1.0.13 glue_1.7.0 gridExtra_2.3
[67] SparseArray_1.4.8 xfun_0.45 here_1.0.1
[70] EBImage_4.46.0 dplyr_1.1.4 HDF5Array_1.32.0
[73] withr_3.0.0 BiocManager_1.30.23 fastmap_1.2.0
[76] boot_1.3-30 rhdf5filters_1.16.0 fansi_1.0.6
[79] spData_2.3.1 rsvd_1.0.5 digest_0.6.36
[82] R6_2.5.1 mime_0.12 colorspace_2.1-0
[85] wk_0.9.2 markdown_1.13 jpeg_0.1-10
[88] RSQLite_2.3.7 R.methodsS3_1.8.2 config_0.3.2
[91] utf8_1.2.4 tidyr_1.3.1 generics_0.1.3
[94] rtracklayer_1.64.0 class_7.3-22 httr_1.4.7
[97] htmlwidgets_1.6.4 S4Arrays_1.4.1 scatterplot3d_0.3-44
[100] spdep_1.3-5 pkgconfig_2.0.3 gtable_0.3.5
[103] blob_1.2.4 XVector_0.44.0 htmltools_0.5.8.1
[106] dotCall64_1.1-1 fftwtools_0.9-11 scales_1.3.0
[109] attempt_0.3.1 png_0.1-8 knitr_1.48
[112] rstudioapi_0.16.0 rjson_0.2.21 curl_5.2.1
[115] proxy_0.4-27 cachem_1.1.0 rhdf5_2.48.0
[118] stringr_1.5.1 BiocVersion_3.19.1 KernSmooth_2.23-24
[121] parallel_4.4.1 vipor_0.4.7 AnnotationDbi_1.66.0
[124] restfulr_0.0.15 s2_1.1.6 pillar_1.9.0
[127] grid_4.4.1 vctrs_0.6.5 promises_1.3.0
[130] BiocSingular_1.20.0 dbplyr_2.5.0 beachmat_2.20.0
[133] xtable_1.8-4 sfheaders_0.4.4 beeswarm_0.4.0
[136] paletteer_1.6.0 evaluate_0.24.0 zeallot_0.1.0
[139] magick_2.8.3 Rsamtools_2.20.0 cli_3.6.3
[142] locfit_1.5-9.10 compiler_4.4.1 crayon_1.5.3
[145] labeling_0.4.3 classInt_0.4-10 rematch2_2.1.2
[148] ggbeeswarm_0.7.2 stringi_1.8.4 deldir_2.0-4
[151] BiocParallel_1.38.0 munsell_0.5.1 Biostrings_2.72.1
[154] lazyeval_0.2.2 tiff_0.1-12 Matrix_1.7-0
[157] ExperimentHub_2.12.0 benchmarkme_1.0.8 sparseMatrixStats_1.16.0
[160] bit64_4.0.5 Rhdf5lib_1.26.0 KEGGREST_1.44.1
[163] statmod_1.5.0 shiny_1.8.1.1 AnnotationHub_3.12.0
[166] gridtext_0.1.5 memoise_2.0.1 bslib_0.7.0
[169] benchmarkmeData_1.0.4 bit_4.0.5
> sessioninfo::session_info()
─ Session info ──────────────────────────────────────────────────────────────────
setting value
version R version 4.4.1 RC (2024-06-06 r86719)
os macOS Sonoma 14.5
system aarch64, darwin20
ui RStudio
language (EN)
collate en_US.UTF-8
ctype en_US.UTF-8
tz America/Chicago
date 2024-10-25
rstudio 2024.07.0-daily+219 Cranberry Hibiscus (desktop)
pandoc 3.1.11 @ /Applications/RStudio.app/Contents/Resources/app/quarto/bin/tools/aarch64/ (via rmarkdown)
─ Packages ──────────────────────────────────────────────────────────────────────
! package * version date (UTC) lib source
abind 1.4-5 2016-07-21 [1] CRAN (R 4.4.0)
AnnotationDbi 1.66.0 2024-05-01 [1] Bioconductor 3.19 (R 4.4.0)
AnnotationHub 3.12.0 2024-04-30 [1] Bioconductor 3.19 (R 4.4.0)
attempt 0.3.1 2020-05-03 [1] CRAN (R 4.4.0)
beachmat 2.20.0 2024-05-06 [1] Bioconductor 3.19 (R 4.4.0)
beeswarm 0.4.0 2021-06-01 [1] CRAN (R 4.4.0)
benchmarkme 1.0.8 2022-06-12 [1] CRAN (R 4.4.0)
benchmarkmeData 1.0.4 2020-04-23 [1] CRAN (R 4.4.0)
Biobase * 2.64.0 2024-04-30 [1] Bioconductor 3.19 (R 4.4.1)
BiocFileCache 2.12.0 2024-04-30 [1] Bioconductor 3.19 (R 4.4.0)
BiocGenerics * 0.50.0 2024-04-30 [1] Bioconductor 3.19 (R 4.4.0)
BiocIO 1.14.0 2024-04-30 [1] Bioconductor 3.19 (R 4.4.0)
BiocManager 1.30.23 2024-05-04 [1] CRAN (R 4.4.0)
BiocNeighbors 1.22.0 2024-04-30 [1] Bioconductor 3.19 (R 4.4.0)
BiocParallel 1.38.0 2024-04-30 [1] Bioconductor 3.19 (R 4.4.0)
BiocSingular 1.20.0 2024-04-30 [1] Bioconductor 3.19 (R 4.4.0)
BiocVersion 3.19.1 2024-04-22 [1] Bioconductor 3.19 (R 4.4.0)
Biostrings 2.72.1 2024-06-02 [1] Bioconductor 3.19 (R 4.4.0)
bit 4.0.5 2022-11-15 [1] CRAN (R 4.4.0)
bit64 4.0.5 2020-08-30 [1] CRAN (R 4.4.0)
bitops 1.0-7 2021-04-24 [1] CRAN (R 4.4.0)
blob 1.2.4 2023-03-17 [1] CRAN (R 4.4.0)
boot 1.3-30 2024-02-26 [1] CRAN (R 4.4.1)
bslib 0.7.0 2024-03-29 [1] CRAN (R 4.4.0)
cachem 1.1.0 2024-05-16 [1] CRAN (R 4.4.0)
class 7.3-22 2023-05-03 [1] CRAN (R 4.4.1)
classInt 0.4-10 2023-09-05 [1] CRAN (R 4.4.0)
P cli 3.6.3 2024-06-21 [2] CRAN (R 4.4.0)
codetools 0.2-20 2024-03-31 [1] CRAN (R 4.4.1)
colorout * 1.3-0.2 2024-05-01 [1] Github (jalvesaq/colorout@c6113a2)
colorspace 2.1-0 2023-01-23 [1] CRAN (R 4.4.0)
commonmark 1.9.1 2024-01-30 [1] CRAN (R 4.4.0)
config 0.3.2 2023-08-30 [1] CRAN (R 4.4.0)
cowplot 1.1.3 2024-01-22 [1] CRAN (R 4.4.0)
crayon 1.5.3 2024-06-20 [1] CRAN (R 4.4.0)
curl 5.2.1 2024-03-01 [1] CRAN (R 4.4.0)
data.table * 1.15.4 2024-03-30 [2] CRAN (R 4.4.0)
DBI 1.2.3 2024-06-02 [1] CRAN (R 4.4.0)
dbplyr 2.5.0 2024-03-19 [1] CRAN (R 4.4.0)
DelayedArray 0.30.1 2024-05-07 [1] Bioconductor 3.19 (R 4.4.0)
DelayedMatrixStats 1.26.0 2024-04-30 [1] Bioconductor 3.19 (R 4.4.0)
deldir 2.0-4 2024-02-28 [1] CRAN (R 4.4.0)
digest 0.6.36 2024-06-23 [1] CRAN (R 4.4.0)
doParallel 1.0.17 2022-02-07 [1] CRAN (R 4.4.1)
dotCall64 1.1-1 2023-11-28 [1] CRAN (R 4.4.0)
dplyr 1.1.4 2023-11-17 [1] CRAN (R 4.4.0)
dqrng 0.4.1 2024-05-28 [1] CRAN (R 4.4.0)
DropletUtils 1.24.0 2024-04-30 [1] Bioconductor 3.19 (R 4.4.0)
DT 0.33 2024-04-04 [1] CRAN (R 4.4.0)
e1071 1.7-14 2023-12-06 [1] CRAN (R 4.4.0)
EBImage 4.46.0 2024-04-30 [1] Bioconductor 3.19 (R 4.4.0)
edgeR 4.2.0 2024-04-30 [1] Bioconductor 3.19 (R 4.4.0)
escheR * 1.4.0 2024-05-16 [1] Bioconductor 3.19 (R 4.4.0)
evaluate 0.24.0 2024-06-10 [1] CRAN (R 4.4.0)
ExperimentHub 2.12.0 2024-04-30 [1] Bioconductor 3.19 (R 4.4.0)
fansi 1.0.6 2023-12-08 [1] CRAN (R 4.4.0)
farver 2.1.2 2024-05-13 [1] CRAN (R 4.4.0)
fastmap 1.2.0 2024-05-15 [1] CRAN (R 4.4.0)
fftwtools 0.9-11 2021-03-01 [1] CRAN (R 4.4.0)
fields 16.2 2024-06-27 [1] CRAN (R 4.4.0)
filelock 1.0.3 2023-12-11 [1] CRAN (R 4.4.0)
foreach 1.5.2 2022-02-02 [1] CRAN (R 4.4.0)
generics 0.1.3 2022-07-05 [1] CRAN (R 4.4.0)
GenomeInfoDb * 1.40.1 2024-05-24 [1] Bioconductor 3.19 (R 4.4.0)
GenomeInfoDbData 1.2.12 2024-05-01 [1] Bioconductor
GenomicAlignments 1.40.0 2024-04-30 [1] Bioconductor 3.19 (R 4.4.0)
GenomicRanges * 1.56.1 2024-06-12 [1] Bioconductor 3.19 (R 4.4.1)
ggbeeswarm 0.7.2 2023-04-29 [1] CRAN (R 4.4.0)
ggplot2 * 3.5.1 2024-04-23 [1] CRAN (R 4.4.0)
ggrastr * 1.0.2 2023-06-01 [1] CRAN (R 4.4.0)
ggrepel 0.9.5 2024-01-10 [1] CRAN (R 4.4.0)
ggtext * 0.1.2 2022-09-16 [1] CRAN (R 4.4.0)
glue 1.7.0 2024-01-09 [1] CRAN (R 4.4.0)
golem 0.4.1 2023-06-05 [1] CRAN (R 4.4.0)
gridExtra 2.3 2017-09-09 [1] CRAN (R 4.4.0)
gridtext 0.1.5 2022-09-16 [1] CRAN (R 4.4.0)
gtable 0.3.5 2024-04-22 [1] CRAN (R 4.4.0)
HDF5Array 1.32.0 2024-04-30 [1] Bioconductor 3.19 (R 4.4.0)
here 1.0.1 2020-12-13 [1] CRAN (R 4.4.0)
htmltools 0.5.8.1 2024-04-04 [1] CRAN (R 4.4.0)
htmlwidgets 1.6.4 2023-12-06 [1] CRAN (R 4.4.0)
httpuv 1.6.15 2024-03-26 [1] CRAN (R 4.4.0)
httr 1.4.7 2023-08-15 [1] CRAN (R 4.4.0)
IRanges * 2.38.1 2024-07-03 [1] Bioconductor 3.19 (R 4.4.1)
irlba 2.3.5.1 2022-10-03 [1] CRAN (R 4.4.0)
iterators 1.0.14 2022-02-05 [1] CRAN (R 4.4.0)
jpeg 0.1-10 2022-11-29 [1] CRAN (R 4.4.0)
jquerylib 0.1.4 2021-04-26 [1] CRAN (R 4.4.0)
jsonlite 1.8.8 2023-12-04 [1] CRAN (R 4.4.0)
KEGGREST 1.44.1 2024-06-19 [1] Bioconductor 3.19 (R 4.4.0)
KernSmooth 2.23-24 2024-05-17 [1] CRAN (R 4.4.1)
knitr 1.48 2024-07-07 [1] CRAN (R 4.4.1)
labeling 0.4.3 2023-08-29 [1] CRAN (R 4.4.0)
later 1.3.2 2023-12-06 [1] CRAN (R 4.4.0)
lattice 0.22-6 2024-03-20 [1] CRAN (R 4.4.1)
lazyeval 0.2.2 2019-03-15 [1] CRAN (R 4.4.0)
lifecycle 1.0.4 2023-11-07 [1] CRAN (R 4.4.0)
limma 3.60.3 2024-06-16 [1] Bioconductor 3.19 (R 4.4.0)
locfit 1.5-9.10 2024-06-24 [1] CRAN (R 4.4.0)
magick 2.8.3 2024-02-18 [1] CRAN (R 4.4.0)
magrittr 2.0.3 2022-03-30 [1] CRAN (R 4.4.0)
maps 3.4.2 2023-12-15 [1] CRAN (R 4.4.0)
markdown 1.13 2024-06-04 [1] CRAN (R 4.4.0)
Matrix 1.7-0 2024-04-26 [1] CRAN (R 4.4.1)
MatrixGenerics * 1.16.0 2024-04-30 [1] Bioconductor 3.19 (R 4.4.0)
matrixStats * 1.3.0 2024-04-11 [1] CRAN (R 4.4.0)
memoise 2.0.1 2021-11-26 [1] CRAN (R 4.4.0)
mime 0.12 2021-09-28 [1] CRAN (R 4.4.0)
munsell 0.5.1 2024-04-01 [1] CRAN (R 4.4.0)
paletteer 1.6.0 2024-01-21 [1] CRAN (R 4.4.0)
pillar 1.9.0 2023-03-22 [1] CRAN (R 4.4.0)
pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 4.4.0)
plotly 4.10.4 2024-01-13 [1] CRAN (R 4.4.0)
png 0.1-8 2022-11-29 [1] CRAN (R 4.4.0)
Polychrome * 1.5.1 2022-05-03 [1] CRAN (R 4.4.0)
promises 1.3.0 2024-04-05 [1] CRAN (R 4.4.0)
proxy 0.4-27 2022-06-09 [1] CRAN (R 4.4.0)
purrr 1.0.2 2023-08-10 [1] CRAN (R 4.4.0)
R.methodsS3 1.8.2 2022-06-13 [1] CRAN (R 4.4.0)
R.oo 1.26.0 2024-01-24 [1] CRAN (R 4.4.0)
R.utils 2.12.3 2023-11-18 [1] CRAN (R 4.4.0)
R6 2.5.1 2021-08-19 [1] CRAN (R 4.4.0)
rappdirs 0.3.3 2021-01-31 [1] CRAN (R 4.4.0)
RColorBrewer 1.1-3 2022-04-03 [1] CRAN (R 4.4.0)
Rcpp 1.0.13 2024-07-17 [1] CRAN (R 4.4.0)
RCurl 1.98-1.14 2024-01-09 [1] CRAN (R 4.4.0)
rematch2 2.1.2 2020-05-01 [1] CRAN (R 4.4.0)
restfulr 0.0.15 2022-06-16 [1] CRAN (R 4.4.0)
rhdf5 2.48.0 2024-04-30 [1] Bioconductor 3.19 (R 4.4.0)
rhdf5filters 1.16.0 2024-04-30 [1] Bioconductor 3.19 (R 4.4.0)
Rhdf5lib 1.26.0 2024-04-30 [1] Bioconductor 3.19 (R 4.4.0)
rjson 0.2.21 2022-01-09 [1] CRAN (R 4.4.0)
P rlang * 1.1.4 2024-06-04 [2] CRAN (R 4.4.1)
rmarkdown 2.27 2024-05-17 [1] CRAN (R 4.4.0)
rprojroot 2.0.4 2023-11-05 [1] CRAN (R 4.4.0)
Rsamtools 2.20.0 2024-04-30 [1] Bioconductor 3.19 (R 4.4.0)
RSQLite 2.3.7 2024-05-27 [1] CRAN (R 4.4.0)
rstudioapi 0.16.0 2024-03-24 [1] CRAN (R 4.4.0)
rsvd 1.0.5 2021-04-16 [1] CRAN (R 4.4.0)
rtracklayer 1.64.0 2024-05-06 [1] Bioconductor 3.19 (R 4.4.0)
s2 1.1.6 2023-12-19 [1] CRAN (R 4.4.0)
S4Arrays 1.4.1 2024-05-20 [1] Bioconductor 3.19 (R 4.4.0)
S4Vectors * 0.42.1 2024-07-03 [1] Bioconductor 3.19 (R 4.4.1)
sass 0.4.9 2024-03-15 [1] CRAN (R 4.4.0)
ScaledMatrix 1.12.0 2024-04-30 [1] Bioconductor 3.19 (R 4.4.0)
scales 1.3.0 2023-11-28 [1] CRAN (R 4.4.0)
scater 1.32.0 2024-04-30 [1] Bioconductor 3.19 (R 4.4.0)
scatterplot3d 0.3-44 2023-05-05 [1] CRAN (R 4.4.0)
scuttle 1.14.0 2024-04-30 [1] Bioconductor 3.19 (R 4.4.0)
sessioninfo 1.2.2 2021-12-06 [1] CRAN (R 4.4.0)
sf * 1.0-16 2024-03-24 [1] CRAN (R 4.4.0)
sfheaders 0.4.4 2024-01-17 [1] CRAN (R 4.4.0)
shiny 1.8.1.1 2024-04-02 [1] CRAN (R 4.4.0)
shinyWidgets 0.8.6 2024-04-24 [1] CRAN (R 4.4.0)
SingleCellExperiment * 1.26.0 2024-04-30 [1] Bioconductor 3.19 (R 4.4.0)
sp 2.1-4 2024-04-30 [1] CRAN (R 4.4.0)
spam 2.10-0 2023-10-23 [1] CRAN (R 4.4.0)
SparseArray 1.4.8 2024-05-30 [1] Bioconductor 3.19 (R 4.4.0)
sparseMatrixStats 1.16.0 2024-04-30 [1] Bioconductor 3.19 (R 4.4.0)
SpatialExperiment * 1.14.0 2024-04-30 [1] Bioconductor 3.19 (R 4.4.0)
SpatialFeatureExperiment * 1.6.1 2024-05-15 [1] Bioconductor 3.19 (R 4.4.0)
spatialLIBD * 1.16.2 2024-05-28 [1] Bioconductor 3.19 (R 4.4.0)
spData 2.3.1 2024-05-31 [1] CRAN (R 4.4.0)
spdep 1.3-5 2024-06-10 [1] CRAN (R 4.4.0)
statmod 1.5.0 2023-01-06 [1] CRAN (R 4.4.0)
stringi 1.8.4 2024-05-06 [1] CRAN (R 4.4.0)
stringr 1.5.1 2023-11-14 [1] CRAN (R 4.4.0)
SummarizedExperiment * 1.34.0 2024-04-30 [1] Bioconductor 3.19 (R 4.4.0)
terra 1.7-78 2024-05-22 [1] CRAN (R 4.4.0)
tibble 3.2.1 2023-03-20 [1] CRAN (R 4.4.0)
tidyr 1.3.1 2024-01-24 [1] CRAN (R 4.4.0)
tidyselect 1.2.1 2024-03-11 [1] CRAN (R 4.4.0)
tiff 0.1-12 2023-11-28 [1] CRAN (R 4.4.0)
UCSC.utils 1.0.0 2024-05-06 [1] Bioconductor 3.19 (R 4.4.0)
units 0.8-5 2023-11-28 [1] CRAN (R 4.4.0)
utf8 1.2.4 2023-10-22 [1] CRAN (R 4.4.0)
vctrs 0.6.5 2023-12-01 [1] CRAN (R 4.4.0)
vipor 0.4.7 2023-12-18 [1] CRAN (R 4.4.0)
viridis * 0.6.5 2024-01-29 [1] CRAN (R 4.4.0)
viridisLite * 0.4.2 2023-05-02 [1] CRAN (R 4.4.0)
withr 3.0.0 2024-01-16 [1] CRAN (R 4.4.0)
wk 0.9.2 2024-07-09 [1] CRAN (R 4.4.0)
xfun 0.45 2024-06-16 [1] CRAN (R 4.4.0)
XML 3.99-0.17 2024-06-25 [1] CRAN (R 4.3.3)
xml2 1.3.6 2023-12-04 [1] CRAN (R 4.4.0)
xtable 1.8-4 2019-04-21 [1] CRAN (R 4.4.0)
XVector 0.44.0 2024-04-30 [1] Bioconductor 3.19 (R 4.4.0)
yaml 2.3.9 2024-07-05 [1] CRAN (R 4.4.0)
zeallot 0.1.0 2018-01-28 [1] CRAN (R 4.4.0)
zlibbioc 1.50.0 2024-04-30 [1] Bioconductor 3.19 (R 4.4.0)
[1] /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/library
[2] /Users/bmulvey/Library/R/arm64/4.4/library
P ── Loaded and on-disk path mismatch.
─────────────────────────────────────────────────────────────────────────────────