library(readr)
combined_Microglia <- read.csv("/Users/usri/Desktop/Mureen.dec6/Celltypes.concordance/combined_Microglia_heatmap.scater.plot.file.csv", row.names = 1)
combined_Microglia <- as.data.frame(combined_Microglia)
head(combined_Microglia, 10)
##        Microglia.PAP1vs.Control Microglia.Shkvs.PBS        Direction   Gene
## Pcdh15               -1.1890763          -0.3738315 Concordance.Down Pcdh15
## Tenm3                -0.4147850          -0.3644790 Concordance.Down  Tenm3
## Csf1                  0.4595667           0.5434152   Concordance.UP   Csf1
## Ctsb                  0.5244967           0.2939233   Concordance.UP   Ctsb
## Egfem1                0.5381028           0.5534336   Concordance.UP Egfem1
## Fat3                  0.4028172           0.2837006   Concordance.UP   Fat3
## Fkbp5                 1.2906097           0.3898174   Concordance.UP  Fkbp5
## Fth1                  1.1818786           1.4137779   Concordance.UP   Fth1
## Glul                  0.9517597           0.4476713   Concordance.UP   Glul
## Grin2a                1.1738602           0.3650096   Concordance.UP Grin2a
library(ggplot2)
library(ggrepel)  # For geom_text_repel if not already loaded
# Assuming 'Direction' has values like "positive" and "negative"
direction_colors <- c( "blue", "red", "darkgreen")
ggplot(combined_Microglia, aes(x = Microglia.PAP1vs.Control, y = Microglia.Shkvs.PBS , label = Gene, colour = Direction)) + 
    geom_point() + 
    scale_colour_manual(values = direction_colors) +
    xlim(-2, 2) +
    ylim(-2, 2) +
    geom_abline(slope = 1, intercept = 0, linetype = "dashed") +
    geom_text_repel() +
    labs(color = "Direction") + ggtitle('Microglia')
## Warning: ggrepel: 25 unlabeled data points (too many overlaps). Consider
## increasing max.overlaps

Astrocytes_combined <- read_csv("Astrocytes_combined_scaterplot.csv")
## Rows: 166 Columns: 4
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (2): Gene, Direction
## dbl (2): Astrocytes.PAP1.vs.Control, Astrocytes.ShK.vs.PBS
## 
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Astrocytes_combined <- as.data.frame(Astrocytes_combined)
head(Astrocytes_combined, 10)
##             Gene Astrocytes.PAP1.vs.Control Astrocytes.ShK.vs.PBS
## 1  9630028H03Rik                 -0.4786760            -0.4984252
## 2          Adcy8                 -0.6738847            -0.4088442
## 3        Atp13a4                 -0.3001954            -0.4373517
## 4  B230323A14Rik                 -0.4421292            -0.5203727
## 5           Bcl2                 -0.3309549            -0.3454662
## 6         Camk2d                 -0.4907768            -0.4311398
## 7     Csgalnact1                 -0.3640388            -0.2875638
## 8         Fchsd2                 -0.3664939            -0.3902031
## 9            Fry                 -0.3118635            -0.2887065
## 10       Gm11266                 -0.3723703            -0.4212250
##           Direction
## 1  Concordance.Down
## 2  Concordance.Down
## 3  Concordance.Down
## 4  Concordance.Down
## 5  Concordance.Down
## 6  Concordance.Down
## 7  Concordance.Down
## 8  Concordance.Down
## 9  Concordance.Down
## 10 Concordance.Down
library(ggplot2)
library(ggrepel)  # For geom_text_repel if not already loaded
# Assuming 'Direction' has values like "positive" and "negative"
direction_colors <- c( "blue", "red", "darkgreen")
ggplot(Astrocytes_combined, aes(x = Astrocytes.PAP1.vs.Control, y = Astrocytes.ShK.vs.PBS , label = Gene, colour = Direction)) + 
    geom_point() + 
    scale_colour_manual(values = direction_colors) +
    xlim(-2, 2) +
    ylim(-2, 2) +
    geom_abline(slope = 1, intercept = 0, linetype = "dashed") +
    geom_text_repel() +
    labs(color = "Direction") + ggtitle('Astrocytes')
## Warning: ggrepel: 147 unlabeled data points (too many overlaps). Consider
## increasing max.overlaps

