library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr     1.1.4     ✔ readr     2.1.5
## ✔ forcats   1.0.0     ✔ stringr   1.5.2
## ✔ ggplot2   3.5.2     ✔ tibble    3.3.0
## ✔ lubridate 1.9.4     ✔ tidyr     1.3.1
## ✔ purrr     1.1.0     
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag()    masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(dplyr)
library(purrr)
library(stringr)
conditions <- read.csv("conditions_annotation.csv")
expression <- read.csv("SC_expression.csv")
mlabels <- read.csv("mergedLabels.csv")
ThirtySevenDegree <-conditions[grepl("37 deg",conditions$primary),] 
myexpression2 <- 
  expression %>%
  dplyr::select(ThirtySevenDegree$ID)
tidyExpression <- myexpression2 %>% pivot_longer(cols = everything())

by_treatment <- tidyExpression %>%
  group_by(name)

by_treatment  %>%
  summarise_all(list(mean = mean, median  = median, n=length))
## # A tibble: 8 × 4
##   name    mean median     n
##   <chr>  <dbl>  <dbl> <int>
## 1 SAABFI  165.   20.3  6071
## 2 SAABFN  165.   17.7  6071
## 3 SAABFS  165.   17.3  6071
## 4 SAABIB  165.   16.6  6071
## 5 SAABIC  165.   15.9  6071
## 6 SAABIF  165.   20.0  6071
## 7 SAABIQ  165.   19.3  6071
## 8 SAABQR  165.   17.6  6071
ggplot(tidyExpression, aes(x=name,y=log(value), fill = name, color = name)) + 
  geom_violin() +
  theme_classic()+
  scale_color_brewer(palette="PuRd")+
  scale_fill_brewer(palette = "BuPu")
## Warning: Removed 1407 rows containing non-finite outside the scale range
## (`stat_ydensity()`).