#pkglibrary(tidyverse)library(readxl)library(patchwork)# srcsource(here::here("src/function/stat_function/stat_analysis_main.R")) # for make plot source(here::here("src/function/fig_export.R")) # This function saves a given plot (plot_x) as both a PDF and a high-resolution PNG file at specified dimensions.# cosmeticssulfate_pallet=read_excel(here::here("data/color_palette.xlsm")) %>%filter(set =="sulfure_condition") %>% dplyr::select(color, treatment) %>%pull(color) %>%setNames(read_excel(here::here("data/color_palette.xlsm")) %>%filter(set =="sulfure_condition") %>%pull(treatment) )mutant_palette=read_excel(here::here("data/color_palette.xlsm")) %>%filter(set =="mutant") %>% dplyr::select(color, treatment) %>%pull(color) %>%setNames(read_excel(here::here("data/color_palette.xlsm")) %>%filter(set =="mutant") %>%pull(treatment) )my_color_palette <-read_excel(here::here("data/color_palette.xlsm"))
18.1 Data importation
Code
# 1. Table de correspondance « nettoyée » : un seul Psat (le plus grand) par PsCammapping <-read_excel( here::here("data/microarray/Resultats_4plex-POIS-2014_01_230415_modKG.xlsx"),sheet ="Pscam_to_Psat_v1c_mrna_besthit-",col_types =c("text", "text", "numeric", "numeric") # attention à "numeric") %>%select(PsCam, Psat) %>%mutate( # extrait la partie numérique de Psatpsat_num =as.integer(str_extract(Psat, "\\d+")) ) %>%arrange(PsCam, desc(psat_num)) %>%# trie du plus grand au plus petitdistinct(PsCam, .keep_all =TRUE) %>%select(-psat_num) # on n’a plus besoin de la colonne intermédiaire# 2. Ton tableau principaldf_qpcr <-read_excel(here::here("data/qpcr/qPCR_myriam.xlsx")) %>%mutate(# 1. condition sulfate : S+ → SS | S‑ → SDsulfur_condition =if_else(str_detect(plant_id, "^S\\+"), "SS", "SD"),# 2. génotype (4 chiffres juste après S+ ou S‑)allele =str_extract(plant_id, "(?<=^S[+-])[0-9]{4}"),# 3. type de génotype : WT si “wt”, sinon Muttype_genotype =if_else(str_detect(str_to_lower(plant_id), "wt"), "WT", "Mut"),# 4. numéro de planteplant_num =str_extract(plant_id, "(?<=\\d{4}-)\\d+") |>as.integer(),genotype =case_when( allele =="4693"& type_genotype =="Mut"~"E568K", allele =="4693"& type_genotype =="WT"~"WT2", allele =="2684"& type_genotype =="Mut"~"W78*",TRUE~"WT1" ) ) %>%left_join(mapping, by ="PsCam")write_csv(df_qpcr, here::here("data/qpcr/output/qPCR.csv"))