library(readr)
Glutamatergic_combined <- read_csv("/Users/usri/Desktop/Mureen.dec6/Celltypes.concordance/Significant.overlapped.Glutamatergic.PAP1.ShK.csv")
## Rows: 236 Columns: 4
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (2): Gene, Direction
## dbl (2): Glutamatergic.Pap.vs.Control, Glutamatergic.ShK.vs.PBS
## 
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Glutamatergic_combined <- as.data.frame(Glutamatergic_combined)
head(Glutamatergic_combined, 10)
##             Gene Glutamatergic.Pap.vs.Control Glutamatergic.ShK.vs.PBS
## 1  2010300C02Rik                    0.3415591                0.3205547
## 2  4930444A19Rik                   -0.4210505               -0.6235831
## 3  4930517O19Rik                   -0.2601487               -0.5290947
## 4  4930555F03Rik                   -0.3509839               -0.5472962
## 5  4932443L11Rik                   -0.3110655               -0.3452029
## 6  4933411O13Rik                    0.4625059               -0.4546592
## 7  6330403K07Rik                   -0.2524713               -0.4005946
## 8  9630028H03Rik                    0.2731180               -0.3262431
## 9  A330015K06Rik                    0.4961092               -0.5951169
## 10 A330076H08Rik                   -0.2542697                0.2631306
##           Direction
## 1    Concordance.UP
## 2  Concordance.Down
## 3  Concordance.Down
## 4  Concordance.Down
## 5  Concordance.Down
## 6        Discordant
## 7  Concordance.Down
## 8        Discordant
## 9        Discordant
## 10       Discordant
library(ggplot2)
library(ggrepel)  # For geom_text_repel if not already loaded
# Assuming 'Direction' has values like "positive" and "negative"
direction_colors <- c( "blue", "red", "darkgreen")
ggplot(Glutamatergic_combined, aes(x = Glutamatergic.Pap.vs.Control, y = Glutamatergic.ShK.vs.PBS , label = Gene, colour = Direction)) + 
    geom_point() + 
    scale_colour_manual(values = direction_colors) +
    xlim(-2, 2) +
    ylim(-2, 2) +
    geom_abline(slope = 1, intercept = 0, linetype = "dashed") +
    geom_text_repel() +
    labs(color = "Direction") + ggtitle('Glutamatergic Neuron')
## Warning: ggrepel: 227 unlabeled data points (too many overlaps). Consider
## increasing max.overlaps

Oligodendrocyte_combined <- read_csv("/Users/usri/Desktop/Mureen.dec6/Celltypes.concordance/Oligodendrocyte_combined.scater.plot.file.csv")
## Rows: 158 Columns: 4
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (2): Gene, Direction
## dbl (2): Oligodendrocyte.Pap1.vs.Control, Oligodendrocyte.ShK.vs.PBS
## 
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Oligodendrocyte_combined <- as.data.frame(Oligodendrocyte_combined)
head(Oligodendrocyte_combined, 10)
##             Gene Oligodendrocyte.Pap1.vs.Control Oligodendrocyte.ShK.vs.PBS
## 1  9330111N05Rik                       0.3720454                  0.3545807
## 2  9330199G10Rik                       0.5379547                  0.3059190
## 3        Adipor2                       0.6313067                  0.3817877
## 4       Arhgap21                       0.4291029                  0.2910258
## 5         Arid5b                       0.5295041                  0.3214507
## 6         Bcl2l1                       0.6538686                  0.3100963
## 7         Clasrp                       0.2503947                  0.2679935
## 8        Dennd5b                       0.3610142                  0.3267114
## 9           Fth1                       0.8828162                  0.6296450
## 10         Itpk1                       0.3206527                  0.5102906
##         Direction
## 1  Concordance.Up
## 2  Concordance.Up
## 3  Concordance.Up
## 4  Concordance.Up
## 5  Concordance.Up
## 6  Concordance.Up
## 7  Concordance.Up
## 8  Concordance.Up
## 9  Concordance.Up
## 10 Concordance.Up
library(ggplot2)
library(ggrepel)  # For geom_text_repel if not already loaded
# Assuming 'Direction' has values like "positive" and "negative"
direction_colors <- c( "blue", "red", "darkgreen")
ggplot(Oligodendrocyte_combined, aes(x = Oligodendrocyte.Pap1.vs.Control, y = Oligodendrocyte.ShK.vs.PBS , label = Gene, colour = Direction)) + 
    geom_point() + 
    scale_colour_manual(values = direction_colors) +
    xlim(-2, 2) +
    ylim(-2, 2) +
    geom_abline(slope = 1, intercept = 0, linetype = "dashed") +
    geom_text_repel() +
    labs(color = "Direction") + ggtitle('Oligodendrocyte')
## Warning: ggrepel: 146 unlabeled data points (too many overlaps). Consider
## increasing max.overlaps

