Last update: 2018-01-18

Code version: 5996c19850dc5fc65723f30bc33ab1c8d083a7e6


Setting important directories. Also loading important libraries and custom functions for analysis.

seq_dir <- "/Volumes/PAULHOOK/sc-da-parkinsons/data"
file_dir <- "/Volumes/PAULHOOK/sc-da-parkinsons/output"
Rdata_dir <- "/Volumes/PAULHOOK/sc-da-parkinsons/data"
Script_dir <- "/Volumes/PAULHOOK/sc-da-parkinsons/code"
figure_dir <- "/Volumes/PAULHOOK/sc-da-parkinsons/figures/"
source(file.path(Script_dir,'init.R'))
source(file.path(Script_dir,"tools_R.r"))

Loading the cds data needed to produce figures

dat.filter <- readRDS(file.path(Rdata_dir,"dat.filter.final.Rds"))
P7.dat.filter <- readRDS(file.path(Rdata_dir,"P7.dat.filter.final.Rds"))
P7.MB.dat.filter <- readRDS(file.path(Rdata_dir,"P7.Mb.dat.filter.final.Rds"))
P7.FB.dat.filter <- readRDS(file.path(Rdata_dir,"P7.Fb.dat.filter.final.Rds"))
P7.OB.dat.filter <- readRDS(file.path(Rdata_dir,"P7.Ob.dat.filter.final.Rds"))

Figure 2A

The following code was used to produce Figure 2A, the P7 all cell t-SNE plot colored by subset cluster identity

# Seting the subset cluster colors needed to keep everything consistent
color.P7 <- c("#F2C318","#E790AC","#F18421","#0168A5","#848483","#A4CAEB","#885793","#008957","#222222")

# Plotting the t-SNE of P7 cells colored by subset cluster identity
p7 <- myTSNEPlotAlpha.triangle(P7.dat.filter,color="subset.cluster") + scale_color_manual(values = color.P7, name = "Subset Cluster") + ggtitle("P7 neurons - tSNE Plot by subset cluster") + xlab("tSNE 1") + ylab("tSNE 2") + theme(legend.position = "bottom",axis.line = element_line(colour = "black")) + theme(plot.title = element_text(hjust = 0.5)) + coord_fixed(ratio = 1) + scale_shape(name = "Age")
## Scale for 'colour' is already present. Adding another scale for
## 'colour', which will replace the existing scale.
pdf(file = file.path(figure_dir, "Figure.2A.pdf"), width = 8, height = 8)
p7
dev.off()
## quartz_off_screen 
##                 2
p7

Figure 2B

The following code was used to produce Figure 2B, 2C, and 2D. These figures display the t-SNE results for the regional P7 analyses including FB, OB, and MB.

# Plotting the t-SNE of P7 OB cells colored by the clusters identified during the iterative analysis
ob <- myTSNEPlotAlpha.triangle(P7.OB.dat.filter,color="kmeans_tSNE_cluster") + scale_color_manual(values = color.P7[7:9], name = "Subset Cluster", labels = c("P7.OB.1","P7.OB.2","P7.OB.3")) + ggtitle("P7 OB neurons t-SNE") + xlab("t-SNE 1") + ylab("t-SNE 2") + theme(legend.position = "bottom",axis.line = element_line(colour = "black")) + theme(plot.title = element_text(hjust = 0.5)) + coord_fixed(ratio = 1) + scale_shape(name = "Age")
## Scale for 'colour' is already present. Adding another scale for
## 'colour', which will replace the existing scale.
pdf(file.path(figure_dir,"Figure.2C.pdf"), height = 4, width = 4)
ob
dev.off()
## quartz_off_screen 
##                 2
ob

# Plotting the t-SNE of P7 FB cells colored by the clusters identified during the iterative analysis
fb <- myTSNEPlotAlpha.triangle(P7.FB.dat.filter,color="kmeans_tSNE_cluster") + scale_color_manual(values = color.P7[1:2], name = "Subset Cluster", labels = c("P7.FB.1","P7.FB.2")) + ggtitle("P7 FB t-SNE") + xlab("t-SNE 1") + ylab("t-SNE 2") + theme(legend.position = "bottom",axis.line = element_line(colour = "black")) + theme(plot.title = element_text(hjust = 0.5)) + coord_fixed(ratio = 1) + scale_shape(name = "Age") + coord_equal(ratio = 0.5)
## Scale for 'colour' is already present. Adding another scale for
## 'colour', which will replace the existing scale.
pdf(file.path(figure_dir,"Figure.2B.pdf"), height = 5, width = 5)
fb
dev.off()
## quartz_off_screen 
##                 2
fb

