#Reading in the conditions and expression file
Mycondition <- read.csv("conditions_annotation.csv", sep = ",", header = T)
Myexpression <- read.csv("SC_expression.csv", sep = ",", header = T)
#Filtering data for YB210 condition
YB210filterconditions <- Mycondition[grepl("YB210", Mycondition$primary),] 
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.1
## ✔ ggplot2   4.0.0     ✔ tibble    3.2.1
## ✔ lubridate 1.9.4     ✔ tidyr     1.3.1
## ✔ purrr     1.0.4     
## ── 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
#Removed the first numbered column, and made each row labeled by Gene
row.names(Myexpression) <- Myexpression[,1]
Myexpression <- Myexpression[,-1]
#Selecting data to use for ggplot
Myexpression2 <-
  Myexpression%>%
  select(YB210filterconditions$ID)
#Creating a summary of observation per row in preparation of ggplot graph
tidyExpression <- Myexpression2 %>% pivot_longer(cols = everything())
#Creating summary of file
by_treatment <- tidyExpression %>%
  group_by(name)

by_treatment %>%
  summarise_all(list(mean = mean, median = median, n = length))
## # A tibble: 2 × 4
##   name    mean median     n
##   <chr>  <dbl>  <dbl> <int>
## 1 INICIA  165.   37.1  6071
## 2 INICIR  165.   37.2  6071
#Creating violin plot graph
ggplot(tidyExpression, aes(x=name,y=log(value))) + 
  geom_violin()
## Warning: Removed 664 rows containing non-finite outside the scale range
## (`stat_ydensity()`).