library(readr)
GABAergic_Combined  <- read_csv("/Users/usri/Desktop/Mureen.dec6/Celltypes.concordance/GABAergic_Combined.scater.plot.csv")
## Rows: 137 Columns: 4
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (2): Gene, Direction
## dbl (2): GABAergic.PAP1.vs.Control, GABAergic.ShK.vs.PBS
## 
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
GABAergic_Combined <- as.data.frame(GABAergic_Combined)
head(GABAergic_Combined, 10)
##             Gene GABAergic.PAP1.vs.Control GABAergic.ShK.vs.PBS
## 1  6330403K07Rik                -0.2745266           -0.4201151
## 2          Aifm3                -0.3931608           -0.3087359
## 3         Angpt2                -0.2836565           -0.4518208
## 4         Ankfn1                -0.5450917           -0.4405324
## 5         Atxn2l                -0.2945982           -0.3766158
## 6  B230217J21Rik                -0.2945627           -0.4674012
## 7  B430010I23Rik                -0.2618529           -0.3988186
## 8          Dcakd                -0.2813577           -0.3357226
## 9           Dpyd                -0.3757872           -0.2688052
## 10        Fbxo10                -0.2547471           -0.4507361
##           Direction
## 1  Concordance.Down
## 2  Concordance.Down
## 3  Concordance.Down
## 4  Concordance.Down
## 5  Concordance.Down
## 6  Concordance.Down
## 7  Concordance.Down
## 8  Concordance.Down
## 9  Concordance.Down
## 10 Concordance.Down
library(ggplot2)
library(ggrepel)  # For geom_text_repel if not already loaded
# Assuming 'Direction' has values like "positive" and "negative"
direction_colors <- c( "blue", "red", "darkgreen")
ggplot(GABAergic_Combined, aes(x = GABAergic.PAP1.vs.Control, y = GABAergic.ShK.vs.PBS , label = Gene, colour = Direction)) + 
    geom_point() + 
    scale_colour_manual(values = direction_colors) +
    xlim(-2, 2) +
    ylim(-2, 2) +
    geom_abline(slope = 1, intercept = 0, linetype = "dashed") +
    geom_text_repel() +
    labs(color = "Direction") + ggtitle('GABAergic.Neuron')
## Warning: ggrepel: 133 unlabeled data points (too many overlaps). Consider
## increasing max.overlaps

library(readr)
Oligodendrocyte_PrecursorCell_Combined  <- read_csv("/Users/usri/Desktop/Mureen.dec6/Celltypes.concordance/Oligodendrocyte_PrecursorCell_Combined.scater.main.csv")
## Rows: 80 Columns: 4
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (2): Gene, Direction
## dbl (2): OPC.PAP1.vs.Control, OPC.ShK.vs.PBS
## 
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Oligodendrocyte_PrecursorCell_Combined <- as.data.frame(Oligodendrocyte_PrecursorCell_Combined)
head(Oligodendrocyte_PrecursorCell_Combined, 10)
##       Gene OPC.PAP1.vs.Control OPC.ShK.vs.PBS      Direction
## 1   Cnksr2           0.4322768      0.6248864 Concordance.UP
## 2    Dip2a           0.5291506      0.5122841 Concordance.UP
## 3    Efr3a           0.4149760      0.4985686 Concordance.UP
## 4    Grin1           0.4784360      0.7426865 Concordance.UP
## 5   Grin2a           0.4882243      0.8477109 Concordance.UP
## 6      Hlf           0.4617496      0.5220250 Concordance.UP
## 7    Itpr1           0.3596582      0.8988930 Concordance.UP
## 8   Kctd16           0.3098695      0.3957652 Concordance.UP
## 9  Mthfd1l           0.4396143      0.6349368 Concordance.UP
## 10    Nrg1           0.5190646      0.3829384 Concordance.UP
library(ggplot2)
library(ggrepel)  # For geom_text_repel if not already loaded
# Assuming 'Direction' has values like "positive" and "negative"
direction_colors <- c( "blue", "red", "darkgreen")
ggplot(Oligodendrocyte_PrecursorCell_Combined, aes(x = OPC.PAP1.vs.Control, y = OPC.ShK.vs.PBS , label = Gene, colour = Direction)) + 
    geom_point() + 
    scale_colour_manual(values = direction_colors) +
    xlim(-2, 2) +
    ylim(-2, 2) +
    geom_abline(slope = 1, intercept = 0, linetype = "dashed") +
    geom_text_repel() +
    labs(color = "Direction") + ggtitle('Oligodendrocyte_PrecursorCell')
## Warning: Removed 1 rows containing missing values (`geom_point()`).
## Warning: Removed 1 rows containing missing values (`geom_text_repel()`).
## Warning: ggrepel: 64 unlabeled data points (too many overlaps). Consider
## increasing max.overlaps

