-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy paththe_script_display_figures.R
1357 lines (1090 loc) · 127 KB
/
the_script_display_figures.R
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
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
# # module load r/4.0
# R
# # the_script_MASTER_SCRIPT_21nov2021.R
#####################################################################################################################################
#####################################################################################################################################
#####################################################################################################################################
#####################################################################################################################################
#####################################################################################################################################
#####################################################################################################################################
set.seed(423)
library(Cairo)
options(bitmapType='cairo')
library(sf)
library(rgl)
library(patchwork)
library(monocle3)
library(plotly)
library(ggplot2)
library(dplyr)
library(edgeR)
library(Seurat)
library(SeuratData)
library(SeuratWrappers)
library(conos)
library(liger)
library(harmony)
library(cowplot)
library(Matrix)
library(gridExtra)
library(stringr)
library(magrittr)
library(dplyr)
library(purrr)
library(future)
library(future.apply)
library(data.table)
# library(vroom)
# library(tidyverse)
library(stringr)
library(magrittr)
library(dplyr)
library(purrr)
plan("multiprocess", workers = 8)
options(future.globals.maxSize = 64000 * 1024^2)
#####################################################################################################################################
#####################################################################################################################################
#####################################################################################################################################
#####################################################################################################################################
#####################################################################################################################################
#####################################################################################################################################
#####################################################################################################################################
#####################################################################################################################################
#####################################################################################################################################
#####################################################################################################################################
#####################################################################################################################################
#####################################################################################################################################
load("integrated.reciprocalPCA.SEURAT3_RPCA_filter600.RData.after.ScaleData.for.figs.RData.after.ScaleData.with.fig3A.RData")
NAME="FIGURES"
write.table(as.data.frame([email protected]),
file=paste(NAME, "META.DATA", "in.assay.RNA.at.the.begining.SCRIPT.txt", sep="."),
sep="\t", quote=FALSE, col.names = TRUE, row.names = TRUE)
#####################################################################################################################################
#####################################################################################################################################
#####################################################################################################################################
#####################################################################################################################################
##################################################################################################################################### COLORS depending on the number of SAMPLES
#####################################################################################################################################
COLOR_PALETTE = c("red", "orange", "yellow", "lime", "green", "cyan", "blue", "purple", "magenta", "brown")
#####################################################################################################################################
#####################################################################################################################################
#####################################################################################################################################
#####################################################################################################################################
#####################################################################################################################################
#####################################################################################################################################
#####################################################################################################################################
#####################################################################################################################################
#####################################################################################################################################
#####################################################################################################################################
#####################################################################################################################################
#####################################################################################################################################
[email protected]$disease = unlist(lapply(strsplit(as.character([email protected]$orig.ident), "\\."), '[[', 1))
[email protected]$phenotype = as.character(map(strsplit([email protected]$orig.ident, split = "\\."), 1))
#####################################################################################################################################
#####################################################################################################################################
##################################################################################################################################### THE FIGURE 1A :
# Visualization using TSNE :
p1 <- DimPlot(samples.combined.list.combined, reduction = "tsne", group.by = "disease", label = FALSE)
p2 <- DimPlot(samples.combined.list.combined, reduction = "tsne", label = FALSE)
plot_grid(p1, p2)
ggsave(paste("figure1A.newDim.Plot", "assay.INTEGRATED.display.TSNE.v3", "png", sep="."), width = 40, height = 20, units = "cm")
##################################################################################
# Visualization using UMAP :
p1 <- DimPlot(samples.combined.list.combined, reduction = "umap", group.by = "disease", label = FALSE)
p2 <- DimPlot(samples.combined.list.combined, reduction = "umap", label = FALSE)
plot_grid(p1, p2)
ggsave(paste("figure1A.newDim.Plot", "assay.INTEGRATED.display.UMAP.v3", "png", sep="."), width = 40, height = 20, units = "cm")
##################################################################################
################################################################################## also on Figure 1A, just to dissociate the plots :::
##################################################################################
##################################################################################
# Visualization using TSNE :
p1 <- DimPlot(samples.combined.list.combined, reduction = "tsne", group.by = "disease", label = FALSE)
plot_grid(p1)
ggsave(paste("figure1A.newDim.Plot", "assay.INTEGRATED.display.TSNE.v4.part1", "png", sep="."), width = 20, height = 20, units = "cm")
# Visualization using TSNE :
p2 <- DimPlot(samples.combined.list.combined, reduction = "tsne", label = FALSE)
plot_grid(p2)
ggsave(paste("figure1A.newDim.Plot", "assay.INTEGRATED.display.TSNE.v4.part2", "png", sep="."), width = 20, height = 20, units = "cm")
##################################################################################
##################################################################################
# Visualization using UMAP :
p1 <- DimPlot(samples.combined.list.combined, reduction = "umap", group.by = "disease", label = FALSE)
plot_grid(p1)
ggsave(paste("figure1A.newDim.Plot", "assay.INTEGRATED.display.UMAP.v4.part1", "png", sep="."), width = 20, height = 20, units = "cm")
# Visualization using UMAP :
p2 <- DimPlot(samples.combined.list.combined, reduction = "umap", label = FALSE)
plot_grid(p2)
ggsave(paste("figure1A.newDim.Plot", "assay.INTEGRATED.display.UMAP.v4.part2", "png", sep="."), width = 20, height = 20, units = "cm")
#####################################################################################################################################
#####################################################################################################################################
#####################################################################################################################################
#####################################################################################################################################
#####################################################################################################################################
#####################################################################################################################################
#####################################################################################################################################
# Visualization using TSNE :
p1 <- DimPlot(samples.combined.list.combined, reduction = "tsne", group.by = "disease", label = FALSE)
p2 <- DimPlot(samples.combined.list.combined, reduction = "tsne", group.by = "seurat_clusters", label = TRUE)
plot_grid(p1, p2)
ggsave(paste("figure1Aa.newDim.Plot", "assay.INTEGRATED.display.TSNE.v5", "png", sep="."), width = 40, height = 20, units = "cm")
##################################################################################
# Visualization using UMAP :
p1 <- DimPlot(samples.combined.list.combined, reduction = "umap", group.by = "disease", label = FALSE)
p2 <- DimPlot(samples.combined.list.combined, reduction = "umap", group.by = "seurat_clusters", label = TRUE)
plot_grid(p1, p2)
ggsave(paste("figure1Aa.newDim.Plot", "assay.INTEGRATED.display.UMAP.v5", "png", sep="."), width = 40, height = 20, units = "cm")
##################################################################################
################################################################################## also on Figure 1A, just to dissociate the plots :::
##################################################################################
##################################################################################
# Visualization using TSNE :
p1 <- DimPlot(samples.combined.list.combined, reduction = "tsne", group.by = "disease", label = FALSE)
plot_grid(p1)
ggsave(paste("figure1Aa.newDim.Plot", "assay.INTEGRATED.display.TSNE.v5.part1", "png", sep="."), width = 20, height = 20, units = "cm")
# Visualization using TSNE :
p2 <- DimPlot(samples.combined.list.combined, reduction = "tsne", group.by = "seurat_clusters", label = TRUE)
plot_grid(p2)
ggsave(paste("figure1Aa.newDim.Plot", "assay.INTEGRATED.display.TSNE.v5.part2", "png", sep="."), width = 20, height = 20, units = "cm")
# Visualization using TSNE :
p3 <- DimPlot(samples.combined.list.combined, reduction = "tsne", group.by = "orig.ident", label = FALSE)
plot_grid(p3)
ggsave(paste("figure1Aa.newDim.Plot", "assay.INTEGRATED.display.TSNE.v5.part3", "png", sep="."), width = 20, height = 20, units = "cm")
##################################################################################
##################################################################################
# Visualization using UMAP :
p1 <- DimPlot(samples.combined.list.combined, reduction = "umap", group.by = "disease", label = FALSE)
plot_grid(p1)
ggsave(paste("figure1Aa.newDim.Plot", "assay.INTEGRATED.display.UMAP.v5.part1", "png", sep="."), width = 20, height = 20, units = "cm")
# Visualization using UMAP :
p2 <- DimPlot(samples.combined.list.combined, reduction = "umap", group.by = "seurat_clusters", label = TRUE)
plot_grid(p2)
ggsave(paste("figure1Aa.newDim.Plot", "assay.INTEGRATED.display.UMAP.v5.part2", "png", sep="."), width = 20, height = 20, units = "cm")
# Visualization using UMAP :
p3 <- DimPlot(samples.combined.list.combined, reduction = "umap", group.by = "orig.ident", label = FALSE)
plot_grid(p3)
ggsave(paste("figure1Aa.newDim.Plot", "assay.INTEGRATED.display.UMAP.v5.part3", "png", sep="."), width = 20, height = 20, units = "cm")
#####################################################################################################################################
#####################################################################################################################################
#####################################################################################################################################
#####################################################################################################################################
##################################################################################################################################### THE FIGURE 1B : adding the CLUSTER NUMBER :
#####################################################################################################################################
#####################################################################################################################################
##################################################################################################################################### adding the CLUSTER NUMBER :
#####################################################################################################################################
##################################################################################################################################### THE FIGURE 1B :
# Visualization using TSNE :
# p1 <- DimPlot(samples.combined.list.combined, reduction = "tsne", group.by = "celltype", label = TRUE, label.size = 3)
# p2 <- DimPlot(samples.combined.list.combined, reduction = "tsne", label = TRUE, label.size = 3)
# plot_grid(p1, p2)
# ggsave(paste("figure1B.Dim.Plot", "assay.INTEGRATED.display.TSNE.v6", "png", sep="."), width = 40, height = 20, units = "cm")
##################################################################################
# Visualization using UMAP :
# p1 <- DimPlot(samples.combined.list.combined, reduction = "umap", group.by = "celltype", label = TRUE, label.size = 3)
# p2 <- DimPlot(samples.combined.list.combined, reduction = "umap", label = TRUE, label.size = 3)
# plot_grid(p1, p2)
# ggsave(paste("figure1B.Dim.Plot", "assay.INTEGRATED.display.UMAP.v6", "png", sep="."), width = 40, height = 20, units = "cm")
##################################################################################
################################################################################## also on Figure 1A, just to dissociate the plots :::
##################################################################################
##################################################################################
# Visualization using TSNE :
# p1 <- DimPlot(samples.combined.list.combined, reduction = "tsne", group.by = "celltype", label = TRUE, label.size = 3)
# plot_grid(p1)
# ggsave(paste("figure1B.Dim.Plot", "assay.INTEGRATED.display.TSNE.v6.part1", "png", sep="."), width = 20, height = 20, units = "cm")
# Visualization using TSNE :
# p2 <- DimPlot(samples.combined.list.combined, reduction = "tsne", label = TRUE, label.size = 3)
# plot_grid(p2)
# ggsave(paste("figure1B.Dim.Plot", "assay.INTEGRATED.display.TSNE.v6.part2", "png", sep="."), width = 20, height = 20, units = "cm")
##################################################################################
##################################################################################
# Visualization using UMAP :
# p1 <- DimPlot(samples.combined.list.combined, reduction = "umap", group.by = "celltype", label = TRUE, label.size = 3)
# plot_grid(p1)
# ggsave(paste("figure1B.Dim.Plot", "assay.INTEGRATED.display.UMAP.v6.part1", "png", sep="."), width = 20, height = 20, units = "cm")
# Visualization using UMAP :
# p2 <- DimPlot(samples.combined.list.combined, reduction = "umap", label = TRUE, label.size = 3)
# plot_grid(p2)
# ggsave(paste("figure1B.Dim.Plot", "assay.INTEGRATED.display.UMAP.v6.part2", "png", sep="."), width = 20, height = 20, units = "cm")
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
#####################################################################################################################################
##################################################################################################################################### displaying the cell type specific markers
##################################################################################################################################### CELL TYPE SPECIFIC MARKERS
#####################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
#########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
### in order to print the CELL TYPE and to combine with the ANNOTATIONS from SUI
### the LIST of MARKERS shall be already present in the RDATA OBJECT :)
the.meta.data = as.data.frame([email protected])
the.meta.data$CELL_ID = rownames(the.meta.data)
ANNOTATED.CELL.TYPES = read.delim("a.LIST.MARKERS.RETINA.mouse.12feb2021.txt.associated.CELL.TYPES.12may2021.txt", header=T, sep="\t", stringsAsFactors=F)
### and to integrate THESE FILES :
the.meta.data.and.ANNOTATED.CELL.TYPES = merge(the.meta.data,
ANNOTATED.CELL.TYPES,
by.x = "celltype",
by.y = "CLUSTER")
row.names(the.meta.data.and.ANNOTATED.CELL.TYPES) = the.meta.data.and.ANNOTATED.CELL.TYPES$CELL_ID
[email protected] = the.meta.data.and.ANNOTATED.CELL.TYPES
head([email protected])
tail([email protected])
table([email protected]$CELL.y)
# AC ASTROCYTES BP CONE MG Nann RGC
# 24096 303 41619 1561 3888 683 1549
# ROD VC
# 25601 392
##################################################################################################################################################################
##################################################################################################################################################################
##################################################################################################################################################################
################################################################################ and displaying based on the CELL TYPE :
################################################################################
##################################################################################################################################################################
##################################################################################################################################################################
##################################################################################################################################################################
SET_7_COLORS = c("red", "black", "darkgreen", "yellow", "blue", "grey", "purple", "pink", "darkorange")
# Visualization using TSNE :
p1 <- DimPlot(samples.combined.list.combined, reduction = "tsne", group.by = "CELL.y", label = TRUE, label.size = 3, cols = SET_7_COLORS)
p2 <- DimPlot(samples.combined.list.combined, reduction = "tsne", group.by = "disease", label = TRUE, label.size = 3)
plot_grid(p1, p2)
ggsave(paste("figure1Bb.Dim.Plot", "assay.INTEGRATED.display.TSNE.v6", "png", sep="."), width = 40, height = 20, units = "cm")
##################################################################################
# Visualization using UMAP :
p1 <- DimPlot(samples.combined.list.combined, reduction = "umap", group.by = "CELL.y", label = TRUE, label.size = 3, cols = SET_7_COLORS)
p2 <- DimPlot(samples.combined.list.combined, reduction = "umap", group.by = "disease", label = TRUE, label.size = 3)
plot_grid(p1, p2)
ggsave(paste("figure1Bb.Dim.Plot", "assay.INTEGRATED.display.UMAP.v6", "png", sep="."), width = 40, height = 20, units = "cm")
##################################################################################
################################################################################## also on Figure 1A, just to dissociate the plots :::
##################################################################################
##################################################################################
# Visualization using TSNE :
p1 <- DimPlot(samples.combined.list.combined, reduction = "tsne", group.by = "CELL.y", label = TRUE, label.size = 3, cols = SET_7_COLORS)
plot_grid(p1)
ggsave(paste("figure1Bb.Dim.Plot", "assay.INTEGRATED.display.TSNE.v6.part1", "png", sep="."), width = 20, height = 20, units = "cm")
# Visualization using TSNE :
p2 <- DimPlot(samples.combined.list.combined, reduction = "tsne", group.by ="orig.ident", label = TRUE, label.size = 3)
plot_grid(p2)
ggsave(paste("figure1Bb.Dim.Plot", "assay.INTEGRATED.display.TSNE.v6.part2", "png", sep="."), width = 20, height = 20, units = "cm")
##################################################################################
##################################################################################
# Visualization using UMAP :
p1 <- DimPlot(samples.combined.list.combined, reduction = "umap", group.by = "CELL.y", label = TRUE, label.size = 3, cols = SET_7_COLORS)
plot_grid(p1)
ggsave(paste("figure1Bb.Dim.Plot", "assay.INTEGRATED.display.UMAP.v6.part1", "png", sep="."), width = 20, height = 20, units = "cm")
# Visualization using UMAP :
p2 <- DimPlot(samples.combined.list.combined, reduction = "umap", group.by ="orig.ident", label = TRUE, label.size = 3)
plot_grid(p2)
ggsave(paste("figure1Bb.Dim.Plot", "assay.INTEGRATED.display.UMAP.v6.part2", "png", sep="."), width = 20, height = 20, units = "cm")
##################################################################################
##################################################################################
# Visualization using TSNE :
p1 <- DimPlot(samples.combined.list.combined, reduction = "tsne", group.by = "CELL.y", label = TRUE, label.size = 3, cols = SET_7_COLORS)
p2 <- DimPlot(samples.combined.list.combined, reduction = "tsne", group.by = "seurat_clusters", label = TRUE, label.size = 3)
plot_grid(p1, p2)
ggsave(paste("figure1Bb.Dim.Plot", "assay.INTEGRATED.display.TSNE.v6.part3", "png", sep="."), width = 40, height = 20, units = "cm")
##################################################################################
# Visualization using UMAP :
p1 <- DimPlot(samples.combined.list.combined, reduction = "umap", group.by = "CELL.y", label = TRUE, label.size = 3, cols = SET_7_COLORS)
p2 <- DimPlot(samples.combined.list.combined, reduction = "umap", group.by = "seurat_clusters", label = TRUE, label.size = 3)
plot_grid(p1, p2)
ggsave(paste("figure1Bb.Dim.Plot", "assay.INTEGRATED.display.UMAP.v6.part3", "png", sep="."), width = 40, height = 20, units = "cm")
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
#########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
#########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##############################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
#########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
# LIST.MARKERS.ordered = read.delim("a.LIST.MARKERS.RETINA.mouse.12feb2021.txt.ordered.CELL.TYPES.txt", header=T, sep="\t", stringsAsFactors=F) ### to read the LIST of OREDERED MARKERS, as Sui suggested.
# LIST.MARKERS.ordered.LIST = LIST.MARKERS.ordered$MARKER
# rownames(LIST.MARKERS.ordered) = LIST.MARKERS.ordered$MARKER
########################################################################################################################
########################################################################################################################
################################################################################ DOT PLOT :
# Idents(samples.combined.list.combined) <- "CELL" ####### to LABEL the CLUSTERS :)
# DotPlot(samples.combined.list.combined, features = LIST.MARKERS.ordered$MARKER)
# ggsave(paste("figure1C.test.DOT.Plot", "by.CELL", "png", sep="."), width = 40, height = 30, units = "cm")
# DotPlot(samples.combined.list.combined, features = LIST.MARKERS.ordered$MARKER) + RotatedAxis()
# ggsave(paste("figure1C.test.DOT.Plot", "by.CELL.rotate.axis", "png", sep="."), width = 40, height = 30, units = "cm")
########################################
########################################################################################################################
################################################################################ DOT PLOT :
# Idents(samples.combined.list.combined) <- "integrated_snn_res.0.4" ####### to LABEL the CLUSTERS :)
# DotPlot(samples.combined.list.combined, features = LIST.MARKERS.ordered$MARKER)
# ggsave(paste("figure1C.test.DOT.Plot", "by.CLUSTER.assay.INTEGRATED.v2", "png", sep="."), width = 40, height = 30, units = "cm")
# DotPlot(samples.combined.list.combined, features = LIST.MARKERS.ordered$MARKER) + RotatedAxis()
# ggsave(paste("figure1C.test.DOT.Plot", "by.CLUSTER.assay.INTEGRATED.v2.rotate.axis", "png", sep="."), width = 30, height = 40, units = "cm")
##########################################################################################################################################
##########################################################################################################################################
################################################################################
################################################################################
################################################################################ for the HEATMAP, to SCALE AGAIN the MATRIX ...
##########################################################################################################################################
############################################################################################### shall we use : samples.combined.list.combined
##############the another way to display the HEATMAPS would be to extract MATRIX for each CLUSTER, and to compute the RAW SUMS
Idents(samples.combined.list.combined) <- "integrated_snn_res.0.4"
# table(Idents(samples.combined.list.combined))
# 0 1 2 3 4 5 6 7 8 9 10 11 12
# 25601 18975 4902 3888 3424 3304 2626 1816 1710 1699 1592 1561 1549
# 13 14 15 16 17 18 19 20 21 22 23 24 25
# 1400 1290 1239 1207 1167 1072 1048 1047 1026 1014 989 944 928
# 26 27 28 29 30 31 32 33 34 35 36 37 38
# 879 836 803 796 785 781 763 690 650 646 621 414 400
# 39 40 41 42 43 44 45 46 47 48 49 50 51
# 392 387 385 333 318 303 294 292 251 164 141 140 134
# 52 53
# 43 33
the_CLUSTERS = unique([email protected]$seurat_clusters)
# [1] 0 1 10 11 12 13 14 15 16 17 18 19 2 20 21 22 23 24 25 26 27 28 29 3 30
# [26] 31 32 33 34 35 36 37 38 39 4 40 41 42 43 44 45 46 47 48 49 5 50 51 52 53
# [51] 6 7 8 9
length(the_CLUSTERS)
# [1] 54
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
#########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
Idents(samples.combined.list.combined) <- "seurat_clusters"
levels(samples.combined.list.combined)
cluster.averages.CLUSTER.SEURAT <- AverageExpression(samples.combined.list.combined, slot = "data", group.by = "seurat_clusters" , return.seurat = TRUE) ### CLUSTER AVERAGES is made as a SEURAT OBJECT
write.table(as.data.frame(cluster.averages.CLUSTER.SEURAT@assays$RNA@counts), file="samples.combined.list.combined.cluster.averages.CLUSTER.SEURAT.return.object.txt", sep="\t",
quote=F, col.names=T, row.names=T)
# cluster.averages.CLUSTER <- AverageExpression(samples.combined.list.combined, slot = "data", group.by = "seurat_clusters" , return.seurat = FALSE)
# head(cluster.averages.CLUSTER$RNA)
# write.table(as.data.frame(cluster.averages.CLUSTER$RNA),
# file="samples.combined.list.combined.cluster.averages.CLUSTER.txt", sep="\t",
# quote=F, col.names=T, row.names=T)
################################################################################################################################
################################################################################################################################
################################################################################################################################
################################################################################################################################ row.names([email protected])
[email protected]$CLUSTER = row.names([email protected])
DoHeatmap(cluster.averages.CLUSTER.SEURAT,
features = LIST.MARKERS.ordered$MARKER,
# group.by = [email protected]$CLUSTER,
group.by = "CLUSTER",
slot = "scale.data",
size = 4.5,
hjust = 0,
angle = 90,
label = TRUE , draw.lines = FALSE) +
scale_fill_gradientn(colors = rev(RColorBrewer::brewer.pal(n =4, name = "RdBu")))
ggsave(paste("figure1C.test.HEATMAP", "by.CLUSTER.AVERAGE.CLUSTER.SEURAT.with.Seurat.DoHeatMap.v3", "png", sep="."), width = 40, height = 20, units = "cm")
################################################################################################################################
################################################################################################################################
################################################################################################################################
################################################################################################################################ how to group the DATA based on CLUSTERS
my_levels = as.numeric([email protected]$CLUSTER)
levels(cluster.averages.CLUSTER.SEURAT) = my_levels
DoHeatmap(cluster.averages.CLUSTER.SEURAT,
features = LIST.MARKERS.ordered$MARKER,
# group.by = [email protected]$CLUSTER,
group.by = "CELL.y",
slot = "scale.data",
size = 4.5,
hjust = 0,
angle = 90,
label = TRUE , draw.lines = FALSE) +
scale_fill_gradientn(colors = rev(RColorBrewer::brewer.pal(n =4, name = "RdBu")))
ggsave(paste("figure1C.test.HEATMAP", "by.CLUSTER.AVERAGE.CLUSTER.SEURAT.with.Seurat.DoHeatMap.v4", "png", sep="."), width = 40, height = 20, units = "cm")
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
#########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
CLUSTER.AVERAGED.as.DF = as.data.frame(cluster.averages.CLUSTER.SEURAT@assays$RNA@counts)
dim( CLUSTER.AVERAGED.as.DF) # [1] 25399
######################################################################################################################
######################################################################################################################
######################################################################################################################
CLUSTER.AVERAGED.as.DF$gene = rownames(CLUSTER.AVERAGED.as.DF)
CLUSTER.AVERAGED.as.DF.SUBSET = CLUSTER.AVERAGED.as.DF[CLUSTER.AVERAGED.as.DF$gene %in% LIST.MARKERS.ordered$MARKER, ]
CLUSTER.AVERAGED.as.DF.SUBSET2 = subset(CLUSTER.AVERAGED.as.DF.SUBSET, select = -c(gene))
write.table(CLUSTER.AVERAGED.as.DF.SUBSET2, file = "CLUSTER.AVERAGED.as.DF.SUBSET2.MATRIX.with.KNOWN.MARKERS.txt",
quote = FALSE, sep = "\t", row.names = TRUE, col.names = TRUE)
######################################################################################################################
###################################################################################################################### as.matrix(cluster.averages@assays$RNA@data)
######################################################################################################################
CLUSTER.AVERAGED.as.DF.SUBSET2 = as.matrix(CLUSTER.AVERAGED.as.DF.SUBSET2)
######################################################################################################################
################################################################################ in order to start setting up the HEATMAPS
################################################################################ to display in a new version the CONSERVED MARKERS
######################################################################################################################
# source("the_script_display_FIGURES_making_HEATMAPS_for_KNOWN_MARKERS.R")
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
library(gplots)
library(pheatmap)
library(RColorBrewer)
col <- colorRampPalette(c("blue", "red"))(100)
# pheatmap(mat, color = colorRampPalette(rev(brewer.pal(n = 10, name ="RdYlBu")))(100))
# pheatmap(mat, color = colorRampPalette(brewer.pal(n = 10, name ="RdBu"))(100))
png(paste("figure1C.test.HEATMAP", "by.CLUSTER.AVERAGE", "KNOWN.MARKERS", "with.pheatmap.v2", "png", sep="."),
width = 3200, # 5 x 300 pixels
height = 1600,
res = 300, # 300 pixels per inch
pointsize = 8)
pheatmap(CLUSTER.AVERAGED.as.DF.SUBSET2,
color = colorRampPalette(brewer.pal(n = 10, name ="RdYlBu"))(100),
kmeans_k = NA,
breaks = NA,
border_color = "grey60",
cellwidth = 11,
cellheight = 11,
scale = "row",
angle_col = c("270", "0", "45", "90", "315"),
cluster_rows = TRUE,
cluster_cols = TRUE,
show_rownames = T,
show_colnames = T,
main = "",
fontsize = 10,
# clustering_distance_cols = "euclidean",
# clustering_distance_rows = "euclidean",
# clustering_method = "complete",
clustering_distance_rows = "manhattan",
clustering_method = "centroid",
)
dev.off()
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
#########################################################################################################################################################################################################################################################################
library(gplots)
library(pheatmap)
library(RColorBrewer)
col <- colorRampPalette(c("blue", "red"))(100)
# pheatmap(mat, color = colorRampPalette(rev(brewer.pal(n = 10, name ="RdYlBu")))(100))
# pheatmap(mat, color = colorRampPalette(brewer.pal(n = 10, name ="RdBu"))(100))
png(paste("figure1C.HEATMAP", "by.CLUSTER.AVERAGE", "KNOWN.MARKERS", "with.pheatmap.v2.UNCLUSTERED", "png", sep="."),
width = 3200, # 5 x 300 pixels
height = 1600,
res = 300, # 300 pixels per inch
pointsize = 8)
pheatmap(CLUSTER.AVERAGED.as.DF.SUBSET2,
color = colorRampPalette(brewer.pal(n = 10, name ="RdYlBu"))(100),
kmeans_k = NA,
breaks = NA,
border_color = "grey60",
cellwidth = 11,
cellheight = 11,
scale = "row",
angle_col = c("270", "0", "45", "90", "315"),
cluster_rows = FALSE,
cluster_cols = FALSE,
show_rownames = T,
show_colnames = T,
main = "",
fontsize = 10,
# clustering_distance_cols = "euclidean",
# clustering_distance_rows = "euclidean",
# clustering_method = "complete",
clustering_distance_rows = "manhattan",
clustering_method = "centroid",
)
dev.off()
##########################################################################################################################################################################################################################################################################
##################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
# AverageExpression(
# object,
# assays = NULL,
# features = NULL,
# return.seurat = FALSE,
# group.by = "ident",
# add.ident = NULL,
# slot = "data",
# verbose = TRUE,
# ...
# )
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
Idents(samples.combined.list.combined) <- "integrated_snn_res.0.4"
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##################################################################################
##################################################################################
################################################################################## label = TRUE, label.size = 3,
################################################################################## also on Figure 1A, just to dissociate the plots :::
##################################################################################
##################################################################################
##################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
### the CODE for the FIGURE 1D
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
z1 <- TSNEPlot(samples.combined.list.combined)
plot_grid(z1)
ggsave(paste("figure1D.TSNE.Plot", "assay.INTEGRATED.display.plot.TSNEplot", "png", sep="."), width = 20, height = 20, units = "cm")
z2 <- UMAPPlot(samples.combined.list.combined)
plot_grid(z2)
ggsave(paste("figure1D.UMAP.Plot", "assay.INTEGRATED.display.plot.UMAPplot", "png", sep="."), width = 20, height = 20, units = "cm")
z3 <- PCAPlot(samples.combined.list.combined)
plot_grid(z3)
ggsave(paste("figure1D.PCA.Plot", "assay.INTEGRATED.display.plot.PCAplot", "png", sep="."), width = 20, height = 20, units = "cm")
unique([email protected]$orig.ident)
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
Idents(samples.combined.list.combined) <- "integrated_snn_res.0.4"
source("the_script_display_FIGURES_fig1D.R")
# source("the_script_display_FIGURES_for_the_ARTICLE_with_SUI_26april2021_to_RETEST6_v2_display_fig1D_in_way1.R")
# source("the_script_display_FIGURES_for_the_ARTICLE_with_SUI_26april2021_to_RETEST6_v2_display_fig1D_in_way2.R")
### perhaps to keep only the DISPLAY in way # 3
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
Idents(samples.combined.list.combined) <- "integrated_snn_res.0.4"
Idents(samples.combined.list.combined) <- "seurat_clusters"
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
source("the_script_display_FIGURES_fig2A.R")
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
################################################################################## the figure 2C
####################################################################################################################
####################################################################################################################
####################################################################################################################
cluster.averages.CLUSTER.SEURAT.per.STIM <- AverageExpression(samples.combined.list.combined, slot = "data", group.by = c("seurat_clusters", "orig.ident"), return.seurat = TRUE) ### CLUSTER AVERAGES is made as a SEURAT OBJECT
### and if we need to access it, we do :
head(cluster.averages.CLUSTER.SEURAT.per.STIM@assays$RNA@counts)
unique(colnames(as.data.frame(cluster.averages.CLUSTER.SEURAT.per.STIM@assays$RNA@counts)))
# for examples : "50_STZ.1M" "50_STZ.2M" "50_STZ.3M" "50_STZ.4M"
# [505] "50_STZ.5M" "50_WT.1M" "50_WT.2M" "50_WT.3M" "50_WT.4M" "50_WT.5M"
#####################################################################################################################
write.table(as.data.frame(cluster.averages.CLUSTER.SEURAT.per.STIM@assays$RNA@counts),
file="samples.combined.list.combined.cluster.averages.CLUSTER.SEURAT.per.STIM.return.object.txt", sep="\t",
quote=F, col.names=T, row.names=T)
# row.names(([email protected]))
# [1] "0" "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" "13" "14"
# [16] "15" "16" "17" "18" "19" "20" "21" "22" "23" "24" "25" "26" "27" "28" "29"
# [31] "30" "31" "32" "33" "34" "35" "36" "37" "38" "39" "40" "41" "42" "43" "44"
# [46] "45" "46" "47" "48" "49" "50" "51" "52" "53"
cluster.averages.CLUSTER.per.STIM <- AverageExpression(samples.combined.list.combined, slot = "data", group.by = c("seurat_clusters", "orig.ident"), return.seurat = FALSE)
write.table(as.data.frame(cluster.averages.CLUSTER.per.STIM$RNA), file="samples.combined.list.combined.cluster.averages.CLUSTER.per.STIM.txt", sep="\t", quote=F, col.names=T, row.names=T)
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##################################################################################
### now to extract the names of the COLUMNS that we are interested in for the CLUSTERS : 0, 3, 8, 11, 12, 15, 17, 28, 30, 44
### the pattern would be : 0_ ; 3_ ; 8_ ; etc
# cluster.averages.CLUSTER.per.STIM.df = as.data.frame(cluster.averages.CLUSTER.per.STIM$RNA)
#####################################################################################################################################################
# cluster.averages.CLUSTER.per.STIM.df.0 = cluster.averages.CLUSTER.per.STIM.df[, grep(pattern="^0_", colnames(cluster.averages.CLUSTER.per.STIM.df))]
# cluster.averages.CLUSTER.per.STIM.df.3 = cluster.averages.CLUSTER.per.STIM.df[, grep(pattern="^3_", colnames(cluster.averages.CLUSTER.per.STIM.df))]
# cluster.averages.CLUSTER.per.STIM.df.8 = cluster.averages.CLUSTER.per.STIM.df[, grep(pattern="^8_", colnames(cluster.averages.CLUSTER.per.STIM.df))]
# cluster.averages.CLUSTER.per.STIM.df.11 = cluster.averages.CLUSTER.per.STIM.df[, grep(pattern="^11_", colnames(cluster.averages.CLUSTER.per.STIM.df))]
# cluster.averages.CLUSTER.per.STIM.df.12 = cluster.averages.CLUSTER.per.STIM.df[, grep(pattern="^12_", colnames(cluster.averages.CLUSTER.per.STIM.df))]
# cluster.averages.CLUSTER.per.STIM.df.15 = cluster.averages.CLUSTER.per.STIM.df[, grep(pattern="^15_", colnames(cluster.averages.CLUSTER.per.STIM.df))]
# cluster.averages.CLUSTER.per.STIM.df.17 = cluster.averages.CLUSTER.per.STIM.df[, grep(pattern="^17_", colnames(cluster.averages.CLUSTER.per.STIM.df))]
# cluster.averages.CLUSTER.per.STIM.df.28 = cluster.averages.CLUSTER.per.STIM.df[, grep(pattern="^28_", colnames(cluster.averages.CLUSTER.per.STIM.df))]
# cluster.averages.CLUSTER.per.STIM.df.30 = cluster.averages.CLUSTER.per.STIM.df[, grep(pattern="^30_", colnames(cluster.averages.CLUSTER.per.STIM.df))]
# cluster.averages.CLUSTER.per.STIM.df.44 = cluster.averages.CLUSTER.per.STIM.df[, grep(pattern="^44_", colnames(cluster.averages.CLUSTER.per.STIM.df))]
# colnames(cluster.averages.CLUSTER.per.STIM.df.0)
# colnames(cluster.averages.CLUSTER.per.STIM.df.3)
# colnames(cluster.averages.CLUSTER.per.STIM.df.8)
# colnames(cluster.averages.CLUSTER.per.STIM.df.11)
# colnames(cluster.averages.CLUSTER.per.STIM.df.12)
# colnames(cluster.averages.CLUSTER.per.STIM.df.15)
# colnames(cluster.averages.CLUSTER.per.STIM.df.17)
# colnames(cluster.averages.CLUSTER.per.STIM.df.28)
# colnames(cluster.averages.CLUSTER.per.STIM.df.30)
# colnames(cluster.averages.CLUSTER.per.STIM.df.44)
# dim(cluster.averages.CLUSTER.per.STIM.df.0)
# dim(cluster.averages.CLUSTER.per.STIM.df.3)
# dim(cluster.averages.CLUSTER.per.STIM.df.8)
# dim(cluster.averages.CLUSTER.per.STIM.df.11)
# dim(cluster.averages.CLUSTER.per.STIM.df.12)
# dim(cluster.averages.CLUSTER.per.STIM.df.15)
# dim(cluster.averages.CLUSTER.per.STIM.df.17)
# dim(cluster.averages.CLUSTER.per.STIM.df.28)
# dim(cluster.averages.CLUSTER.per.STIM.df.30)
# dim(cluster.averages.CLUSTER.per.STIM.df.44)
#####################################################################################################################################################
################################################################################## and now to print these DF in order to do the heatmaps offline
# write.table(cluster.averages.CLUSTER.per.STIM.df.0,
# file="samples.combined.list.combined.cluster.averages.CLUSTER.SEURAT.per.STIM.cluster.averages.CLUSTER.per.STIM.df.0.txt", sep="\t",
# quote=F, col.names=T, row.names=T)
# write.table(cluster.averages.CLUSTER.per.STIM.df.3,
# file="samples.combined.list.combined.cluster.averages.CLUSTER.SEURAT.per.STIM.cluster.averages.CLUSTER.per.STIM.df.3.txt", sep="\t",
# quote=F, col.names=T, row.names=T)
# write.table(cluster.averages.CLUSTER.per.STIM.df.8,
# file="samples.combined.list.combined.cluster.averages.CLUSTER.SEURAT.per.STIM.cluster.averages.CLUSTER.per.STIM.df.8.txt", sep="\t",
# quote=F, col.names=T, row.names=T)
# write.table(cluster.averages.CLUSTER.per.STIM.df.11,
# file="samples.combined.list.combined.cluster.averages.CLUSTER.SEURAT.per.STIM.cluster.averages.CLUSTER.per.STIM.df.11.txt", sep="\t",
# quote=F, col.names=T, row.names=T)
# write.table(cluster.averages.CLUSTER.per.STIM.df.12,
# file="samples.combined.list.combined.cluster.averages.CLUSTER.SEURAT.per.STIM.cluster.averages.CLUSTER.per.STIM.df.12.txt", sep="\t",
# quote=F, col.names=T, row.names=T)
# write.table(cluster.averages.CLUSTER.per.STIM.df.15,
# file="samples.combined.list.combined.cluster.averages.CLUSTER.SEURAT.per.STIM.cluster.averages.CLUSTER.per.STIM.df.15.txt", sep="\t",
# quote=F, col.names=T, row.names=T)
# write.table(cluster.averages.CLUSTER.per.STIM.df.17,
# file="samples.combined.list.combined.cluster.averages.CLUSTER.SEURAT.per.STIM.cluster.averages.CLUSTER.per.STIM.df.17.txt", sep="\t",
# quote=F, col.names=T, row.names=T)
# write.table(cluster.averages.CLUSTER.per.STIM.df.28,
# file="samples.combined.list.combined.cluster.averages.CLUSTER.SEURAT.per.STIM.cluster.averages.CLUSTER.per.STIM.df.28.txt", sep="\t",
# quote=F, col.names=T, row.names=T)
# write.table(cluster.averages.CLUSTER.per.STIM.df.30,
# file="samples.combined.list.combined.cluster.averages.CLUSTER.SEURAT.per.STIM.cluster.averages.CLUSTER.per.STIM.df.30.txt", sep="\t",
# quote=F, col.names=T, row.names=T)
# write.table(cluster.averages.CLUSTER.per.STIM.df.44,
# file="samples.combined.list.combined.cluster.averages.CLUSTER.SEURAT.per.STIM.cluster.averages.CLUSTER.per.STIM.df.44.txt", sep="\t",
# quote=F, col.names=T, row.names=T)
##################################################################################################################################################### FIGURE 3A
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
# Violin plot of the following genes in all 20 samples.
# Gfap, Zfp36, cebpd, timp1, crym, lcn2, cp, txnip, fth1, press56, id3, id4, id2, clvs1, agt, agmo, gadd45g, gnb3, mlf1, ptprn2, Zmat4, Tmsb4x, Nrxn3, ccdc136, opn1sw, Eno1,
# B2m, LOC100364435, Ifi27l2b, vgf, car3, hspb1, chi3l1, dkk3, Rlbp1.
LIST_GENES_SUI = list("Gfap", "Zfp36", "Cebpd", "Timp1", "Crym", "Lcn2", "Cp", "Txnip", "Fth1", "Prss56", "Id3", "Id4", "Id2",
"Clvs1", "Agt", "Agmo", "Gadd45g", "Gnb3", "Mlf1", "Ptprn2", "Zmat4", "Tmsb4x", "Nrxn3", "Ccdc136", "Opn1sw",
"Eno1", "B2m", "LOC100364435", "Ifi27l2b", "Vgf", "Car3", "Hspb1", "Chi3l1", "Dkk3", "Rlbp1")
### and to DISPLAY these GENES in the CLUSTERS : 0, 3, 11, 17, 44
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
Idents(samples.combined.list.combined) <- "orig.ident"
# cluster0
# cluster3
# cluster11
# cluster17
# cluster44
# in order to double check the META.DATA :
head([email protected])
head([email protected])
head([email protected])
head([email protected])
head([email protected])
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##################################################################################
################################################################################## the figure 3A : we have a new organization of the VIOLIN PLOTS
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
##########################################################################################################################################################################################################################################################################
LIST_GENES_SUI = list("Gfap", "Zfp36", "Cebpd", "Timp1", "Crym", "Lcn2", "Cp", "Txnip", "Fth1", "Prss56", "Id3", "Id4", "Id2",
"Clvs1", "Agt", "Agmo", "Gadd45g", "Gnb3", "Mlf1", "Ptprn2", "Zmat4", "Tmsb4x", "Nrxn3", "Ccdc136", "Opn1sw",
"Eno1", "B2m", "LOC100364435", "Ifi27l2b", "Vgf", "Car3", "Hspb1", "Chi3l1", "Dkk3", "Rlbp1")
# cluster0
# cluster3
# cluster11
# cluster17