library(VennDiagram)
## Loading required package: grid
## Loading required package: futile.logger
library(readr)  # Ensure read_csv is available

# Read the data
VENN_JAN28 <- read_csv("~/Desktop/SnRNAseq.manuscript.Plots.April10/PAP1.vs.Control.plots/VENN.JAN28.csv")
## Rows: 1047849 Columns: 13
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (13): JTC.PULL, JTC.MOUSE, BV2.MOUSE, PAP1.UP, PAP1.DOWN, ShK.UP, ShK.DO...
## 
## ℹ 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.
# Define the input sets
venn.list <- list(
  PAP1.UP = head(VENN_JAN28$PAP1.UP, 212),
  PAP1.DOWN = head(VENN_JAN28$PAP1.DOWN, 175),
  Pro.Resilience = head(VENN_JAN28$Pro.Resilience.Mouse, 299),
  Anti.Resilience = head(VENN_JAN28$`Anti-Resilience.Mouse`, 216)
)

# Create the Venn diagram
venn.plot <- venn.diagram(
  x = venn.list,
  category.names = c("PAP1.UP", "PAP1.DOWN", "Pro.Resilience", "Anti-Resilience"),
  fill = c("skyblue", "lightgoldenrod1", "orchid", "salmon"),
  alpha = 0.5,
  cex = 2.5,
  cat.cex = 1.5,
  cat.col = c("blue4", "darkorange3", "purple4", "red3"),
  filename = NULL  # Direct plotting
)

# Render the diagram
grid::grid.draw(venn.plot)

library(readr)
PAP1_Interferon_venn <- read_csv("~/Desktop/SnRNAseq.manuscript.Plots.April10/PAP1.vs.Control.plots/PAP1.Interferon.venn.csv")
## Rows: 913 Columns: 4
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (4): IFN1.UP.825, IFN2.UP.913, PAP1.UP, PAP1.DOWN
## 
## ℹ 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.
# Define the input sets
venn.list <- list(
  PAP1.UP = head(PAP1_Interferon_venn$PAP1.UP, 212 ),
  PAP1.DOWN = head(PAP1_Interferon_venn$PAP1.DOWN, 175),
IFN1 = head(PAP1_Interferon_venn$IFN1.UP.825, 825),
IFN2 = head(PAP1_Interferon_venn$IFN2.UP.913, 913)
)

# Create the Venn diagram
venn.plot <- venn.diagram(
  x = venn.list,
  category.names = c("PAP1.UP", "PAP1.DOWN", "IFN1", "IFN2"),
  fill = c("skyblue", "lightgoldenrod1", "orchid", "salmon"),
  alpha = 0.5,
  cex = 2.5,
  cat.cex = 1.5,
  cat.col = c("blue4", "darkgreen", "purple4", "red3"),
  filename = NULL  # Direct plotting
)

# Render the diagram
grid::grid.draw(venn.plot)