# Plotting the t-SNE of P7 MB cells colored by the clusters identified during the iterative analysis
mb <- myTSNEPlotAlpha.triangle(P7.MB.dat.filter,color="kmeans_tSNE_cluster") + scale_color_manual(values = color.P7[3:6], name = "Subset Cluster", labels = c("P7.MB.1","P7.MB.2","P7.MB.3","P7.MB.4")) + ggtitle("P7 MB t-SNE") + xlab("t-SNE 1") + ylab("t-SNE 2") + theme(legend.position = "bottom",axis.line = element_line(colour = "black")) + theme(plot.title = element_text(hjust = 0.5)) + coord_fixed(ratio = 0.5) + scale_shape(name = "Age")
## Scale for 'colour' is already present. Adding another scale for
## 'colour', which will replace the existing scale.
pdf(file = file.path(figure_dir, "Figure.2D.pdf"), width = 6, height = 4)
mb
dev.off()
## quartz_off_screen 
##                 2
mb

Session Info

sessionInfo()
## R version 3.3.0 (2016-05-03)
## Platform: x86_64-apple-darwin13.4.0 (64-bit)
## Running under: OS X 10.11.6 (El Capitan)
## 
## locale:
## [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
## 
## attached base packages:
##  [1] grid      splines   stats4    parallel  stats     graphics  grDevices
##  [8] utils     datasets  methods   base     
## 
## other attached packages:
##  [1] ggbiplot_0.55       scales_0.5.0        SC3_1.1.4          
##  [4] ROCR_1.0-7          jackstraw_1.1.1     lfa_1.2.2          
##  [7] tsne_0.1-3          gridExtra_2.3       slackr_1.4.2       
## [10] vegan_2.4-4         permute_0.9-4       MASS_7.3-47        
## [13] gplots_3.0.1        RColorBrewer_1.1-2  Hmisc_4.0-3        
## [16] Formula_1.2-2       survival_2.41-3     lattice_0.20-35    
## [19] Heatplus_2.18.0     Rtsne_0.13          pheatmap_1.0.8     
## [22] tidyr_0.7.1         dplyr_0.7.4         plyr_1.8.4         
## [25] heatmap.plus_1.3    stringr_1.2.0       marray_1.50.0      
## [28] limma_3.28.21       reshape2_1.4.3      monocle_2.2.0      
## [31] DDRTree_0.1.5       irlba_2.2.1         VGAM_1.0-2         
## [34] ggplot2_2.2.1       Biobase_2.32.0      BiocGenerics_0.18.0
## [37] Matrix_1.2-11      
## 
## loaded via a namespace (and not attached):
##  [1] RSelenium_1.7.1        colorspace_1.3-2       class_7.3-14          
##  [4] rprojroot_1.2          htmlTable_1.9          corpcor_1.6.9         
##  [7] base64enc_0.1-3        mvtnorm_1.0-6          codetools_0.2-15      
## [10] doParallel_1.0.11      robustbase_0.92-7      knitr_1.17            
## [13] jsonlite_1.5           cluster_2.0.6          semver_0.2.0          
## [16] shiny_1.0.5            rrcov_1.4-3            httr_1.3.1            
## [19] backports_1.1.1        assertthat_0.2.0       lazyeval_0.2.1        
## [22] acepack_1.4.1          htmltools_0.3.6        tools_3.3.0           
## [25] bindrcpp_0.2           igraph_1.1.2           gtable_0.2.0          
## [28] glue_1.1.1             binman_0.1.0           doRNG_1.6.6           
## [31] Rcpp_0.12.14           slam_0.1-37            gdata_2.18.0          
## [34] nlme_3.1-131           iterators_1.0.8        mime_0.5              
## [37] rngtools_1.2.4         gtools_3.5.0           WriteXLS_4.0.0        
## [40] XML_3.98-1.9           DEoptimR_1.0-8         yaml_2.1.15           
## [43] pkgmaker_0.22          rpart_4.1-11           fastICA_1.2-1         
## [46] latticeExtra_0.6-28    stringi_1.1.5          pcaPP_1.9-72          
## [49] foreach_1.4.3          e1071_1.6-8            checkmate_1.8.4       
## [52] caTools_1.17.1         rlang_0.1.6            pkgconfig_2.0.1       
## [55] matrixStats_0.52.2     bitops_1.0-6           qlcMatrix_0.9.5       
## [58] evaluate_0.10.1        purrr_0.2.4            bindr_0.1             
## [61] labeling_0.3           htmlwidgets_0.9        magrittr_1.5          
## [64] R6_2.2.2               combinat_0.0-8         wdman_0.2.2           
## [67] foreign_0.8-69         mgcv_1.8-22            nnet_7.3-12           
## [70] tibble_1.3.4           KernSmooth_2.23-15     rmarkdown_1.8         
## [73] data.table_1.10.4      HSMMSingleCell_0.106.2 digest_0.6.12         
## [76] xtable_1.8-2           httpuv_1.3.5           openssl_0.9.7         
## [79] munsell_0.4.3          registry_0.3

This R Markdown site was created with workflowr