This R Markdown is meant to facilitate the reproducibility of the findings in https://docs.google.com/document/d/166X4o_6HegeS0uUHRa4ahKedkaVEMeiRagCm7T9nOVU/edit?usp=sharing. Here we specifically focus on the c-Fos and Slide-seq data, as detailed in Figure 7.
First, we load relevant packages.
library(nat)
library(plyr)
library(cocoframer)
library(purrr)
library(rgl)
library(RNifti)
library(tidyverse)
library(ggplot2)
library(ggrepel)
library(RColorBrewer)
library(tidyr)
library(plotly)
library(data.table)
library(dplyr)
'%notin%' = Negate('%in%')
Our first object is to view the c-Fos data at the whole brain level. For this visualization, we limit the voxels shown to those for which we have Slide-seq data, and those that have a non-zero number of c-Fos expressing cells. Here we load the Slide-seq and c-Fos data, limiting the data to voxels where the Slide-seq data is found.
slideseq = readRDS("Data/Vascular/SupportFiles/100um_Celltypes_in_each_Voxel_and_totalsums.rds")
cfos_data = readRDS("Data/cFos/DataFiles/CFOS_data_registeredto_100UmABA_OrganizedbyTimepoint.rds")
slideseq = filter(slideseq, slideseq$total_sums >= 1)
joint = left_join(slideseq, cfos_data)
#For all instances where we have a Slideseq voxel, but do not have a c-Fos score, we set these values to zero
joint[is.na(joint)] <- 0
We load the Allen Brain Atlas mesh and shift it slightly so it has the same coordinates as the c-Fos and Slide-seq data.
structures <- c("root")
mesh_list <- map(structures, ccf_2017_mesh)
names(mesh_list) <- structures
#Shift the ABA to fit the coordinate system
mesh_list$root$vb[2,] = mesh_list$root$vb[2,] - 500
mesh_list$root$vb[3,] = mesh_list$root$vb[3,] - 500
Plot the Slide-seq voxels within the brain.
try(close3d(), silent = TRUE)
plot3d(mesh_list$root, col = "grey", alpha = 0.1, add= TRUE)
plot3d(joint$Voxel_X, joint$Voxel_Y, joint$Voxel_Z, col = "black", add = TRUE)