library(ggplot2)
library(pheatmap)
combined_Microglia <- read.csv("/Users/usri/Desktop/Mureen.dec6/Celltypes.concordance/combined_Microglia_heatmap.scater.plot.file.csv", row.names = 1)
table(combined_Microglia$Direction)
## 
## Concordance.Down   Concordance.UP       Discordant 
##                2               11               30
Microglia <- combined_Microglia %>% select(-c('Direction' , 'Gene'))
Microglia <- as.matrix(Microglia)
# Step 2: Set up the color palette (optional)
my_palette <- colorRampPalette(c("blue", "white", "red"))(n = 100)
# Step 3: Create the heatmap using pheatmap
pheatmap(Microglia, color = my_palette, cluster_rows = TRUE, cluster_cols = FALSE, main = 'Microglia', display_numbers = TRUE)

library(readr)
Oligodendrocytes_Concordance_up_down <- read.csv("/Users/usri/Desktop/Mureen.dec6/Celltypes.concordance/Oligodendrocytes.Concordance.up.down.csv", row.names = 1)
Oligodendrocytes_Concordance_up_down <- Oligodendrocytes_Concordance_up_down %>% select(-c('Direction'))
Oligodendrocytes_Concordance_up_down <- as.matrix(Oligodendrocytes_Concordance_up_down)
# Define the range of logFC values you want to emphasize
low_logFC <- -2  # Adjust this threshold as needed

# Adjust the color palette to emphasize low fold change values
my_palette <- colorRampPalette(c("blue", "white", "red"))(n = 100)
my_palette <- colorRampPalette(c("blue", "white"))(n = 50)  # Change midpoint color
my_palette <- c(my_palette, colorRampPalette(c("white", "red"))(n = 50))

# Create the heatmap using pheatmap with the modified color palette
pheatmap(Oligodendrocytes_Concordance_up_down, color = my_palette, 
         cluster_rows = TRUE, cluster_cols = FALSE, 
         main = ' Oligodendrocytes_Concordance_up_down', 
         display_numbers = TRUE)

library(readr)
Oligodendrocytes_Discordant <- read.csv("/Users/usri/Desktop/Mureen.dec6/Celltypes.concordance/Oligodendrocytes.Discordant.csv", row.names = 1)
Oligodendrocytes_Discordant <- Oligodendrocytes_Discordant %>% select(-c('Direction'))
Oligodendrocytes_Discordant <- as.matrix(Oligodendrocytes_Discordant)
# Define the range of logFC values you want to emphasize
low_logFC <- -2  # Adjust this threshold as needed
# Adjust the color palette to emphasize low fold change values
my_palette <- colorRampPalette(c("blue", "white", "red"))(n = 100)
my_palette <- colorRampPalette(c("blue", "white"))(n = 50)  # Change midpoint color
my_palette <- c(my_palette, colorRampPalette(c("white", "red"))(n = 50))
# Create the heatmap using pheatmap with the modified color palette
pheatmap(Oligodendrocytes_Discordant, color = my_palette, 
         cluster_rows = TRUE, cluster_cols = FALSE, 
         main = 'Oligodendrocytes_Discordant', 
         display_numbers = TRUE)

#Astrocytes_combined.concordance <- subset(Astrocytes_combined, Direction!= "Discordant")
library(readr)
Astrocytes_Concordance <- read.csv("/Users/usri/Desktop/Mureen.dec6/Celltypes.concordance/Astrocytes.Concordance.csv", row.names = 1)
Astrocytes_Concordance <- Astrocytes_Concordance %>% select(-c('Direction'))
Astrocytes_Concordance <- as.matrix(Astrocytes_Concordance)
# Step 2: Set up the color palette (optional)
my_palette <- colorRampPalette(c("blue", "white", "red"))(n = 100)
# Step 3: Create the heatmap using pheatmap
pheatmap(Astrocytes_Concordance, color = my_palette, cluster_rows = TRUE, cluster_cols = FALSE, main = 'Astrocytes_Concordance', display_numbers = TRUE)

library(readr)
Astrocytes_Discordant <- read.csv("/Users/usri/Desktop/Mureen.dec6/Celltypes.concordance/Astrocytes.Discordant.csv", row.names = 1)
Astrocytes_Discordant <- Astrocytes_Discordant %>% select(-c('Direction'))
Astrocytes_Discordant <- as.matrix( Astrocytes_Discordant)
# Step 2: Set up the color palette (optional)
my_palette <- colorRampPalette(c("blue", "white", "red"))(n = 100)
# Step 3: Create the heatmap using pheatmap
pheatmap(Astrocytes_Discordant, color = my_palette, cluster_rows = TRUE, cluster_cols = FALSE, main = 'Astrocytes_Discordant', display_numbers = TRUE)