An object of class Seurat
27381 features across 35642 samples within 1 assay
Active assay: RNA (27381 features, 0 variable features)
2 dimensional reductions calculated: densmap_logit, densmap_xgboost
Quantify and plot hexagon representation of feature interactions with Spearman’s correlation
Insr and Lxn correlation in astrocytes
Code
p1 <-plot_hexbin_interact(srt,type =c("data", "data"),mod =c("RNA", "RNA"), feature =c("Insr", "Lxn"), interact ="corr_spearman",ylab ="densMAP2", xlab ="densMAP1",title ="Interaction between mRNA expression of Insr and Lxn/nSpearman rho in hexagonal cells representation") +scale_fill_gradientn(colors = srt@misc$expr_Colour_Palette_gnuplot_r,na.value ="white" )p1
Insr and Gfap correlation in astrocytes
Code
p2 <-plot_hexbin_interact(srt,type =c("data", "data"),mod =c("RNA", "RNA"), feature =c("Insr", "Gfap"), interact ="corr_spearman",ylab ="densMAP2", xlab ="densMAP1",title ="Interaction between mRNA expression of Insr and Gfap/nSpearman rho in hexagonal cells representation") +scale_fill_gradientn(colors = srt@misc$expr_Colour_Palette_gnuplot_r,na.value ="white" )p2
Insr and Mfn2 correlation in astrocytes
Code
p3 <-plot_hexbin_interact(srt,type =c("data", "data"),mod =c("RNA", "RNA"), feature =c("Insr", "Mfn2"), interact ="corr_spearman",ylab ="densMAP2", xlab ="densMAP1",title ="Interaction between mRNA expression of Insr and Mfn2/nSpearman rho in hexagonal cells representation") +scale_fill_gradientn(colors = srt@misc$expr_Colour_Palette_gnuplot_r,na.value ="white" )p3
Lxn and Gfap correlation in astrocytes
Code
p4 <-plot_hexbin_interact(srt,type =c("data", "data"),mod =c("RNA", "RNA"), feature =c("Lxn", "Gfap"), interact ="corr_spearman",ylab ="densMAP2", xlab ="densMAP1",title ="Interaction between mRNA expression of Lxn and Gfap/nSpearman rho in hexagonal cells representation") +scale_fill_gradientn(colors = srt@misc$expr_Colour_Palette_gnuplot_r,na.value ="white" )p4
Lxn and Mfn2 correlation in astrocytes
Code
p5 <-plot_hexbin_interact(srt,type =c("data", "data"),mod =c("RNA", "RNA"), feature =c("Lxn", "Mfn2"), interact ="corr_spearman",ylab ="densMAP2", xlab ="densMAP1",title ="Interaction between mRNA expression of Lxn and Mfn2/nSpearman rho in hexagonal cells representation") +scale_fill_gradientn(colors = srt@misc$expr_Colour_Palette_gnuplot_r,na.value ="white" )p5
Gfap and Mfn2 correlation in astrocytes
Code
p6 <-plot_hexbin_interact(srt,type =c("data", "data"),mod =c("RNA", "RNA"), feature =c("Gfap", "Mfn2"), interact ="corr_spearman",ylab ="densMAP2", xlab ="densMAP1",title ="Interaction between mRNA expression of Gfap and Mfn2/nSpearman rho in hexagonal cells representation") +scale_fill_gradientn(colors = srt@misc$expr_Colour_Palette_gnuplot_r,na.value ="white" )p6
Plot in one grid
Code
# Create an empty plot for the unused spaces in the gridempty <-plot_grid(NULL, NULL, labels ="")# Arrange the plotsplot_grid( p3, empty, empty, p2, p6, empty, p1, p5, p4,ncol =3, nrow =3)
Barplot of Insr and Lxn expression in astrocytes across different individual hypothalamic nuclei
Code
# Create a new variable that combines Insr_pos and Lxn_posdf <- sbs_mtx %>%mutate(VarComb =case_when( Insr_pos & Lxn_pos ~"Insr+/Lxn+", Insr_pos &!Lxn_pos ~"Insr+/Lxn-",!Insr_pos & Lxn_pos ~"Insr-/Lxn+",!Insr_pos &!Lxn_pos ~"Insr-/Lxn-" ))# Calculate counts and proportions for each categorydf_counts <- df %>%group_by(region, VarComb) %>%summarise(n =n()) %>%mutate(prop = n /sum(n))# Calculate the total counts for each categorydf_total_counts <- df %>%group_by(region) %>%summarise(total_n =n())# Create a vector of region names ordered by prop for Insr+/Lxn+ cases for each regionordered_regions <- df_counts %>%filter(VarComb =="Insr+/Lxn-") %>%arrange(desc(prop)) %>%pull(region)# Reorder the factor levels of regiondf_counts$region <-factor(df_counts$region, levels = ordered_regions)df_total_counts$region <-factor(df_total_counts$region, levels = ordered_regions)# Reorder the factor levels of combinationsdf_counts$VarComb <-factor(df_counts$VarComb, levels =rev(c("Insr+/Lxn-", "Insr+/Lxn+", "Insr-/Lxn+", "Insr-/Lxn-")))# Create a stacked bar plotggplot(df_counts, aes(x = region, y = n, fill = VarComb)) +geom_bar(stat ="identity", color ="black") +scale_fill_manual(values =c("Insr+/Lxn+"="purple", "Insr+/Lxn-"="red3", "Insr-/Lxn+"="royalblue", "Insr-/Lxn-"="grey50")) +labs(x ="Hypothalamic subregion", y ="Number of cells", fill ="Expression") +theme_minimal() +scale_x_discrete(labels = coded_region)
Code
ggplot(df_counts, aes(x = region, y = prop, fill = VarComb)) +geom_bar(stat ="identity", color ="black", position ="fill") +scale_fill_manual(values =c("Insr+/Lxn-"="red3", "Insr+/Lxn+"="purple", "Insr-/Lxn+"="royalblue", "Insr-/Lxn-"="grey50")) +labs(x ="Hypothalamic subregion", y ="Proportion of cells", fill ="Expression") +theme_minimal() +scale_x_discrete(labels = coded_region)
Session information
Code
sI <- sessioninfo::session_info()sI$loadedOnly <-NULLprint(sI, locale =FALSE)