diff --git a/CO2xCOMM/Porewater/Sulfide/2026/GCReW_CO2xComm_Porewater_H2S_Template.Rmd b/CO2xCOMM/Porewater/Sulfide/2026/GCReW_CO2xComm_Porewater_H2S_Template.Rmd new file mode 100644 index 0000000..4bd1ce7 --- /dev/null +++ b/CO2xCOMM/Porewater/Sulfide/2026/GCReW_CO2xComm_Porewater_H2S_Template.Rmd @@ -0,0 +1,1322 @@ +--- +title: "CO2xComm: Porewater Sulfide" +author: "Month Year Samples" +date: "`r Sys.Date()`" +output: + pdf_document: + toc: false + number_sections: false +geometry: left=2cm,right=2cm,top=1cm,bottom=2cm +--- +## Code Set up +```{r setup, include=FALSE} + +library(dplyr) +library(broom) +library(ggplot2) +library(ggpubr) +library(stringr) +library(purrr) +library(tidyverse) +library(here) +library(data.table) +library(matrixStats) +library(gridExtra) +library(grid) +library(plater) +library(raster) +library(knitr) +library(readxl) +library(ggrepel) + +``` + +## run information +```{r Information to be changed} + +##Before or After Reruns (YES or NO) +After_Reruns = "YES" +#If NO will not write final data file + #And Will Write a Rerun File + +###things that need to be changed + +sample_month = "July" +sample_year = "2025" +Run_Date = as.Date("07/14/2025", format = "%m/%d/%Y") +Run_by = "Melanie Giessner"#Instrument user +Script_run_by ="Brenden Blakley"#Code user + +Run_notes=""#any notes from run + +#Import Plate Data + +plates<- c("Plate1","Plate2","Plate3","Plate4","Plate5","Plate6","Plate7", "Plate8", "Plate9", "Plate10", "Plate_rr") + +Raw_plates <- c("Raw Data/20250714_LTREB_H2S_Plate1.csv", + "Raw Data/20250714_LTREB_H2S_Plate2.csv", + "Raw Data/20250714_LTREB_H2S_Plate3.csv", + "Raw Data/20250714_LTREB_H2S_Plate4.csv", + "Raw Data/20250714_LTREB_H2S_Plate5.csv", + "Raw Data/20250714_LTREB_H2S_Plate6.csv", + "Raw Data/20250715_LTREB_H2S_Plate7.csv", + "Raw Data/20250715_LTREB_H2S_Plate8.csv", + "Raw Data/20250715_LTREB_H2S_Plate9.csv", + "Raw Data/20250715_LTREB_H2S_Plate10.csv", + "Raw Data/20250716_LTREB_H2S_reruns.csv") + +#Import Run Date for Each Plate for Std curve qaqc +Run_dates <- tibble( + Plate = c("Plate1","Plate2","Plate3","Plate4","Plate5","Plate6","Plate7","Plate8","Plate9","Plate10", "Plate_rr"), + Run_Date = c("07/14/2025","07/14/2025","07/14/2025","07/14/2025","07/14/2025","07/14/2025","07/15/2025","07/15/2025", "07/15/2025", "07/15/2025", "07/16/2025") + ) + + Run_dates <- Run_dates %>% mutate(Run_Date = as.Date(Run_Date, format = "%m/%d/%Y")) + + +# Define the file path for QAQC log file - NO Need to change just check year +log_path <- "Processed Data/LTREB_1M_H2S_QAQC_2025.csv" + +# Define final path for data be sure to change year and month and run number +final_path <- "Processed Data/GCReW_CO2xComm_Porewater_H2S_202507.csv" +rerun_path <- "Processed Data/GCReW_CO2xComm_Porewater_H2S_202507_reruns.csv" + + +``` + +```{r Set Up Code - constants and QAQC cutoffs, include=FALSE} + +#Flag cutoffs + r2_cutoff = 0.985 #this is the level below which we want to rerun or consider a curve + cv_flag_stds = 10 #this is the maximum cv allowed for standards + p_value_chkstds = 0.05 #the p-value for the t-test between check standards must be greater than this + p_value_MC = 0.05 #the p-value for the t-test between matrix checks and top std must be greater than this + cv_flag_sample = 10 #this is the maximum cv allowed for samples + dups_perc_diff = 15.5 #this is the maximum percent difference allowed between duplicates + high_recovery_cutoff = 120 #this is the maximum percent recovery of SO4 allowed in spiked samples + low_recovery_cutoff = 80 #this is the minimum percent recovery of SO4 allowed in spiked samples + +#Standard concentrations - Update if running different standard curve: +# standard units are in uM + standards <- tibble( + IDs = c("Std 0", "Std 1", "Std 2", "Std 3", "Std 4", "Std 5"), + Conc = c(0, 5.0, 12.5, 25.0, 50.0, 100.0) + ) #uM + + chk_standards <- tibble( + IDs = c("ChkStd 0", "ChkStd 3", "ChkStd 4"), + Conc = c(0, 25.0, 50.0) + ) #uM + + mtx_standards <- tibble( + IDs = c("MC: 10ppt S5"), + Conc = c(100) + ) #uM + +#Spike concentration calc + #spike for these samples was 50 uL of the 100uM standard + Con1 <- 1000000 #conversion factor value for spike volumes (uL -> L) + spk_std <- 100 # uM S2- standard used + spkvol <- 50 # uL volume of spike added + spk_Conc <- spk_std*(spkvol/Con1) # umoles of S2- added to each spiked sample + sample_vol <- 250 # the sample volume without the spike is 250 uL + samp_vol_a <- 300 # the sample volume + +#Top standard Concentration- Update if running different standard curve: + Top_STD = 100 + + +#Metadata file path +Raw_Metadata = here(".." , "GCReW", "GCReW_Project_Treatment_Metadata.csv") + +#Significant Digits +sigdigs <- 3 + +``` + + +##Read in metadata and create similar sample IDs for matching to samples +```{r pull in metadata for later, include=FALSE} + +#read in metadata + +raw_metadata <- read.csv(Raw_Metadata) +#clean up columns in metadata file: +metadata <- raw_metadata %>% + filter(grepl("1-Meter", Nickname, ignore.case = TRUE)) %>% + mutate(Sample_Name = paste0(Sample.ID)) %>% + mutate(Month = sample_month) %>% + mutate(Year = sample_year) %>% + rename( + Sample_ID = Sample.ID, + Plot_Name = Plot, + ) %>% + dplyr::select(-Temp_Treatment) %>% + mutate(Treatment = ifelse( + CO2_Treatment == "Elevated" & + N_Treatment == "Amended", + "eCO2_N", + ifelse( + CO2_Treatment == "Elevated" & + N_Treatment == "Ambient", + "eCO2", + ifelse(CO2_Treatment == "Ambient" & + N_Treatment == "Amended" , "N" , "Ambient") + ) + )) + +``` + + +##Read in data +```{r read in plates,echo=FALSE,include=FALSE} + +#read in the csv files +dat<-read_plates( + files = Raw_plates,#list of all file paths + plate_names = plates , #list of plate names + well_ids_column = "Wells", # name to give column of well IDs (optional) + sep = "," # separator used in the csv file (optional) +) %>% + rename("Abs"=values, + "IDs"=values.2, + "Dilution"=values.3) +head(dat) + +``` + +##Remove High CV Stds +```{r, echo=FALSE} + +#filter for STDs +H2S_stds_raw <- dat %>% subset(IDs %like% "Std" | IDs %like% "Chk" | IDs %like% "MC") + +#Add in STD values +H2S_stds <- left_join(H2S_stds_raw, standards, by = "IDs") + +#Calculate CVs and add flags +H2S_STD_cv <- H2S_stds %>% group_by(Plate, IDs) %>% mutate(CV = cv(Abs)) %>% mutate(CV_Flag = ifelse(CV >= cv_flag_stds, "CV_High", "CV_Good")) %>% ungroup() + +#calculate new cv getting best cv from points if cv was high +H2S_STD_cv_new <- H2S_STD_cv %>% group_by(Plate, IDs) %>% + mutate(CV_New = map_dbl(row_number(), ~cv(Abs[-.x]))) %>% #Calculate CVs without 1 point + mutate(Removed = ifelse( #Choose Lowest CV if CV is high + CV_Flag == "CV_High", + ifelse( + CV_New == min(CV_New), + "RMVD", + "KEPT"), "CV_Good"), +CV2 = ifelse(CV_Flag == "CV_High", min(CV_New), CV), +Abs_rm = ifelse(Removed == "RMVD", NA, Abs)) %>% + mutate(Mean_Abs2 = mean(Abs_rm, na.rm = TRUE)) %>% + mutate(CV_Flag2 = ifelse(CV2 >= cv_flag_stds, "CV_High", "CV_Good")) %>% ungroup() + +#organize data +H2S_STD_CV_fin <- H2S_STD_cv_new %>% dplyr::select(Plate, + Wells, + Abs, + Removed, + IDs, + Dilution, + Conc, + Mean_Abs2, + CV2, + CV_Flag2) %>% + mutate(Mean_Abs = Mean_Abs2, CV_Flag = CV_Flag2, CV = CV2) %>% + dplyr::select(Plate, + Wells, Abs, + Removed, + IDs, + Dilution, + Conc, + Mean_Abs, + CV, + CV_Flag) + + +``` + + +##Check R2 & Remove Standards if Necessary +```{r, echo=FALSE} +split_data <- H2S_STD_CV_fin %>% filter(IDs %like% "Std") %>% filter(!IDs %like% "Chk") %>% dplyr::select(Plate, IDs, Conc, Mean_Abs, Abs, Removed, CV_Flag) %>% filter(!Removed == "RMVD") %>% #Split Data by Plate + distinct() %>% + group_by(Plate) %>% + group_split() + +#run regression and get coefficients by Run +Slope_H2S_raw_list <- map(split_data, ~ .x %>% mutate(Curve = "H2S", + R2 = summary(lm(Abs ~ Conc, data = .))$adj.r.squared , + Slope = coef(lm(Abs ~ Conc, data = .))[2], + Intercept = coef(lm(Abs ~ Conc, data = .))[1])) + + + Slope_H2S_raw <- bind_rows(Slope_H2S_raw_list) + + #check R2 and flag + Slope_H2S_Std_Crvs <- Slope_H2S_raw %>% dplyr::select(Plate, Curve, R2, Slope, Intercept) %>% distinct() %>% mutate(R2_Flag = ifelse(R2 >= r2_cutoff, "R2_Good", "R2_Bad")) + + #join standard curve CVs and regression values + R2_Check_Raw <- left_join(Slope_H2S_Std_Crvs, H2S_STD_CV_fin, by = "Plate") + + R2_Check <- R2_Check_Raw %>% + dplyr::select(Plate, + IDs, + Abs, + Removed, + Mean_Abs, + Conc, + R2, + Slope, + Intercept, + CV_Flag, + CV, + R2_Flag) %>% filter(IDs %like% "Std") %>% filter(!IDs %like% "Chk") %>% + distinct() + + #calculate concentrations from standard curve and separate removable points + + R2_Split <- R2_Check %>% mutate(RMVBL = ifelse(IDs %in% c("Std 0", "Std 1", "Std 5"), "No", "Yes")) %>% group_by(Plate) %>% dplyr::select(-Abs, -Removed) %>% distinct() %>% group_split() + + R2_New <- map( + R2_Split, + ~ .x %>% mutate( + Curve = "H2S", + R2_New = map_dbl(row_number(), ~ + summary(lm( + Mean_Abs[-.x] ~ Conc[-.x], data = pick(Mean_Abs, Conc) + ))$adj.r.squared) , + Slope_New = map_dbl(row_number(), ~ + coef(lm( + Mean_Abs[-.x] ~ Conc[-.x], data = pick(Mean_Abs, Conc) + ))[2]) , + Intercept_New = map_dbl(row_number(), ~ + coef(lm( + Mean_Abs[-.x] ~ Conc[-.x], data = pick(Mean_Abs, Conc) + ))[1]) + ) + ) %>% bind_rows() + + R2_Check_RMVBL <- R2_New %>% mutate(R2_New = round(R2_New, digits = 8), + CV = round(CV, digits = 8)) %>% group_by(Plate) %>% mutate(R2_New = ifelse(IDs %in% c("Std 0", "Std 1", "Std 5"), NA, R2_New)) %>% mutate(R2_RMV = ifelse( + R2_Flag == "R2_Bad", + ifelse(R2_New == max(R2_New, na.rm = TRUE), "RMVD", "KEPT"), + "R2_Good" + )) %>% mutate(R2_RMV_CV = ifelse( + R2_RMV == "R2_Good", + ifelse(CV_Flag == "CV_High", ifelse(CV == max(CV), "RMVD", "KEPT"), "KEPT"), + R2_RMV + )) %>% mutate(R2_RMVD = ifelse(is.na(R2_RMV_CV), "KEPT", R2_RMV_CV)) %>% dplyr::select(-R2_RMV, -R2_RMV_CV) + +R2_Removed_forPair <- R2_Check_RMVBL %>% dplyr::select(Plate, IDs, R2_RMVD) %>% distinct() + +H2S_STDs_Pair <- H2S_STD_CV_fin %>% filter(IDs %like% "Std") %>% filter(!IDs %like% "Chk") %>% dplyr::select(Plate, IDs, Conc, Mean_Abs, Abs, Removed, CV_Flag) %>% filter(!Removed == "RMVD") %>% distinct() %>% left_join(R2_Removed_forPair) + + + R2_Check_fin <- H2S_STDs_Pair %>% mutate(STD_ABS_rmv = ifelse(R2_RMVD == "RMVD", NA, Abs)) %>% group_by(Plate) %>% mutate(Points = ifelse("RMVD" %in% R2_RMVD, "Point_Removed", "ALL_KEPT")) %>% dplyr::select(Plate, IDs, Conc, STD_ABS_rmv, CV_Flag, Points) %>% ungroup() %>% na.omit() + + #separate plates for new regression + split_data_rmv <- R2_Check_fin %>% + distinct() %>% + group_by(Plate) %>% + group_split() + + #get new standard curve values + Slope_H2S_raw_list_rm <- map(split_data_rmv, ~ .x %>% mutate(Curve = "H2S", + R2 = summary(lm(STD_ABS_rmv ~ Conc, data = .))$adj.r.squared , + Slope = coef(lm(STD_ABS_rmv ~ Conc, data = .))[2], + Intercept = coef(lm(STD_ABS_rmv ~ Conc, data = .))[1])) + + Slope_H2S_raw_rm <- bind_rows(Slope_H2S_raw_list_rm) + + Slope_H2S_Std_Crvs_rm <- Slope_H2S_raw_rm %>% dplyr::select(Plate, Curve, R2, Slope, Intercept, CV_Flag, Points) %>% distinct() %>% mutate(R2_Flag = ifelse(R2 >= r2_cutoff, "R2_Good", "R2_Bad")) + + +``` + + +## Plot Standard Curves +```{r Plot all Standard Curves together, echo=FALSE} +##this is to see if there are any stds or plates that look off + +#Plot Std Crvs by plate +H2S_Curve <- ggplot(Slope_H2S_raw_rm, aes(STD_ABS_rmv, Conc, color = Plate, linetype = Points)) + geom_point(size = 3) + + geom_smooth(method = "lm", formula = "y ~ x", se = FALSE) + labs(title = "H2S Standard Curves", x = "Absorbance", y = "Concentration (uM)") + + theme_classic() +H2S_Curve + +#Add dates to plate and format data +STD_run_date <- left_join(Run_dates, Slope_H2S_Std_Crvs_rm, by = join_by(Plate)) +new_log_stds <- STD_run_date %>% dplyr::select(Plate, + Curve, + R2, + Slope, + Intercept, + Run_Date) %>% mutate(R2 = round(R2, digits = 4), Slope = round(Slope, digits = 4), Intercept = round(Intercept, digits = 4), ) %>% mutate(Run = "Current Runs") + + +#read in log file and format +log <- read.csv(log_path) +log_2 <- log %>% mutate(Run_Date = as.Date(as.character(Run_Date), format = "%Y-%m-%d"), Run = "Past Runs") +log_3 <- log_2[, -c(1)] +log_4 <- rbind(log_3, new_log_stds) + +unique_log <- log_4 %>% distinct(.keep_all = TRUE) + +#Calculate Mean and SD and calculate 2SD range for slope and intercept +mean_slope <- mean(unique_log$Slope, na.rm = TRUE) +sd_slope <- sd(unique_log$Slope, na.rm = TRUE) + +hi_2sd_slope <- mean_slope + 2*sd_slope + +lo_2sd_slope <- mean_slope - 2*sd_slope + +mean_int <- mean(unique_log$Intercept, na.rm = TRUE) +sd_int <- sd(unique_log$Intercept, na.rm = TRUE) + +hi_2sd_int <- mean_int + 2*sd_int + +lo_2sd_int <- mean_int - 2*sd_int + +#Plot Slope log +Slopes_chk <- ggplot(unique_log, aes(x = Run_Date, y = Slope, col = Run)) + + ylim(0.0045,0.018) + + scale_color_manual(values = c("Past Runs" = "grey27", "Current Runs" = "cyan3")) + + geom_abline(intercept = mean_slope - 2*sd_slope, slope = 0, linetype = "dashed", linewidth = 1.5, col = "red" )+ + geom_abline(intercept = mean_slope + 2*sd_slope, slope = 0, linetype = "dashed", linewidth = 1.5, col = "red" )+ + geom_point(size = 2) + + theme_classic()+ + ggtitle("Slope Log") + +#Plot Intercept log +ints_chk <- ggplot(unique_log, aes(x = Run_Date, y = Intercept, col = Run)) + + ylim(0.03, 0.15) + + scale_color_manual(values = c("Past Runs" = "grey27", "Current Runs" = "cyan3")) + + geom_abline(intercept = mean_int - 2*sd_int, slope = 0, linetype = "dashed", linewidth = 1.5, col = "red" )+ + geom_abline(intercept = mean_int + 2*sd_int, slope = 0, linetype = "dashed", linewidth = 1.5, col = "red" )+ + geom_point(size = 2) + + theme_classic()+ + ggtitle("Intercept Log") + +ints_chk + +Slopes_chk + +write.csv(unique_log, log_path) + +#Get done of original runs +Date_1 <-as.Date(new_log_stds$Run_Date[which(new_log_stds$Plate == "Plate1")]) + +#Check if Std Crvs are Within range and see if dates are close enough for combination +stdcrv_tagged <- new_log_stds %>% mutate( + In_Range_Slope = ifelse( + Slope >= hi_2sd_slope | + Slope <= lo_2sd_slope, + "Out of Range", + "In Range" + ), + In_Range_Int = ifelse( + Intercept >= hi_2sd_int | + Intercept <= lo_2sd_int, + "Out of Range", + "In Range" + ) +) %>% mutate( + Slope = ifelse(In_Range_Slope == "Out of Range", NA, Slope), + Intercept = ifelse(In_Range_Int == "Out of Range", NA, Intercept) +) %>% mutate(Date_Diff = abs(difftime(Date_1, Run_Date, units = "days"))) %>% mutate(Date_Close = ifelse(Date_Diff <= 2, "Yes", "No")) %>% mutate(Slope_Flag = ifelse(is.na(Slope), "Slope_Bad" , "Slope_Good"), Int_Flag = ifelse(is.na(Intercept), "Intercept_Bad" , "Intercept_Good")) %>% mutate( + Slope = ifelse(is.na(Intercept) | R2 <= r2_cutoff, NA, Slope), + Intercept = ifelse(is.na(Slope)| R2 <= r2_cutoff, NA, Intercept), + Curve_RMVD = ifelse(is.na(Slope) | + is.na(Intercept) | R2 <= r2_cutoff , "RMVD", "KEPT") +) + +#Calculate Combo Std Crv +stdcrv_filtered <- stdcrv_tagged %>% filter(Date_Close == "Yes") + +mean_slope_fin <- mean(stdcrv_filtered$Slope, na.rm = TRUE) + +mean_int_fin <- mean(stdcrv_filtered$Intercept, na.rm = TRUE) + +#Attach Slope and Intercept to Plates +Std_crv_calc <- stdcrv_tagged %>% mutate(Slope_Calc = ifelse(Date_Close == "Yes", mean_slope_fin, Slope), Int_Calc = ifelse(Date_Close == "Yes", mean_int_fin, Intercept)) %>% dplyr::select(Plate, Slope_Calc, Int_Calc, Curve_RMVD, Slope_Flag, Int_Flag) %>% as.data.frame() + +std_curves <- Std_crv_calc %>% dplyr::select(Plate, Curve_RMVD) %>% filter(Curve_RMVD != "RMVD") %>% distinct() + +Curve_Flags <- Std_crv_calc %>% dplyr::select(Plate, Slope_Flag, Int_Flag) %>% distinct() + +Curve_Flags_forJoin <- Curve_Flags %>% mutate(Slope_Flag = ifelse(Slope_Flag %like% "Good", "", Slope_Flag), Int_Flag = ifelse(Int_Flag %like% "Good", "", Int_Flag)) +``` + +## Return Flags For Standard Curve +```{r, echo=FALSE} + +STD_CRV_flags <- full_join(Slope_H2S_Std_Crvs_rm, Run_dates, by = join_by(Plate)) + +STD_CRV_flags_table1 <- STD_CRV_flags %>% dplyr::select(Plate, R2_Flag, CV_Flag) + +STD_CRV_flags_table2 <- Std_crv_calc %>% dplyr::select(Plate, Curve_RMVD) %>% mutate(Curve_RMVD = ifelse(Curve_RMVD == "RMVD", "REMOVED", Curve_RMVD)) + +knitr::kable(STD_CRV_flags_table1, format="markdown") + +knitr::kable(STD_CRV_flags_table2, format="markdown") + + +``` + +## Method Detection Limit +```{r, echo=FALSE} + +#get only lowest standard + STD_MDL_df <- H2S_STD_CV_fin %>% filter(IDs == "Std 1" + #, Removed != "RMVD" + ) %>% dplyr::select(Plate, Mean_Abs, IDs) %>% distinct() + + STD0_df <- H2S_STD_CV_fin %>% filter(IDs == "Std 0" + #, Removed != "RMVD" + ) %>% dplyr::select(Plate, Mean_Abs, IDs) %>% distinct() +#calculate the standard deviation of abs +stddev_mdl <- sd(STD_MDL_df$Mean_Abs) + +#Calculate Mean Std 0 +std0_mean <- mean(STD0_df$Mean_Abs) + +#calculate n +n <- length(STD_MDL_df$Mean_Abs) + +#Identify the proper Student's T for n-1 +StudentsT <-qt(.99,(n-1)) + +#Multiply Standard deviation by Student's T +STD_var <- (stddev_mdl*StudentsT) +MDL <- STD_var + std0_mean + +MDL_df <- as.data.frame(MDL) + +MDL_Plot <- ggplot() + + geom_bar(stat = 'identity', data = STD_MDL_df, aes(x = Plate, y = Mean_Abs, fill = IDs)) + + geom_bar(data = STD0_df, aes(x = Plate, y = Mean_Abs, fill = IDs), stat = 'identity') + + scale_fill_manual(name = "Standard:", values = c("Std 0" = "lightgreen", "Std 1" = "cornflowerblue")) + + geom_hline(yintercept = MDL, linetype = "dashed", linewidth = 1.5, color = "blue3") + + geom_label_repel(data = MDL_df, aes(x = 1.25, y = MDL + 0.015), label = paste0("MDL: ", signif(MDL, digits = sigdigs)), alpha = 0.7, color = "blue3") + + ggtitle(label = "H2S Minimum Detection Limit") + + labs(y = "Mean Absorbance") + + theme_classic() + +MDL_Plot +``` + +## Compare Check Standards to Standards +```{r, echo = FALSE} + +#subset datasets for comparison + +std0 <- subset(H2S_STD_CV_fin, IDs == "Std 0"& Plate %in% std_curves$Plate & !Removed == "RMVD") +std3 <- subset(H2S_STD_CV_fin, IDs == "Std 3"& Plate %in% std_curves$Plate & !Removed == "RMVD") +std4 <- subset(H2S_STD_CV_fin, IDs == "Std 4" & Plate %in% std_curves$Plate & !Removed == "RMVD") +std5 <- subset(H2S_STD_CV_fin, IDs == "Std 5" & Plate %in% std_curves$Plate & !Removed == "RMVD") + + +H2S_CHK_STD_CV_fin <- H2S_STD_CV_fin %>% filter(IDs %like% "ChkStd" | IDs %like% "ppt") +#Tag Check Standards and perform T Test +H2S_CHKs_a <- H2S_CHK_STD_CV_fin %>% + mutate(Std_ID = case_when( + IDs == "ChkStd 0" ~ paste0("Std 0"), + IDs == "ChkStd 3" ~ paste0("Std 3"), + IDs == "ChkStd 4" ~ paste0("Std 4"), + IDs %like% "S5" ~ paste0("Std 5") + ), + Chk_Abs = Abs, + Chk_Removed = Removed, + Chk_IDs = IDs, + Chk_Mean_Abs = Mean_Abs, + Chk_cv_flag = CV_Flag + ) %>% filter(!Chk_Removed == "RMVD") %>% + group_by(Std_ID,Plate) %>% + mutate( + Chk_pvalue = case_when( + Chk_IDs == "ChkStd 0" ~ t.test(std0$Abs, Chk_Abs,var.equal = T)$p.value[1], + Chk_IDs == "ChkStd 3" ~ t.test(std3$Abs, Chk_Abs,var.equal = T)$p.value[1], + Chk_IDs == "ChkStd 4" ~ t.test(std4$Abs, Chk_Abs,var.equal = T)$p.value[1], + Chk_IDs == "MC: 10ppt S5" ~ t.test(std5$Abs, Chk_Abs,var.equal = T)$p.value[1], + Chk_IDs == "MC: 20ppt S5" ~ t.test(std5$Abs, Chk_Abs,var.equal = T)$p.value[1] + ))%>% + ungroup() %>% + dplyr::select(Std_ID, Chk_IDs, Chk_pvalue, Chk_cv_flag, Chk_Mean_Abs, Plate) %>% distinct(.keep_all = TRUE) + +H2S_CHKs_1 <- H2S_CHKs_a %>% dplyr::select(-Chk_Mean_Abs) + +#Get Standard Values and set values for standards with no variance +H2S_STD_forCHK_a <- H2S_STD_CV_fin %>% filter(IDs %in% c("Std 0", "Std 3", "Std 4", "Std 5") ) %>% + mutate(Std_ID = IDs +) %>% filter(!Removed == "RMVD") %>% + dplyr::select(Plate, Std_ID, IDs, CV_Flag, Mean_Abs) %>% distinct(.keep_all = TRUE) + +H2S_STD_forCHK <- H2S_STD_forCHK_a %>% dplyr::select( -Mean_Abs) + +#join check standards with standards +Chk_Std_join <- full_join(H2S_CHKs_1, H2S_STD_forCHK, by = join_by(Std_ID, Plate)) + + +#flag data +Chk_Std_flags <- Chk_Std_join %>% mutate( + Chk_Flag_pv= ifelse( + Chk_pvalue > p_value_chkstds , + "Chk_Good", + "Chk_Bad" + ) + +) %>% mutate(CHK_Flag = paste0(gsub(" ", "", IDs), Chk_Flag_pv)) %>% + mutate(CHK_CV_Flag = paste0("Chk",gsub(" ", "", IDs), Chk_cv_flag)) + + #Organize Data for Plotting and Flagging +Chk_Flags <- Chk_Std_flags %>% group_by(Plate) %>% + mutate(Chk_Flag = ifelse(any(CHK_Flag %like% "Bad"), "Chk_Bad", "Chk_Good"), Chk_cv_flag = ifelse(any(CHK_CV_Flag %like% "High"), "Chk_CV_High", "Chk_CV_Good")) %>% + ungroup() %>% + mutate(CHK_CV_Flags = ifelse(CHK_CV_Flag %like% "High", paste0(gsub(" ", "", IDs), Chk_cv_flag), "Good")) %>% mutate(CHKs_Flag = ifelse(CHK_Flag %like% "Bad", CHK_Flag, "Good")) + +H2S_CHKs_plot <- H2S_CHKs_a %>% rename(IDs = Chk_IDs, Mean_Abs = Chk_Mean_Abs) %>% mutate(Type = "Check") %>% dplyr::select(-Chk_cv_flag,-Chk_pvalue) + +H2S_Std_chkplot <- H2S_STD_forCHK_a %>% dplyr::select(IDs, Mean_Abs, Std_ID, Plate) %>% mutate(Type = "Standard") + +Chk_flags_plot <- Chk_Flags %>% dplyr::select(Std_ID, Plate, CHKs_Flag, Chk_Flag_pv) %>% group_by(Std_ID,Plate) %>% distinct(.keep_all = TRUE) %>% mutate(Check_Flag = ifelse(Chk_Flag_pv %like% "Good", "Good", "Bad")) + +H2S_Chks_bind <- rbind(H2S_CHKs_plot, H2S_Std_chkplot) + +H2S_Chks_bind_1 <- left_join(H2S_Chks_bind, Chk_flags_plot, by = join_by(Std_ID,Plate)) + +H2S_Chks_plot_bind_a <- H2S_Chks_bind_1 %>% mutate(Plot_ID = ifelse(IDs %like% "Chk" | IDs %like% "MC", substr(IDs, 4, 8), IDs)) %>% mutate(Plot_ID = ifelse(Plot_ID %like% "10pp", "Matrix: 10ppt", Plot_ID )) +H2S_Chks_plot_bind <-H2S_Chks_plot_bind_a %>% filter(str_detect(Type, "Check")) %>% mutate(Plot_ID =as.factor(Plot_ID)) + +Check_Val <- H2S_Chks_plot_bind_a %>% filter(!str_detect(Plot_ID, "Check")) %>% group_by(Plot_ID) %>% mutate(Z = mean(Mean_Abs)) %>% dplyr::select(Plot_ID, Z) %>% distinct(.keep_all = TRUE) %>% filter(!Plot_ID %like% "10pp") %>% mutate(Plot_ID = ifelse(Plot_ID %like% "Std 5", "Matrix: 10ppt", Plot_ID )) %>% mutate(Plot_ID = as.factor(Plot_ID)) + +#Plot Check Standards +H2S_chk_plot <- ggplot(data = H2S_Chks_plot_bind, aes(x = Plate, y = Mean_Abs)) + + geom_bar(stat = 'identity', + position = position_dodge2(preserve = "single"), linewidth = 0.75, aes(fill = Check_Flag)) + + geom_hline(data = Check_Val, aes(yintercept = Z), linetype = "dashed", linewidth = 1, color = "darkblue") + + facet_wrap(.~Plot_ID) + + ylim(0, max(H2S_Chks_plot_bind$Mean_Abs) + 0.2) + + geom_label_repel(data = Check_Val, aes( x = "Plate1", y = Z + 0.25), label = "Mean Target Arbsorbance", alpha = 0.7, color = "darkblue") + + scale_fill_manual(values = c("Good" = "darkgreen", "Bad" = "darkred")) + + theme_classic() + labs(x = " ", y = "Absorbance", title = + "Check Stds: H2S with Confidence Interval") + + theme(legend.position = "bottom", axis.text.x = element_text( + angle = 90, + vjust = 0.5, + hjust = 1)) + + +H2S_chk_plot + +``` + +## Display Any Check Flags +```{r, echo=FALSE} +Chk_Flag_1 <- Chk_Flags %>% dplyr::select(Plate, CHKs_Flag) %>% filter(CHKs_Flag != "Good") + +CHK_CV_Flag_1 <- Chk_Flags %>% dplyr::select(Plate, CHK_CV_Flags) %>% filter(CHK_CV_Flags != "Good") + +knitr::kable(Chk_Flag_1, format="markdown") + +knitr::kable(CHK_CV_Flag_1, format="markdown") + +``` + + +##Calculate Sulfide Concentrations & Add Concentration Flags +```{r Calculate Sulfide Concentrations,echo=FALSE,include=FALSE} + +High_Std <- H2S_STD_CV_fin %>% filter(IDs == "Std 5") %>% mutate(Mean_Abs = round(Mean_Abs, digits = 4)) %>% ungroup() %>% dplyr::select(Plate, Mean_Abs) %>% distinct(.keep_all = TRUE) %>% rename(High_DL = Mean_Abs) + +#filter out stds and other experiments +raw_data <- dat %>% + filter(!str_detect(IDs, "Std")) %>% + filter(!str_detect(IDs, "MC")) + +#Calculate Concentrations and fix zeroes/negative values and flag conc + +joined_data <- right_join(Std_crv_calc, raw_data, by = join_by(Plate)) + +calc_data <- joined_data %>% mutate(Conc = ((Abs - Int_Calc) / Slope_Calc)*Dilution) %>% mutate(Conc = ifelse(Conc <= 0, 0, Conc)) + +dl_data <- right_join(High_Std, calc_data, by = join_by(Plate)) + +``` + +##Remove High CV Samples and Average +```{r, echo=FALSE} + +#Calculate CVs +H2S_SPL_cv <- dl_data %>% group_by(Plate, IDs) %>% mutate(Mean_Conc = mean(Conc)) %>% mutate(Conc_SD = sd(Conc)) %>% mutate(CV = cv(Conc)) %>% mutate(CV_Flag = ifelse(CV >= cv_flag_stds, "CV_High", "CV_Good")) %>% mutate(Mean_Abs = mean(Abs)) %>% mutate(Conc_Flag = ifelse(Mean_Abs < MDL, "bdl", ifelse(Mean_Abs > High_DL, "adl", "Within_Range"))) %>% ungroup() + +#calculate new cv getting best cv from points if cv was high +H2S_SPL_cv_new <- H2S_SPL_cv %>% group_by(Plate, IDs) %>% + mutate(CV_New = map_dbl(row_number(), ~cv(Conc[-.x]))) %>% #Calculate CVs without 1 point + mutate(Removed = ifelse( #Choose Lowest CV if CV is high + CV_Flag == "CV_High", + ifelse( + CV_New == min(CV_New), + "RMVD", + "KEPT"), "CV_Good"), +CV2 = ifelse(CV_Flag == "CV_High", min(CV_New), CV), +Conc_rm = ifelse(Removed == "RMVD", NA, Conc)) %>% + mutate(Mean_Conc2 = mean(Conc_rm, na.rm = TRUE)) %>% + mutate(CV_Flag2 = ifelse(CV2 >= cv_flag_sample, "CV_High", "CV_Good")) %>% + mutate(Conc_SD2 = sd(Conc_rm, na.rm = TRUE)) %>% ungroup() + +H2S_SPL_CV_fin <- H2S_SPL_cv_new %>% dplyr::select(Plate, + Wells, + Conc, + Removed, + IDs, + Dilution, + Conc, + Mean_Conc2, + Conc_SD2, + CV2, + CV_Flag2, + Conc_Flag) %>% + mutate(Mean_Conc = Mean_Conc2, CV_Flag = CV_Flag2, SD_Conc = Conc_SD2, CV = CV2) %>% + dplyr::select(Plate, Conc, + Removed, + IDs, + Dilution, + Mean_Conc, + SD_Conc, + CV, + CV_Flag, + Conc_Flag) + +``` + +## Plot Samples +```{r, echo=FALSE} + +#Filter samples and mark reruns +H2S_Spl_pre_viz <- H2S_SPL_cv_new %>% mutate(IDs = toupper(IDs)) %>% + filter(str_detect(IDs, "SP") | str_detect(IDs, "SC")) %>% + filter(!str_detect(IDs, "DUP")) %>% + filter(!str_detect(IDs, "SPIKE")) %>% + dplyr::select(Plate, IDs, Mean_Conc, Conc_SD, CV_Flag) %>% distinct(.keep_all = TRUE) %>% mutate(IDs = ifelse(Plate %like% "rr", paste0(IDs, "_RR"), IDs)) %>% mutate(ForPlot = ifelse(row_number() <= 80, "A", "B")) + +#Plot Samples before corrections +H2S_Spl_Plot_Pre <- ggplot(H2S_Spl_pre_viz, aes(y = Mean_Conc, x = IDs, fill = CV_Flag)) + + geom_bar(stat = 'identity', + position = position_dodge2(), + linewidth = 0.75, + col = "white") + + scale_fill_manual(values = c( + "CV_Good" = "green2", + "CV_High" = "pink2" + )) + + labs(y = "Sulfide (uM)", x = "Sample ID") + + geom_errorbar( + aes(ymin = Mean_Conc - Conc_SD, ymax = Mean_Conc + Conc_SD), + width = 0.3, + position = position_dodge(.1) + ) + + theme_classic() + + facet_wrap(~ ForPlot ,, scale = "free_x", ncol = 1) + + theme(legend.position = "bottom", axis.text.x = element_text( + angle = 90, + vjust = 0.5, + hjust = 1) + ) + + ggtitle("Sample triplicate means and sd dev before bad reps removed") + + +H2S_Spl_Plot_Pre + +H2S_Spl_rmv_viz <- H2S_SPL_CV_fin %>% mutate(IDs = toupper(IDs)) %>% + filter(str_detect(IDs, "SP") | str_detect(IDs, "SC")) %>% + filter(!str_detect(IDs, "DUP")) %>% + filter(!str_detect(IDs, "SPIKE")) %>% + dplyr::select(Plate, IDs, Mean_Conc, SD_Conc, CV_Flag, Conc_Flag) %>% distinct(.keep_all = TRUE) %>% mutate(IDs = ifelse(Plate %like% "rr", paste0(IDs, "_RR"), IDs)) %>% mutate(ForPlot = ifelse(row_number() <= 80, "A", "B")) + +#Plot samples after Corrections +H2S_Spl_Plot_CV <- ggplot(H2S_Spl_rmv_viz, aes(y = Mean_Conc, x = IDs, fill = CV_Flag)) + + geom_bar(aes(col = Conc_Flag), stat = 'identity', + position = position_dodge(), + linewidth = 0.75) + + scale_fill_manual(values = c( + "CV_Good" = "green2", + "CV_High" = "pink2" + )) + + scale_color_manual(values = c("Within_Range" = "darkgreen", "adl" = "red3", "bdl" = "blue3" )) + + labs(y = "Sulfide (uM)", x = "Sample ID") + + geom_errorbar( + aes(ymin = Mean_Conc - SD_Conc, ymax = Mean_Conc + SD_Conc), + width = 0.3, + position = position_dodge(.1) + ) + + theme_classic() + + facet_wrap(~ForPlot, scales = "free_x", ncol = 1) + + theme(legend.position = "bottom", axis.text.x = element_text( + angle = 90, + vjust = 0.5, + hjust = 1), + strip.text = element_blank(), + strip.background = element_blank() + ) + + ggtitle("Sample triplicate means and sd dev after bad reps removed") + + +H2S_Spl_Plot_CV + + + +``` + + +## Duplicate QAQC + +```{r,echo=FALSE} + +#pull out any rows that have "Dup" in the ID column and tag reruns +DUP_start <- H2S_SPL_CV_fin %>% mutate(Dup_ID = gsub(" ", "", substr(IDs, 1, 6)), + Dup = ifelse(IDs %like% "Dup", "Dup", "Org")) %>% mutate(Dup_ID = ifelse(Plate %like% "rr", paste0(Dup_ID, "_RR"), Dup_ID)) + +#separate dups from originals and tag for pairing + +dups_only <- DUP_start %>% filter(Dup == "Dup") %>% dplyr::select(Dup_ID, Mean_Conc, SD_Conc, Plate) %>% rename(Dup_Conc = Mean_Conc, Dup_SD = SD_Conc) %>% distinct(.keep_all = TRUE) + +no_dups <- DUP_start %>% filter(!Dup == "Dup") + +dup_spls_l <- dups_only %>% dplyr::select(Dup_ID) %>% distinct(.keep_all = TRUE) + +dup_spls <- no_dups %>% filter(Dup_ID %in% as.vector(dup_spls_l$Dup_ID)) %>% dplyr::select(Dup_ID, Mean_Conc, SD_Conc, Plate, IDs) %>% distinct(.keep_all = TRUE) + +dup_join <- full_join(dups_only, dup_spls, by = join_by(Dup_ID, Plate)) %>% na.omit() + +#Calculate Percent difference and Flag +dup_flags <- dup_join %>% + mutate(Diff_P = (abs(100 * (Mean_Conc - Dup_Conc) / mean(c(Mean_Conc, Dup_Conc))))) %>% + mutate(Dup_Flag = ifelse(Diff_P >= dups_perc_diff, "Dup_Bad", "Dup_Good")) + +#oraganize data for flagging and plotting +dup_flags_1 <- dup_flags %>% dplyr::select(Dup_ID, Dup_Flag, Diff_P, Plate) + +Dup_for_plot_1 <- DUP_start %>% dplyr::select(Plate, Mean_Conc, Dup_ID, IDs) %>% distinct(.keep_all = TRUE) %>% filter(Dup_ID %in% as.vector(dup_spls_l$Dup_ID)) %>% + left_join(dup_flags_1, by = join_by(Dup_ID, Plate)) %>% + mutate(Dup = ifelse(IDs %like% "Dup", "Duplicate", "Original")) %>% + dplyr::select(-IDs, -Mean_Conc, -Dup) %>% distinct(.keep_all = TRUE) %>% na.omit + +#plot Data +Dup_Plot <- ggplot(Dup_for_plot_1, + aes( + x = Plate, + y = Diff_P + )) + + geom_bar( + aes(fill = Dup_Flag), + stat = 'identity', + position = position_dodge2(preserve = "single"), + linewidth = 0.9 + ) + + geom_label_repel(data = as.data.frame(1), aes(x = "Plate1", y=17.5), label= "Percent Difference Cutoff", color = "red3", alpha = 0.7) + + geom_hline(aes(yintercept = dups_perc_diff), linetype = "dashed", linewidth = 1.5, color = "red3") + + labs(y = "Percent Difference", x = "Sample ID") + + scale_fill_manual(values = c( + "Dup_Good" = "darkgreen", + "Dup_Bad" = "darkred" + )) + + theme_classic()+ + theme(legend.position = "bottom") + + ggtitle("H2S Duplicates") + +Dup_Plot + + +``` + +## Display Dup Flags + +```{r, echo=FALSE} +Dup_Flag_1 <- dup_flags %>% group_by(Plate) %>% mutate(Dup_Flags = ifelse("Dup_Bad" %in% Dup_Flag, "Dup_Bad", "Dup_Good")) %>% dplyr::select(Plate, Dup_Flags) %>% rename(Dup_Flag = Dup_Flags) %>% distinct(.keep_all = TRUE) + +Dup_Flags_1 <-Dup_Flag_1 %>% mutate(Dup_Flags = paste0(Dup_Flag, "-", Plate)) + +Dup_Flags_2 <- Dup_Flags_1 %>% dplyr::select(Plate, Dup_Flag) %>% group_by(Plate) %>% mutate(Duplicate_Flag = ifelse("Dup_Bad" %in% Dup_Flag, "Dup_Bad", "")) %>% dplyr::select(Plate, Duplicate_Flag) %>% rename(Dup_Flag = Duplicate_Flag) %>% distinct(.keep_all = TRUE) + +Bad_Dups <- dup_flags %>% filter(str_detect(Dup_Flag, "Dup_Bad")) + +Bad_D_N <- length(Bad_Dups$Dup_Flag) + +Total_D_N <- length(dup_flags$Dup_Flag) + +ifelse(Bad_D_N/Total_D_N > 0.4, paste0("<60% of Dups Pass, Rerun"), paste0(">60% Dups Pass") ) + +Duplicate_Flag <- ifelse(Bad_D_N/Total_D_N > 0.4, paste0(" >40% Dups Fail"), "" ) + +knitr::kable(Dup_Flag_1, format="markdown") + + +``` + +## Spike QAQC +```{r, echo=FALSE} +#pull out any rows that have "Spk" in the ID column +SPK_start <- H2S_SPL_CV_fin %>% mutate(Spk_ID = gsub(" ", "", substr(IDs, 1, 6)), + Spk = ifelse(IDs %like% "Spike", "Spk", "Org")) %>% mutate(Spk_ID = ifelse(Plate %like% "rr", paste0(Spk_ID, "_RR"), Spk_ID)) +#separate spikes from originals +spks_only <- SPK_start %>% filter(Spk == "Spk") %>% dplyr::select(Spk_ID, Mean_Conc, SD_Conc, Dilution, Plate) %>% rename(Spk_Conc = Mean_Conc, + Spk_SD = SD_Conc, + Spk_Dilution = Dilution) %>% distinct(.keep_all = TRUE) + +no_spks <- SPK_start %>% filter(!Spk == "Spk") + +spls_l <- no_spks %>% dplyr::select(Spk_ID) %>% distinct(.keep_all = TRUE) + +spk_spls_l <- spks_only %>% dplyr::select(Spk_ID) %>% distinct(.keep_all = TRUE) + +spk_spls <- no_spks %>% filter(Spk_ID %in% as.vector(spk_spls_l$Spk_ID)) %>% dplyr::select(Spk_ID, Mean_Conc, SD_Conc, Plate, IDs, Dilution) %>% distinct(.keep_all = TRUE) + +SPK_only <- spks_only %>% filter(Spk_ID %in% as.vector(spls_l$Spk_ID)) + +spk_join <- full_join(SPK_only, spk_spls, by = join_by(Spk_ID, Plate)) + +#Calculate recovery and flag data +spk_flags <- spk_join %>% mutate( + Spl_mol = (sample_vol / Con1) * (Mean_Conc / Dilution), + Spk_mol = ((sample_vol + spkvol) / Con1) * (Spk_Conc / Spk_Dilution), + Spk_exp = Spl_mol + spk_Conc, + Spk_recovery = (Spk_mol/Spk_exp) * 100) %>% + mutate( + Spk_Flag = ifelse( + Spk_recovery >= high_recovery_cutoff | + Spk_recovery <= low_recovery_cutoff, + "Spk_Bad", + "Spk_Good" + ) + ) + +#organize data for flagging and plotting +spk_flags_1 <- spk_flags %>% dplyr::select(Spk_ID, Spk_Flag, Spk_recovery, Plate) %>% na.omit() + +Spk_for_plot_a <- SPK_start %>% dplyr::select(Plate, Mean_Conc, Spk_ID, IDs) %>% + distinct(.keep_all = TRUE) %>% + filter(Spk_ID %in% as.vector(spk_spls_l$Spk_ID)) %>% + left_join(spk_flags_1, by = join_by(Spk_ID, Plate)) %>% + mutate(Spk = ifelse(IDs %like% "Spike", "Spike", "Original")) %>% + filter(Spk_ID %in% as.vector(spls_l$Spk_ID)) + +Spk_for_plot_1 <- Spk_for_plot_a %>% dplyr::select(Plate, Spk_ID, Spk_recovery, Spk_Flag) %>% na.omit() %>% distinct(.keep_all = TRUE) + +#plot data +Spk_Plot <- ggplot(Spk_for_plot_1, + aes( + x = Plate, + y = Spk_recovery + )) + + geom_rect(aes(xmin=0, xmax=Inf, ymin=low_recovery_cutoff, ymax=high_recovery_cutoff), alpha = 0.25, fill ="palegreen") + + geom_bar( aes(fill = Spk_Flag), + stat = 'identity', + position = position_dodge2(preserve = "single"), + linewidth = 0.9 + ) + + geom_hline(aes(yintercept = high_recovery_cutoff), linetype = "dashed", color = "green3", linewidth = 1.5) + + geom_hline(aes(yintercept = low_recovery_cutoff), linetype = "dashed", color = "green3", linewidth = 1.5) + + geom_label_repel(data = as.data.frame(1),aes(x = "Plate1", y=high_recovery_cutoff - 7.5), label= "Acceptable Recovery Range", color = "darkgreen", alpha = 0.7) + + labs(y = "Spike Recovery (%)", x = "Plate") + + scale_fill_manual(values = c( + "Spk_Good" = "darkgreen", + "Spk_Bad" = "darkred" + )) + + theme_classic() + + theme(legend.position = "bottom") + + ggtitle("H2S Spikes") + +Spk_Plot + + +``` + +## Display Spike Flags +```{r, echo=FALSE} + +#Check if all Spikes are paired +ifelse(all(as.vector(spk_spls_l$Spk_ID) %in% as.vector(spls_l$Spk_ID)), paste0("Spikes Paired"), paste0("Spike Missing Pair")) + +#Format Data frame +Spk_Flag_1 <- spk_flags %>% dplyr::select(Plate, IDs, Spk_Flag) %>% na.omit() + +#Attach Plate to Flag +Spk_Flags_1 <-Spk_Flag_1 %>% group_by(Plate) %>% mutate(Spk_Flags_T = ifelse( "Spk_Bad" %in% Spk_Flag, paste0("Spk_Bad"), paste0("Spk_Good"))) %>% mutate(Spk_Flags = paste0(Spk_Flags_T, "-", Plate))%>% ungroup() +#If any Spikes in Plate are bad, then flag plate +Spk_Flags_2 <- Spk_Flags_1 %>% dplyr::select(Plate, Spk_Flag) %>% group_by(Plate) %>% mutate(Spike_Flag = ifelse("Spk_Bad" %in% Spk_Flag, "Spk_Bad", "")) %>% dplyr::select(Plate, Spike_Flag) %>% rename(Spk_Flag = Spike_Flag) %>% distinct(.keep_all = TRUE) + +Spk_disp <- Spk_Flags_1 %>% dplyr::select(Plate, Spk_Flags_T) %>% rename(Spike_Flag = Spk_Flags_T) %>% distinct(.keep_all = TRUE) %>% na.omit() + +knitr::kable(Spk_disp, format="markdown") + +bad <- Spk_Flag_1 %>% filter(Spk_Flag %like% "Bad") + +length_bad <- length(as.vector(bad$Spk_Flag)) + +length_all <- length(as.vector(Spk_Flag_1$Spk_Flag)) + +ifelse(length_bad/length_all > 0.4, paste0("<60% of Spikes Pass, Rerun"), paste0("Spikes Pass") ) + +Spike_Flag <- ifelse(length_bad/length_all > 0.4, paste0(">40% Spikes Fail"), "" ) + +``` + + +## Merge samples with Metadata & check all samples are present +```{r check sample ids with metadata, echo=FALSE} +#Get Samples Only +H2S_spls_md <- H2S_SPL_CV_fin %>% mutate(IDs = toupper(IDs)) %>% + filter(str_detect(IDs, "SP") | str_detect(IDs, "SC")) %>% + filter(!str_detect(IDs, "DUP")) %>% + filter(!str_detect(IDs, "SPIKE")) + +#Check for reruns and replace +H2S_spl_rrn <- H2S_spls_md %>% + filter(Plate %like% "rr") %>% + dplyr::select(IDs, Mean_Conc, Conc_Flag) %>% + rename(RRN_Conc = Mean_Conc, Conc_Flag_rr = Conc_Flag) %>% + distinct(.keep_all = TRUE) + +RRN_IDs <- as.vector(H2S_spl_rrn$IDs) + +H2S_spl_og <- H2S_spls_md %>% + filter(!Plate %like% "rr") %>% + dplyr::select(IDs, Mean_Conc, Conc_Flag, Plate, CV_Flag, Dilution, CV) %>% + distinct(.keep_all = TRUE) %>% + mutate(Rerun = ifelse(IDs %in% RRN_IDs, "RRN", "Org")) + +H2S_spl_rr_join <- full_join(H2S_spl_rrn,H2S_spl_og, by = join_by(IDs) ) + +Samples_Tagged <- H2S_spl_rr_join %>% mutate( + Conc = ifelse(Rerun == "RRN", RRN_Conc, Mean_Conc), + Conc_Flag = ifelse(Rerun == "RRN", Conc_Flag_rr, Conc_Flag) +) %>% dplyr::select(IDs, Conc, Conc_Flag, CV_Flag, Plate, Dilution, CV) %>% rename(Sample_ID = IDs) %>% ungroup() %>% group_by(Sample_ID) %>% mutate( + Min_CV = ifelse(CV == min(CV), "KEEP", "RMV"), # get if CV is lowest of reruns + Within_Range = "Within_Range" %in% Conc_Flag, #Get if any are within range + BDL = "bdl" %in% Conc_Flag, #get if any are below detection limit + Max_Dil = max(Dilution), #get maximum dilution of reruns + Min_Dil = min(Dilution),#get minimum dilution of reruns + All_Good = all(Conc_Flag == "Within_Range") & all(CV_Flag == "CV_Good"), #get if all are within range and good cv + CV_Check = CV == min(CV[which(Dilution == Max_Dil)]), #Get if CV is lowest of highest dilution for reruns + Number = length(Conc) #get number of times ran +) %>% ungroup() %>% + mutate(Remove = ifelse(Number == 1, #check if sample was reran + "KEEP", + ifelse(All_Good, #check if multiple samples meet all criteria + ifelse(Min_CV == "KEEP", #Keep only lowest CV + "KEEP1", + "RMV1"), + ifelse(Conc_Flag == "Within_Range" & CV_Flag == "CV_Good", #If only one sample meets all criteria keep that one + "KEEP2", ifelse(Conc_Flag == "Within_Range", "KEEP2a", + ifelse(!(Within_Range) & BDL, #Check if none are within range but are under detection limit + ifelse(Dilution == Min_Dil, #keep lowest dilution + "KEEP3", + "RMV3"), + ifelse(!(Within_Range) & CV_Check, #if all are above detection limit keep lowest CV of highest dilution + "KEEP4", + "RMV4") + ) + ) + )))) + +Samples <- Samples_Tagged %>% filter(Remove %like% "KEEP") + +#check to see if all samples are present in the metadata +all_present <- all(metadata$Sample_Name %in% Samples$Sample_ID) + +if (all_present) { + message("All sample IDs are present in data") +} else { + message("Some sample IDs are missing from data.") + + # Optional: Which ones are missing? + missing_ids <- setdiff(metadata$Sample_Name, Samples$Sample_ID) + print(missing_ids) +} + + +#merge metadata with sample run data +merged_data <- metadata %>% + mutate(Sample_ID = paste0("\\b", Sample_ID, "\\b")) %>% + fuzzyjoin::regex_left_join(Samples, ., by = c(Sample_ID = "Sample_Name")) + +#might want to include a flag or something to see that all the samples are included? + +``` + + +##Add Flags +```{r, echo=FALSE} + +#Get only bad flags for each plate and check +Chk_Flags_All <- Chk_Flags %>% dplyr::select(Plate, CHKs_Flag) %>% filter(CHKs_Flag %like% "Bad") %>% na.omit() %>% distinct(.keep_all = TRUE) %>% group_by(Plate) %>% + summarise( + CHKSTD_Flags = paste(CHKs_Flag, collapse = ", "), + .groups = 'drop' # Drops the grouping structure after summarizing + ) + + +STD_Flags_All <- STD_CRV_flags %>% dplyr::select(Plate, R2_Flag, CV_Flag) %>% mutate(STDCV_Flags = paste0("STD", CV_Flag)) %>% dplyr::select(-CV_Flag) %>% mutate( + R2_Flag = ifelse(R2_Flag %like% "Good", NA, R2_Flag), + STDCV_Flags = ifelse(STDCV_Flags %like% "Good", NA, STDCV_Flags) +) %>% na.omit() + +Flags_Int <- tibble(Plate = c(plates)) + +#Join Flags + +Flags_Joined_1 <-left_join(Flags_Int, Dup_Flags_2, by = join_by(Plate)) + +Flags_Joined_2 <- left_join(Flags_Joined_1, Spk_Flags_2, by = join_by(Plate)) + +Flags_Joined_3 <- left_join(Flags_Joined_2, Chk_Flags_All, by = join_by(Plate)) + +Flags_Joined_4 <- left_join(Flags_Joined_3, STD_Flags_All, by = join_by(Plate)) + +Flags_Joined <- left_join(Flags_Joined_4, Curve_Flags_forJoin, by = join_by(Plate)) + + +Flags_Joined[Flags_Joined == "NA"] <- NA + +#Merge Flags into one column +Flags <- Flags_Joined %>% replace(is.na(.), "") %>% mutate( + H2S_Flags = paste0( + Spk_Flag, + " ", + Dup_Flag, + " ", + CHKSTD_Flags, + " ", + R2_Flag, + " ", + STDCV_Flags, + " ", + Slope_Flag, + " ", + Int_Flag + ) +) %>% dplyr::select(Plate, H2S_Flags) + +#Add Flags to data +flagged_data <- left_join(merged_data, Flags, by = join_by(Plate)) + + +df_all_clean <- flagged_data %>% dplyr::select(-Plate) + +``` + +##Organize Data +```{r, echo=FALSE} +#check results +#head(Samples) + +#pull out what we need + +df_all_clean_cols <- df_all_clean %>% + dplyr::select( + Site, + Project, + Year, + Month, + Community, + Nickname, + Plot_Name, + Depth_cm, + CO2_Treatment, + N_Treatment, + Conc, + Conc_Flag, + CV_Flag, + H2S_Flags + ) + +final_data_labeled <- df_all_clean_cols %>% + mutate( + Run_notes = Run_notes,# new column with notes about the run + Analysis_rundate = Run_Date) + +#rename columns +org_labeled_fin_data <- final_data_labeled %>% + rename( + H2S_Conc_uM = Conc, + H2S_Conc_Flag = Conc_Flag, + Plot = Plot_Name, + H2S_CV_Flag = CV_Flag + ) + +#Order Columns for Final Data Frame +All_Clean_Data <- org_labeled_fin_data %>% + dplyr::select( + Site, + Project, + Year, + Month, + Community, + Nickname, + Plot, + Depth_cm, + CO2_Treatment, + N_Treatment, + H2S_Conc_uM, + H2S_Conc_Flag, + H2S_CV_Flag, + H2S_Flags, + Analysis_rundate, + Run_notes + ) +#head(Samples1) + +``` + + +## Visualize Data +```{r Visualize Data, echo=FALSE} +cat("Visualize Data") + +### Ammonia +H2S_forplot <- All_Clean_Data + +#need to work out how best to plot these data + + H2S_forplot <- H2S_forplot %>% + mutate(Treatment = ifelse( + CO2_Treatment == "Elevated" & + Community == "SPPA", + "eCO2_SPPA", + ifelse( + CO2_Treatment == "Elevated" & + Community == "SCAM", + "eCO2_SCAM", + ifelse(CO2_Treatment == "Ambient" & + Community == "SPPA" , "aCO2_SPPA" , "aCO2_SCAM") + ) + )) %>% + mutate(CO2_Treatment = ifelse(CO2_Treatment == "Ambient", "aCO2", "eCO2")) %>% + mutate(Order = ifelse(CO2_Treatment == "Ambient", "1", "2")) + + H2S_forplot <- H2S_forplot[order(H2S_forplot$CO2_Treatment), ] + +viz_H2S_plot2 <- ggplot(data = H2S_forplot, aes( + x = factor(as.factor(CO2_Treatment), levels = c("eCO2", "aCO2")), + y = H2S_Conc_uM, + color = as.factor(Treatment), + fill = as.factor(Treatment) +)) + + geom_bar( + stat = "identity", + position = position_dodge2(padding = 0.5, preserve = "single") + ) + + facet_grid(Depth_cm ~ ., scales = "fixed", space = "free_x") + + scale_fill_manual( + values = c( + "eCO2_SPPA" = "#EAC435", + "eCO2_SCAM" = "#149911", + "aCO2_SPPA" = "white", + "aCO2_SCAM" = "white" + ), + name = "Treatment:", + breaks = c("eCO2_SPPA", "eCO2_SCAM", "aCO2_SPPA", "aCO2_SCAM"), + labels = c("eCO2_SPPA", "eCO2_SCAM", "aCO2_SPPA", "aCO2_SCAM") + ) + + scale_color_manual(values = c( + "eCO2_SPPA" = "#EAC435", + "eCO2_SCAM" = "#149911", + "aCO2_SPPA" = "#EAC435", + "aCO2_SCAM" = "#149911" + ), + name = "Treatment:", + breaks = c("eCO2_SPPA", "eCO2_SCAM", "aCO2_SPPA", "aCO2_SCAM"), + labels = c("eCO2_SPPA", "eCO2_SCAM", "aCO2_SPPA", "aCO2_SCAM") + ) + + theme_classic() + + labs(x = " ", + y = "H2S (uM)", + title = "CO2xCOMM: Porewater Methane", + fill = "CO2 Treatment:", + color = "Community:") + + theme(legend.position = "right") + + scale_x_discrete(drop = TRUE) + + theme( + axis.text.x = element_text(angle = 0, hjust = 0.5), + panel.border = element_rect( + color = "black", + fill = NA, + linewidth = 0.8 + ) + ) + +coord_flip() +print(viz_H2S_plot2) + + +``` +```{r, echo = FALSE} +#ensure points are in correct order +H2S_forplot <- H2S_forplot[order(H2S_forplot$Depth_cm), ] + +color1 <- c("SC1", "SC2", "SP1", "SP2") +color2 <- c("SC6", "SC4", "SP4", "SP5") +color3 <- c("SC9", "SC8", "SP8", "SP9") +color4 <- c("SC10", "SC12", "SP10", "SP11") +color5 <- c("SC14", "SC15", "SP14", "SP13") + +H2S_forplot <- H2S_forplot %>% + mutate( + Plot_Color = case_when( + Plot %in% color1 ~ "Color1", + Plot %in% color2 ~ "Color2", + Plot %in% color3 ~ "Color3", + Plot %in% color4 ~ "Color4", + Plot %in% color5 ~ "Color5" + ) + ) + +#make plot +viz_H2S_plot_2 <- ggplot(data = H2S_forplot, aes(x = H2S_Conc_uM, y = as.numeric(Depth_cm), color = Plot_Color)) + + geom_point(size = 3) + + geom_path(linewidth = 1) + + scale_color_manual( + values = c( + "Color1" = "#FFD500", + "Color2" = "#00D0FF", + "Color3" = "#FF0075", + "Color4" = "#80d280", + "Color5" = "#ff6040" + ), + labels = c("1", "2", "3", "4", "5") + ) + + facet_grid(Treatment ~ ., scales = "fixed") + + labs( + x = "H2S (uM)", + y = "Depth (cm)", + title = "CO2xCOMM: Porewater H2S by Replicate", + color = "Replicate" + ) + + scale_y_reverse(breaks = c(20, 40, 80), limits = c(90, 10)) + + theme_classic() + + theme( + axis.text.x = element_text(angle = 0, hjust = 0.5), + panel.border = element_rect( + color = "black", + fill = NA, + linewidth = 0.8 + ) + ) + +viz_H2S_plot_2 +``` + + +##Export Data +```{r, echo=FALSE} + + Rerun_Data <- All_Clean_Data %>% filter(H2S_Conc_Flag != "Within Range" | H2S_CV_Flag %like% "High") + +if(After_Reruns == "YES"){ + write.csv(All_Clean_Data, final_path)} else { + write.csv(Rerun_Data, rerun_path) } +#end +``` + + +### END \ No newline at end of file diff --git a/CO2xCOMM/Porewater/Sulfide/2026/Processed Data/LTREB_2M_H2S_QAQC_2026.csv b/CO2xCOMM/Porewater/Sulfide/2026/Processed Data/LTREB_2M_H2S_QAQC_2026.csv new file mode 100644 index 0000000..357fc6b --- /dev/null +++ b/CO2xCOMM/Porewater/Sulfide/2026/Processed Data/LTREB_2M_H2S_QAQC_2026.csv @@ -0,0 +1,219 @@ +"","Plate","Curve","R2","Slope","Intercept","Run_Date","Run" +"1",NA,"H2S",0.991219025,0.01093912,0.100689277,2025-09-22,"Past Runs" +"2",NA,"H2S",0.993877242,0.011939201,0.06915697,2025-09-22,"Past Runs" +"3",NA,"H2S",0.993801685,0.00988706,0.089656986,2025-09-22,"Past Runs" +"4",NA,"H2S",0.98902287,0.011446925,0.096027164,2025-09-19,"Past Runs" +"5",NA,"H2S",0.994548336,0.011899625,0.083277661,2025-09-19,"Past Runs" +"6",NA,"H2S",0.992796039,0.009941877,0.087862342,2025-09-19,"Past Runs" +"7",NA,"H2S",0.997865585,0.011856306,0.066974671,2025-09-19,"Past Runs" +"8",NA,"H2S",0.986077314,0.012606847,0.075308108,2025-09-19,"Past Runs" +"9",NA,"H2S",0.992846269,0.01106119,0.083271756,2025-09-19,"Past Runs" +"10",NA,"H2S",0.989586556,0.012257337,0.086131432,2025-09-18,"Past Runs" +"11",NA,"H2S",0.994028851,0.011363046,0.089013852,2025-09-18,"Past Runs" +"12",NA,"H2S",0.986483002,0.012786783,0.079924043,2025-09-18,"Past Runs" +"13",NA,"H2S",0.987456283,0.010471189,0.097437793,2025-09-18,"Past Runs" +"14",NA,"H2S",0.990170085,0.011201815,0.080205858,2025-09-18,"Past Runs" +"15",NA,"H2S",0.994921447,0.011747968,0.0821679,2025-09-18,"Past Runs" +"16",NA,"H2S",0.988565262,0.011839841,0.069910825,2025-07-16,"Past Runs" +"17",NA,"H2S",0.991619504,0.011745192,0.081514125,2025-07-16,"Past Runs" +"18",NA,"H2S",0.990299632,0.011051745,0.072271651,2025-07-16,"Past Runs" +"19",NA,"H2S",0.991820501,0.011030978,0.107305831,2025-07-16,"Past Runs" +"20",NA,"H2S",0.987843267,0.011940853,0.084781412,2025-07-16,"Past Runs" +"21",NA,"H2S",0.992091938,0.011957557,0.080297784,2025-07-16,"Past Runs" +"22",NA,"H2S",0.991711318,0.011277024,0.093205964,2025-07-16,"Past Runs" +"23",NA,"H2S",0.990221806,0.012007601,0.081764155,2025-07-15,"Past Runs" +"24",NA,"H2S",0.985259661,0.010168475,0.104301957,2025-07-15,"Past Runs" +"25",NA,"H2S",0.988492907,0.011813071,0.068994131,2025-07-16,"Past Runs" +"26",NA,"H2S",0.994149685,0.013418056,0.072423824,2025-07-15,"Past Runs" +"27",NA,"H2S",0.991748191,0.011735538,0.088628605,2025-07-15,"Past Runs" +"28",NA,"H2S",0.989333168,0.012411661,0.088435965,2025-07-15,"Past Runs" +"29",NA,"H2S",0.992931678,0.011946484,0.10370681,2025-07-14,"Past Runs" +"30",NA,"H2S",0.99409875,0.011778654,0.091418456,2025-07-14,"Past Runs" +"31",NA,"H2S",0.988158507,0.010797151,0.091271836,2025-07-14,"Past Runs" +"32",NA,"H2S",0.992095456,0.010752828,0.104719179,2025-07-14,"Past Runs" +"33",NA,"H2S",0.99451618,0.011110069,0.090558393,2025-07-14,"Past Runs" +"34",NA,"H2S",0.992226742,0.012274256,0.095585343,2025-08-27,"Past Runs" +"35",NA,"H2S",0.989946431,0.01162827,0.097001612,2025-08-27,"Past Runs" +"36",NA,"H2S",0.988459596,0.011593871,0.102538661,2025-08-27,"Past Runs" +"37",NA,"H2S",0.984009845,0.01077442,0.094690475,2025-08-08,"Past Runs" +"38",NA,"H2S",0.991998684,0.012003707,0.087888803,2025-08-08,"Past Runs" +"39",NA,"H2S",0.988472937,0.013654087,0.080747996,2025-08-08,"Past Runs" +"40",NA,"H2S",0.989644138,0.011187528,0.100376401,2025-08-08,"Past Runs" +"41",NA,"H2S",0.991253241,0.01240335,0.091781398,2025-07-28,"Past Runs" +"42",NA,"H2S",0.985302046,0.010983613,0.096511057,2025-07-28,"Past Runs" +"43",NA,"H2S",0.989746609,0.012199156,0.083958107,2025-07-28,"Past Runs" +"44",NA,"H2S",0.983978644,0.01257192,0.082066064,2025-07-28,"Past Runs" +"45",NA,"H2S",0.985041184,0.013253135,0.095890286,2025-06-23,"Past Runs" +"46",NA,"H2S",0.988479922,0.012770225,0.097515258,2025-06-23,"Past Runs" +"47",NA,"H2S",0.986622245,0.014490479,0.088550945,2025-06-23,"Past Runs" +"48",NA,"H2S",0.98593674,0.012464999,0.101324152,2025-06-23,"Past Runs" +"49",NA,"H2S",0.992217588,0.011106834,0.087410369,2025-06-03,"Past Runs" +"50",NA,"H2S",0.994571071,0.01266079,0.086043319,2025-06-03,"Past Runs" +"51",NA,"H2S",0.987008654,0.01202734,0.088509886,2025-06-03,"Past Runs" +"52",NA,"H2S",0.991890557,0.010510502,0.089450704,2025-06-03,"Past Runs" +"53",NA,"H2S",0.990808319,0.011660482,0.083892866,2025-06-03,"Past Runs" +"54",NA,"H2S",0.99195308,0.012188907,0.076050353,2025-06-03,"Past Runs" +"55",NA,"H2S",0.990300427,0.011117767,0.095151906,2025-06-03,"Past Runs" +"56",NA,"H2S",0.990287741,0.012773563,0.085475942,2025-06-02,"Past Runs" +"57",NA,"H2S",0.985219853,0.012034496,0.101191716,2025-06-02,"Past Runs" +"58",NA,"H2S",0.990742934,0.012442945,0.09150939,2025-06-02,"Past Runs" +"59",NA,"H2S",0.988190426,0.012914305,0.098581692,2025-06-02,"Past Runs" +"60",NA,"H2S",0.989470668,0.01309737,0.091276263,2025-06-02,"Past Runs" +"61",NA,"H2S",0.985446517,0.012512003,0.101529112,2025-06-02,"Past Runs" +"62",NA,"H2S",0.989516031,0.009990116,0.090615023,2025-05-29,"Past Runs" +"63",NA,"H2S",0.989050067,0.009114036,0.092492755,2025-05-29,"Past Runs" +"64",NA,"H2S",0.992170999,0.009329021,0.090250992,2025-05-27,"Past Runs" +"65",NA,"H2S",0.991744664,0.009917044,0.078245698,2025-05-27,"Past Runs" +"66",NA,"H2S",0.994352551,0.009616728,0.087789906,2025-05-27,"Past Runs" +"67",NA,"H2S",0.985006054,0.009610255,0.07704108,2025-05-27,"Past Runs" +"68",NA,"H2S",0.993274803,0.009359273,0.090591475,2025-05-27,"Past Runs" +"69",NA,"H2S",0.986045229,0.011531354,0.077709532,2024-11-18,"Past Runs" +"70",NA,"H2S",0.986196268,0.011480984,0.07703203,2024-11-18,"Past Runs" +"71",NA,"H2S",0.985787929,0.009948554,0.091199531,2024-11-18,"Past Runs" +"72",NA,"H2S",0.988947878,0.010495862,0.093284593,2024-11-18,"Past Runs" +"73",NA,"H2S",0.988264781,0.010127226,0.080001514,2024-10-28,"Past Runs" +"74",NA,"H2S",0.988125768,0.009325271,0.097513836,2024-10-28,"Past Runs" +"75",NA,"H2S",0.99758753,0.011945752,0.067197191,2024-10-28,"Past Runs" +"76",NA,"H2S",0.993078174,0.009645972,0.08151815,2024-10-07,"Past Runs" +"77",NA,"H2S",0.986071127,0.009987862,0.086021444,2024-10-04,"Past Runs" +"78",NA,"H2S",0.986143404,0.009891411,0.079796142,2024-10-04,"Past Runs" +"79",NA,"H2S",0.99164056,0.009670319,0.086201323,2024-10-03,"Past Runs" +"80",NA,"H2S",0.992085737,0.009733216,0.067611651,2024-10-03,"Past Runs" +"81",NA,"H2S",0.992009962,0.01118999,0.069642654,2024-10-03,"Past Runs" +"82",NA,"H2S",0.985288821,0.010925627,0.071179528,2024-10-03,"Past Runs" +"83",NA,"H2S",0.995390082,0.011330148,0.070037534,2024-10-03,"Past Runs" +"84",NA,"H2S",0.994790512,0.009796019,0.071794375,2024-10-01,"Past Runs" +"85",NA,"H2S",0.989580278,0.010755502,0.087527355,2024-10-01,"Past Runs" +"86",NA,"H2S",0.990511071,0.009855933,0.084838618,2024-10-01,"Past Runs" +"87",NA,"H2S",0.992652978,0.009918529,0.082342296,2024-10-01,"Past Runs" +"88",NA,"H2S",0.986832476,0.010348222,0.095254617,2024-09-23,"Past Runs" +"89",NA,"H2S",0.993120795,0.012220049,0.075212346,2024-09-23,"Past Runs" +"90",NA,"H2S",0.997632416,0.009657487,0.072204384,2024-09-25,"Past Runs" +"91",NA,"H2S",0.988833662,0.010418036,0.079942507,2024-09-24,"Past Runs" +"92",NA,"H2S",0.989425359,0.010908767,0.079669724,2024-09-24,"Past Runs" +"93",NA,"H2S",0.9939478,0.011206242,0.073020732,2024-09-24,"Past Runs" +"94",NA,"H2S",0.992036143,0.010398233,0.086327041,2024-09-24,"Past Runs" +"95",NA,"H2S",0.986162946,0.010280929,0.083188885,2024-09-24,"Past Runs" +"96",NA,"H2S",0.987800455,0.011372072,0.073224086,2024-09-23,"Past Runs" +"97",NA,"H2S",0.997485183,0.011409313,0.06519985,2024-09-23,"Past Runs" +"98",NA,"H2S",0.989099616,0.009735423,0.086474227,2024-09-19,"Past Runs" +"99",NA,"H2S",0.985472997,0.010406102,0.081660091,2024-09-19,"Past Runs" +"100",NA,"H2S",0.985753501,0.011560614,0.084016281,2024-09-19,"Past Runs" +"101",NA,"H2S",0.997161027,0.011775527,0.069868502,2024-09-18,"Past Runs" +"102",NA,"H2S",0.989061589,0.010749066,0.094634117,2024-09-18,"Past Runs" +"103",NA,"H2S",0.988308897,0.010324402,0.093490431,2024-09-18,"Past Runs" +"104",NA,"H2S",0.988282091,0.011748716,0.090496556,2024-09-18,"Past Runs" +"105",NA,"H2S",0.990611188,0.011004901,0.08215848,2024-09-09,"Past Runs" +"106",NA,"H2S",0.992687363,0.011700541,0.077148047,2024-08-30,"Past Runs" +"107",NA,"H2S",0.988249032,0.010524088,0.096531712,2024-09-03,"Past Runs" +"108",NA,"H2S",0.988532329,0.010996494,0.084496543,2024-09-03,"Past Runs" +"109",NA,"H2S",0.989712544,0.011101339,0.099050983,2024-09-03,"Past Runs" +"110",NA,"H2S",0.986439831,0.010996091,0.08776573,2024-08-30,"Past Runs" +"111",NA,"H2S",0.989313189,0.010457844,0.084754346,2024-08-30,"Past Runs" +"112",NA,"H2S",0.990177739,0.010268758,0.087174996,2024-08-30,"Past Runs" +"113",NA,"H2S",0.985866463,0.010585417,0.09737672,2024-08-30,"Past Runs" +"114",NA,"H2S",0.99044815,0.011181375,0.077015013,2024-08-30,"Past Runs" +"115",NA,"H2S",0.99053911,0.011535354,0.07384657,2024-08-29,"Past Runs" +"116",NA,"H2S",0.985015156,0.009782729,0.093669731,2024-08-29,"Past Runs" +"117",NA,"H2S",0.990100963,0.011025989,0.095480695,2024-08-29,"Past Runs" +"118",NA,"H2S",0.986738056,0.011094002,0.090055999,2024-08-29,"Past Runs" +"119",NA,"H2S",0.994093709,0.010473948,0.080691929,2024-08-29,"Past Runs" +"120",NA,"H2S",0.986192277,0.011543972,0.085092199,2024-08-07,"Past Runs" +"121",NA,"H2S",0.989960946,0.010741325,0.089432284,2024-08-07,"Past Runs" +"122",NA,"H2S",0.986951933,0.011912043,0.085700427,2024-08-07,"Past Runs" +"123",NA,"H2S",0.991998444,0.010555363,0.079000944,2024-08-07,"Past Runs" +"124",NA,"H2S",0.985536677,0.011846101,0.081424587,2024-07-29,"Past Runs" +"125",NA,"H2S",0.989595015,0.01224124,0.098524648,2024-07-29,"Past Runs" +"126",NA,"H2S",0.986188356,0.010118538,0.089341935,2024-07-25,"Past Runs" +"127",NA,"H2S",0.992411811,0.012549456,0.078491188,2024-07-25,"Past Runs" +"128",NA,"H2S",0.986593659,0.012390759,0.091396714,2024-07-25,"Past Runs" +"129",NA,"H2S",0.987105229,0.011378377,0.09863995,2024-07-25,"Past Runs" +"130",NA,"H2S",0.985994152,0.011415216,0.08057319,2024-07-25,"Past Runs" +"131",NA,"H2S",0.990738705,0.011295641,0.084048401,2024-07-31,"Past Runs" +"132",NA,"H2S",0.987136133,0.011450047,0.079739708,2024-07-29,"Past Runs" +"133",NA,"H2S",0.99126783,0.013018999,0.08407446,2024-07-29,"Past Runs" +"134",NA,"H2S",0.991454138,0.01254834,0.090174827,2024-07-29,"Past Runs" +"135",NA,"H2S",0.99018676,0.010771473,0.09900375,2024-07-24,"Past Runs" +"136",NA,"H2S",0.984822062,0.011740029,0.096632577,2024-07-24,"Past Runs" +"137",NA,"H2S",0.993424378,0.012468772,0.07384182,2024-07-19,"Past Runs" +"138",NA,"H2S",0.989184664,0.01069962,0.08457192,2024-07-19,"Past Runs" +"139",NA,"H2S",0.989831855,0.011217555,0.074495287,2024-07-19,"Past Runs" +"140",NA,"H2S",0.988637133,0.011247898,0.09116868,2024-07-19,"Past Runs" +"141",NA,"H2S",0.990494512,0.012004154,0.08805378,2024-07-19,"Past Runs" +"142",NA,"H2S",0.988124802,0.011667535,0.091833244,2024-07-19,"Past Runs" +"143",NA,"H2S",0.990863942,0.010234964,0.079436097,2024-07-18,"Past Runs" +"144",NA,"H2S",0.983817166,0.010882717,0.094621893,2024-07-18,"Past Runs" +"145",NA,"H2S",0.990198017,0.011687802,0.081889383,2024-07-18,"Past Runs" +"146",NA,"H2S",0.987899965,0.01159855,0.091733041,2024-07-18,"Past Runs" +"147",NA,"H2S",0.989060685,0.011495464,0.099538763,2024-07-18,"Past Runs" +"148",NA,"H2S",0.986916133,0.009342433,0.095298628,2024-07-18,"Past Runs" +"149",NA,"H2S",0.984427464,0.011641613,0.092097982,2024-07-19,"Past Runs" +"150",NA,"H2S",0.990912834,0.010479158,0.086080607,2024-07-19,"Past Runs" +"151",NA,"H2S",0.987412326,0.010983562,0.094991681,2024-07-18,"Past Runs" +"152",NA,"H2S",0.986465804,0.011418341,0.090477665,2024-07-18,"Past Runs" +"153",NA,"H2S",0.987068169,0.011199063,0.089853992,2024-07-18,"Past Runs" +"154",NA,"H2S",0.989037854,0.011295078,0.081699567,2024-07-17,"Past Runs" +"155",NA,"H2S",0.992083054,0.012185227,0.07626707,2024-07-17,"Past Runs" +"156",NA,"H2S",0.992139993,0.011646417,0.077884912,2024-07-17,"Past Runs" +"157",NA,"H2S",0.993165626,0.012227159,0.072878643,2024-07-17,"Past Runs" +"158",NA,"H2S",0.991179678,0.010917098,0.077263615,2024-07-17,"Past Runs" +"159",NA,"H2S",0.994482296,0.010706488,0.074416857,2024-07-17,"Past Runs" +"160",NA,"H2S",0.993221658,0.011432212,0.085152764,2024-07-15,"Past Runs" +"161",NA,"H2S",0.991012311,0.012163061,0.075124953,2024-07-05,"Past Runs" +"162",NA,"H2S",0.985644961,0.012042341,0.087343444,2024-07-05,"Past Runs" +"163",NA,"H2S",0.990282541,0.011631377,0.089041685,2024-07-05,"Past Runs" +"164",NA,"H2S",0.987824676,0.011559837,0.066632483,2024-07-05,"Past Runs" +"165",NA,"H2S",0.987863383,0.012339206,0.093894911,2024-07-03,"Past Runs" +"166",NA,"H2S",0.994315831,0.012786291,0.087233216,2024-07-03,"Past Runs" +"167",NA,"H2S",0.988339045,0.011649182,0.091537982,2024-07-03,"Past Runs" +"168",NA,"H2S",0.988950697,0.014678212,0.09163757,2023-11-14,"Past Runs" +"169",NA,"H2S",0.990040026,0.012259376,0.107676904,2023-11-14,"Past Runs" +"170",NA,"H2S",0.992010649,0.010954084,0.079408389,2024-05-29,"Past Runs" +"171",NA,"H2S",0.989206107,0.010763348,0.088663974,2024-05-29,"Past Runs" +"172",NA,"H2S",0.990869031,0.010939769,0.092318935,2024-05-29,"Past Runs" +"173",NA,"H2S",0.985767699,0.010729643,0.084530357,2024-05-29,"Past Runs" +"174",NA,"H2S",0.990353193,0.011621645,0.084002879,2024-05-28,"Past Runs" +"175",NA,"H2S",0.987684582,0.01183304,0.076585822,2024-05-28,"Past Runs" +"176",NA,"H2S",0.990127271,0.010373918,0.082859368,2024-05-28,"Past Runs" +"177",NA,"H2S",0.992091943,0.011632631,0.078949694,2024-05-28,"Past Runs" +"178",NA,"H2S",0.991295752,0.011015224,0.083816625,2024-05-23,"Past Runs" +"179",NA,"H2S",0.987251905,0.011995579,0.078461365,2024-05-23,"Past Runs" +"180",NA,"H2S",0.991135851,0.011944649,0.090053389,2024-05-23,"Past Runs" +"181",NA,"H2S",0.987847657,0.013334201,0.076212686,2024-05-22,"Past Runs" +"182",NA,"H2S",0.98858924,0.010019939,0.074402064,2024-05-22,"Past Runs" +"183",NA,"H2S",0.992678091,0.012147509,0.085708498,2024-05-22,"Past Runs" +"184",NA,"H2S",0.993578596,0.012248114,0.078688178,2024-05-22,"Past Runs" +"185",NA,"H2S",0.992362286,0.01333791,0.069302726,2024-05-21,"Past Runs" +"186",NA,"H2S",0.989216329,0.012520477,0.080249778,2024-05-21,"Past Runs" +"187",NA,"H2S",0.986391164,0.012989122,0.080584704,2024-05-21,"Past Runs" +"188","Plate1","H2S",0.9936,0.0095,0.0909,2025-05-27,"Past Runs" +"189","Plate2","H2S",0.9942,0.009,0.0831,2025-05-27,"Past Runs" +"190","Plate3","H2S",0.9939,0.0095,0.0892,2025-05-27,"Past Runs" +"191","Plate4","H2S",0.9985,0.0101,0.0762,2025-05-27,"Past Runs" +"192","Plate5","H2S",0.9972,0.0096,0.0866,2025-05-27,"Past Runs" +"193","Plate6","H2S",0.9985,0.0101,0.0762,2025-05-27,"Past Runs" +"194","Plate7","H2S",0.9985,0.0101,0.0762,2025-05-27,"Past Runs" +"195","Plate_rr","H2S",0.9906,0.0131,0.0934,2025-06-02,"Past Runs" +"196","Plate1","H2S",0.9801,0.0114,0.1116,2025-07-14,"Past Runs" +"197","Plate2","H2S",0.9881,0.0107,0.1167,2025-07-14,"Past Runs" +"198","Plate3","H2S",0.9796,0.0113,0.1195,2025-07-14,"Past Runs" +"199","Plate4","H2S",0.9888,0.0115,0.1123,2025-07-14,"Past Runs" +"200","Plate5","H2S",0.9961,0.012,0.1021,2025-07-14,"Past Runs" +"201","Plate6","H2S",0.9961,0.012,0.1021,2025-07-14,"Past Runs" +"202","Plate7","H2S",0.994,0.0128,0.0806,2025-07-15,"Past Runs" +"203","Plate8","H2S",0.9928,0.0115,0.0903,2025-07-15,"Past Runs" +"204","Plate9","H2S",0.9974,0.0117,0.0896,2025-07-15,"Past Runs" +"205","Plate10","H2S",0.9962,0.0134,0.0672,2025-07-15,"Past Runs" +"206","Plate_rr","H2S",0.9994,0.0124,0.0564,2025-07-16,"Past Runs" +"207","Plate1","H2S",0.9862,0.012,0.1023,2025-09-18,"Past Runs" +"208","Plate2","H2S",0.9977,0.0107,0.082,2025-09-18,"Past Runs" +"209","Plate3","H2S",0.9949,0.0109,0.0927,2025-09-18,"Past Runs" +"210","Plate4","H2S",0.9978,0.0126,0.0764,2025-09-18,"Past Runs" +"211","Plate5","H2S",0.9933,0.0112,0.0942,2025-09-18,"Past Runs" +"212","Plate6","H2S",0.9978,0.0121,0.0843,2025-09-18,"Past Runs" +"213","Plate_rr","H2S",0.9982,0.011,0.0827,2025-09-19,"Past Runs" +"214","Plate1","H2S",0.9907,0.0116,0.1023,2026-05-18,"Current Runs" +"215","Plate2","H2S",0.991,0.0121,0.0937,2026-05-18,"Current Runs" +"216","Plate3","H2S",0.9921,0.0124,0.1034,2026-05-18,"Current Runs" +"217","Plate4","H2S",0.9957,0.0115,0.0953,2026-05-18,"Current Runs" +"218","Plate5","H2S",0.9876,0.011,0.1017,2026-05-19,"Current Runs" diff --git a/CO2xN/Porewater/Sulfide/2026/Datasheets/2026May_LTREB_H2S_Datasheets.pdf b/CO2xN/Porewater/Sulfide/2026/Datasheets/2026May_LTREB_H2S_Datasheets.pdf new file mode 100644 index 0000000..ab81103 Binary files /dev/null and b/CO2xN/Porewater/Sulfide/2026/Datasheets/2026May_LTREB_H2S_Datasheets.pdf differ diff --git a/CO2xN/Porewater/Sulfide/2026/Datasheets/2026May_LTREB_H2S_Datasheets.xlsx b/CO2xN/Porewater/Sulfide/2026/Datasheets/2026May_LTREB_H2S_Datasheets.xlsx new file mode 100644 index 0000000..0e21466 Binary files /dev/null and b/CO2xN/Porewater/Sulfide/2026/Datasheets/2026May_LTREB_H2S_Datasheets.xlsx differ diff --git a/CO2xN/Porewater/Sulfide/2026/GCReW_CO2xN_Porewater_H2S_202605.Rmd b/CO2xN/Porewater/Sulfide/2026/GCReW_CO2xN_Porewater_H2S_202605.Rmd new file mode 100644 index 0000000..bf0b647 --- /dev/null +++ b/CO2xN/Porewater/Sulfide/2026/GCReW_CO2xN_Porewater_H2S_202605.Rmd @@ -0,0 +1,1319 @@ +--- +title: "CO2xN: Porewater Sulfide" +author: "Month Year Samples" +date: "`r Sys.Date()`" +output: + pdf_document: + toc: false + number_sections: false +geometry: left=2cm,right=2cm,top=1cm,bottom=2cm +--- +## Code Set up +```{r setup, include=FALSE} + +library(dplyr) +library(broom) +library(ggplot2) +library(ggpubr) +library(stringr) +library(purrr) +library(tidyverse) +library(here) +library(data.table) +library(matrixStats) +library(gridExtra) +library(grid) +library(plater) +library(raster) +library(knitr) +library(readxl) +library(ggrepel) + +``` + +## run information +```{r Information to be changed} + +##Before or After Reruns (YES or NO) +After_Reruns = "YES" +#If NO will not write final data file + #And Will Write a Rerun File + +###things that need to be changed + +sample_month = "May" +sample_year = "2026" +Run_Date = as.Date("05/19/2026", format = "%m/%d/%Y") +Run_by = "Melanie Giessner"#Instrument user +Script_run_by ="Melanie"#Code user + +Run_notes=""#any notes from run + +#Import Plate Data + +plates<- c("Plate1","Plate2","Plate3","Plate4","Plate5","rrPlate1","rrPlate2") + +folder_path_rawdata <- paste0("Raw Data") +Raw_plates <- list.files(path = folder_path_rawdata, full.names = TRUE,pattern = "Plate") +head(Raw_plates) + + +#Import Run Date for Each Plate for Std curve qaqc +Run_dates <- tibble( + Plate = plates, + Run_Date = c("05/18/2026","05/18/2026","05/18/2026","05/18/2026","05/19/2026","06/01/2026","06/01/2026") + ) + + Run_dates <- Run_dates %>% mutate(Run_Date = as.Date(Run_Date, tryFormats = c("%Y-%m-%d", "%m/%d/%y", "%m/%d/%Y"))) + + +# Define the file path for QAQC log file - NO Need to change just check year +log_path <- "Processed Data/LTREB_2M_H2S_QAQC_2026.csv" + +# Define final path for data be sure to change year and month and run number +final_path <- "Processed Data/GCReW_CO2xN_Porewater_H2S_202605.csv" +rerun_path <- "Processed Data/GCReW_CO2xN_Porewater_H2S_202605_reruns.csv" + +``` + +```{r Set Up Code - constants and QAQC cutoffs, include=FALSE} + +#Flag cutoffs + r2_cutoff = 0.985 #this is the level below which we want to rerun or consider a curve + cv_flag_stds = 10 #this is the maximum cv allowed for standards + p_value_chkstds = 0.05 #the p-value for the t-test between check standards must be greater than this + p_value_MC = 0.05 #the p-value for the t-test between matrix checks and top std must be greater than this + cv_flag_sample = 10 #this is the maximum cv allowed for samples + dups_perc_diff = 15.5 #this is the maximum percent difference allowed between duplicates + high_recovery_cutoff = 120 #this is the maximum percent recovery of SO4 allowed in spiked samples + low_recovery_cutoff = 80 #this is the minimum percent recovery of SO4 allowed in spiked samples + +#Standard concentrations - Update if running different standard curve: +# standard units are in uM + standards <- tibble( + IDs = c("Std 0", "Std 1", "Std 2", "Std 3", "Std 4", "Std 5"), + Conc = c(0, 5.0, 12.5, 25.0, 50.0, 100.0) + ) #uM + + chk_standards <- tibble( + IDs = c("ChkStd 0", "ChkStd 3", "ChkStd 4"), + Conc = c(0, 25.0, 50.0) + ) #uM + + mtx_standards <- tibble( + IDs = c("MC: 10ppt S5"), + Conc = c(100) + ) #uM + +#Spike concentration calc + #spike for these samples was 50 uL of the 100uM standard + Con1 <- 1000000 #conversion factor value for spike volumes (uL -> L) + spk_std <- 100 # uM S2- standard used + spkvol <- 50 # uL volume of spike added + spk_Conc <- spk_std*(spkvol/Con1) # umoles of S2- added to each spiked sample + sample_vol <- 250 # the sample volume without the spike is 250 uL + samp_vol_a <- 300 # the sample volume + +#Top standard Concentration- Update if running different standard curve: + Top_STD = 100 + + +#Metadata file path +Raw_Metadata = here(".." , "GCReW", "GCReW_Project_Treatment_Metadata.csv") + +#Significant Digits +sigdigs <- 3 + +``` + + +##Read in metadata and create similar sample IDs for matching to samples +```{r pull in metadata for later, include=FALSE} + +#read in metadata + +raw_metadata <- read.csv(Raw_Metadata) +#clean up columns in metadata file: +metadata <- raw_metadata %>% + filter(grepl("2-Meter", Nickname, ignore.case = TRUE)) %>% + mutate(Sample_Name = paste0(Sample.ID)) %>% + mutate(Month = sample_month) %>% + mutate(Year = sample_year) %>% + rename( + Sample_ID = Sample.ID, + Plot_Name = Plot, + ) %>% + dplyr::select(-Temp_Treatment) %>% + mutate(Treatment = ifelse( + CO2_Treatment == "Elevated" & + N_Treatment == "Amended", + "eCO2_N", + ifelse( + CO2_Treatment == "Elevated" & + N_Treatment == "Ambient", + "eCO2", + ifelse(CO2_Treatment == "Ambient" & + N_Treatment == "Amended" , "N" , "Ambient") + ) + )) + +``` + + +##Read in data +```{r read in plates,echo=FALSE,include=FALSE} + +#read in the csv files +dat<-read_plates( + files = Raw_plates,#list of all file paths + plate_names = plates , #list of plate names + well_ids_column = "Wells", # name to give column of well IDs (optional) + sep = "," # separator used in the csv file (optional) +) %>% + rename("Abs"=values, + "IDs"=values.2, + "Dilution"=values.3) +head(dat) + +``` + +##Remove High CV Stds +```{r, echo=FALSE} + +#filter for STDs +H2S_stds_raw <- dat %>% subset(IDs %like% "Std" | IDs %like% "Chk" | IDs %like% "MC") + +#Add in STD values +H2S_stds <- left_join(H2S_stds_raw, standards, by = "IDs") + +#Calculate CVs and add flags +H2S_STD_cv <- H2S_stds %>% group_by(Plate, IDs) %>% mutate(CV = cv(Abs)) %>% mutate(CV_Flag = ifelse(CV >= cv_flag_stds, "CV_High", "CV_Good")) %>% ungroup() + +#calculate new cv getting best cv from points if cv was high +H2S_STD_cv_new <- H2S_STD_cv %>% group_by(Plate, IDs) %>% + mutate(CV_New = map_dbl(row_number(), ~cv(Abs[-.x]))) %>% #Calculate CVs without 1 point + mutate(Removed = ifelse( #Choose Lowest CV if CV is high + CV_Flag == "CV_High", + ifelse( + CV_New == min(CV_New), + "RMVD", + "KEPT"), "CV_Good"), +CV2 = ifelse(CV_Flag == "CV_High", min(CV_New), CV), +Abs_rm = ifelse(Removed == "RMVD", NA, Abs)) %>% + mutate(Mean_Abs2 = mean(Abs_rm, na.rm = TRUE)) %>% + mutate(CV_Flag2 = ifelse(CV2 >= cv_flag_stds, "CV_High", "CV_Good")) %>% ungroup() + +#organize data +H2S_STD_CV_fin <- H2S_STD_cv_new %>% dplyr::select(Plate, + Wells, + Abs, + Removed, + IDs, + Dilution, + Conc, + Mean_Abs2, + CV2, + CV_Flag2) %>% + mutate(Mean_Abs = Mean_Abs2, CV_Flag = CV_Flag2, CV = CV2) %>% + dplyr::select(Plate, + Wells, Abs, + Removed, + IDs, + Dilution, + Conc, + Mean_Abs, + CV, + CV_Flag) + + +``` + + +##Check R2 & Remove Standards if Necessary +```{r, echo=FALSE} +split_data <- H2S_STD_CV_fin %>% filter(IDs %like% "Std") %>% filter(!IDs %like% "Chk") %>% dplyr::select(Plate, IDs, Conc, Mean_Abs, Abs, Removed, CV_Flag) %>% filter(!Removed == "RMVD") %>% #Split Data by Plate + distinct() %>% + group_by(Plate) %>% + group_split() + +#run regression and get coefficients by Run +Slope_H2S_raw_list <- map(split_data, ~ .x %>% mutate(Curve = "H2S", + R2 = summary(lm(Abs ~ Conc, data = .))$adj.r.squared , + Slope = coef(lm(Abs ~ Conc, data = .))[2], + Intercept = coef(lm(Abs ~ Conc, data = .))[1])) + + + Slope_H2S_raw <- bind_rows(Slope_H2S_raw_list) + + #check R2 and flag + Slope_H2S_Std_Crvs <- Slope_H2S_raw %>% dplyr::select(Plate, Curve, R2, Slope, Intercept) %>% distinct() %>% mutate(R2_Flag = ifelse(R2 >= r2_cutoff, "R2_Good", "R2_Bad")) + + #join standard curve CVs and regression values + R2_Check_Raw <- left_join(Slope_H2S_Std_Crvs, H2S_STD_CV_fin, by = "Plate") + + R2_Check <- R2_Check_Raw %>% + dplyr::select(Plate, + IDs, + Abs, + Removed, + Mean_Abs, + Conc, + R2, + Slope, + Intercept, + CV_Flag, + CV, + R2_Flag) %>% filter(IDs %like% "Std") %>% filter(!IDs %like% "Chk") %>% + distinct() + + #calculate concentrations from standard curve and separate removable points + + R2_Split <- R2_Check %>% mutate(RMVBL = ifelse(IDs %in% c("Std 0", "Std 1", "Std 5"), "No", "Yes")) %>% group_by(Plate) %>% dplyr::select(-Abs, -Removed) %>% distinct() %>% group_split() + + R2_New <- map( + R2_Split, + ~ .x %>% mutate( + Curve = "H2S", + R2_New = map_dbl(row_number(), ~ + summary(lm( + Mean_Abs[-.x] ~ Conc[-.x], data = pick(Mean_Abs, Conc) + ))$adj.r.squared) , + Slope_New = map_dbl(row_number(), ~ + coef(lm( + Mean_Abs[-.x] ~ Conc[-.x], data = pick(Mean_Abs, Conc) + ))[2]) , + Intercept_New = map_dbl(row_number(), ~ + coef(lm( + Mean_Abs[-.x] ~ Conc[-.x], data = pick(Mean_Abs, Conc) + ))[1]) + ) + ) %>% bind_rows() + + R2_Check_RMVBL <- R2_New %>% mutate(R2_New = round(R2_New, digits = 8), + CV = round(CV, digits = 8)) %>% group_by(Plate) %>% mutate(R2_New = ifelse(IDs %in% c("Std 0", "Std 1", "Std 5"), NA, R2_New)) %>% mutate(R2_RMV = ifelse( + R2_Flag == "R2_Bad", + ifelse(R2_New == max(R2_New, na.rm = TRUE), "RMVD", "KEPT"), + "R2_Good" + )) %>% mutate(R2_RMV_CV = ifelse( + R2_RMV == "R2_Good", + ifelse(CV_Flag == "CV_High", ifelse(CV == max(CV), "RMVD", "KEPT"), "KEPT"), + R2_RMV + )) %>% mutate(R2_RMVD = ifelse(is.na(R2_RMV_CV), "KEPT", R2_RMV_CV)) %>% dplyr::select(-R2_RMV, -R2_RMV_CV) + +R2_Removed_forPair <- R2_Check_RMVBL %>% dplyr::select(Plate, IDs, R2_RMVD) %>% distinct() + +H2S_STDs_Pair <- H2S_STD_CV_fin %>% filter(IDs %like% "Std") %>% filter(!IDs %like% "Chk") %>% dplyr::select(Plate, IDs, Conc, Mean_Abs, Abs, Removed, CV_Flag) %>% filter(!Removed == "RMVD") %>% distinct() %>% left_join(R2_Removed_forPair) + + + R2_Check_fin <- H2S_STDs_Pair %>% mutate(STD_ABS_rmv = ifelse(R2_RMVD == "RMVD", NA, Abs)) %>% group_by(Plate) %>% mutate(Points = ifelse("RMVD" %in% R2_RMVD, "Point_Removed", "ALL_KEPT")) %>% dplyr::select(Plate, IDs, Conc, STD_ABS_rmv, CV_Flag, Points) %>% ungroup() %>% na.omit() + + #separate plates for new regression + split_data_rmv <- R2_Check_fin %>% + distinct() %>% + group_by(Plate) %>% + group_split() + + #get new standard curve values + Slope_H2S_raw_list_rm <- map(split_data_rmv, ~ .x %>% mutate(Curve = "H2S", + R2 = summary(lm(STD_ABS_rmv ~ Conc, data = .))$adj.r.squared , + Slope = coef(lm(STD_ABS_rmv ~ Conc, data = .))[2], + Intercept = coef(lm(STD_ABS_rmv ~ Conc, data = .))[1])) + + Slope_H2S_raw_rm <- bind_rows(Slope_H2S_raw_list_rm) + + Slope_H2S_Std_Crvs_rm <- Slope_H2S_raw_rm %>% dplyr::select(Plate, Curve, R2, Slope, Intercept, CV_Flag, Points) %>% distinct() %>% mutate(R2_Flag = ifelse(R2 >= r2_cutoff, "R2_Good", "R2_Bad")) + + +``` + + +## Plot Standard Curves +```{r Plot all Standard Curves together, echo=FALSE} +##this is to see if there are any stds or plates that look off + +#Plot Std Crvs by plate +H2S_Curve <- ggplot(Slope_H2S_raw_rm, aes(STD_ABS_rmv, Conc, color = Plate, linetype = Points)) + geom_point(size = 3) + + geom_smooth(method = "lm", formula = "y ~ x", se = FALSE) + labs(title = "H2S Standard Curves", x = "Absorbance", y = "Concentration (uM)") + + theme_classic() +H2S_Curve + +#Add dates to plate and format data +STD_run_date <- left_join(Run_dates, Slope_H2S_Std_Crvs_rm, by = join_by(Plate)) +new_log_stds <- STD_run_date %>% dplyr::select(Plate, + Curve, + R2, + Slope, + Intercept, + Run_Date) %>% mutate(R2 = round(R2, digits = 4), Slope = round(Slope, digits = 4), Intercept = round(Intercept, digits = 4), ) %>% mutate(Run = "Current Runs") + + +#read in log file and format +log <- read.csv(log_path) +log_2 <- log %>% mutate(Run_Date = as.Date(as.character(Run_Date), format = "%Y-%m-%d"), Run = "Past Runs") +log_3 <- log_2[, -c(1)] +log_4 <- rbind(log_3, new_log_stds) + +unique_log <- log_4 %>% distinct(.keep_all = TRUE) + +#Calculate Mean and SD and calculate 2SD range for slope and intercept +mean_slope <- mean(unique_log$Slope, na.rm = TRUE) +sd_slope <- sd(unique_log$Slope, na.rm = TRUE) + +hi_2sd_slope <- mean_slope + 2*sd_slope + +lo_2sd_slope <- mean_slope - 2*sd_slope + +mean_int <- mean(unique_log$Intercept, na.rm = TRUE) +sd_int <- sd(unique_log$Intercept, na.rm = TRUE) + +hi_2sd_int <- mean_int + 2*sd_int + +lo_2sd_int <- mean_int - 2*sd_int + +#Plot Slope log +Slopes_chk <- ggplot(unique_log, aes(x = Run_Date, y = Slope, col = Run)) + + ylim(0.0045,0.018) + + scale_color_manual(values = c("Past Runs" = "grey27", "Current Runs" = "cyan3")) + + geom_abline(intercept = mean_slope - 2*sd_slope, slope = 0, linetype = "dashed", linewidth = 1.5, col = "red" )+ + geom_abline(intercept = mean_slope + 2*sd_slope, slope = 0, linetype = "dashed", linewidth = 1.5, col = "red" )+ + geom_point(size = 2) + + theme_classic()+ + ggtitle("Slope Log") + +#Plot Intercept log +ints_chk <- ggplot(unique_log, aes(x = Run_Date, y = Intercept, col = Run)) + + ylim(0.03, 0.15) + + scale_color_manual(values = c("Past Runs" = "grey27", "Current Runs" = "cyan3")) + + geom_abline(intercept = mean_int - 2*sd_int, slope = 0, linetype = "dashed", linewidth = 1.5, col = "red" )+ + geom_abline(intercept = mean_int + 2*sd_int, slope = 0, linetype = "dashed", linewidth = 1.5, col = "red" )+ + geom_point(size = 2) + + theme_classic()+ + ggtitle("Intercept Log") + +ints_chk + +Slopes_chk + + +#Get done of original runs +Date_1 <-as.Date(new_log_stds$Run_Date[which(new_log_stds$Plate == "Plate1")]) + +#Check if Std Crvs are Within range and see if dates are close enough for combination +stdcrv_tagged <- new_log_stds %>% mutate( + In_Range_Slope = ifelse( + Slope >= hi_2sd_slope | + Slope <= lo_2sd_slope, + "Out of Range", + "In Range" + ), + In_Range_Int = ifelse( + Intercept >= hi_2sd_int | + Intercept <= lo_2sd_int, + "Out of Range", + "In Range" + ) +) %>% mutate( + Slope = ifelse(In_Range_Slope == "Out of Range", NA, Slope), + Intercept = ifelse(In_Range_Int == "Out of Range", NA, Intercept) +) %>% mutate(Date_Diff = abs(difftime(Date_1, Run_Date, units = "days"))) %>% mutate(Date_Close = ifelse(Date_Diff <= 2, "Yes", "No")) %>% mutate(Slope_Flag = ifelse(is.na(Slope), "Slope_Bad" , "Slope_Good"), Int_Flag = ifelse(is.na(Intercept), "Intercept_Bad" , "Intercept_Good")) %>% mutate( + Slope = ifelse(is.na(Intercept) | R2 <= r2_cutoff, NA, Slope), + Intercept = ifelse(is.na(Slope)| R2 <= r2_cutoff, NA, Intercept), + Curve_RMVD = ifelse(is.na(Slope) | + is.na(Intercept) | R2 <= r2_cutoff , "RMVD", "KEPT") +) + +#Calculate Combo Std Crv +stdcrv_filtered <- stdcrv_tagged %>% filter(Date_Close == "Yes") +stdcrv_filtered_no <- stdcrv_tagged %>% filter(Date_Close == "No") +mean_slope_fin <- mean(stdcrv_filtered$Slope, na.rm = TRUE) +mean_slope_no <- mean(stdcrv_filtered_no$Slope, na.rm = TRUE) +mean_int_fin <- mean(stdcrv_filtered$Intercept, na.rm = TRUE) +mean_int_no <- mean(stdcrv_filtered_no$Intercept, na.rm = TRUE) + +#Attach Slope and Intercept to Plates +Std_crv_calc <- stdcrv_tagged %>% mutate(Slope_Calc = ifelse(Date_Close == "Yes", mean_slope_fin, mean_slope_no), Int_Calc = ifelse(Date_Close == "Yes", mean_int_fin, mean_int_no)) %>% dplyr::select(Plate, Slope_Calc, Int_Calc, Curve_RMVD, Slope_Flag, Int_Flag) %>% as.data.frame() + +std_curves <- Std_crv_calc %>% dplyr::select(Plate, Curve_RMVD) %>% filter(Curve_RMVD != "RMVD") %>% distinct() + +Curve_Flags <- Std_crv_calc %>% dplyr::select(Plate, Slope_Flag, Int_Flag) %>% distinct() + +Curve_Flags_forJoin <- Curve_Flags %>% mutate(Slope_Flag = ifelse(Slope_Flag %like% "Good", "", Slope_Flag), Int_Flag = ifelse(Int_Flag %like% "Good", "", Int_Flag)) + + +Std_crv_calc <-Std_crv_calc %>% distinct() +``` + +## Return Flags For Standard Curve +```{r, echo=FALSE} + +STD_CRV_flags <- full_join(Slope_H2S_Std_Crvs_rm, Run_dates, by = join_by(Plate)) + +STD_CRV_flags_table1 <- STD_CRV_flags %>% dplyr::select(Plate, R2_Flag, CV_Flag) + +STD_CRV_flags_table2 <- Std_crv_calc %>% dplyr::select(Plate, Curve_RMVD) %>% mutate(Curve_RMVD = ifelse(Curve_RMVD == "RMVD", "REMOVED", Curve_RMVD)) + +knitr::kable(STD_CRV_flags_table1, format="markdown") + +knitr::kable(STD_CRV_flags_table2, format="markdown") + + +``` + +## Method Detection Limit +```{r, echo=FALSE} + +#get only lowest standard + STD_MDL_df <- H2S_STD_CV_fin %>% filter(IDs == "Std 1" + #, Removed != "RMVD" + ) %>% dplyr::select(Plate, Mean_Abs, IDs) %>% distinct() + + STD0_df <- H2S_STD_CV_fin %>% filter(IDs == "Std 0" + #, Removed != "RMVD" + ) %>% dplyr::select(Plate, Mean_Abs, IDs) %>% distinct() +#calculate the standard deviation of abs +stddev_mdl <- sd(STD_MDL_df$Mean_Abs) + +#Calculate Mean Std 0 +std0_mean <- mean(STD0_df$Mean_Abs) + +#calculate n +n <- length(STD_MDL_df$Mean_Abs) + +#Identify the proper Student's T for n-1 +StudentsT <-qt(.99,(n-1)) + +#Multiply Standard deviation by Student's T +STD_var <- (stddev_mdl*StudentsT) +MDL <- STD_var + std0_mean + +MDL_df <- as.data.frame(MDL) + +MDL_Plot <- ggplot() + + geom_bar(stat = 'identity', data = STD_MDL_df, aes(x = Plate, y = Mean_Abs, fill = IDs)) + + geom_bar(data = STD0_df, aes(x = Plate, y = Mean_Abs, fill = IDs), stat = 'identity') + + scale_fill_manual(name = "Standard:", values = c("Std 0" = "lightgreen", "Std 1" = "cornflowerblue")) + + geom_hline(yintercept = MDL, linetype = "dashed", linewidth = 1.5, color = "blue3") + + geom_label_repel(data = MDL_df, aes(x = 1.25, y = MDL + 0.015), label = paste0("MDL: ", signif(MDL, digits = sigdigs)), alpha = 0.7, color = "blue3") + + ggtitle(label = "H2S Minimum Detection Limit") + + labs(y = "Mean Absorbance") + + theme_classic() + +MDL_Plot +``` + +## Compare Check Standards to Standards +```{r, echo = FALSE} + +#subset datasets for comparison + +std0 <- subset(H2S_STD_CV_fin, IDs == "Std 0"& Plate %in% std_curves$Plate & !Removed == "RMVD") +std3 <- subset(H2S_STD_CV_fin, IDs == "Std 3"& Plate %in% std_curves$Plate & !Removed == "RMVD") +std4 <- subset(H2S_STD_CV_fin, IDs == "Std 4" & Plate %in% std_curves$Plate & !Removed == "RMVD") +std5 <- subset(H2S_STD_CV_fin, IDs == "Std 5" & Plate %in% std_curves$Plate & !Removed == "RMVD") + + +H2S_CHK_STD_CV_fin <- H2S_STD_CV_fin %>% filter(IDs %like% "ChkStd" | IDs %like% "ppt") +#Tag Check Standards and perform T Test +H2S_CHKs_a <- H2S_CHK_STD_CV_fin %>% + mutate(Std_ID = case_when( + IDs == "ChkStd 0" ~ paste0("Std 0"), + IDs == "ChkStd 3" ~ paste0("Std 3"), + IDs == "ChkStd 4" ~ paste0("Std 4"), + IDs %like% "S5" ~ paste0("Std 5") + ), + Chk_Abs = Abs, + Chk_Removed = Removed, + Chk_IDs = IDs, + Chk_Mean_Abs = Mean_Abs, + Chk_cv_flag = CV_Flag + ) %>% filter(!Chk_Removed == "RMVD") %>% + group_by(Std_ID,Plate) %>% + mutate( + Chk_pvalue = case_when( + Chk_IDs == "ChkStd 0" ~ t.test(std0$Abs, Chk_Abs,var.equal = T)$p.value[1], + Chk_IDs == "ChkStd 3" ~ t.test(std3$Abs, Chk_Abs,var.equal = T)$p.value[1], + Chk_IDs == "ChkStd 4" ~ t.test(std4$Abs, Chk_Abs,var.equal = T)$p.value[1], + Chk_IDs == "MC: 10ppt S5" ~ t.test(std5$Abs, Chk_Abs,var.equal = T)$p.value[1], + Chk_IDs == "MC: 20ppt S5" ~ t.test(std5$Abs, Chk_Abs,var.equal = T)$p.value[1] + ))%>% + ungroup() %>% + dplyr::select(Std_ID, Chk_IDs, Chk_pvalue, Chk_cv_flag, Chk_Mean_Abs, Plate) %>% distinct(.keep_all = TRUE) + +H2S_CHKs_1 <- H2S_CHKs_a %>% dplyr::select(-Chk_Mean_Abs) + +#Get Standard Values and set values for standards with no variance +H2S_STD_forCHK_a <- H2S_STD_CV_fin %>% filter(IDs %in% c("Std 0", "Std 3", "Std 4", "Std 5") ) %>% + mutate(Std_ID = IDs +) %>% filter(!Removed == "RMVD") %>% + dplyr::select(Plate, Std_ID, IDs, CV_Flag, Mean_Abs) %>% distinct(.keep_all = TRUE) + +H2S_STD_forCHK <- H2S_STD_forCHK_a %>% dplyr::select( -Mean_Abs) + +#join check standards with standards +Chk_Std_join <- full_join(H2S_CHKs_1, H2S_STD_forCHK, by = join_by(Std_ID, Plate)) + + +#flag data +Chk_Std_flags <- Chk_Std_join %>% mutate( + Chk_Flag_pv= ifelse( + Chk_pvalue > p_value_chkstds , + "Chk_Good", + "Chk_Bad" + ) + +) %>% mutate(CHK_Flag = paste0(gsub(" ", "", IDs), Chk_Flag_pv)) %>% + mutate(CHK_CV_Flag = paste0("Chk",gsub(" ", "", IDs), Chk_cv_flag)) + + #Organize Data for Plotting and Flagging +Chk_Flags <- Chk_Std_flags %>% group_by(Plate) %>% + mutate(Chk_Flag = ifelse(any(CHK_Flag %like% "Bad"), "Chk_Bad", "Chk_Good"), Chk_cv_flag = ifelse(any(CHK_CV_Flag %like% "High"), "Chk_CV_High", "Chk_CV_Good")) %>% + ungroup() %>% + mutate(CHK_CV_Flags = ifelse(CHK_CV_Flag %like% "High", paste0(gsub(" ", "", IDs), Chk_cv_flag), "Good")) %>% mutate(CHKs_Flag = ifelse(CHK_Flag %like% "Bad", CHK_Flag, "Good")) + +H2S_CHKs_plot <- H2S_CHKs_a %>% rename(IDs = Chk_IDs, Mean_Abs = Chk_Mean_Abs) %>% mutate(Type = "Check") %>% dplyr::select(-Chk_cv_flag,-Chk_pvalue) + +H2S_Std_chkplot <- H2S_STD_forCHK_a %>% dplyr::select(IDs, Mean_Abs, Std_ID, Plate) %>% mutate(Type = "Standard") + +Chk_flags_plot <- Chk_Flags %>% dplyr::select(Std_ID, Plate, CHKs_Flag, Chk_Flag_pv) %>% group_by(Std_ID,Plate) %>% distinct(.keep_all = TRUE) %>% mutate(Check_Flag = ifelse(Chk_Flag_pv %like% "Good", "Good", "Bad")) + +H2S_Chks_bind <- rbind(H2S_CHKs_plot, H2S_Std_chkplot) + +H2S_Chks_bind_1 <- left_join(H2S_Chks_bind, Chk_flags_plot, by = join_by(Std_ID,Plate)) + +H2S_Chks_plot_bind_a <- H2S_Chks_bind_1 %>% mutate(Plot_ID = ifelse(IDs %like% "Chk" | IDs %like% "MC", substr(IDs, 4, 8), IDs)) %>% mutate(Plot_ID = ifelse(Plot_ID %like% "10pp", "Matrix: 10ppt", Plot_ID )) +H2S_Chks_plot_bind <-H2S_Chks_plot_bind_a %>% filter(str_detect(Type, "Check")) %>% mutate(Plot_ID =as.factor(Plot_ID)) + +Check_Val <- H2S_Chks_plot_bind_a %>% filter(!str_detect(Type, "Check")) %>% group_by(Plot_ID) %>% mutate(Z = mean(Mean_Abs)) %>% dplyr::select(Plot_ID, Z) %>% distinct(.keep_all = TRUE) %>% filter(!Plot_ID %like% "10pp") %>% mutate(Plot_ID = ifelse(Plot_ID %like% "Std 5", "Matrix: 10ppt", Plot_ID )) %>% mutate(Plot_ID = as.factor(Plot_ID)) + +#Plot Check Standards +H2S_chk_plot <- ggplot(data = H2S_Chks_plot_bind, aes(x = Plate, y = Mean_Abs)) + + geom_bar(stat = 'identity', + position = position_dodge2(preserve = "single"), linewidth = 0.75, aes(fill = Check_Flag)) + + geom_hline(data = Check_Val, aes(yintercept = Z), linetype = "dashed", linewidth = 1, color = "darkblue") + + facet_wrap(.~Plot_ID) + + ylim(0, max(H2S_Chks_plot_bind$Mean_Abs) + 0.2) + + geom_label_repel(data = Check_Val, aes( x = "Plate1", y = Z + 0.25), label = "Mean Target Arbsorbance", alpha = 0.7, color = "darkblue") + + scale_fill_manual(values = c("Good" = "darkgreen", "Bad" = "darkred")) + + theme_classic() + labs(x = " ", y = "Absorbance", title = + "Check Stds: H2S with Confidence Interval") + + theme(legend.position = "bottom", axis.text.x = element_text( + angle = 90, + vjust = 0.5, + hjust = 1)) + + +H2S_chk_plot + +``` + +## Display Any Check Flags +```{r, echo=FALSE} +Chk_Flag_1 <- Chk_Flags %>% dplyr::select(Plate, CHKs_Flag) %>% filter(CHKs_Flag != "Good") + +CHK_CV_Flag_1 <- Chk_Flags %>% dplyr::select(Plate, CHK_CV_Flags) %>% filter(CHK_CV_Flags != "Good") + +knitr::kable(Chk_Flag_1, format="markdown") + +knitr::kable(CHK_CV_Flag_1, format="markdown") + +``` + + +##Calculate Sulfide Concentrations & Add Concentration Flags +```{r Calculate Sulfide Concentrations,echo=FALSE,include=FALSE} + +High_Std <- H2S_STD_CV_fin %>% filter(IDs == "Std 5") %>% mutate(Mean_Abs = round(Mean_Abs, digits = 4)) %>% ungroup() %>% dplyr::select(Plate, Mean_Abs) %>% distinct(.keep_all = TRUE) %>% rename(High_DL = Mean_Abs) + +#filter out stds and other experiments +raw_data <- dat %>% + filter(!str_detect(IDs, "Std")) %>% + filter(!str_detect(IDs, "MC")) + +#Calculate Concentrations and fix zeroes/negative values and flag conc + +joined_data <- right_join(Std_crv_calc, raw_data, by = join_by(Plate)) + +calc_data <- joined_data %>% mutate(Conc = ((Abs - Int_Calc) / Slope_Calc)*Dilution) %>% mutate(Conc = ifelse(Conc <= 0, 0, Conc)) + +dl_data <- right_join(High_Std, calc_data, by = join_by(Plate)) + +``` + +##Remove High CV Samples and Average +```{r, echo=FALSE} + +#Calculate CVs +H2S_SPL_cv <- dl_data %>% group_by(Plate, IDs) %>% mutate(Mean_Conc = mean(Conc)) %>% mutate(Conc_SD = sd(Conc)) %>% mutate(CV = cv(Conc)) %>% mutate(CV_Flag = ifelse(CV >= cv_flag_stds, "CV_High", "CV_Good")) %>% mutate(Mean_Abs = mean(Abs)) %>% mutate(Conc_Flag = ifelse(Mean_Abs < MDL, "bdl", ifelse(Mean_Abs > High_DL, "adl", "Within_Range"))) %>% ungroup() + +#calculate new cv getting best cv from points if cv was high +H2S_SPL_cv_new <- H2S_SPL_cv %>% group_by(Plate, IDs) %>% + mutate(CV_New = map_dbl(row_number(), ~cv(Conc[-.x]))) %>% #Calculate CVs without 1 point + mutate(Removed = ifelse( #Choose Lowest CV if CV is high + CV_Flag == "CV_High", + ifelse( + CV_New == min(CV_New), + "RMVD", + "KEPT"), "CV_Good"), +CV2 = ifelse(CV_Flag == "CV_High", min(CV_New), CV), +Conc_rm = ifelse(Removed == "RMVD", NA, Conc)) %>% + mutate(Mean_Conc2 = mean(Conc_rm, na.rm = TRUE)) %>% + mutate(CV_Flag2 = ifelse(CV2 >= cv_flag_sample, "CV_High", "CV_Good")) %>% + mutate(Conc_SD2 = sd(Conc_rm, na.rm = TRUE)) %>% ungroup() + +H2S_SPL_CV_fin <- H2S_SPL_cv_new %>% dplyr::select(Plate, + Wells, + Conc, + Removed, + IDs, + Dilution, + Conc, + Mean_Conc2, + Conc_SD2, + CV2, + CV_Flag2, + Conc_Flag) %>% + mutate(Mean_Conc = Mean_Conc2, CV_Flag = CV_Flag2, SD_Conc = Conc_SD2, CV = CV2) %>% + dplyr::select(Plate, Conc, + Removed, + IDs, + Dilution, + Mean_Conc, + SD_Conc, + CV, + CV_Flag, + Conc_Flag) + +``` + +## Plot Samples +```{r, echo=FALSE} + +#Filter samples and mark reruns +H2S_Spl_pre_viz <- H2S_SPL_cv_new %>% mutate(IDs = toupper(IDs)) %>% + filter(str_detect(IDs, "L")) %>% + filter(!str_detect(IDs, "DUP")) %>% + filter(!str_detect(IDs, "SPIKE")) %>% + dplyr::select(Plate, IDs, Mean_Conc, Conc_SD, CV_Flag) %>% distinct(.keep_all = TRUE) %>% mutate(IDs = ifelse(Plate %like% "rr", paste0(IDs, "_RR"), IDs)) %>% mutate(ForPlot = ifelse(row_number() <= 80, "A", "B")) + +#Plot Samples before corrections +H2S_Spl_Plot_Pre <- ggplot(H2S_Spl_pre_viz, aes(y = Mean_Conc, x = IDs, fill = CV_Flag)) + + geom_bar(stat = 'identity', + position = position_dodge2(), + linewidth = 0.75, + col = "white") + + scale_fill_manual(values = c( + "CV_Good" = "green2", + "CV_High" = "pink2" + )) + + labs(y = "Sulfide (uM)", x = "Sample ID") + + geom_errorbar( + aes(ymin = Mean_Conc - Conc_SD, ymax = Mean_Conc + Conc_SD), + width = 0.3, + position = position_dodge(.1) + ) + + theme_classic() + + facet_wrap(~ ForPlot ,, scale = "free_x", ncol = 1) + + theme(legend.position = "bottom", axis.text.x = element_text( + angle = 90, + vjust = 0.5, + hjust = 1) + ) + + ggtitle("Sample triplicate means and sd dev before bad reps removed") + + +H2S_Spl_Plot_Pre + +H2S_Spl_rmv_viz <- H2S_SPL_CV_fin %>% mutate(IDs = toupper(IDs)) %>% + filter(str_detect(IDs, "L")) %>% + filter(!str_detect(IDs, "DUP")) %>% + filter(!str_detect(IDs, "SPIKE")) %>% + dplyr::select(Plate, IDs, Mean_Conc, SD_Conc, CV_Flag, Conc_Flag) %>% distinct(.keep_all = TRUE) %>% mutate(IDs = ifelse(Plate %like% "rr", paste0(IDs, "_RR"), IDs)) %>% mutate(ForPlot = ifelse(row_number() <= 80, "A", "B")) + +#Plot samples after Corrections +H2S_Spl_Plot_CV <- ggplot(H2S_Spl_rmv_viz, aes(y = Mean_Conc, x = IDs, fill = CV_Flag)) + + geom_bar(aes(col = Conc_Flag), stat = 'identity', + position = position_dodge(), + linewidth = 0.75) + + scale_fill_manual(values = c( + "CV_Good" = "green2", + "CV_High" = "pink2" + )) + + scale_color_manual(values = c("Within_Range" = "darkgreen", "adl" = "red3", "bdl" = "blue3" )) + + labs(y = "Sulfide (uM)", x = "Sample ID") + + geom_errorbar( + aes(ymin = Mean_Conc - SD_Conc, ymax = Mean_Conc + SD_Conc), + width = 0.3, + position = position_dodge(.1) + ) + + theme_classic() + + facet_wrap(~ForPlot, scales = "free_x", ncol = 1) + + theme(legend.position = "bottom", axis.text.x = element_text( + angle = 90, + vjust = 0.5, + hjust = 1), + strip.text = element_blank(), + strip.background = element_blank() + ) + + ggtitle("Sample triplicate means and sd dev after bad reps removed") + + +H2S_Spl_Plot_CV + + + +``` + + +## Duplicate QAQC + +```{r,echo=FALSE} + +#pull out any rows that have "Dup" in the ID column and tag reruns +DUP_start <- H2S_SPL_CV_fin %>% mutate(Dup_ID = gsub(" ", "", substr(IDs, 1, 6)), + Dup = ifelse(IDs %like% "Dup", "Dup", "Org")) %>% mutate(Dup_ID = ifelse(Plate %like% "rr", paste0(Dup_ID, "_RR"), Dup_ID)) + +#separate dups from originals and tag for pairing + +dups_only <- DUP_start %>% filter(Dup == "Dup") %>% dplyr::select(Dup_ID, Mean_Conc, SD_Conc, Plate) %>% rename(Dup_Conc = Mean_Conc, Dup_SD = SD_Conc) %>% distinct(.keep_all = TRUE) + +no_dups <- DUP_start %>% filter(!Dup == "Dup") + +dup_spls_l <- dups_only %>% dplyr::select(Dup_ID) %>% distinct(.keep_all = TRUE) + +dup_spls <- no_dups %>% filter(Dup_ID %in% as.vector(dup_spls_l$Dup_ID)) %>% dplyr::select(Dup_ID, Mean_Conc, SD_Conc, Plate, IDs) %>% distinct(.keep_all = TRUE) + +dup_join <- full_join(dups_only, dup_spls, by = join_by(Dup_ID, Plate)) %>% na.omit() + +#Calculate Percent difference and Flag +dup_flags <- dup_join %>% + mutate(Diff_P = (abs(100 * (Mean_Conc - Dup_Conc) / mean(c(Mean_Conc, Dup_Conc))))) %>% + mutate(Dup_Flag = ifelse(Diff_P >= dups_perc_diff, "Dup_Bad", "Dup_Good")) + +#oraganize data for flagging and plotting +dup_flags_1 <- dup_flags %>% dplyr::select(Dup_ID, Dup_Flag, Diff_P, Plate) + +Dup_for_plot_1 <- DUP_start %>% dplyr::select(Plate, Mean_Conc, Dup_ID, IDs) %>% distinct(.keep_all = TRUE) %>% filter(Dup_ID %in% as.vector(dup_spls_l$Dup_ID)) %>% + left_join(dup_flags_1, by = join_by(Dup_ID, Plate)) %>% + mutate(Dup = ifelse(IDs %like% "Dup", "Duplicate", "Original")) %>% + dplyr::select(-IDs, -Mean_Conc, -Dup) %>% distinct(.keep_all = TRUE) %>% na.omit + +#plot Data +Dup_Plot <- ggplot(Dup_for_plot_1, + aes( + x = Plate, + y = Diff_P + )) + + geom_bar( + aes(fill = Dup_Flag), + stat = 'identity', + position = position_dodge2(preserve = "single"), + linewidth = 0.9 + ) + + geom_label_repel(data = as.data.frame(1), aes(x = "Plate1", y=17.5), label= "Percent Difference Cutoff", color = "red3", alpha = 0.7) + + geom_hline(aes(yintercept = dups_perc_diff), linetype = "dashed", linewidth = 1.5, color = "red3") + + labs(y = "Percent Difference", x = "Sample ID") + + scale_fill_manual(values = c( + "Dup_Good" = "darkgreen", + "Dup_Bad" = "darkred" + )) + + theme_classic()+ + theme(legend.position = "bottom") + + ggtitle("H2S Duplicates") + +Dup_Plot + + +``` + +## Display Dup Flags + +```{r, echo=FALSE} +Dup_Flag_1 <- dup_flags %>% group_by(Plate) %>% mutate(Dup_Flags = ifelse("Dup_Bad" %in% Dup_Flag, "Dup_Bad", "Dup_Good")) %>% dplyr::select(Plate, Dup_Flags) %>% rename(Dup_Flag = Dup_Flags) %>% distinct(.keep_all = TRUE) + +Dup_Flags_1 <-Dup_Flag_1 %>% mutate(Dup_Flags = paste0(Dup_Flag, "-", Plate)) + +Dup_Flags_2 <- Dup_Flags_1 %>% dplyr::select(Plate, Dup_Flag) %>% group_by(Plate) %>% mutate(Duplicate_Flag = ifelse("Dup_Bad" %in% Dup_Flag, "Dup_Bad", "")) %>% dplyr::select(Plate, Duplicate_Flag) %>% rename(Dup_Flag = Duplicate_Flag) %>% distinct(.keep_all = TRUE) + +Bad_Dups <- dup_flags %>% filter(str_detect(Dup_Flag, "Dup_Bad")) + +Bad_D_N <- length(Bad_Dups$Dup_Flag) + +Total_D_N <- length(dup_flags$Dup_Flag) + +ifelse(Bad_D_N/Total_D_N > 0.4, paste0("<60% of Dups Pass, Rerun"), paste0(">60% Dups Pass") ) + +Duplicate_Flag <- ifelse(Bad_D_N/Total_D_N > 0.4, paste0(" >40% Dups Fail"), "" ) + +knitr::kable(Dup_Flag_1, format="markdown") + + +``` + +## Spike QAQC +```{r, echo=FALSE} +#pull out any rows that have "Spk" in the ID column +SPK_start <- H2S_SPL_CV_fin %>% mutate(Spk_ID = gsub(" ", "", substr(IDs, 1, 6)), + Spk = ifelse(IDs %like% "Spike", "Spk", "Org")) %>% mutate(Spk_ID = ifelse(Plate %like% "rr", paste0(Spk_ID, "_RR"), Spk_ID)) +#separate spikes from originals +spks_only <- SPK_start %>% filter(Spk == "Spk") %>% dplyr::select(Spk_ID, Mean_Conc, SD_Conc, Dilution, Plate) %>% rename(Spk_Conc = Mean_Conc, + Spk_SD = SD_Conc, + Spk_Dilution = Dilution) %>% distinct(.keep_all = TRUE) + +no_spks <- SPK_start %>% filter(!Spk == "Spk") + +spls_l <- no_spks %>% dplyr::select(Spk_ID) %>% distinct(.keep_all = TRUE) + +spk_spls_l <- spks_only %>% dplyr::select(Spk_ID) %>% distinct(.keep_all = TRUE) + +spk_spls <- no_spks %>% filter(Spk_ID %in% as.vector(spk_spls_l$Spk_ID)) %>% dplyr::select(Spk_ID, Mean_Conc, SD_Conc, Plate, IDs, Dilution) %>% distinct(.keep_all = TRUE) + +SPK_only <- spks_only %>% filter(Spk_ID %in% as.vector(spls_l$Spk_ID)) + +spk_join <- full_join(SPK_only, spk_spls, by = join_by(Spk_ID, Plate)) + +#Calculate recovery and flag data +spk_flags <- spk_join %>% mutate( + Spl_mol = (sample_vol / Con1) * (Mean_Conc / Dilution), + Spk_mol = ((sample_vol + spkvol) / Con1) * (Spk_Conc / Spk_Dilution), + Spk_exp = Spl_mol + spk_Conc, + Spk_recovery = (Spk_mol/Spk_exp) * 100) %>% + mutate( + Spk_Flag = ifelse( + Spk_recovery >= high_recovery_cutoff | + Spk_recovery <= low_recovery_cutoff, + "Spk_Bad", + "Spk_Good" + ) + ) + +#organize data for flagging and plotting +spk_flags_1 <- spk_flags %>% dplyr::select(Spk_ID, Spk_Flag, Spk_recovery, Plate) %>% na.omit() + +Spk_for_plot_a <- SPK_start %>% dplyr::select(Plate, Mean_Conc, Spk_ID, IDs) %>% + distinct(.keep_all = TRUE) %>% + filter(Spk_ID %in% as.vector(spk_spls_l$Spk_ID)) %>% + left_join(spk_flags_1, by = join_by(Spk_ID, Plate)) %>% + mutate(Spk = ifelse(IDs %like% "Spike", "Spike", "Original")) %>% + filter(Spk_ID %in% as.vector(spls_l$Spk_ID)) + +Spk_for_plot_1 <- Spk_for_plot_a %>% dplyr::select(Plate, Spk_ID, Spk_recovery, Spk_Flag) %>% na.omit() %>% distinct(.keep_all = TRUE) + +#plot data +Spk_Plot <- ggplot(Spk_for_plot_1, + aes( + x = Plate, + y = Spk_recovery + )) + + geom_rect(aes(xmin=0, xmax=Inf, ymin=low_recovery_cutoff, ymax=high_recovery_cutoff), alpha = 0.25, fill ="palegreen") + + geom_bar( aes(fill = Spk_Flag), + stat = 'identity', + position = position_dodge2(preserve = "single"), + linewidth = 0.9 + ) + + geom_hline(aes(yintercept = high_recovery_cutoff), linetype = "dashed", color = "green3", linewidth = 1.5) + + geom_hline(aes(yintercept = low_recovery_cutoff), linetype = "dashed", color = "green3", linewidth = 1.5) + + geom_label_repel(data = as.data.frame(1),aes(x = "Plate1", y=high_recovery_cutoff - 7.5), label= "Acceptable Recovery Range", color = "darkgreen", alpha = 0.7) + + labs(y = "Spike Recovery (%)", x = "Plate") + + scale_fill_manual(values = c( + "Spk_Good" = "darkgreen", + "Spk_Bad" = "darkred" + )) + + theme_classic() + + theme(legend.position = "bottom") + + ggtitle("H2S Spikes") + +Spk_Plot + + +``` + +## Display Spike Flags +```{r, echo=FALSE} + +#Check if all Spikes are paired +ifelse(all(as.vector(spk_spls_l$Spk_ID) %in% as.vector(spls_l$Spk_ID)), paste0("Spikes Paired"), paste0("Spike Missing Pair")) + +#Format Data frame +Spk_Flag_1 <- spk_flags %>% dplyr::select(Plate, IDs, Spk_Flag) %>% na.omit() + +#Attach Plate to Flag +Spk_Flags_1 <-Spk_Flag_1 %>% group_by(Plate) %>% mutate(Spk_Flags_T = ifelse( "Spk_Bad" %in% Spk_Flag, paste0("Spk_Bad"), paste0("Spk_Good"))) %>% mutate(Spk_Flags = paste0(Spk_Flags_T, "-", Plate))%>% ungroup() +#If any Spikes in Plate are bad, then flag plate +Spk_Flags_2 <- Spk_Flags_1 %>% dplyr::select(Plate, Spk_Flag) %>% group_by(Plate) %>% mutate(Spike_Flag = ifelse("Spk_Bad" %in% Spk_Flag, "Spk_Bad", "")) %>% dplyr::select(Plate, Spike_Flag) %>% rename(Spk_Flag = Spike_Flag) %>% distinct(.keep_all = TRUE) + +Spk_disp <- Spk_Flags_1 %>% dplyr::select(Plate, Spk_Flags_T) %>% rename(Spike_Flag = Spk_Flags_T) %>% distinct(.keep_all = TRUE) %>% na.omit() + +knitr::kable(Spk_disp, format="markdown") + +bad <- Spk_Flag_1 %>% filter(Spk_Flag %like% "Bad") + +length_bad <- length(as.vector(bad$Spk_Flag)) + +length_all <- length(as.vector(Spk_Flag_1$Spk_Flag)) + +ifelse(length_bad/length_all > 0.4, paste0("<60% of Spikes Pass, Rerun"), paste0("Spikes Pass") ) + +Spike_Flag <- ifelse(length_bad/length_all > 0.4, paste0(">40% Spikes Fail"), "" ) + +``` + + +## Merge samples with Metadata & check all samples are present +```{r check sample ids with metadata, echo=FALSE} +#Get Samples Only +H2S_spls_md <- H2S_SPL_CV_fin %>% mutate(IDs = toupper(IDs)) %>% + filter(str_detect(IDs, "L")) %>% + filter(!str_detect(IDs, "DUP")) %>% + filter(!str_detect(IDs, "SPIKE")) + +#Check for reruns and replace +H2S_spl_rrn <- H2S_spls_md %>%group_by(IDs,Plate) %>% + filter(Plate %like% "rr") %>% ungroup() %>% + dplyr::select(IDs, Mean_Conc, Conc_Flag, Dilution) %>% + rename(RRN_Conc = Mean_Conc, Conc_Flag_rr = Conc_Flag, Dilution_rr = Dilution) %>% + distinct(.keep_all = TRUE) + +RRN_IDs <- as.vector(H2S_spl_rrn$IDs) + +H2S_spl_og <- H2S_spls_md %>% group_by(IDs,Plate) %>% + filter(!Plate %like% "rr") %>% ungroup() %>% + dplyr::select(IDs, Mean_Conc, Conc_Flag, Plate, CV_Flag, Dilution, CV) %>% + distinct(.keep_all = TRUE) %>% + mutate(Rerun = ifelse(IDs %in% RRN_IDs, "RRN", "Org")) + +H2S_spl_rr_join <- full_join(H2S_spl_rrn, H2S_spl_og, by = join_by(IDs) ) + +Samples_Tagged <- H2S_spl_rr_join %>% mutate( + Conc = ifelse(Rerun == "RRN", RRN_Conc, Mean_Conc), + Conc_Flag = ifelse(Rerun == "RRN", Conc_Flag_rr, Conc_Flag), + Dilution = ifelse(Rerun == "RRN", Dilution_rr, Dilution) +) %>% dplyr::select(IDs, Conc, Conc_Flag, CV_Flag, Plate, Dilution, CV) %>% rename(Sample_ID = IDs) %>% ungroup() %>% group_by(Sample_ID) %>% mutate( + Min_CV = ifelse(CV == min(CV), "KEEP", "RMV"), # get if CV is lowest of reruns + Within_Range = "Within_Range" %in% Conc_Flag, #Get if any are within range + BDL = "bdl" %in% Conc_Flag, #get if any are below detection limit + Max_Dil = max(Dilution), #get maximum dilution of reruns + Min_Dil = min(Dilution),#get minimum dilution of reruns + All_Good = all(Conc_Flag == "Within_Range") & all(CV_Flag == "CV_Good"), #get if all are within range and good cv + CV_Check = CV == min(CV[which(Dilution == Max_Dil)]), #Get if CV is lowest of highest dilution for reruns + Number = length(Conc) #get number of times ran +) %>% ungroup() %>% + mutate(Remove = ifelse(Number == 1, #check if sample was reran + "KEEP", + ifelse(All_Good, #check if multiple samples meet all criteria + ifelse(Min_CV == "KEEP", #Keep only lowest CV + "KEEP1", + "RMV1"), + ifelse(Conc_Flag == "Within_Range" & CV_Flag == "CV_Good", #If only one sample meets all criteria keep that one + "KEEP2", ifelse(Conc_Flag == "Within_Range", "KEEP2a", + ifelse(!(Within_Range) & BDL, #Check if none are within range but are under detection limit + ifelse(Dilution == Min_Dil, #keep lowest dilution + "KEEP3", + "RMV3"), + ifelse(!(Within_Range) & CV_Check, #if all are above detection limit keep lowest CV of highest dilution + "KEEP4", + "RMV4") + ) + ) + )))) + +Samples <- Samples_Tagged %>% filter(Remove %like% "KEEP") + +#check to see if all samples are present in the metadata +all_present <- all(metadata$Sample_Name %in% Samples$Sample_ID) + +if (all_present) { + message("All sample IDs are present in data") +} else { + message("Some sample IDs are missing from data.") + + # Optional: Which ones are missing? + missing_ids <- setdiff(metadata$Sample_Name, Samples$Sample_ID) + print(missing_ids) +} + + +#merge metadata with sample run data +merged_data <- metadata %>% + mutate(Sample_ID = paste0("\\b", Sample_ID, "\\b")) %>% + fuzzyjoin::regex_left_join(Samples, ., by = c(Sample_ID = "Sample_Name")) + +#might want to include a flag or something to see that all the samples are included? + +``` + + +##Add Flags +```{r, echo=FALSE} + +#Get only bad flags for each plate and check +Chk_Flags_All <- Chk_Flags %>% dplyr::select(Plate, CHKs_Flag) %>% filter(CHKs_Flag %like% "Bad") %>% na.omit() %>% distinct(.keep_all = TRUE) %>% group_by(Plate) %>% + summarise( + CHKSTD_Flags = paste(CHKs_Flag, collapse = ", "), + .groups = 'drop' # Drops the grouping structure after summarizing + ) + + +STD_Flags_All <- STD_CRV_flags %>% dplyr::select(Plate, R2_Flag, CV_Flag) %>% mutate(STDCV_Flags = paste0("STD", CV_Flag)) %>% dplyr::select(-CV_Flag) %>% mutate( + R2_Flag = ifelse(R2_Flag %like% "Good", NA, R2_Flag), + STDCV_Flags = ifelse(STDCV_Flags %like% "Good", NA, STDCV_Flags) +) %>% na.omit() + +Flags_Int <- tibble(Plate = c(plates)) + +#Join Flags + +Flags_Joined_1 <-left_join(Flags_Int, Dup_Flags_2, by = join_by(Plate)) + +Flags_Joined_2 <- left_join(Flags_Joined_1, Spk_Flags_2, by = join_by(Plate)) + +Flags_Joined_3 <- left_join(Flags_Joined_2, Chk_Flags_All, by = join_by(Plate)) + +Flags_Joined_4 <- left_join(Flags_Joined_3, STD_Flags_All, by = join_by(Plate)) + +Flags_Joined <- left_join(Flags_Joined_4, Curve_Flags_forJoin, by = join_by(Plate)) + + +Flags_Joined[Flags_Joined == "NA"] <- NA + +#Merge Flags into one column +Flags <- Flags_Joined %>% replace(is.na(.), "") %>% mutate( + H2S_Flags = paste0( + Spk_Flag, + " ", + Dup_Flag, + " ", + CHKSTD_Flags, + " ", + R2_Flag, + " ", + STDCV_Flags, + " ", + Slope_Flag, + " ", + Int_Flag + ) +) %>% dplyr::select(Plate, H2S_Flags) + +#Add Flags to data +flagged_data <- left_join(merged_data, Flags, by = join_by(Plate)) + + +df_all_clean <- flagged_data %>% dplyr::select(-Plate) + +``` + +##Organize Data +```{r, echo=FALSE} +#check results +#head(Samples) + +#pull out what we need + +df_all_clean_cols <- df_all_clean %>% + dplyr::select( + Site, + Project, + Year, + Month, + Community, + Nickname, + Plot_Name, + Depth_cm, + CO2_Treatment, + N_Treatment, + Conc, + Conc_Flag, + CV_Flag, + H2S_Flags + ) + +final_data_labeled <- df_all_clean_cols %>% + mutate( + Run_notes = Run_notes,# new column with notes about the run + Analysis_rundate = Run_Date) + +#rename columns +org_labeled_fin_data <- final_data_labeled %>% + rename( + H2S_Conc_uM = Conc, + H2S_Conc_Flag = Conc_Flag, + Plot = Plot_Name, + H2S_CV_Flag = CV_Flag + ) + +#Order Columns for Final Data Frame +All_Clean_Data <- org_labeled_fin_data %>% + dplyr::select( + Site, + Project, + Year, + Month, + Community, + Nickname, + Plot, + Depth_cm, + CO2_Treatment, + N_Treatment, + H2S_Conc_uM, + H2S_Conc_Flag, + H2S_CV_Flag, + H2S_Flags, + Analysis_rundate, + Run_notes + ) +#head(Samples1) + +``` + + +## Visualize Data +```{r Visualize Data, echo=FALSE} + +H2S_forplot <- All_Clean_Data + +#ensure points are in correct order + +H2S_forplot <- H2S_forplot[order(H2S_forplot$Depth_cm), ] + +color1 <- c("L1", "L2", "L3", "L4") +color2 <- c("L5", "L6", "L8", "L10") +color3 <- c("L7", "L9", "L11", "L12") +color4 <- c("L13", "L14", "L16", "L15") +color5 <- c("L17", "L18", "L19", "L20") + +H2S_forplot <- H2S_forplot %>% + mutate( + Plot_Color = case_when( + Plot %in% color1 ~ "Color1", + Plot %in% color2 ~ "Color2", + Plot %in% color3 ~ "Color3", + Plot %in% color4 ~ "Color4", + Plot %in% color5 ~ "Color5" + ) + ) %>% + mutate(Treatment = ifelse( + CO2_Treatment == "Elevated" & + N_Treatment == "Amended", + "eCO2 & eN", + ifelse( + CO2_Treatment == "Elevated" & + N_Treatment == "Ambient", + "eCO2 & aN", + ifelse( + CO2_Treatment == "Ambient" & + N_Treatment == "Amended" , + "aCO2 & eN" , + "aCO2 & aN" + ) + ) + )) %>% + mutate(CO2_Treatment = ifelse(CO2_Treatment == "Ambient", "aCO2", "eCO2")) %>% + mutate(N_Treatment = ifelse(N_Treatment == "Ambient", "aN", "eN")) + +viz_H2S_plot2 <- ggplot(data = H2S_forplot, aes( + x = factor(as.factor(CO2_Treatment), levels = c("eCO2", "aCO2")), + y = H2S_Conc_uM, + fill = as.factor(Treatment), + color = as.factor(Treatment) +)) + + geom_bar( + stat = "identity", + position = position_dodge2(padding = 0.25,preserve = "single") + ) + + facet_grid(Depth_cm ~ N_Treatment, scales = "fixed") + + scale_fill_manual(values = c( + "eCO2 & eN" = "#DB5461", + "eCO2 & aN" = "#454ADE", + "aCO2 & eN" = "white", + "aCO2 & aN" = "white" + ), + name = "Treatment:", + breaks = c("eCO2 & eN", "eCO2 & aN", "aCO2 & aN", "aCO2 & eN"), + labels = c("eCO2 & eN", "eCO2 & aN", "aCO2 & aN", "aCO2 & eN") + + ) + + scale_color_manual(values = c( + "eCO2 & eN" = "#DB5461", + "eCO2 & aN" = "#454ADE", + "aCO2 & eN" = "#DB5461", + "aCO2 & aN" = "#454ADE" + ), + name = "Treatment:", + breaks = c("eCO2 & eN", "eCO2 & aN", "aCO2 & aN", "aCO2 & eN"), + labels = c("eCO2 & eN", "eCO2 & aN", "aCO2 & aN", "aCO2 & eN") + ) + + theme_classic() + + labs(x = " ", + y = "H2S (uM)", + title = "CO2xN: Porewater Sulfide" + ) + + theme(legend.position = "right") + + scale_x_discrete(drop = TRUE) + + theme( + axis.text.x = element_text(angle = 0, hjust = 0.5), + panel.border = element_rect( + color = "black", + fill = NA, + linewidth = 0.8 + ) + ) + +coord_flip() +print(viz_H2S_plot2) + +``` + + + +```{r, echo=FALSE} +#ensure points are in correct order + +#make plot +viz_H2S_plot_2 <- ggplot(data = H2S_forplot, aes(x = H2S_Conc_uM, y = as.numeric(Depth_cm), color = Plot_Color)) + + geom_point(size = 3) + + geom_path(linewidth = 1) + + scale_color_manual( + values = c( + "Color1" = "#FFD500", + "Color2" = "#00D0FF", + "Color3" = "#FF0075", + "Color4" = "#80d280", + "Color5" = "#ff6040" + ), + labels = c("1", "2", "3", "4", "5") + ) + + facet_grid(Treatment ~ ., scales = "fixed") + + labs( + x = "H2S (uM)", + y = "Depth (cm)", + title = "CO2xN: Porewater H2S by Replicate", + color = "Replicate" + ) + + scale_y_reverse(breaks = c(20, 40, 80), limits = c(90, 10)) + + theme_classic() + + theme( + axis.text.x = element_text(angle = 0, hjust = 0.5), + panel.border = element_rect( + color = "black", + fill = NA, + linewidth = 0.8 + ) + ) + +viz_H2S_plot_2 +``` + + +##Export Data +```{r, echo=FALSE} +write.csv(unique_log, log_path) + + Rerun_Data <- All_Clean_Data %>% filter(H2S_Conc_Flag != "Within Range" | H2S_CV_Flag %like% "High") + +if(After_Reruns == "YES"){ + write.csv(All_Clean_Data, final_path)} else { + write.csv(Rerun_Data, rerun_path) } +#end +``` + + +### END \ No newline at end of file diff --git a/CO2xN/Porewater/Sulfide/2026/GCReW_CO2xN_Porewater_H2S_Template.Rmd b/CO2xN/Porewater/Sulfide/2026/GCReW_CO2xN_Porewater_H2S_Template.Rmd new file mode 100644 index 0000000..fd89a7e --- /dev/null +++ b/CO2xN/Porewater/Sulfide/2026/GCReW_CO2xN_Porewater_H2S_Template.Rmd @@ -0,0 +1,1319 @@ +--- +title: "CO2xN: Porewater Sulfide" +author: "Month Year Samples" +date: "`r Sys.Date()`" +output: + pdf_document: + toc: false + number_sections: false +geometry: left=2cm,right=2cm,top=1cm,bottom=2cm +--- +## Code Set up +```{r setup, include=FALSE} + +library(dplyr) +library(broom) +library(ggplot2) +library(ggpubr) +library(stringr) +library(purrr) +library(tidyverse) +library(here) +library(data.table) +library(matrixStats) +library(gridExtra) +library(grid) +library(plater) +library(raster) +library(knitr) +library(readxl) +library(ggrepel) + +``` + +## run information +```{r Information to be changed} + +##Before or After Reruns (YES or NO) +After_Reruns = "YES" +#If NO will not write final data file + #And Will Write a Rerun File + +###things that need to be changed + +sample_month = "May" +sample_year = "2026" +Run_Date = as.Date("05/19/2026", format = "%m/%d/%Y") +Run_by = "Melanie Giessner"#Instrument user +Script_run_by ="Melanie"#Code user + +Run_notes=""#any notes from run + +#Import Plate Data + +plates<- c("Plate1","Plate2","Plate3","Plate4","Plate5","rrPlate1","rrPlate2") + +folder_path_rawdata <- paste0("Raw Data") +Raw_plates <- list.files(path = folder_path_rawdata, full.names = TRUE,pattern = "Plate") +head(Raw_plates) + + +#Import Run Date for Each Plate for Std curve qaqc +Run_dates <- tibble( + Plate = plates, + Run_Date = c("05/18/2026","05/18/2026","05/18/2026","05/18/2026","05/19/2026","06/01/2026","06/01/2026") + ) + + Run_dates <- Run_dates %>% mutate(Run_Date = as.Date(Run_Date, tryFormats = c("%Y-%m-%d", "%m/%d/%y", "%m/%d/%Y"))) + + +# Define the file path for QAQC log file - NO Need to change just check year +log_path <- "Processed Data/LTREB_2M_H2S_QAQC_2026.csv" + +# Define final path for data be sure to change year and month and run number +final_path <- "Processed Data/GCReW_CO2xN_Porewater_H2S_202605.csv" +rerun_path <- "Processed Data/GCReW_CO2xN_Porewater_H2S_202605_reruns.csv" + +``` + +```{r Set Up Code - constants and QAQC cutoffs, include=FALSE} + +#Flag cutoffs + r2_cutoff = 0.985 #this is the level below which we want to rerun or consider a curve + cv_flag_stds = 10 #this is the maximum cv allowed for standards + p_value_chkstds = 0.05 #the p-value for the t-test between check standards must be greater than this + p_value_MC = 0.05 #the p-value for the t-test between matrix checks and top std must be greater than this + cv_flag_sample = 10 #this is the maximum cv allowed for samples + dups_perc_diff = 15.5 #this is the maximum percent difference allowed between duplicates + high_recovery_cutoff = 120 #this is the maximum percent recovery of SO4 allowed in spiked samples + low_recovery_cutoff = 80 #this is the minimum percent recovery of SO4 allowed in spiked samples + +#Standard concentrations - Update if running different standard curve: +# standard units are in uM + standards <- tibble( + IDs = c("Std 0", "Std 1", "Std 2", "Std 3", "Std 4", "Std 5"), + Conc = c(0, 5.0, 12.5, 25.0, 50.0, 100.0) + ) #uM + + chk_standards <- tibble( + IDs = c("ChkStd 0", "ChkStd 3", "ChkStd 4"), + Conc = c(0, 25.0, 50.0) + ) #uM + + mtx_standards <- tibble( + IDs = c("MC: 10ppt S5"), + Conc = c(100) + ) #uM + +#Spike concentration calc + #spike for these samples was 50 uL of the 100uM standard + Con1 <- 1000000 #conversion factor value for spike volumes (uL -> L) + spk_std <- 100 # uM S2- standard used + spkvol <- 50 # uL volume of spike added + spk_Conc <- spk_std*(spkvol/Con1) # umoles of S2- added to each spiked sample + sample_vol <- 250 # the sample volume without the spike is 250 uL + samp_vol_a <- 300 # the sample volume + +#Top standard Concentration- Update if running different standard curve: + Top_STD = 100 + + +#Metadata file path +Raw_Metadata = here(".." , "GCReW", "GCReW_Project_Treatment_Metadata.csv") + +#Significant Digits +sigdigs <- 3 + +``` + + +##Read in metadata and create similar sample IDs for matching to samples +```{r pull in metadata for later, include=FALSE} + +#read in metadata + +raw_metadata <- read.csv(Raw_Metadata) +#clean up columns in metadata file: +metadata <- raw_metadata %>% + filter(grepl("2-Meter", Nickname, ignore.case = TRUE)) %>% + mutate(Sample_Name = paste0(Sample.ID)) %>% + mutate(Month = sample_month) %>% + mutate(Year = sample_year) %>% + rename( + Sample_ID = Sample.ID, + Plot_Name = Plot, + ) %>% + dplyr::select(-Temp_Treatment) %>% + mutate(Treatment = ifelse( + CO2_Treatment == "Elevated" & + N_Treatment == "Amended", + "eCO2_N", + ifelse( + CO2_Treatment == "Elevated" & + N_Treatment == "Ambient", + "eCO2", + ifelse(CO2_Treatment == "Ambient" & + N_Treatment == "Amended" , "N" , "Ambient") + ) + )) + +``` + + +##Read in data +```{r read in plates,echo=FALSE,include=FALSE} + +#read in the csv files +dat<-read_plates( + files = Raw_plates,#list of all file paths + plate_names = plates , #list of plate names + well_ids_column = "Wells", # name to give column of well IDs (optional) + sep = "," # separator used in the csv file (optional) +) %>% + rename("Abs"=values, + "IDs"=values.2, + "Dilution"=values.3) +head(dat) + +``` + +##Remove High CV Stds +```{r, echo=FALSE} + +#filter for STDs +H2S_stds_raw <- dat %>% subset(IDs %like% "Std" | IDs %like% "Chk" | IDs %like% "MC") + +#Add in STD values +H2S_stds <- left_join(H2S_stds_raw, standards, by = "IDs") + +#Calculate CVs and add flags +H2S_STD_cv <- H2S_stds %>% group_by(Plate, IDs) %>% mutate(CV = cv(Abs)) %>% mutate(CV_Flag = ifelse(CV >= cv_flag_stds, "CV_High", "CV_Good")) %>% ungroup() + +#calculate new cv getting best cv from points if cv was high +H2S_STD_cv_new <- H2S_STD_cv %>% group_by(Plate, IDs) %>% + mutate(CV_New = map_dbl(row_number(), ~cv(Abs[-.x]))) %>% #Calculate CVs without 1 point + mutate(Removed = ifelse( #Choose Lowest CV if CV is high + CV_Flag == "CV_High", + ifelse( + CV_New == min(CV_New), + "RMVD", + "KEPT"), "CV_Good"), +CV2 = ifelse(CV_Flag == "CV_High", min(CV_New), CV), +Abs_rm = ifelse(Removed == "RMVD", NA, Abs)) %>% + mutate(Mean_Abs2 = mean(Abs_rm, na.rm = TRUE)) %>% + mutate(CV_Flag2 = ifelse(CV2 >= cv_flag_stds, "CV_High", "CV_Good")) %>% ungroup() + +#organize data +H2S_STD_CV_fin <- H2S_STD_cv_new %>% dplyr::select(Plate, + Wells, + Abs, + Removed, + IDs, + Dilution, + Conc, + Mean_Abs2, + CV2, + CV_Flag2) %>% + mutate(Mean_Abs = Mean_Abs2, CV_Flag = CV_Flag2, CV = CV2) %>% + dplyr::select(Plate, + Wells, Abs, + Removed, + IDs, + Dilution, + Conc, + Mean_Abs, + CV, + CV_Flag) + + +``` + + +##Check R2 & Remove Standards if Necessary +```{r, echo=FALSE} +split_data <- H2S_STD_CV_fin %>% filter(IDs %like% "Std") %>% filter(!IDs %like% "Chk") %>% dplyr::select(Plate, IDs, Conc, Mean_Abs, Abs, Removed, CV_Flag) %>% filter(!Removed == "RMVD") %>% #Split Data by Plate + distinct() %>% + group_by(Plate) %>% + group_split() + +#run regression and get coefficients by Run +Slope_H2S_raw_list <- map(split_data, ~ .x %>% mutate(Curve = "H2S", + R2 = summary(lm(Abs ~ Conc, data = .))$adj.r.squared , + Slope = coef(lm(Abs ~ Conc, data = .))[2], + Intercept = coef(lm(Abs ~ Conc, data = .))[1])) + + + Slope_H2S_raw <- bind_rows(Slope_H2S_raw_list) + + #check R2 and flag + Slope_H2S_Std_Crvs <- Slope_H2S_raw %>% dplyr::select(Plate, Curve, R2, Slope, Intercept) %>% distinct() %>% mutate(R2_Flag = ifelse(R2 >= r2_cutoff, "R2_Good", "R2_Bad")) + + #join standard curve CVs and regression values + R2_Check_Raw <- left_join(Slope_H2S_Std_Crvs, H2S_STD_CV_fin, by = "Plate") + + R2_Check <- R2_Check_Raw %>% + dplyr::select(Plate, + IDs, + Abs, + Removed, + Mean_Abs, + Conc, + R2, + Slope, + Intercept, + CV_Flag, + CV, + R2_Flag) %>% filter(IDs %like% "Std") %>% filter(!IDs %like% "Chk") %>% + distinct() + + #calculate concentrations from standard curve and separate removable points + + R2_Split <- R2_Check %>% mutate(RMVBL = ifelse(IDs %in% c("Std 0", "Std 1", "Std 5"), "No", "Yes")) %>% group_by(Plate) %>% dplyr::select(-Abs, -Removed) %>% distinct() %>% group_split() + + R2_New <- map( + R2_Split, + ~ .x %>% mutate( + Curve = "H2S", + R2_New = map_dbl(row_number(), ~ + summary(lm( + Mean_Abs[-.x] ~ Conc[-.x], data = pick(Mean_Abs, Conc) + ))$adj.r.squared) , + Slope_New = map_dbl(row_number(), ~ + coef(lm( + Mean_Abs[-.x] ~ Conc[-.x], data = pick(Mean_Abs, Conc) + ))[2]) , + Intercept_New = map_dbl(row_number(), ~ + coef(lm( + Mean_Abs[-.x] ~ Conc[-.x], data = pick(Mean_Abs, Conc) + ))[1]) + ) + ) %>% bind_rows() + + R2_Check_RMVBL <- R2_New %>% mutate(R2_New = round(R2_New, digits = 8), + CV = round(CV, digits = 8)) %>% group_by(Plate) %>% mutate(R2_New = ifelse(IDs %in% c("Std 0", "Std 1", "Std 5"), NA, R2_New)) %>% mutate(R2_RMV = ifelse( + R2_Flag == "R2_Bad", + ifelse(R2_New == max(R2_New, na.rm = TRUE), "RMVD", "KEPT"), + "R2_Good" + )) %>% mutate(R2_RMV_CV = ifelse( + R2_RMV == "R2_Good", + ifelse(CV_Flag == "CV_High", ifelse(CV == max(CV), "RMVD", "KEPT"), "KEPT"), + R2_RMV + )) %>% mutate(R2_RMVD = ifelse(is.na(R2_RMV_CV), "KEPT", R2_RMV_CV)) %>% dplyr::select(-R2_RMV, -R2_RMV_CV) + +R2_Removed_forPair <- R2_Check_RMVBL %>% dplyr::select(Plate, IDs, R2_RMVD) %>% distinct() + +H2S_STDs_Pair <- H2S_STD_CV_fin %>% filter(IDs %like% "Std") %>% filter(!IDs %like% "Chk") %>% dplyr::select(Plate, IDs, Conc, Mean_Abs, Abs, Removed, CV_Flag) %>% filter(!Removed == "RMVD") %>% distinct() %>% left_join(R2_Removed_forPair) + + + R2_Check_fin <- H2S_STDs_Pair %>% mutate(STD_ABS_rmv = ifelse(R2_RMVD == "RMVD", NA, Abs)) %>% group_by(Plate) %>% mutate(Points = ifelse("RMVD" %in% R2_RMVD, "Point_Removed", "ALL_KEPT")) %>% dplyr::select(Plate, IDs, Conc, STD_ABS_rmv, CV_Flag, Points) %>% ungroup() %>% na.omit() + + #separate plates for new regression + split_data_rmv <- R2_Check_fin %>% + distinct() %>% + group_by(Plate) %>% + group_split() + + #get new standard curve values + Slope_H2S_raw_list_rm <- map(split_data_rmv, ~ .x %>% mutate(Curve = "H2S", + R2 = summary(lm(STD_ABS_rmv ~ Conc, data = .))$adj.r.squared , + Slope = coef(lm(STD_ABS_rmv ~ Conc, data = .))[2], + Intercept = coef(lm(STD_ABS_rmv ~ Conc, data = .))[1])) + + Slope_H2S_raw_rm <- bind_rows(Slope_H2S_raw_list_rm) + + Slope_H2S_Std_Crvs_rm <- Slope_H2S_raw_rm %>% dplyr::select(Plate, Curve, R2, Slope, Intercept, CV_Flag, Points) %>% distinct() %>% mutate(R2_Flag = ifelse(R2 >= r2_cutoff, "R2_Good", "R2_Bad")) + + +``` + + +## Plot Standard Curves +```{r Plot all Standard Curves together, echo=FALSE} +##this is to see if there are any stds or plates that look off + +#Plot Std Crvs by plate +H2S_Curve <- ggplot(Slope_H2S_raw_rm, aes(STD_ABS_rmv, Conc, color = Plate, linetype = Points)) + geom_point(size = 3) + + geom_smooth(method = "lm", formula = "y ~ x", se = FALSE) + labs(title = "H2S Standard Curves", x = "Absorbance", y = "Concentration (uM)") + + theme_classic() +H2S_Curve + +#Add dates to plate and format data +STD_run_date <- left_join(Run_dates, Slope_H2S_Std_Crvs_rm, by = join_by(Plate)) +new_log_stds <- STD_run_date %>% dplyr::select(Plate, + Curve, + R2, + Slope, + Intercept, + Run_Date) %>% mutate(R2 = round(R2, digits = 4), Slope = round(Slope, digits = 4), Intercept = round(Intercept, digits = 4), ) %>% mutate(Run = "Current Runs") + + +#read in log file and format +log <- read.csv(log_path) +log_2 <- log %>% mutate(Run_Date = as.Date(as.character(Run_Date), tryFormats = c("%Y-%m-%d", "%m/%d/%Y")), Run = "Past Runs") +log_3 <- log_2[, -c(1)] +log_4 <- rbind(log_3, new_log_stds) + +unique_log <- log_4 %>% distinct(Plate,Curve,R2,Slope,Intercept,.keep_all = TRUE) + +#Calculate Mean and SD and calculate 2SD range for slope and intercept +mean_slope <- mean(unique_log$Slope, na.rm = TRUE) +sd_slope <- sd(unique_log$Slope, na.rm = TRUE) + +hi_2sd_slope <- mean_slope + 2*sd_slope + +lo_2sd_slope <- mean_slope - 2*sd_slope + +mean_int <- mean(unique_log$Intercept, na.rm = TRUE) +sd_int <- sd(unique_log$Intercept, na.rm = TRUE) + +hi_2sd_int <- mean_int + 2*sd_int + +lo_2sd_int <- mean_int - 2*sd_int + +#Plot Slope log +Slopes_chk <- ggplot(unique_log, aes(x = Run_Date, y = Slope, col = Run)) + + ylim(0.0045,0.018) + + scale_color_manual(values = c("Past Runs" = "grey27", "Current Runs" = "cyan3")) + + geom_abline(intercept = mean_slope - 2*sd_slope, slope = 0, linetype = "dashed", linewidth = 1.5, col = "red" )+ + geom_abline(intercept = mean_slope + 2*sd_slope, slope = 0, linetype = "dashed", linewidth = 1.5, col = "red" )+ + geom_point(size = 2) + + theme_classic()+ + ggtitle("Slope Log") + +#Plot Intercept log +ints_chk <- ggplot(unique_log, aes(x = Run_Date, y = Intercept, col = Run)) + + ylim(0.03, 0.15) + + scale_color_manual(values = c("Past Runs" = "grey27", "Current Runs" = "cyan3")) + + geom_abline(intercept = mean_int - 2*sd_int, slope = 0, linetype = "dashed", linewidth = 1.5, col = "red" )+ + geom_abline(intercept = mean_int + 2*sd_int, slope = 0, linetype = "dashed", linewidth = 1.5, col = "red" )+ + geom_point(size = 2) + + theme_classic()+ + ggtitle("Intercept Log") + +ints_chk + +Slopes_chk + + +#Get done of original runs +Date_1 <-as.Date(new_log_stds$Run_Date[which(new_log_stds$Plate == "Plate1")]) + +#Check if Std Crvs are Within range and see if dates are close enough for combination +stdcrv_tagged <- new_log_stds %>% mutate( + In_Range_Slope = ifelse( + Slope >= hi_2sd_slope | + Slope <= lo_2sd_slope, + "Out of Range", + "In Range" + ), + In_Range_Int = ifelse( + Intercept >= hi_2sd_int | + Intercept <= lo_2sd_int, + "Out of Range", + "In Range" + ) +) %>% mutate( + Slope = ifelse(In_Range_Slope == "Out of Range", NA, Slope), + Intercept = ifelse(In_Range_Int == "Out of Range", NA, Intercept) +) %>% mutate(Date_Diff = abs(difftime(Date_1, Run_Date, units = "days"))) %>% mutate(Date_Close = ifelse(Date_Diff <= 2, "Yes", "No")) %>% mutate(Slope_Flag = ifelse(is.na(Slope), "Slope_Bad" , "Slope_Good"), Int_Flag = ifelse(is.na(Intercept), "Intercept_Bad" , "Intercept_Good")) %>% mutate( + Slope = ifelse(is.na(Intercept) | R2 <= r2_cutoff, NA, Slope), + Intercept = ifelse(is.na(Slope)| R2 <= r2_cutoff, NA, Intercept), + Curve_RMVD = ifelse(is.na(Slope) | + is.na(Intercept) | R2 <= r2_cutoff , "RMVD", "KEPT") +) + +#Calculate Combo Std Crv +stdcrv_filtered <- stdcrv_tagged %>% filter(Date_Close == "Yes") +stdcrv_filtered_no <- stdcrv_tagged %>% filter(Date_Close == "No") +mean_slope_fin <- mean(stdcrv_filtered$Slope, na.rm = TRUE) +mean_slope_no <- mean(stdcrv_filtered_no$Slope, na.rm = TRUE) +mean_int_fin <- mean(stdcrv_filtered$Intercept, na.rm = TRUE) +mean_int_no <- mean(stdcrv_filtered_no$Intercept, na.rm = TRUE) + +#Attach Slope and Intercept to Plates +Std_crv_calc <- stdcrv_tagged %>% mutate(Slope_Calc = ifelse(Date_Close == "Yes", mean_slope_fin, mean_slope_no), Int_Calc = ifelse(Date_Close == "Yes", mean_int_fin, mean_int_no)) %>% dplyr::select(Plate, Slope_Calc, Int_Calc, Curve_RMVD, Slope_Flag, Int_Flag) %>% as.data.frame() + +std_curves <- Std_crv_calc %>% dplyr::select(Plate, Curve_RMVD) %>% filter(Curve_RMVD != "RMVD") %>% distinct() + +Curve_Flags <- Std_crv_calc %>% dplyr::select(Plate, Slope_Flag, Int_Flag) %>% distinct() + +Curve_Flags_forJoin <- Curve_Flags %>% mutate(Slope_Flag = ifelse(Slope_Flag %like% "Good", "", Slope_Flag), Int_Flag = ifelse(Int_Flag %like% "Good", "", Int_Flag)) + + +Std_crv_calc <-Std_crv_calc %>% distinct() +``` + +## Return Flags For Standard Curve +```{r, echo=FALSE} + +STD_CRV_flags <- full_join(Slope_H2S_Std_Crvs_rm, Run_dates, by = join_by(Plate)) + +STD_CRV_flags_table1 <- STD_CRV_flags %>% dplyr::select(Plate, R2_Flag, CV_Flag) + +STD_CRV_flags_table2 <- Std_crv_calc %>% dplyr::select(Plate, Curve_RMVD) %>% mutate(Curve_RMVD = ifelse(Curve_RMVD == "RMVD", "REMOVED", Curve_RMVD)) + +knitr::kable(STD_CRV_flags_table1, format="markdown") + +knitr::kable(STD_CRV_flags_table2, format="markdown") + + +``` + +## Method Detection Limit +```{r, echo=FALSE} + +#get only lowest standard + STD_MDL_df <- H2S_STD_CV_fin %>% filter(IDs == "Std 1" + #, Removed != "RMVD" + ) %>% dplyr::select(Plate, Mean_Abs, IDs) %>% distinct() + + STD0_df <- H2S_STD_CV_fin %>% filter(IDs == "Std 0" + #, Removed != "RMVD" + ) %>% dplyr::select(Plate, Mean_Abs, IDs) %>% distinct() +#calculate the standard deviation of abs +stddev_mdl <- sd(STD_MDL_df$Mean_Abs) + +#Calculate Mean Std 0 +std0_mean <- mean(STD0_df$Mean_Abs) + +#calculate n +n <- length(STD_MDL_df$Mean_Abs) + +#Identify the proper Student's T for n-1 +StudentsT <-qt(.99,(n-1)) + +#Multiply Standard deviation by Student's T +STD_var <- (stddev_mdl*StudentsT) +MDL <- STD_var + std0_mean + +MDL_df <- as.data.frame(MDL) + +MDL_Plot <- ggplot() + + geom_bar(stat = 'identity', data = STD_MDL_df, aes(x = Plate, y = Mean_Abs, fill = IDs)) + + geom_bar(data = STD0_df, aes(x = Plate, y = Mean_Abs, fill = IDs), stat = 'identity') + + scale_fill_manual(name = "Standard:", values = c("Std 0" = "lightgreen", "Std 1" = "cornflowerblue")) + + geom_hline(yintercept = MDL, linetype = "dashed", linewidth = 1.5, color = "blue3") + + geom_label_repel(data = MDL_df, aes(x = 1.25, y = MDL + 0.015), label = paste0("MDL: ", signif(MDL, digits = sigdigs)), alpha = 0.7, color = "blue3") + + ggtitle(label = "H2S Minimum Detection Limit") + + labs(y = "Mean Absorbance") + + theme_classic() + +MDL_Plot +``` + +## Compare Check Standards to Standards +```{r, echo = FALSE} + +#subset datasets for comparison + +std0 <- subset(H2S_STD_CV_fin, IDs == "Std 0"& Plate %in% std_curves$Plate & !Removed == "RMVD") +std3 <- subset(H2S_STD_CV_fin, IDs == "Std 3"& Plate %in% std_curves$Plate & !Removed == "RMVD") +std4 <- subset(H2S_STD_CV_fin, IDs == "Std 4" & Plate %in% std_curves$Plate & !Removed == "RMVD") +std5 <- subset(H2S_STD_CV_fin, IDs == "Std 5" & Plate %in% std_curves$Plate & !Removed == "RMVD") + + +H2S_CHK_STD_CV_fin <- H2S_STD_CV_fin %>% filter(IDs %like% "ChkStd" | IDs %like% "ppt") +#Tag Check Standards and perform T Test +H2S_CHKs_a <- H2S_CHK_STD_CV_fin %>% + mutate(Std_ID = case_when( + IDs == "ChkStd 0" ~ paste0("Std 0"), + IDs == "ChkStd 3" ~ paste0("Std 3"), + IDs == "ChkStd 4" ~ paste0("Std 4"), + IDs %like% "S5" ~ paste0("Std 5") + ), + Chk_Abs = Abs, + Chk_Removed = Removed, + Chk_IDs = IDs, + Chk_Mean_Abs = Mean_Abs, + Chk_cv_flag = CV_Flag + ) %>% filter(!Chk_Removed == "RMVD") %>% + group_by(Std_ID,Plate) %>% + mutate( + Chk_pvalue = case_when( + Chk_IDs == "ChkStd 0" ~ t.test(std0$Abs, Chk_Abs,var.equal = T)$p.value[1], + Chk_IDs == "ChkStd 3" ~ t.test(std3$Abs, Chk_Abs,var.equal = T)$p.value[1], + Chk_IDs == "ChkStd 4" ~ t.test(std4$Abs, Chk_Abs,var.equal = T)$p.value[1], + Chk_IDs == "MC: 10ppt S5" ~ t.test(std5$Abs, Chk_Abs,var.equal = T)$p.value[1], + Chk_IDs == "MC: 20ppt S5" ~ t.test(std5$Abs, Chk_Abs,var.equal = T)$p.value[1] + ))%>% + ungroup() %>% + dplyr::select(Std_ID, Chk_IDs, Chk_pvalue, Chk_cv_flag, Chk_Mean_Abs, Plate) %>% distinct(.keep_all = TRUE) + +H2S_CHKs_1 <- H2S_CHKs_a %>% dplyr::select(-Chk_Mean_Abs) + +#Get Standard Values and set values for standards with no variance +H2S_STD_forCHK_a <- H2S_STD_CV_fin %>% filter(IDs %in% c("Std 0", "Std 3", "Std 4", "Std 5") ) %>% + mutate(Std_ID = IDs +) %>% filter(!Removed == "RMVD") %>% + dplyr::select(Plate, Std_ID, IDs, CV_Flag, Mean_Abs) %>% distinct(.keep_all = TRUE) + +H2S_STD_forCHK <- H2S_STD_forCHK_a %>% dplyr::select( -Mean_Abs) + +#join check standards with standards +Chk_Std_join <- full_join(H2S_CHKs_1, H2S_STD_forCHK, by = join_by(Std_ID, Plate)) + + +#flag data +Chk_Std_flags <- Chk_Std_join %>% mutate( + Chk_Flag_pv= ifelse( + Chk_pvalue > p_value_chkstds , + "Chk_Good", + "Chk_Bad" + ) + +) %>% mutate(CHK_Flag = paste0(gsub(" ", "", IDs), Chk_Flag_pv)) %>% + mutate(CHK_CV_Flag = paste0("Chk",gsub(" ", "", IDs), Chk_cv_flag)) + + #Organize Data for Plotting and Flagging +Chk_Flags <- Chk_Std_flags %>% group_by(Plate) %>% + mutate(Chk_Flag = ifelse(any(CHK_Flag %like% "Bad"), "Chk_Bad", "Chk_Good"), Chk_cv_flag = ifelse(any(CHK_CV_Flag %like% "High"), "Chk_CV_High", "Chk_CV_Good")) %>% + ungroup() %>% + mutate(CHK_CV_Flags = ifelse(CHK_CV_Flag %like% "High", paste0(gsub(" ", "", IDs), Chk_cv_flag), "Good")) %>% mutate(CHKs_Flag = ifelse(CHK_Flag %like% "Bad", CHK_Flag, "Good")) + +H2S_CHKs_plot <- H2S_CHKs_a %>% rename(IDs = Chk_IDs, Mean_Abs = Chk_Mean_Abs) %>% mutate(Type = "Check") %>% dplyr::select(-Chk_cv_flag,-Chk_pvalue) + +H2S_Std_chkplot <- H2S_STD_forCHK_a %>% dplyr::select(IDs, Mean_Abs, Std_ID, Plate) %>% mutate(Type = "Standard") + +Chk_flags_plot <- Chk_Flags %>% dplyr::select(Std_ID, Plate, CHKs_Flag, Chk_Flag_pv) %>% group_by(Std_ID,Plate) %>% distinct(.keep_all = TRUE) %>% mutate(Check_Flag = ifelse(Chk_Flag_pv %like% "Good", "Good", "Bad")) + +H2S_Chks_bind <- rbind(H2S_CHKs_plot, H2S_Std_chkplot) + +H2S_Chks_bind_1 <- left_join(H2S_Chks_bind, Chk_flags_plot, by = join_by(Std_ID,Plate)) + +H2S_Chks_plot_bind_a <- H2S_Chks_bind_1 %>% mutate(Plot_ID = ifelse(IDs %like% "Chk" | IDs %like% "MC", substr(IDs, 4, 8), IDs)) %>% mutate(Plot_ID = ifelse(Plot_ID %like% "10pp", "Matrix: 10ppt", Plot_ID )) +H2S_Chks_plot_bind <-H2S_Chks_plot_bind_a %>% filter(str_detect(Type, "Check")) %>% mutate(Plot_ID =as.factor(Plot_ID)) + +Check_Val <- H2S_Chks_plot_bind_a %>% filter(!str_detect(Type, "Check")) %>% group_by(Plot_ID) %>% mutate(Z = mean(Mean_Abs)) %>% dplyr::select(Plot_ID, Z) %>% distinct(.keep_all = TRUE) %>% filter(!Plot_ID %like% "10pp") %>% mutate(Plot_ID = ifelse(Plot_ID %like% "Std 5", "Matrix: 10ppt", Plot_ID )) %>% mutate(Plot_ID = as.factor(Plot_ID)) + +#Plot Check Standards +H2S_chk_plot <- ggplot(data = H2S_Chks_plot_bind, aes(x = Plate, y = Mean_Abs)) + + geom_bar(stat = 'identity', + position = position_dodge2(preserve = "single"), linewidth = 0.75, aes(fill = Check_Flag)) + + geom_hline(data = Check_Val, aes(yintercept = Z), linetype = "dashed", linewidth = 1, color = "darkblue") + + facet_wrap(.~Plot_ID) + + ylim(0, max(H2S_Chks_plot_bind$Mean_Abs) + 0.2) + + geom_label_repel(data = Check_Val, aes( x = "Plate1", y = Z + 0.25), label = "Mean Target Arbsorbance", alpha = 0.7, color = "darkblue") + + scale_fill_manual(values = c("Good" = "darkgreen", "Bad" = "darkred")) + + theme_classic() + labs(x = " ", y = "Absorbance", title = + "Check Stds: H2S with Confidence Interval") + + theme(legend.position = "bottom", axis.text.x = element_text( + angle = 90, + vjust = 0.5, + hjust = 1)) + + +H2S_chk_plot + +``` + +## Display Any Check Flags +```{r, echo=FALSE} +Chk_Flag_1 <- Chk_Flags %>% dplyr::select(Plate, CHKs_Flag) %>% filter(CHKs_Flag != "Good") + +CHK_CV_Flag_1 <- Chk_Flags %>% dplyr::select(Plate, CHK_CV_Flags) %>% filter(CHK_CV_Flags != "Good") + +knitr::kable(Chk_Flag_1, format="markdown") + +knitr::kable(CHK_CV_Flag_1, format="markdown") + +``` + + +##Calculate Sulfide Concentrations & Add Concentration Flags +```{r Calculate Sulfide Concentrations,echo=FALSE,include=FALSE} + +High_Std <- H2S_STD_CV_fin %>% filter(IDs == "Std 5") %>% mutate(Mean_Abs = round(Mean_Abs, digits = 4)) %>% ungroup() %>% dplyr::select(Plate, Mean_Abs) %>% distinct(.keep_all = TRUE) %>% rename(High_DL = Mean_Abs) + +#filter out stds and other experiments +raw_data <- dat %>% + filter(!str_detect(IDs, "Std")) %>% + filter(!str_detect(IDs, "MC")) + +#Calculate Concentrations and fix zeroes/negative values and flag conc + +joined_data <- right_join(Std_crv_calc, raw_data, by = join_by(Plate)) + +calc_data <- joined_data %>% mutate(Conc = ((Abs - Int_Calc) / Slope_Calc)*Dilution) %>% mutate(Conc = ifelse(Conc <= 0, 0, Conc)) + +dl_data <- right_join(High_Std, calc_data, by = join_by(Plate)) + +``` + +##Remove High CV Samples and Average +```{r, echo=FALSE} + +#Calculate CVs +H2S_SPL_cv <- dl_data %>% group_by(Plate, IDs) %>% mutate(Mean_Conc = mean(Conc)) %>% mutate(Conc_SD = sd(Conc)) %>% mutate(CV = cv(Conc)) %>% mutate(CV_Flag = ifelse(CV >= cv_flag_stds, "CV_High", "CV_Good")) %>% mutate(Mean_Abs = mean(Abs)) %>% mutate(Conc_Flag = ifelse(Mean_Abs < MDL, "bdl", ifelse(Mean_Abs > High_DL, "adl", "Within_Range"))) %>% ungroup() + +#calculate new cv getting best cv from points if cv was high +H2S_SPL_cv_new <- H2S_SPL_cv %>% group_by(Plate, IDs) %>% + mutate(CV_New = map_dbl(row_number(), ~cv(Conc[-.x]))) %>% #Calculate CVs without 1 point + mutate(Removed = ifelse( #Choose Lowest CV if CV is high + CV_Flag == "CV_High", + ifelse( + CV_New == min(CV_New), + "RMVD", + "KEPT"), "CV_Good"), +CV2 = ifelse(CV_Flag == "CV_High", min(CV_New), CV), +Conc_rm = ifelse(Removed == "RMVD", NA, Conc)) %>% + mutate(Mean_Conc2 = mean(Conc_rm, na.rm = TRUE)) %>% + mutate(CV_Flag2 = ifelse(CV2 >= cv_flag_sample, "CV_High", "CV_Good")) %>% + mutate(Conc_SD2 = sd(Conc_rm, na.rm = TRUE)) %>% ungroup() + +H2S_SPL_CV_fin <- H2S_SPL_cv_new %>% dplyr::select(Plate, + Wells, + Conc, + Removed, + IDs, + Dilution, + Conc, + Mean_Conc2, + Conc_SD2, + CV2, + CV_Flag2, + Conc_Flag) %>% + mutate(Mean_Conc = Mean_Conc2, CV_Flag = CV_Flag2, SD_Conc = Conc_SD2, CV = CV2) %>% + dplyr::select(Plate, Conc, + Removed, + IDs, + Dilution, + Mean_Conc, + SD_Conc, + CV, + CV_Flag, + Conc_Flag) + +``` + +## Plot Samples +```{r, echo=FALSE} + +#Filter samples and mark reruns +H2S_Spl_pre_viz <- H2S_SPL_cv_new %>% mutate(IDs = toupper(IDs)) %>% + filter(str_detect(IDs, "L")) %>% + filter(!str_detect(IDs, "DUP")) %>% + filter(!str_detect(IDs, "SPIKE")) %>% + dplyr::select(Plate, IDs, Mean_Conc, Conc_SD, CV_Flag) %>% distinct(.keep_all = TRUE) %>% mutate(IDs = ifelse(Plate %like% "rr", paste0(IDs, "_RR"), IDs)) %>% mutate(ForPlot = ifelse(row_number() <= 80, "A", "B")) + +#Plot Samples before corrections +H2S_Spl_Plot_Pre <- ggplot(H2S_Spl_pre_viz, aes(y = Mean_Conc, x = IDs, fill = CV_Flag)) + + geom_bar(stat = 'identity', + position = position_dodge2(), + linewidth = 0.75, + col = "white") + + scale_fill_manual(values = c( + "CV_Good" = "green2", + "CV_High" = "pink2" + )) + + labs(y = "Sulfide (uM)", x = "Sample ID") + + geom_errorbar( + aes(ymin = Mean_Conc - Conc_SD, ymax = Mean_Conc + Conc_SD), + width = 0.3, + position = position_dodge(.1) + ) + + theme_classic() + + facet_wrap(~ ForPlot ,, scale = "free_x", ncol = 1) + + theme(legend.position = "bottom", axis.text.x = element_text( + angle = 90, + vjust = 0.5, + hjust = 1) + ) + + ggtitle("Sample triplicate means and sd dev before bad reps removed") + + +H2S_Spl_Plot_Pre + +H2S_Spl_rmv_viz <- H2S_SPL_CV_fin %>% mutate(IDs = toupper(IDs)) %>% + filter(str_detect(IDs, "L")) %>% + filter(!str_detect(IDs, "DUP")) %>% + filter(!str_detect(IDs, "SPIKE")) %>% + dplyr::select(Plate, IDs, Mean_Conc, SD_Conc, CV_Flag, Conc_Flag) %>% distinct(.keep_all = TRUE) %>% mutate(IDs = ifelse(Plate %like% "rr", paste0(IDs, "_RR"), IDs)) %>% mutate(ForPlot = ifelse(row_number() <= 80, "A", "B")) + +#Plot samples after Corrections +H2S_Spl_Plot_CV <- ggplot(H2S_Spl_rmv_viz, aes(y = Mean_Conc, x = IDs, fill = CV_Flag)) + + geom_bar(aes(col = Conc_Flag), stat = 'identity', + position = position_dodge(), + linewidth = 0.75) + + scale_fill_manual(values = c( + "CV_Good" = "green2", + "CV_High" = "pink2" + )) + + scale_color_manual(values = c("Within_Range" = "darkgreen", "adl" = "red3", "bdl" = "blue3" )) + + labs(y = "Sulfide (uM)", x = "Sample ID") + + geom_errorbar( + aes(ymin = Mean_Conc - SD_Conc, ymax = Mean_Conc + SD_Conc), + width = 0.3, + position = position_dodge(.1) + ) + + theme_classic() + + facet_wrap(~ForPlot, scales = "free_x", ncol = 1) + + theme(legend.position = "bottom", axis.text.x = element_text( + angle = 90, + vjust = 0.5, + hjust = 1), + strip.text = element_blank(), + strip.background = element_blank() + ) + + ggtitle("Sample triplicate means and sd dev after bad reps removed") + + +H2S_Spl_Plot_CV + + + +``` + + +## Duplicate QAQC + +```{r,echo=FALSE} + +#pull out any rows that have "Dup" in the ID column and tag reruns +DUP_start <- H2S_SPL_CV_fin %>% mutate(Dup_ID = gsub(" ", "", substr(IDs, 1, 6)), + Dup = ifelse(IDs %like% "Dup", "Dup", "Org")) %>% mutate(Dup_ID = ifelse(Plate %like% "rr", paste0(Dup_ID, "_RR"), Dup_ID)) + +#separate dups from originals and tag for pairing + +dups_only <- DUP_start %>% filter(Dup == "Dup") %>% dplyr::select(Dup_ID, Mean_Conc, SD_Conc, Plate) %>% rename(Dup_Conc = Mean_Conc, Dup_SD = SD_Conc) %>% distinct(.keep_all = TRUE) + +no_dups <- DUP_start %>% filter(!Dup == "Dup") + +dup_spls_l <- dups_only %>% dplyr::select(Dup_ID) %>% distinct(.keep_all = TRUE) + +dup_spls <- no_dups %>% filter(Dup_ID %in% as.vector(dup_spls_l$Dup_ID)) %>% dplyr::select(Dup_ID, Mean_Conc, SD_Conc, Plate, IDs) %>% distinct(.keep_all = TRUE) + +dup_join <- full_join(dups_only, dup_spls, by = join_by(Dup_ID, Plate)) %>% na.omit() + +#Calculate Percent difference and Flag +dup_flags <- dup_join %>% + mutate(Diff_P = (abs(100 * (Mean_Conc - Dup_Conc) / mean(c(Mean_Conc, Dup_Conc))))) %>% + mutate(Dup_Flag = ifelse(Diff_P >= dups_perc_diff, "Dup_Bad", "Dup_Good")) + +#oraganize data for flagging and plotting +dup_flags_1 <- dup_flags %>% dplyr::select(Dup_ID, Dup_Flag, Diff_P, Plate) + +Dup_for_plot_1 <- DUP_start %>% dplyr::select(Plate, Mean_Conc, Dup_ID, IDs) %>% distinct(.keep_all = TRUE) %>% filter(Dup_ID %in% as.vector(dup_spls_l$Dup_ID)) %>% + left_join(dup_flags_1, by = join_by(Dup_ID, Plate)) %>% + mutate(Dup = ifelse(IDs %like% "Dup", "Duplicate", "Original")) %>% + dplyr::select(-IDs, -Mean_Conc, -Dup) %>% distinct(.keep_all = TRUE) %>% na.omit + +#plot Data +Dup_Plot <- ggplot(Dup_for_plot_1, + aes( + x = Plate, + y = Diff_P + )) + + geom_bar( + aes(fill = Dup_Flag), + stat = 'identity', + position = position_dodge2(preserve = "single"), + linewidth = 0.9 + ) + + geom_label_repel(data = as.data.frame(1), aes(x = "Plate1", y=17.5), label= "Percent Difference Cutoff", color = "red3", alpha = 0.7) + + geom_hline(aes(yintercept = dups_perc_diff), linetype = "dashed", linewidth = 1.5, color = "red3") + + labs(y = "Percent Difference", x = "Sample ID") + + scale_fill_manual(values = c( + "Dup_Good" = "darkgreen", + "Dup_Bad" = "darkred" + )) + + theme_classic()+ + theme(legend.position = "bottom") + + ggtitle("H2S Duplicates") + +Dup_Plot + + +``` + +## Display Dup Flags + +```{r, echo=FALSE} +Dup_Flag_1 <- dup_flags %>% group_by(Plate) %>% mutate(Dup_Flags = ifelse("Dup_Bad" %in% Dup_Flag, "Dup_Bad", "Dup_Good")) %>% dplyr::select(Plate, Dup_Flags) %>% rename(Dup_Flag = Dup_Flags) %>% distinct(.keep_all = TRUE) + +Dup_Flags_1 <-Dup_Flag_1 %>% mutate(Dup_Flags = paste0(Dup_Flag, "-", Plate)) + +Dup_Flags_2 <- Dup_Flags_1 %>% dplyr::select(Plate, Dup_Flag) %>% group_by(Plate) %>% mutate(Duplicate_Flag = ifelse("Dup_Bad" %in% Dup_Flag, "Dup_Bad", "")) %>% dplyr::select(Plate, Duplicate_Flag) %>% rename(Dup_Flag = Duplicate_Flag) %>% distinct(.keep_all = TRUE) + +Bad_Dups <- dup_flags %>% filter(str_detect(Dup_Flag, "Dup_Bad")) + +Bad_D_N <- length(Bad_Dups$Dup_Flag) + +Total_D_N <- length(dup_flags$Dup_Flag) + +ifelse(Bad_D_N/Total_D_N > 0.4, paste0("<60% of Dups Pass, Rerun"), paste0(">60% Dups Pass") ) + +Duplicate_Flag <- ifelse(Bad_D_N/Total_D_N > 0.4, paste0(" >40% Dups Fail"), "" ) + +knitr::kable(Dup_Flag_1, format="markdown") + + +``` + +## Spike QAQC +```{r, echo=FALSE} +#pull out any rows that have "Spk" in the ID column +SPK_start <- H2S_SPL_CV_fin %>% mutate(Spk_ID = gsub(" ", "", substr(IDs, 1, 6)), + Spk = ifelse(IDs %like% "Spike", "Spk", "Org")) %>% mutate(Spk_ID = ifelse(Plate %like% "rr", paste0(Spk_ID, "_RR"), Spk_ID)) +#separate spikes from originals +spks_only <- SPK_start %>% filter(Spk == "Spk") %>% dplyr::select(Spk_ID, Mean_Conc, SD_Conc, Dilution, Plate) %>% rename(Spk_Conc = Mean_Conc, + Spk_SD = SD_Conc, + Spk_Dilution = Dilution) %>% distinct(.keep_all = TRUE) + +no_spks <- SPK_start %>% filter(!Spk == "Spk") + +spls_l <- no_spks %>% dplyr::select(Spk_ID) %>% distinct(.keep_all = TRUE) + +spk_spls_l <- spks_only %>% dplyr::select(Spk_ID) %>% distinct(.keep_all = TRUE) + +spk_spls <- no_spks %>% filter(Spk_ID %in% as.vector(spk_spls_l$Spk_ID)) %>% dplyr::select(Spk_ID, Mean_Conc, SD_Conc, Plate, IDs, Dilution) %>% distinct(.keep_all = TRUE) + +SPK_only <- spks_only %>% filter(Spk_ID %in% as.vector(spls_l$Spk_ID)) + +spk_join <- full_join(SPK_only, spk_spls, by = join_by(Spk_ID, Plate)) + +#Calculate recovery and flag data +spk_flags <- spk_join %>% mutate( + Spl_mol = (sample_vol / Con1) * (Mean_Conc / Dilution), + Spk_mol = ((sample_vol + spkvol) / Con1) * (Spk_Conc / Spk_Dilution), + Spk_exp = Spl_mol + spk_Conc, + Spk_recovery = (Spk_mol/Spk_exp) * 100) %>% + mutate( + Spk_Flag = ifelse( + Spk_recovery >= high_recovery_cutoff | + Spk_recovery <= low_recovery_cutoff, + "Spk_Bad", + "Spk_Good" + ) + ) + +#organize data for flagging and plotting +spk_flags_1 <- spk_flags %>% dplyr::select(Spk_ID, Spk_Flag, Spk_recovery, Plate) %>% na.omit() + +Spk_for_plot_a <- SPK_start %>% dplyr::select(Plate, Mean_Conc, Spk_ID, IDs) %>% + distinct(.keep_all = TRUE) %>% + filter(Spk_ID %in% as.vector(spk_spls_l$Spk_ID)) %>% + left_join(spk_flags_1, by = join_by(Spk_ID, Plate)) %>% + mutate(Spk = ifelse(IDs %like% "Spike", "Spike", "Original")) %>% + filter(Spk_ID %in% as.vector(spls_l$Spk_ID)) + +Spk_for_plot_1 <- Spk_for_plot_a %>% dplyr::select(Plate, Spk_ID, Spk_recovery, Spk_Flag) %>% na.omit() %>% distinct(.keep_all = TRUE) + +#plot data +Spk_Plot <- ggplot(Spk_for_plot_1, + aes( + x = Plate, + y = Spk_recovery + )) + + geom_rect(aes(xmin=0, xmax=Inf, ymin=low_recovery_cutoff, ymax=high_recovery_cutoff), alpha = 0.25, fill ="palegreen") + + geom_bar( aes(fill = Spk_Flag), + stat = 'identity', + position = position_dodge2(preserve = "single"), + linewidth = 0.9 + ) + + geom_hline(aes(yintercept = high_recovery_cutoff), linetype = "dashed", color = "green3", linewidth = 1.5) + + geom_hline(aes(yintercept = low_recovery_cutoff), linetype = "dashed", color = "green3", linewidth = 1.5) + + geom_label_repel(data = as.data.frame(1),aes(x = "Plate1", y=high_recovery_cutoff - 7.5), label= "Acceptable Recovery Range", color = "darkgreen", alpha = 0.7) + + labs(y = "Spike Recovery (%)", x = "Plate") + + scale_fill_manual(values = c( + "Spk_Good" = "darkgreen", + "Spk_Bad" = "darkred" + )) + + theme_classic() + + theme(legend.position = "bottom") + + ggtitle("H2S Spikes") + +Spk_Plot + + +``` + +## Display Spike Flags +```{r, echo=FALSE} + +#Check if all Spikes are paired +ifelse(all(as.vector(spk_spls_l$Spk_ID) %in% as.vector(spls_l$Spk_ID)), paste0("Spikes Paired"), paste0("Spike Missing Pair")) + +#Format Data frame +Spk_Flag_1 <- spk_flags %>% dplyr::select(Plate, IDs, Spk_Flag) %>% na.omit() + +#Attach Plate to Flag +Spk_Flags_1 <-Spk_Flag_1 %>% group_by(Plate) %>% mutate(Spk_Flags_T = ifelse( "Spk_Bad" %in% Spk_Flag, paste0("Spk_Bad"), paste0("Spk_Good"))) %>% mutate(Spk_Flags = paste0(Spk_Flags_T, "-", Plate))%>% ungroup() +#If any Spikes in Plate are bad, then flag plate +Spk_Flags_2 <- Spk_Flags_1 %>% dplyr::select(Plate, Spk_Flag) %>% group_by(Plate) %>% mutate(Spike_Flag = ifelse("Spk_Bad" %in% Spk_Flag, "Spk_Bad", "")) %>% dplyr::select(Plate, Spike_Flag) %>% rename(Spk_Flag = Spike_Flag) %>% distinct(.keep_all = TRUE) + +Spk_disp <- Spk_Flags_1 %>% dplyr::select(Plate, Spk_Flags_T) %>% rename(Spike_Flag = Spk_Flags_T) %>% distinct(.keep_all = TRUE) %>% na.omit() + +knitr::kable(Spk_disp, format="markdown") + +bad <- Spk_Flag_1 %>% filter(Spk_Flag %like% "Bad") + +length_bad <- length(as.vector(bad$Spk_Flag)) + +length_all <- length(as.vector(Spk_Flag_1$Spk_Flag)) + +ifelse(length_bad/length_all > 0.4, paste0("<60% of Spikes Pass, Rerun"), paste0("Spikes Pass") ) + +Spike_Flag <- ifelse(length_bad/length_all > 0.4, paste0(">40% Spikes Fail"), "" ) + +``` + + +## Merge samples with Metadata & check all samples are present +```{r check sample ids with metadata, echo=FALSE} +#Get Samples Only +H2S_spls_md <- H2S_SPL_CV_fin %>% mutate(IDs = toupper(IDs)) %>% + filter(str_detect(IDs, "L")) %>% + filter(!str_detect(IDs, "DUP")) %>% + filter(!str_detect(IDs, "SPIKE")) + +#Check for reruns and replace +H2S_spl_rrn <- H2S_spls_md %>%group_by(IDs,Plate) %>% + filter(Plate %like% "rr") %>% ungroup() %>% + dplyr::select(IDs, Mean_Conc, Conc_Flag, Dilution) %>% + rename(RRN_Conc = Mean_Conc, Conc_Flag_rr = Conc_Flag, Dilution_rr = Dilution) %>% + distinct(.keep_all = TRUE) + +RRN_IDs <- as.vector(H2S_spl_rrn$IDs) + +H2S_spl_og <- H2S_spls_md %>% group_by(IDs,Plate) %>% + filter(!Plate %like% "rr") %>% ungroup() %>% + dplyr::select(IDs, Mean_Conc, Conc_Flag, Plate, CV_Flag, Dilution, CV) %>% + distinct(.keep_all = TRUE) %>% + mutate(Rerun = ifelse(IDs %in% RRN_IDs, "RRN", "Org")) + +H2S_spl_rr_join <- full_join(H2S_spl_rrn, H2S_spl_og, by = join_by(IDs) ) + +Samples_Tagged <- H2S_spl_rr_join %>% mutate( + Conc = ifelse(Rerun == "RRN", RRN_Conc, Mean_Conc), + Conc_Flag = ifelse(Rerun == "RRN", Conc_Flag_rr, Conc_Flag), + Dilution = ifelse(Rerun == "RRN", Dilution_rr, Dilution) +) %>% dplyr::select(IDs, Conc, Conc_Flag, CV_Flag, Plate, Dilution, CV) %>% rename(Sample_ID = IDs) %>% ungroup() %>% group_by(Sample_ID) %>% mutate( + Min_CV = ifelse(CV == min(CV), "KEEP", "RMV"), # get if CV is lowest of reruns + Within_Range = "Within_Range" %in% Conc_Flag, #Get if any are within range + BDL = "bdl" %in% Conc_Flag, #get if any are below detection limit + Max_Dil = max(Dilution), #get maximum dilution of reruns + Min_Dil = min(Dilution),#get minimum dilution of reruns + All_Good = all(Conc_Flag == "Within_Range") & all(CV_Flag == "CV_Good"), #get if all are within range and good cv + CV_Check = CV == min(CV[which(Dilution == Max_Dil)]), #Get if CV is lowest of highest dilution for reruns + Number = length(Conc) #get number of times ran +) %>% ungroup() %>% + mutate(Remove = ifelse(Number == 1, #check if sample was reran + "KEEP", + ifelse(All_Good, #check if multiple samples meet all criteria + ifelse(Min_CV == "KEEP", #Keep only lowest CV + "KEEP1", + "RMV1"), + ifelse(Conc_Flag == "Within_Range" & CV_Flag == "CV_Good", #If only one sample meets all criteria keep that one + "KEEP2", ifelse(Conc_Flag == "Within_Range", "KEEP2a", + ifelse(!(Within_Range) & BDL, #Check if none are within range but are under detection limit + ifelse(Dilution == Min_Dil, #keep lowest dilution + "KEEP3", + "RMV3"), + ifelse(!(Within_Range) & CV_Check, #if all are above detection limit keep lowest CV of highest dilution + "KEEP4", + "RMV4") + ) + ) + )))) + +Samples <- Samples_Tagged %>% filter(Remove %like% "KEEP") + +#check to see if all samples are present in the metadata +all_present <- all(metadata$Sample_Name %in% Samples$Sample_ID) + +if (all_present) { + message("All sample IDs are present in data") +} else { + message("Some sample IDs are missing from data.") + + # Optional: Which ones are missing? + missing_ids <- setdiff(metadata$Sample_Name, Samples$Sample_ID) + print(missing_ids) +} + + +#merge metadata with sample run data +merged_data <- metadata %>% + mutate(Sample_ID = paste0("\\b", Sample_ID, "\\b")) %>% + fuzzyjoin::regex_left_join(Samples, ., by = c(Sample_ID = "Sample_Name")) + +#might want to include a flag or something to see that all the samples are included? + +``` + + +##Add Flags +```{r, echo=FALSE} + +#Get only bad flags for each plate and check +Chk_Flags_All <- Chk_Flags %>% dplyr::select(Plate, CHKs_Flag) %>% filter(CHKs_Flag %like% "Bad") %>% na.omit() %>% distinct(.keep_all = TRUE) %>% group_by(Plate) %>% + summarise( + CHKSTD_Flags = paste(CHKs_Flag, collapse = ", "), + .groups = 'drop' # Drops the grouping structure after summarizing + ) + + +STD_Flags_All <- STD_CRV_flags %>% dplyr::select(Plate, R2_Flag, CV_Flag) %>% mutate(STDCV_Flags = paste0("STD", CV_Flag)) %>% dplyr::select(-CV_Flag) %>% mutate( + R2_Flag = ifelse(R2_Flag %like% "Good", NA, R2_Flag), + STDCV_Flags = ifelse(STDCV_Flags %like% "Good", NA, STDCV_Flags) +) %>% na.omit() + +Flags_Int <- tibble(Plate = c(plates)) + +#Join Flags + +Flags_Joined_1 <-left_join(Flags_Int, Dup_Flags_2, by = join_by(Plate)) + +Flags_Joined_2 <- left_join(Flags_Joined_1, Spk_Flags_2, by = join_by(Plate)) + +Flags_Joined_3 <- left_join(Flags_Joined_2, Chk_Flags_All, by = join_by(Plate)) + +Flags_Joined_4 <- left_join(Flags_Joined_3, STD_Flags_All, by = join_by(Plate)) + +Flags_Joined <- left_join(Flags_Joined_4, Curve_Flags_forJoin, by = join_by(Plate)) + + +Flags_Joined[Flags_Joined == "NA"] <- NA + +#Merge Flags into one column +Flags <- Flags_Joined %>% replace(is.na(.), "") %>% mutate( + H2S_Flags = paste0( + Spk_Flag, + " ", + Dup_Flag, + " ", + CHKSTD_Flags, + " ", + R2_Flag, + " ", + STDCV_Flags, + " ", + Slope_Flag, + " ", + Int_Flag + ) +) %>% dplyr::select(Plate, H2S_Flags) + +#Add Flags to data +flagged_data <- left_join(merged_data, Flags, by = join_by(Plate)) + + +df_all_clean <- flagged_data %>% dplyr::select(-Plate) + +``` + +##Organize Data +```{r, echo=FALSE} +#check results +#head(Samples) + +#pull out what we need + +df_all_clean_cols <- df_all_clean %>% + dplyr::select( + Site, + Project, + Year, + Month, + Community, + Nickname, + Plot_Name, + Depth_cm, + CO2_Treatment, + N_Treatment, + Conc, + Conc_Flag, + CV_Flag, + H2S_Flags + ) + +final_data_labeled <- df_all_clean_cols %>% + mutate( + Run_notes = Run_notes,# new column with notes about the run + Analysis_rundate = Run_Date) + +#rename columns +org_labeled_fin_data <- final_data_labeled %>% + rename( + H2S_Conc_uM = Conc, + H2S_Conc_Flag = Conc_Flag, + Plot = Plot_Name, + H2S_CV_Flag = CV_Flag + ) + +#Order Columns for Final Data Frame +All_Clean_Data <- org_labeled_fin_data %>% + dplyr::select( + Site, + Project, + Year, + Month, + Community, + Nickname, + Plot, + Depth_cm, + CO2_Treatment, + N_Treatment, + H2S_Conc_uM, + H2S_Conc_Flag, + H2S_CV_Flag, + H2S_Flags, + Analysis_rundate, + Run_notes + ) +#head(Samples1) + +``` + + +## Visualize Data +```{r Visualize Data, echo=FALSE} + +H2S_forplot <- All_Clean_Data + +#ensure points are in correct order + +H2S_forplot <- H2S_forplot[order(H2S_forplot$Depth_cm), ] + +color1 <- c("L1", "L2", "L3", "L4") +color2 <- c("L5", "L6", "L8", "L10") +color3 <- c("L7", "L9", "L11", "L12") +color4 <- c("L13", "L14", "L16", "L15") +color5 <- c("L17", "L18", "L19", "L20") + +H2S_forplot <- H2S_forplot %>% + mutate( + Plot_Color = case_when( + Plot %in% color1 ~ "Color1", + Plot %in% color2 ~ "Color2", + Plot %in% color3 ~ "Color3", + Plot %in% color4 ~ "Color4", + Plot %in% color5 ~ "Color5" + ) + ) %>% + mutate(Treatment = ifelse( + CO2_Treatment == "Elevated" & + N_Treatment == "Amended", + "eCO2 & eN", + ifelse( + CO2_Treatment == "Elevated" & + N_Treatment == "Ambient", + "eCO2 & aN", + ifelse( + CO2_Treatment == "Ambient" & + N_Treatment == "Amended" , + "aCO2 & eN" , + "aCO2 & aN" + ) + ) + )) %>% + mutate(CO2_Treatment = ifelse(CO2_Treatment == "Ambient", "aCO2", "eCO2")) %>% + mutate(N_Treatment = ifelse(N_Treatment == "Ambient", "aN", "eN")) + +viz_H2S_plot2 <- ggplot(data = H2S_forplot, aes( + x = factor(as.factor(CO2_Treatment), levels = c("eCO2", "aCO2")), + y = H2S_Conc_uM, + fill = as.factor(Treatment), + color = as.factor(Treatment) +)) + + geom_bar( + stat = "identity", + position = position_dodge2(padding = 0.25,preserve = "single") + ) + + facet_grid(Depth_cm ~ N_Treatment, scales = "fixed") + + scale_fill_manual(values = c( + "eCO2 & eN" = "#DB5461", + "eCO2 & aN" = "#454ADE", + "aCO2 & eN" = "white", + "aCO2 & aN" = "white" + ), + name = "Treatment:", + breaks = c("eCO2 & eN", "eCO2 & aN", "aCO2 & aN", "aCO2 & eN"), + labels = c("eCO2 & eN", "eCO2 & aN", "aCO2 & aN", "aCO2 & eN") + + ) + + scale_color_manual(values = c( + "eCO2 & eN" = "#DB5461", + "eCO2 & aN" = "#454ADE", + "aCO2 & eN" = "#DB5461", + "aCO2 & aN" = "#454ADE" + ), + name = "Treatment:", + breaks = c("eCO2 & eN", "eCO2 & aN", "aCO2 & aN", "aCO2 & eN"), + labels = c("eCO2 & eN", "eCO2 & aN", "aCO2 & aN", "aCO2 & eN") + ) + + theme_classic() + + labs(x = " ", + y = "H2S (uM)", + title = "CO2xN: Porewater Sulfide" + ) + + theme(legend.position = "right") + + scale_x_discrete(drop = TRUE) + + theme( + axis.text.x = element_text(angle = 0, hjust = 0.5), + panel.border = element_rect( + color = "black", + fill = NA, + linewidth = 0.8 + ) + ) + +coord_flip() +print(viz_H2S_plot2) + +``` + + + +```{r, echo=FALSE} +#ensure points are in correct order + +#make plot +viz_H2S_plot_2 <- ggplot(data = H2S_forplot, aes(x = H2S_Conc_uM, y = as.numeric(Depth_cm), color = Plot_Color)) + + geom_point(size = 3) + + geom_path(linewidth = 1) + + scale_color_manual( + values = c( + "Color1" = "#FFD500", + "Color2" = "#00D0FF", + "Color3" = "#FF0075", + "Color4" = "#80d280", + "Color5" = "#ff6040" + ), + labels = c("1", "2", "3", "4", "5") + ) + + facet_grid(Treatment ~ ., scales = "fixed") + + labs( + x = "H2S (uM)", + y = "Depth (cm)", + title = "CO2xN: Porewater H2S by Replicate", + color = "Replicate" + ) + + scale_y_reverse(breaks = c(20, 40, 80), limits = c(90, 10)) + + theme_classic() + + theme( + axis.text.x = element_text(angle = 0, hjust = 0.5), + panel.border = element_rect( + color = "black", + fill = NA, + linewidth = 0.8 + ) + ) + +viz_H2S_plot_2 +``` + + +##Export Data +```{r, echo=FALSE} +write.csv(unique_log, log_path) + + Rerun_Data <- All_Clean_Data %>% filter(H2S_Conc_Flag != "Within Range" | H2S_CV_Flag %like% "High") + +if(After_Reruns == "YES"){ + write.csv(All_Clean_Data, final_path)} else { + write.csv(Rerun_Data, rerun_path) } +#end +``` + + +### END \ No newline at end of file diff --git a/CO2xN/Porewater/Sulfide/2026/Processed Data/GCReW_CO2xN_Porewater_H2S_202605.csv b/CO2xN/Porewater/Sulfide/2026/Processed Data/GCReW_CO2xN_Porewater_H2S_202605.csv new file mode 100644 index 0000000..b3b7ef9 --- /dev/null +++ b/CO2xN/Porewater/Sulfide/2026/Processed Data/GCReW_CO2xN_Porewater_H2S_202605.csv @@ -0,0 +1,61 @@ +"","Site","Project","Year","Month","Community","Nickname","Plot","Depth_cm","CO2_Treatment","N_Treatment","H2S_Conc_uM","H2S_Conc_Flag","H2S_CV_Flag","H2S_Flags","Analysis_rundate","Run_notes" +"1","GCReW","CO2xN","2026","May","SCAM","2-Meter","L18",20,"Elevated","Amended",7.73623188405797,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad, Std4Chk_Bad ",2026-05-19,"" +"2","GCReW","CO2xN","2026","May","SCAM","2-Meter","L11",40,"Ambient","Amended",1764.34782608696,"Within_Range","CV_High","Spk_Bad Std5Chk_Bad ",2026-05-19,"" +"3","GCReW","CO2xN","2026","May","SCAM","2-Meter","L13",40,"Elevated","Ambient",2390.4347826087,"Within_Range","CV_Good","Spk_Bad Dup_Bad Std5Chk_Bad Intercept_Bad",2026-05-19,"" +"4","GCReW","CO2xN","2026","May","SCAM","2-Meter","L16",80,"Ambient","Ambient",2266.52173913043,"Within_Range","CV_Good","Spk_Bad Dup_Bad Std5Chk_Bad Intercept_Bad",2026-05-19,"" +"5","GCReW","CO2xN","2026","May","SCAM","2-Meter","L1",40,"Elevated","Amended",3260.82621082621,"Within_Range","CV_Good","Spk_Bad Dup_Bad Std5Chk_Bad ",2026-05-19,"" +"6","GCReW","CO2xN","2026","May","SCAM","2-Meter","L4",20,"Ambient","Amended",1285.04273504274,"Within_Range","CV_Good","Spk_Bad Dup_Bad Std5Chk_Bad ",2026-05-19,"" +"7","GCReW","CO2xN","2026","May","SCAM","2-Meter","L5",80,"Elevated","Amended",2735.18518518519,"Within_Range","CV_Good","Spk_Bad Dup_Bad Std5Chk_Bad ",2026-05-19,"" +"8","GCReW","CO2xN","2026","May","SCAM","2-Meter","L1",80,"Elevated","Amended",2998.71794871795,"Within_Range","CV_Good","Spk_Bad Dup_Bad Std5Chk_Bad ",2026-05-19,"" +"9","GCReW","CO2xN","2026","May","SCAM","2-Meter","L6",20,"Ambient","Ambient",2684.61538461538,"Within_Range","CV_Good","Spk_Bad Dup_Bad Std5Chk_Bad ",2026-05-19,"" +"10","GCReW","CO2xN","2026","May","SCAM","2-Meter","L2",20,"Ambient","Ambient",1813.53276353276,"Within_Range","CV_Good","Spk_Bad Dup_Bad Std5Chk_Bad ",2026-05-19,"" +"11","GCReW","CO2xN","2026","May","SCAM","2-Meter","L6",40,"Ambient","Ambient",2468.80341880342,"Within_Range","CV_Good","Spk_Bad Dup_Bad Std5Chk_Bad ",2026-05-19,"" +"12","GCReW","CO2xN","2026","May","SCAM","2-Meter","L2",40,"Ambient","Ambient",2481.62393162393,"Within_Range","CV_Good","Spk_Bad Dup_Bad Std5Chk_Bad ",2026-05-19,"" +"13","GCReW","CO2xN","2026","May","SCAM","2-Meter","L2",80,"Ambient","Ambient",2601.28205128205,"Within_Range","CV_Good","Spk_Bad Dup_Bad Std5Chk_Bad ",2026-05-19,"" +"14","GCReW","CO2xN","2026","May","SCAM","2-Meter","L4",40,"Ambient","Amended",2144.01709401709,"Within_Range","CV_Good","Spk_Bad Dup_Bad Std5Chk_Bad ",2026-05-19,"" +"15","GCReW","CO2xN","2026","May","SCAM","2-Meter","L3",20,"Elevated","Ambient",3346.2962962963,"Within_Range","CV_Good","Spk_Bad Dup_Bad Std5Chk_Bad ",2026-05-19,"" +"16","GCReW","CO2xN","2026","May","SCAM","2-Meter","L4",80,"Ambient","Amended",3588.46153846154,"Within_Range","CV_Good","Spk_Bad Dup_Bad Std5Chk_Bad ",2026-05-19,"" +"17","GCReW","CO2xN","2026","May","SCAM","2-Meter","L3",40,"Elevated","Ambient",3474.50142450142,"Within_Range","CV_Good","Spk_Bad Dup_Bad Std5Chk_Bad ",2026-05-19,"" +"18","GCReW","CO2xN","2026","May","SCAM","2-Meter","L5",20,"Elevated","Amended",1042.87749287749,"Within_Range","CV_Good","Spk_Bad Dup_Bad Std5Chk_Bad ",2026-05-19,"" +"19","GCReW","CO2xN","2026","May","SCAM","2-Meter","L1",20,"Elevated","Amended",1616.95156695157,"Within_Range","CV_Good","Spk_Bad Dup_Bad Std5Chk_Bad ",2026-05-19,"" +"20","GCReW","CO2xN","2026","May","SCAM","2-Meter","L3",80,"Elevated","Ambient",2743.73219373219,"Within_Range","CV_Good","Spk_Bad Dup_Bad Std5Chk_Bad ",2026-05-19,"" +"21","GCReW","CO2xN","2026","May","SCAM","2-Meter","L5",40,"Elevated","Amended",2082.05128205128,"Within_Range","CV_Good","Spk_Bad Dup_Bad Std5Chk_Bad ",2026-05-19,"" +"22","GCReW","CO2xN","2026","May","SCAM","2-Meter","L7",20,"Ambient","Ambient",1396.15384615385,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad ",2026-05-19,"" +"23","GCReW","CO2xN","2026","May","SCAM","2-Meter","L9",80,"Elevated","Ambient",2500.8547008547,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad ",2026-05-19,"" +"24","GCReW","CO2xN","2026","May","SCAM","2-Meter","L7",40,"Ambient","Ambient",1681.05413105413,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad ",2026-05-19,"" +"25","GCReW","CO2xN","2026","May","SCAM","2-Meter","L11",80,"Ambient","Amended",2009.40170940171,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad ",2026-05-19,"" +"26","GCReW","CO2xN","2026","May","SCAM","2-Meter","L7",80,"Ambient","Ambient",2483.04843304843,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad ",2026-05-19,"" +"27","GCReW","CO2xN","2026","May","SCAM","2-Meter","L12",20,"Elevated","Amended",975.213675213675,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad ",2026-05-19,"" +"28","GCReW","CO2xN","2026","May","SCAM","2-Meter","L8",20,"Elevated","Ambient",1833.47578347578,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad ",2026-05-19,"" +"29","GCReW","CO2xN","2026","May","SCAM","2-Meter","L8",40,"Elevated","Ambient",1985.89743589744,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad ",2026-05-19,"" +"30","GCReW","CO2xN","2026","May","SCAM","2-Meter","L10",20,"Ambient","Amended",1990.17094017094,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad ",2026-05-19,"" +"31","GCReW","CO2xN","2026","May","SCAM","2-Meter","L8",80,"Elevated","Ambient",2816.38176638177,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad ",2026-05-19,"" +"32","GCReW","CO2xN","2026","May","SCAM","2-Meter","L10",40,"Ambient","Amended",2249.4301994302,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad ",2026-05-19,"" +"33","GCReW","CO2xN","2026","May","SCAM","2-Meter","L9",20,"Elevated","Ambient",1047.150997151,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad ",2026-05-19,"" +"34","GCReW","CO2xN","2026","May","SCAM","2-Meter","L10",80,"Ambient","Amended",2528.63247863248,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad ",2026-05-19,"" +"35","GCReW","CO2xN","2026","May","SCAM","2-Meter","L6",80,"Ambient","Ambient",2739.45868945869,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad ",2026-05-19,"" +"36","GCReW","CO2xN","2026","May","SCAM","2-Meter","L9",40,"Elevated","Ambient",1426.06837606838,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad ",2026-05-19,"" +"37","GCReW","CO2xN","2026","May","SCAM","2-Meter","L11",20,"Ambient","Amended",1796.43874643875,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad ",2026-05-19,"" +"38","GCReW","CO2xN","2026","May","SCAM","2-Meter","L12",80,"Elevated","Amended",2337.74928774929,"Within_Range","CV_Good","Spk_Bad Dup_Bad Std5Chk_Bad Intercept_Bad",2026-05-19,"" +"39","GCReW","CO2xN","2026","May","SCAM","2-Meter","L15",40,"Elevated","Amended",2530.05698005698,"Within_Range","CV_Good","Spk_Bad Dup_Bad Std5Chk_Bad Intercept_Bad",2026-05-19,"" +"40","GCReW","CO2xN","2026","May","SCAM","2-Meter","L17",20,"Ambient","Ambient",1051.4245014245,"Within_Range","CV_Good","Spk_Bad Dup_Bad Std5Chk_Bad Intercept_Bad",2026-05-19,"" +"41","GCReW","CO2xN","2026","May","SCAM","2-Meter","L13",20,"Elevated","Ambient",1004.41595441595,"Within_Range","CV_Good","Spk_Bad Dup_Bad Std5Chk_Bad Intercept_Bad",2026-05-19,"" +"42","GCReW","CO2xN","2026","May","SCAM","2-Meter","L17",40,"Ambient","Ambient",2666.80911680912,"Within_Range","CV_Good","Spk_Bad Dup_Bad Std5Chk_Bad Intercept_Bad",2026-05-19,"" +"43","GCReW","CO2xN","2026","May","SCAM","2-Meter","L17",80,"Ambient","Ambient",1851.9943019943,"Within_Range","CV_Good","Spk_Bad Dup_Bad Std5Chk_Bad Intercept_Bad",2026-05-19,"" +"44","GCReW","CO2xN","2026","May","SCAM","2-Meter","L13",80,"Elevated","Ambient",1941.73789173789,"Within_Range","CV_Good","Spk_Bad Dup_Bad Std5Chk_Bad Intercept_Bad",2026-05-19,"" +"45","GCReW","CO2xN","2026","May","SCAM","2-Meter","L14",20,"Ambient","Amended",1391.88034188034,"Within_Range","CV_Good","Spk_Bad Dup_Bad Std5Chk_Bad Intercept_Bad",2026-05-19,"" +"46","GCReW","CO2xN","2026","May","SCAM","2-Meter","L15",80,"Elevated","Amended",2380.48433048433,"Within_Range","CV_Good","Spk_Bad Dup_Bad Std5Chk_Bad Intercept_Bad",2026-05-19,"" +"47","GCReW","CO2xN","2026","May","SCAM","2-Meter","L14",40,"Ambient","Amended",2370.51282051282,"Within_Range","CV_Good","Spk_Bad Dup_Bad Std5Chk_Bad Intercept_Bad",2026-05-19,"" +"48","GCReW","CO2xN","2026","May","SCAM","2-Meter","L16",20,"Ambient","Ambient",2481.62393162393,"Within_Range","CV_Good","Spk_Bad Dup_Bad Std5Chk_Bad Intercept_Bad",2026-05-19,"" +"49","GCReW","CO2xN","2026","May","SCAM","2-Meter","L14",80,"Ambient","Amended",2810.68376068376,"Within_Range","CV_Good","Spk_Bad Dup_Bad Std5Chk_Bad Intercept_Bad",2026-05-19,"" +"50","GCReW","CO2xN","2026","May","SCAM","2-Meter","L16",40,"Ambient","Ambient",1904.70085470085,"Within_Range","CV_Good","Spk_Bad Dup_Bad Std5Chk_Bad Intercept_Bad",2026-05-19,"" +"51","GCReW","CO2xN","2026","May","SCAM","2-Meter","L12",40,"Elevated","Amended",1540.02849002849,"Within_Range","CV_Good","Spk_Bad Dup_Bad Std5Chk_Bad Intercept_Bad",2026-05-19,"" +"52","GCReW","CO2xN","2026","May","SCAM","2-Meter","L15",20,"Elevated","Amended",2260.82621082621,"Within_Range","CV_Good","Spk_Bad Dup_Bad Std5Chk_Bad Intercept_Bad",2026-05-19,"" +"53","GCReW","CO2xN","2026","May","SCAM","2-Meter","L18",40,"Elevated","Amended",1451.7094017094,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad, Std4Chk_Bad ",2026-05-19,"" +"54","GCReW","CO2xN","2026","May","SCAM","2-Meter","L18",80,"Elevated","Amended",1936.03988603989,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad, Std4Chk_Bad ",2026-05-19,"" +"55","GCReW","CO2xN","2026","May","SCAM","2-Meter","L19",20,"Elevated","Ambient",2592.73504273504,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad, Std4Chk_Bad ",2026-05-19,"" +"56","GCReW","CO2xN","2026","May","SCAM","2-Meter","L19",40,"Elevated","Ambient",3134.04558404558,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad, Std4Chk_Bad ",2026-05-19,"" +"57","GCReW","CO2xN","2026","May","SCAM","2-Meter","L19",80,"Elevated","Ambient",3430.34188034188,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad, Std4Chk_Bad ",2026-05-19,"" +"58","GCReW","CO2xN","2026","May","SCAM","2-Meter","L20",20,"Ambient","Amended",1940.31339031339,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad, Std4Chk_Bad ",2026-05-19,"" +"59","GCReW","CO2xN","2026","May","SCAM","2-Meter","L20",40,"Ambient","Amended",2522.93447293447,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad, Std4Chk_Bad ",2026-05-19,"" +"60","GCReW","CO2xN","2026","May","SCAM","2-Meter","L20",80,"Ambient","Amended",2605.55555555556,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad, Std4Chk_Bad ",2026-05-19,"" diff --git a/CO2xN/Porewater/Sulfide/2026/Processed Data/LTREB_2M_H2S_QAQC_2026.csv b/CO2xN/Porewater/Sulfide/2026/Processed Data/LTREB_2M_H2S_QAQC_2026.csv new file mode 100644 index 0000000..1b3bd88 --- /dev/null +++ b/CO2xN/Porewater/Sulfide/2026/Processed Data/LTREB_2M_H2S_QAQC_2026.csv @@ -0,0 +1,233 @@ +"","Plate","Curve","R2","Slope","Intercept","Run_Date","Run" +"1",NA,"H2S",0.991219025,0.01093912,0.100689277,2025-09-22,"Past Runs" +"2",NA,"H2S",0.993877242,0.011939201,0.06915697,2025-09-22,"Past Runs" +"3",NA,"H2S",0.993801685,0.00988706,0.089656986,2025-09-22,"Past Runs" +"4",NA,"H2S",0.98902287,0.011446925,0.096027164,2025-09-19,"Past Runs" +"5",NA,"H2S",0.994548336,0.011899625,0.083277661,2025-09-19,"Past Runs" +"6",NA,"H2S",0.992796039,0.009941877,0.087862342,2025-09-19,"Past Runs" +"7",NA,"H2S",0.997865585,0.011856306,0.066974671,2025-09-19,"Past Runs" +"8",NA,"H2S",0.986077314,0.012606847,0.075308108,2025-09-19,"Past Runs" +"9",NA,"H2S",0.992846269,0.01106119,0.083271756,2025-09-19,"Past Runs" +"10",NA,"H2S",0.989586556,0.012257337,0.086131432,2025-09-18,"Past Runs" +"11",NA,"H2S",0.994028851,0.011363046,0.089013852,2025-09-18,"Past Runs" +"12",NA,"H2S",0.986483002,0.012786783,0.079924043,2025-09-18,"Past Runs" +"13",NA,"H2S",0.987456283,0.010471189,0.097437793,2025-09-18,"Past Runs" +"14",NA,"H2S",0.990170085,0.011201815,0.080205858,2025-09-18,"Past Runs" +"15",NA,"H2S",0.994921447,0.011747968,0.0821679,2025-09-18,"Past Runs" +"16",NA,"H2S",0.988565262,0.011839841,0.069910825,2025-07-16,"Past Runs" +"17",NA,"H2S",0.991619504,0.011745192,0.081514125,2025-07-16,"Past Runs" +"18",NA,"H2S",0.990299632,0.011051745,0.072271651,2025-07-16,"Past Runs" +"19",NA,"H2S",0.991820501,0.011030978,0.107305831,2025-07-16,"Past Runs" +"20",NA,"H2S",0.987843267,0.011940853,0.084781412,2025-07-16,"Past Runs" +"21",NA,"H2S",0.992091938,0.011957557,0.080297784,2025-07-16,"Past Runs" +"22",NA,"H2S",0.991711318,0.011277024,0.093205964,2025-07-16,"Past Runs" +"23",NA,"H2S",0.990221806,0.012007601,0.081764155,2025-07-15,"Past Runs" +"24",NA,"H2S",0.985259661,0.010168475,0.104301957,2025-07-15,"Past Runs" +"25",NA,"H2S",0.988492907,0.011813071,0.068994131,2025-07-16,"Past Runs" +"26",NA,"H2S",0.994149685,0.013418056,0.072423824,2025-07-15,"Past Runs" +"27",NA,"H2S",0.991748191,0.011735538,0.088628605,2025-07-15,"Past Runs" +"28",NA,"H2S",0.989333168,0.012411661,0.088435965,2025-07-15,"Past Runs" +"29",NA,"H2S",0.992931678,0.011946484,0.10370681,2025-07-14,"Past Runs" +"30",NA,"H2S",0.99409875,0.011778654,0.091418456,2025-07-14,"Past Runs" +"31",NA,"H2S",0.988158507,0.010797151,0.091271836,2025-07-14,"Past Runs" +"32",NA,"H2S",0.992095456,0.010752828,0.104719179,2025-07-14,"Past Runs" +"33",NA,"H2S",0.99451618,0.011110069,0.090558393,2025-07-14,"Past Runs" +"34",NA,"H2S",0.992226742,0.012274256,0.095585343,2025-08-27,"Past Runs" +"35",NA,"H2S",0.989946431,0.01162827,0.097001612,2025-08-27,"Past Runs" +"36",NA,"H2S",0.988459596,0.011593871,0.102538661,2025-08-27,"Past Runs" +"37",NA,"H2S",0.984009845,0.01077442,0.094690475,2025-08-08,"Past Runs" +"38",NA,"H2S",0.991998684,0.012003707,0.087888803,2025-08-08,"Past Runs" +"39",NA,"H2S",0.988472937,0.013654087,0.080747996,2025-08-08,"Past Runs" +"40",NA,"H2S",0.989644138,0.011187528,0.100376401,2025-08-08,"Past Runs" +"41",NA,"H2S",0.991253241,0.01240335,0.091781398,2025-07-28,"Past Runs" +"42",NA,"H2S",0.985302046,0.010983613,0.096511057,2025-07-28,"Past Runs" +"43",NA,"H2S",0.989746609,0.012199156,0.083958107,2025-07-28,"Past Runs" +"44",NA,"H2S",0.983978644,0.01257192,0.082066064,2025-07-28,"Past Runs" +"45",NA,"H2S",0.985041184,0.013253135,0.095890286,2025-06-23,"Past Runs" +"46",NA,"H2S",0.988479922,0.012770225,0.097515258,2025-06-23,"Past Runs" +"47",NA,"H2S",0.986622245,0.014490479,0.088550945,2025-06-23,"Past Runs" +"48",NA,"H2S",0.98593674,0.012464999,0.101324152,2025-06-23,"Past Runs" +"49",NA,"H2S",0.992217588,0.011106834,0.087410369,2025-06-03,"Past Runs" +"50",NA,"H2S",0.994571071,0.01266079,0.086043319,2025-06-03,"Past Runs" +"51",NA,"H2S",0.987008654,0.01202734,0.088509886,2025-06-03,"Past Runs" +"52",NA,"H2S",0.991890557,0.010510502,0.089450704,2025-06-03,"Past Runs" +"53",NA,"H2S",0.990808319,0.011660482,0.083892866,2025-06-03,"Past Runs" +"54",NA,"H2S",0.99195308,0.012188907,0.076050353,2025-06-03,"Past Runs" +"55",NA,"H2S",0.990300427,0.011117767,0.095151906,2025-06-03,"Past Runs" +"56",NA,"H2S",0.990287741,0.012773563,0.085475942,2025-06-02,"Past Runs" +"57",NA,"H2S",0.985219853,0.012034496,0.101191716,2025-06-02,"Past Runs" +"58",NA,"H2S",0.990742934,0.012442945,0.09150939,2025-06-02,"Past Runs" +"59",NA,"H2S",0.988190426,0.012914305,0.098581692,2025-06-02,"Past Runs" +"60",NA,"H2S",0.989470668,0.01309737,0.091276263,2025-06-02,"Past Runs" +"61",NA,"H2S",0.985446517,0.012512003,0.101529112,2025-06-02,"Past Runs" +"62",NA,"H2S",0.989516031,0.009990116,0.090615023,2025-05-29,"Past Runs" +"63",NA,"H2S",0.989050067,0.009114036,0.092492755,2025-05-29,"Past Runs" +"64",NA,"H2S",0.992170999,0.009329021,0.090250992,2025-05-27,"Past Runs" +"65",NA,"H2S",0.991744664,0.009917044,0.078245698,2025-05-27,"Past Runs" +"66",NA,"H2S",0.994352551,0.009616728,0.087789906,2025-05-27,"Past Runs" +"67",NA,"H2S",0.985006054,0.009610255,0.07704108,2025-05-27,"Past Runs" +"68",NA,"H2S",0.993274803,0.009359273,0.090591475,2025-05-27,"Past Runs" +"69",NA,"H2S",0.986045229,0.011531354,0.077709532,2024-11-18,"Past Runs" +"70",NA,"H2S",0.986196268,0.011480984,0.07703203,2024-11-18,"Past Runs" +"71",NA,"H2S",0.985787929,0.009948554,0.091199531,2024-11-18,"Past Runs" +"72",NA,"H2S",0.988947878,0.010495862,0.093284593,2024-11-18,"Past Runs" +"73",NA,"H2S",0.988264781,0.010127226,0.080001514,2024-10-28,"Past Runs" +"74",NA,"H2S",0.988125768,0.009325271,0.097513836,2024-10-28,"Past Runs" +"75",NA,"H2S",0.99758753,0.011945752,0.067197191,2024-10-28,"Past Runs" +"76",NA,"H2S",0.993078174,0.009645972,0.08151815,2024-10-07,"Past Runs" +"77",NA,"H2S",0.986071127,0.009987862,0.086021444,2024-10-04,"Past Runs" +"78",NA,"H2S",0.986143404,0.009891411,0.079796142,2024-10-04,"Past Runs" +"79",NA,"H2S",0.99164056,0.009670319,0.086201323,2024-10-03,"Past Runs" +"80",NA,"H2S",0.992085737,0.009733216,0.067611651,2024-10-03,"Past Runs" +"81",NA,"H2S",0.992009962,0.01118999,0.069642654,2024-10-03,"Past Runs" +"82",NA,"H2S",0.985288821,0.010925627,0.071179528,2024-10-03,"Past Runs" +"83",NA,"H2S",0.995390082,0.011330148,0.070037534,2024-10-03,"Past Runs" +"84",NA,"H2S",0.994790512,0.009796019,0.071794375,2024-10-01,"Past Runs" +"85",NA,"H2S",0.989580278,0.010755502,0.087527355,2024-10-01,"Past Runs" +"86",NA,"H2S",0.990511071,0.009855933,0.084838618,2024-10-01,"Past Runs" +"87",NA,"H2S",0.992652978,0.009918529,0.082342296,2024-10-01,"Past Runs" +"88",NA,"H2S",0.986832476,0.010348222,0.095254617,2024-09-23,"Past Runs" +"89",NA,"H2S",0.993120795,0.012220049,0.075212346,2024-09-23,"Past Runs" +"90",NA,"H2S",0.997632416,0.009657487,0.072204384,2024-09-25,"Past Runs" +"91",NA,"H2S",0.988833662,0.010418036,0.079942507,2024-09-24,"Past Runs" +"92",NA,"H2S",0.989425359,0.010908767,0.079669724,2024-09-24,"Past Runs" +"93",NA,"H2S",0.9939478,0.011206242,0.073020732,2024-09-24,"Past Runs" +"94",NA,"H2S",0.992036143,0.010398233,0.086327041,2024-09-24,"Past Runs" +"95",NA,"H2S",0.986162946,0.010280929,0.083188885,2024-09-24,"Past Runs" +"96",NA,"H2S",0.987800455,0.011372072,0.073224086,2024-09-23,"Past Runs" +"97",NA,"H2S",0.997485183,0.011409313,0.06519985,2024-09-23,"Past Runs" +"98",NA,"H2S",0.989099616,0.009735423,0.086474227,2024-09-19,"Past Runs" +"99",NA,"H2S",0.985472997,0.010406102,0.081660091,2024-09-19,"Past Runs" +"100",NA,"H2S",0.985753501,0.011560614,0.084016281,2024-09-19,"Past Runs" +"101",NA,"H2S",0.997161027,0.011775527,0.069868502,2024-09-18,"Past Runs" +"102",NA,"H2S",0.989061589,0.010749066,0.094634117,2024-09-18,"Past Runs" +"103",NA,"H2S",0.988308897,0.010324402,0.093490431,2024-09-18,"Past Runs" +"104",NA,"H2S",0.988282091,0.011748716,0.090496556,2024-09-18,"Past Runs" +"105",NA,"H2S",0.990611188,0.011004901,0.08215848,2024-09-09,"Past Runs" +"106",NA,"H2S",0.992687363,0.011700541,0.077148047,2024-08-30,"Past Runs" +"107",NA,"H2S",0.988249032,0.010524088,0.096531712,2024-09-03,"Past Runs" +"108",NA,"H2S",0.988532329,0.010996494,0.084496543,2024-09-03,"Past Runs" +"109",NA,"H2S",0.989712544,0.011101339,0.099050983,2024-09-03,"Past Runs" +"110",NA,"H2S",0.986439831,0.010996091,0.08776573,2024-08-30,"Past Runs" +"111",NA,"H2S",0.989313189,0.010457844,0.084754346,2024-08-30,"Past Runs" +"112",NA,"H2S",0.990177739,0.010268758,0.087174996,2024-08-30,"Past Runs" +"113",NA,"H2S",0.985866463,0.010585417,0.09737672,2024-08-30,"Past Runs" +"114",NA,"H2S",0.99044815,0.011181375,0.077015013,2024-08-30,"Past Runs" +"115",NA,"H2S",0.99053911,0.011535354,0.07384657,2024-08-29,"Past Runs" +"116",NA,"H2S",0.985015156,0.009782729,0.093669731,2024-08-29,"Past Runs" +"117",NA,"H2S",0.990100963,0.011025989,0.095480695,2024-08-29,"Past Runs" +"118",NA,"H2S",0.986738056,0.011094002,0.090055999,2024-08-29,"Past Runs" +"119",NA,"H2S",0.994093709,0.010473948,0.080691929,2024-08-29,"Past Runs" +"120",NA,"H2S",0.986192277,0.011543972,0.085092199,2024-08-07,"Past Runs" +"121",NA,"H2S",0.989960946,0.010741325,0.089432284,2024-08-07,"Past Runs" +"122",NA,"H2S",0.986951933,0.011912043,0.085700427,2024-08-07,"Past Runs" +"123",NA,"H2S",0.991998444,0.010555363,0.079000944,2024-08-07,"Past Runs" +"124",NA,"H2S",0.985536677,0.011846101,0.081424587,2024-07-29,"Past Runs" +"125",NA,"H2S",0.989595015,0.01224124,0.098524648,2024-07-29,"Past Runs" +"126",NA,"H2S",0.986188356,0.010118538,0.089341935,2024-07-25,"Past Runs" +"127",NA,"H2S",0.992411811,0.012549456,0.078491188,2024-07-25,"Past Runs" +"128",NA,"H2S",0.986593659,0.012390759,0.091396714,2024-07-25,"Past Runs" +"129",NA,"H2S",0.987105229,0.011378377,0.09863995,2024-07-25,"Past Runs" +"130",NA,"H2S",0.985994152,0.011415216,0.08057319,2024-07-25,"Past Runs" +"131",NA,"H2S",0.990738705,0.011295641,0.084048401,2024-07-31,"Past Runs" +"132",NA,"H2S",0.987136133,0.011450047,0.079739708,2024-07-29,"Past Runs" +"133",NA,"H2S",0.99126783,0.013018999,0.08407446,2024-07-29,"Past Runs" +"134",NA,"H2S",0.991454138,0.01254834,0.090174827,2024-07-29,"Past Runs" +"135",NA,"H2S",0.99018676,0.010771473,0.09900375,2024-07-24,"Past Runs" +"136",NA,"H2S",0.984822062,0.011740029,0.096632577,2024-07-24,"Past Runs" +"137",NA,"H2S",0.993424378,0.012468772,0.07384182,2024-07-19,"Past Runs" +"138",NA,"H2S",0.989184664,0.01069962,0.08457192,2024-07-19,"Past Runs" +"139",NA,"H2S",0.989831855,0.011217555,0.074495287,2024-07-19,"Past Runs" +"140",NA,"H2S",0.988637133,0.011247898,0.09116868,2024-07-19,"Past Runs" +"141",NA,"H2S",0.990494512,0.012004154,0.08805378,2024-07-19,"Past Runs" +"142",NA,"H2S",0.988124802,0.011667535,0.091833244,2024-07-19,"Past Runs" +"143",NA,"H2S",0.990863942,0.010234964,0.079436097,2024-07-18,"Past Runs" +"144",NA,"H2S",0.983817166,0.010882717,0.094621893,2024-07-18,"Past Runs" +"145",NA,"H2S",0.990198017,0.011687802,0.081889383,2024-07-18,"Past Runs" +"146",NA,"H2S",0.987899965,0.01159855,0.091733041,2024-07-18,"Past Runs" +"147",NA,"H2S",0.989060685,0.011495464,0.099538763,2024-07-18,"Past Runs" +"148",NA,"H2S",0.986916133,0.009342433,0.095298628,2024-07-18,"Past Runs" +"149",NA,"H2S",0.984427464,0.011641613,0.092097982,2024-07-19,"Past Runs" +"150",NA,"H2S",0.990912834,0.010479158,0.086080607,2024-07-19,"Past Runs" +"151",NA,"H2S",0.987412326,0.010983562,0.094991681,2024-07-18,"Past Runs" +"152",NA,"H2S",0.986465804,0.011418341,0.090477665,2024-07-18,"Past Runs" +"153",NA,"H2S",0.987068169,0.011199063,0.089853992,2024-07-18,"Past Runs" +"154",NA,"H2S",0.989037854,0.011295078,0.081699567,2024-07-17,"Past Runs" +"155",NA,"H2S",0.992083054,0.012185227,0.07626707,2024-07-17,"Past Runs" +"156",NA,"H2S",0.992139993,0.011646417,0.077884912,2024-07-17,"Past Runs" +"157",NA,"H2S",0.993165626,0.012227159,0.072878643,2024-07-17,"Past Runs" +"158",NA,"H2S",0.991179678,0.010917098,0.077263615,2024-07-17,"Past Runs" +"159",NA,"H2S",0.994482296,0.010706488,0.074416857,2024-07-17,"Past Runs" +"160",NA,"H2S",0.993221658,0.011432212,0.085152764,2024-07-15,"Past Runs" +"161",NA,"H2S",0.991012311,0.012163061,0.075124953,2024-07-05,"Past Runs" +"162",NA,"H2S",0.985644961,0.012042341,0.087343444,2024-07-05,"Past Runs" +"163",NA,"H2S",0.990282541,0.011631377,0.089041685,2024-07-05,"Past Runs" +"164",NA,"H2S",0.987824676,0.011559837,0.066632483,2024-07-05,"Past Runs" +"165",NA,"H2S",0.987863383,0.012339206,0.093894911,2024-07-03,"Past Runs" +"166",NA,"H2S",0.994315831,0.012786291,0.087233216,2024-07-03,"Past Runs" +"167",NA,"H2S",0.988339045,0.011649182,0.091537982,2024-07-03,"Past Runs" +"168",NA,"H2S",0.988950697,0.014678212,0.09163757,2023-11-14,"Past Runs" +"169",NA,"H2S",0.990040026,0.012259376,0.107676904,2023-11-14,"Past Runs" +"170",NA,"H2S",0.992010649,0.010954084,0.079408389,2024-05-29,"Past Runs" +"171",NA,"H2S",0.989206107,0.010763348,0.088663974,2024-05-29,"Past Runs" +"172",NA,"H2S",0.990869031,0.010939769,0.092318935,2024-05-29,"Past Runs" +"173",NA,"H2S",0.985767699,0.010729643,0.084530357,2024-05-29,"Past Runs" +"174",NA,"H2S",0.990353193,0.011621645,0.084002879,2024-05-28,"Past Runs" +"175",NA,"H2S",0.987684582,0.01183304,0.076585822,2024-05-28,"Past Runs" +"176",NA,"H2S",0.990127271,0.010373918,0.082859368,2024-05-28,"Past Runs" +"177",NA,"H2S",0.992091943,0.011632631,0.078949694,2024-05-28,"Past Runs" +"178",NA,"H2S",0.991295752,0.011015224,0.083816625,2024-05-23,"Past Runs" +"179",NA,"H2S",0.987251905,0.011995579,0.078461365,2024-05-23,"Past Runs" +"180",NA,"H2S",0.991135851,0.011944649,0.090053389,2024-05-23,"Past Runs" +"181",NA,"H2S",0.987847657,0.013334201,0.076212686,2024-05-22,"Past Runs" +"182",NA,"H2S",0.98858924,0.010019939,0.074402064,2024-05-22,"Past Runs" +"183",NA,"H2S",0.992678091,0.012147509,0.085708498,2024-05-22,"Past Runs" +"184",NA,"H2S",0.993578596,0.012248114,0.078688178,2024-05-22,"Past Runs" +"185",NA,"H2S",0.992362286,0.01333791,0.069302726,2024-05-21,"Past Runs" +"186",NA,"H2S",0.989216329,0.012520477,0.080249778,2024-05-21,"Past Runs" +"187",NA,"H2S",0.986391164,0.012989122,0.080584704,2024-05-21,"Past Runs" +"188","Plate1","H2S",0.9936,0.0095,0.0909,2025-05-27,"Past Runs" +"189","Plate2","H2S",0.9942,0.009,0.0831,2025-05-27,"Past Runs" +"190","Plate3","H2S",0.9939,0.0095,0.0892,2025-05-27,"Past Runs" +"191","Plate4","H2S",0.9985,0.0101,0.0762,2025-05-27,"Past Runs" +"192","Plate5","H2S",0.9972,0.0096,0.0866,2025-05-27,"Past Runs" +"193","Plate6","H2S",0.9985,0.0101,0.0762,2025-05-27,"Past Runs" +"194","Plate7","H2S",0.9985,0.0101,0.0762,2025-05-27,"Past Runs" +"195","Plate_rr","H2S",0.9906,0.0131,0.0934,2025-06-02,"Past Runs" +"196","Plate1","H2S",0.9801,0.0114,0.1116,2025-07-14,"Past Runs" +"197","Plate2","H2S",0.9881,0.0107,0.1167,2025-07-14,"Past Runs" +"198","Plate3","H2S",0.9796,0.0113,0.1195,2025-07-14,"Past Runs" +"199","Plate4","H2S",0.9888,0.0115,0.1123,2025-07-14,"Past Runs" +"200","Plate5","H2S",0.9961,0.012,0.1021,2025-07-14,"Past Runs" +"201","Plate6","H2S",0.9961,0.012,0.1021,2025-07-14,"Past Runs" +"202","Plate7","H2S",0.994,0.0128,0.0806,2025-07-15,"Past Runs" +"203","Plate8","H2S",0.9928,0.0115,0.0903,2025-07-15,"Past Runs" +"204","Plate9","H2S",0.9974,0.0117,0.0896,2025-07-15,"Past Runs" +"205","Plate10","H2S",0.9962,0.0134,0.0672,2025-07-15,"Past Runs" +"206","Plate_rr","H2S",0.9994,0.0124,0.0564,2025-07-16,"Past Runs" +"207","Plate1","H2S",0.9862,0.012,0.1023,2025-09-18,"Past Runs" +"208","Plate2","H2S",0.9977,0.0107,0.082,2025-09-18,"Past Runs" +"209","Plate3","H2S",0.9949,0.0109,0.0927,2025-09-18,"Past Runs" +"210","Plate4","H2S",0.9978,0.0126,0.0764,2025-09-18,"Past Runs" +"211","Plate5","H2S",0.9933,0.0112,0.0942,2025-09-18,"Past Runs" +"212","Plate6","H2S",0.9978,0.0121,0.0843,2025-09-18,"Past Runs" +"213","Plate_rr","H2S",0.9982,0.011,0.0827,2025-09-19,"Past Runs" +"214","Plate1","H2S",0.9907,0.0116,0.1023,2026-05-18,"Past Runs" +"215","Plate2","H2S",0.991,0.0121,0.0937,2026-05-18,"Past Runs" +"216","Plate3","H2S",0.9921,0.0124,0.1034,2026-05-18,"Past Runs" +"217","Plate4","H2S",0.9957,0.0115,0.0953,2026-05-18,"Past Runs" +"218","Plate5","H2S",0.9876,0.011,0.1017,2026-05-19,"Past Runs" +"219","Plate1","H2S",0.9909,0.012,0.0971,2026-05-18,"Past Runs" +"220","Plate2","H2S",0.9917,0.012,0.0926,2026-05-18,"Past Runs" +"221","Plate3","H2S",0.9863,0.0119,0.1118,2026-05-18,"Past Runs" +"222","Plate4","H2S",0.9961,0.0115,0.0897,2026-05-18,"Past Runs" +"223","Plate5","H2S",0.9915,0.0113,0.0938,2026-05-19,"Past Runs" +"224","rrPlate1","H2S",0.9866,0.0128,0.1203,2026-06-01,"Past Runs" +"225","rrPlate2","H2S",0.9922,0.0115,0.0987,2026-06-01,"Past Runs" +"226","Plate1","H2S",0.9909,0.012,0.0971,2020-05-18,"Current Runs" +"227","Plate2","H2S",0.9917,0.012,0.0926,2020-05-18,"Current Runs" +"228","Plate3","H2S",0.9863,0.0119,0.1118,2020-05-18,"Current Runs" +"229","Plate4","H2S",0.9961,0.0115,0.0897,2020-05-18,"Current Runs" +"230","Plate5","H2S",0.9915,0.0113,0.0938,2020-05-19,"Current Runs" +"231","rrPlate1","H2S",0.9866,0.0128,0.1203,2020-06-01,"Current Runs" +"232","rrPlate2","H2S",0.9922,0.0115,0.0987,2020-06-01,"Current Runs" diff --git a/CO2xN/Porewater/Sulfide/2026/Raw Data/20260518_LTREB_H2S_Plate1.csv b/CO2xN/Porewater/Sulfide/2026/Raw Data/20260518_LTREB_H2S_Plate1.csv new file mode 100644 index 0000000..cd20397 --- /dev/null +++ b/CO2xN/Porewater/Sulfide/2026/Raw Data/20260518_LTREB_H2S_Plate1.csv @@ -0,0 +1,29 @@ +,1,2,3,4,5,6,7,8,9,10,11,12 +A,0.063,0.061,0.063,0.775,0.887,0.907,0.407,0.39,0.385,0.763,0.752,0.685 +B,0.141,0.16,0.148,0.94,0.751,0.839,0.066,0.064,0.063,0.703,0.551,0.74 +C,0.248,0.258,0.237,0.544,0.515,0.494,0.378,0.338,0.327,0.72,0.635,0.658 +D,0.482,0.571,0.431,0.697,0.692,0.633,0.454,0.537,0.404,0.575,0.773,0.831 +E,0.955,0.941,0.736,0.684,0.717,0.705,0.58,0.509,0.61,0.979,0.858,0.726 +F,1.373,1.231,1.255,0.838,0.896,0.895,0.787,0.971,0.895,0.065,0.063,0.061 +G,1.405,1.462,1.3,0.85,0.987,0.882,0.323,0.341,0.348,0.655,0.681,0.688 +H,0.467,0.469,0.479,0.695,0.749,0.762,0.479,0.586,0.575,0.839,0.789,0.791 +,,,,,,,,,,,, +,1,2,3,4,5,6,7,8,9,10,11,12 +A,Std 0,Std 0,Std 0,L1-40,L1-40,L1-40,L4-20,L4-20,L4-20,L5-80,L5-80,L5-80 +B,Std 1,Std 1,Std 1,L1-80,L1-80,L1-80,ChkStd 0,ChkStd 0,ChkStd 0,L6-20,L6-20,L6-20 +C,Std 2,Std 2,Std 2,L2-20,L2-20,L2-20,L4-20 Dup,L4-20 Dup,L4-20 Dup,L6-40,L6-40,L6-40 +D,Std 3,Std 3,Std 3,L2-40,L2-40,L2-40,ChkStd 3,ChkStd 3,ChkStd 3,L1-20 Spike,L1-20 Spike,L1-20 Spike +E,Std 4,Std 4,Std 4,L2-80,L2-80,L2-80,L4-40,L4-40,L4-40,L4-40 Spike,L4-40 Spike,L4-40 Spike +F,Std 5,Std 5,Std 5,L3-20,L3-20,L3-20,L4-80,L4-80,L4-80,ChkStd 0,ChkStd 0,ChkStd 0 +G,MC: 10ppt S5,MC: 10ppt S5,MC: 10ppt S5,L3-40,L3-40,L3-40,L5-20,L5-20,L5-20,L6-40 Dup,L6-40 Dup,L6-40 Dup +H,L1-20,L1-20,L1-20,L3-80,L3-80,L3-80,L5-40,L5-40,L5-40,ChkStd 4,ChkStd 4,ChkStd 4 +,,,,,,,,,,,, +,1,2,3,4,5,6,7,8,9,10,11,12 +A,1,1,1,50,50,50,50,50,50,50,50,50 +B,1,1,1,50,50,50,1,1,1,50,50,50 +C,1,1,1,50,50,50,50,50,50,50,50,50 +D,1,1,1,50,50,50,1,1,1,50,50,50 +E,1,1,1,50,50,50,50,50,50,50,50,50 +F,1,1,1,50,50,50,50,50,50,1,1,1 +G,1,1,1,50,50,50,50,50,50,50,50,50 +H,50,50,50,50,50,50,50,50,50,1,1,1 diff --git a/CO2xN/Porewater/Sulfide/2026/Raw Data/20260518_LTREB_H2S_Plate2.csv b/CO2xN/Porewater/Sulfide/2026/Raw Data/20260518_LTREB_H2S_Plate2.csv new file mode 100644 index 0000000..7a1e4e7 --- /dev/null +++ b/CO2xN/Porewater/Sulfide/2026/Raw Data/20260518_LTREB_H2S_Plate2.csv @@ -0,0 +1,29 @@ +,1,2,3,4,5,6,7,8,9,10,11,12 +A,0.062,0.063,0.065,0.436,0.43,0.394,0.816,0.704,0.653,0.464,0.529,0.358 +B,0.148,0.138,0.19,0.513,0.464,0.483,0.065,0.063,0.063,0.596,0.709,0.531 +C,0.221,0.275,0.222,0.623,0.726,0.674,0.831,0.699,0.645,0.337,0.306,0.4 +D,0.546,0.429,0.474,0.535,0.521,0.511,0.418,0.458,0.406,0.927,1.072,1.004 +E,0.775,0.97,0.713,0.586,0.542,0.546,0.542,0.576,0.461,0.795,0.703,0.919 +F,1.008,0.67,0.868,0.794,0.743,0.72,0.658,0.61,0.591,0.064,0.062,0.063 +G,1.418,1.487,1.351,0.358,0.324,0.333,0.694,0.676,0.807,0.355,0.351,0.348 +H,0.687,0.743,0.773,0.439,0.395,0.447,0.494,0.528,0.519,1.282,1.244,1.267 +,,,,,,,,,,,, +,1,2,3,4,5,6,7,8,9,10,11,12 +A,Std 0,Std 0,Std 0,L7-20,L7-20,L7-20,L9-80,L9-80,L9-80,L11-40,L11-40,L11-40 +B,Std 1,Std 1,Std 1,L7-40,L7-40,L7-40,ChkStd 0,ChkStd 0,ChkStd 0,L11-80,L11-80,L11-80 +C,Std 2,Std 2,Std 2,L7-80,L7-80,L7-80,L9-80 Dup,L9-80 Dup,L9-80 Dup,L12-20,L12-20,L12-20 +D,Std 3,Std 3,Std 3,L8-20,L8-20,L8-20,ChkStd 3,ChkStd 3,ChkStd 3,L6-80 Spike,L6-80 Spike,L6-80 Spike +E,Std 4,Std 4,Std 4,L8-40,L8-40,L8-40,L10-20,L10-20,L10-20,L10-20 Spike,L10-20 Spike,L10-20 Spike +F,ChkStd 4,ChkStd 4,ChkStd 4,L8-80,L8-80,L8-80,L10-40,L10-40,L10-40,ChkStd 0,ChkStd 0,ChkStd 0 +G,MC: 10ppt S5,MC: 10ppt S5,MC: 10ppt S5,L9-20,L9-20,L9-20,L10-80,L10-80,L10-80,L12-20 Dup,L12-20 Dup,L12-20 Dup +H,L6-80,L6-80,L6-80,L9-40,L9-40,L9-40,L11-20,L11-20,L11-20,Std 5,Std 5,Std 5 +,,,,,,,,,,,, +,1,2,3,4,5,6,7,8,9,10,11,12 +A,1,1,1,50,50,50,50,50,50,50,50,50 +B,1,1,1,50,50,50,1,1,1,50,50,50 +C,1,1,1,50,50,50,50,50,50,50,50,50 +D,1,1,1,50,50,50,1,1,1,50,50,50 +E,1,1,1,50,50,50,50,50,50,50,50,50 +F,1,1,1,50,50,50,50,50,50,1,1,1 +G,1,1,1,50,50,50,50,50,50,50,50,50 +H,50,50,50,50,50,50,50,50,50,1,1,1 diff --git a/CO2xN/Porewater/Sulfide/2026/Raw Data/20260518_LTREB_H2S_Plate3.csv b/CO2xN/Porewater/Sulfide/2026/Raw Data/20260518_LTREB_H2S_Plate3.csv new file mode 100644 index 0000000..4fbfd70 --- /dev/null +++ b/CO2xN/Porewater/Sulfide/2026/Raw Data/20260518_LTREB_H2S_Plate3.csv @@ -0,0 +1,29 @@ +,1,2,3,4,5,6,7,8,9,10,11,12 +A,0.059,0.061,0.061,0.613,0.702,0.606,0.652,0.729,0.675,0.36,0.327,0.331 +B,0.181,0.13,0.237,0.33,0.343,0.312,0.06,0.06,0.061,0.751,0.658,0.743 +C,0.255,0.236,0.254,0.631,0.777,0.674,0.658,0.818,0.61,0.541,0.523,0.516 +D,0.482,0.421,0.465,0.578,0.554,0.511,0.4,0.445,0.447,0.712,0.633,0.792 +E,0.811,0.73,0.716,0.385,0.444,0.428,0.625,0.621,0.705,0.954,0.776,1.055 +F,1.314,1.197,1.34,0.682,0.671,0.591,0.678,0.696,0.648,0.065,0.061,0.062 +G,1.494,1.357,1.344,0.743,0.627,0.759,0.564,0.514,0.62,0.453,0.52,0.477 +H,0.474,0.457,0.43,0.637,0.568,0.662,0.557,0.631,0.514,0.745,0.859,0.966 +,,,,,,,,,,,, +,1,2,3,4,5,6,7,8,9,10,11,12 +A,Std 0,Std 0,Std 0,L12-80,L12-80,L12-80,L15-40,L15-40,L15-40,L17-20,L17-20,L17-20 +B,Std 1,Std 1,Std 1,L13-20,L13-20,L13-20,ChkStd 0,ChkStd 0,ChkStd 0,L17-40,L17-40,L17-40 +C,Std 2,Std 2,Std 2,L13-40,L13-40,L13-40,L15-40 Dup,L15-40 Dup,L15-40 Dup,L17-80,L17-80,L17-80 +D,Std 3,Std 3,Std 3,L13-80,L13-80,L13-80,ChkStd 3,ChkStd 3,ChkStd 3,L12-40 Spike,L12-40 Spike,L12-40 Spike +E,Std 4,Std 4,Std 4,L14-20,L14-20,L14-20,L15-80,L15-80,L15-80,L15-80 Spike,L15-80 Spike,L15-80 Spike +F,Std 5,Std 5,Std 5,L14-40,L14-40,L14-40,L16-20,L16-20,L16-20,ChkStd 0,ChkStd 0,ChkStd 0 +G,MC: 10ppt S5,MC: 10ppt S5,MC: 10ppt S5,L14-80,L14-80,L14-80,L16-40,L16-40,L16-40,L17-80 Dup,L17-80 Dup,L17-80 Dup +H,L12-40,L12-40,L12-40,L15-20,L15-20,L15-20,L16-80,L16-80,L16-80,ChkStd 4,ChkStd 4,ChkStd 4 +,,,,,,,,,,,, +,1,2,3,4,5,6,7,8,9,10,11,12 +A,1,1,1,50,50,50,50,50,50,50,50,50 +B,1,1,1,50,50,50,1,1,1,50,50,50 +C,1,1,1,50,50,50,50,50,50,50,50,50 +D,1,1,1,50,50,50,1,1,1,50,50,50 +E,1,1,1,50,50,50,50,50,50,50,50,50 +F,1,1,1,50,50,50,50,50,50,1,1,1 +G,1,1,1,50,50,50,50,50,50,50,50,50 +H,50,50,50,50,50,50,50,50,50,1,1,1 diff --git a/CO2xN/Porewater/Sulfide/2026/Raw Data/20260518_LTREB_H2S_Plate4.csv b/CO2xN/Porewater/Sulfide/2026/Raw Data/20260518_LTREB_H2S_Plate4.csv new file mode 100644 index 0000000..8b25dee --- /dev/null +++ b/CO2xN/Porewater/Sulfide/2026/Raw Data/20260518_LTREB_H2S_Plate4.csv @@ -0,0 +1,29 @@ +,1,2,3,4,5,6,7,8,9,10,11,12 +A,0.066,0.061,0.063,0.419,0.446,0.434,0.196,0.191,0.196,0.086,0.095,0.086 +B,0.123,0.152,0.152,0.545,0.546,0.548,0.063,0.06,0.063,0.099,0.091,0.09 +C,0.249,0.238,0.216,0.684,0.688,0.728,0.195,0.215,0.195,0.212,0.231,0.232 +D,0.5,0.447,0.401,0.807,0.852,0.821,0.372,0.428,0.543,0.429,0.366,0.516 +E,0.822,0.84,0.853,0.873,0.749,0.919,0.269,0.309,0.288,0.61,0.627,0.652 +F,1.215,1.234,1.239,0.528,0.553,0.561,0.18,0.19,0.197,0.066,0.077,0.063 +G,1.396,1.407,1.403,0.724,0.681,0.646,0.258,0.278,0.274,0.209,0.198,0.202 +H,0.069,0.068,0.07,0.65,0.765,0.694,0.065,0.071,0.064,0.776,0.689,0.677 +,,,,,,,,,,,, +,1,2,3,4,5,6,7,8,9,10,11,12 +A,Std 0,Std 0,Std 0,L18-40,L18-40,L18-40,P1-20,P1-20,P1-20,P3-40,P3-40,P3-40 +B,Std 1,Std 1,Std 1,L18-80,L18-80,L18-80,ChkStd 0,ChkStd 0,ChkStd 0,P4-20,P4-20,P4-20 +C,Std 2,Std 2,Std 2,L19-20,L19-20,L19-20,P1-20 Dup,P1-20 Dup,P1-20 Dup,P4-40,P4-40,P4-40 +D,Std 3,Std 3,Std 3,L19-40,L19-40,L19-40,ChkStd 3,ChkStd 3,ChkStd 3,L18-20 Spike,L18-20 Spike,L18-20 Spike +E,Std 4,Std 4,Std 4,L19-80,L19-80,L19-80,P1-40,P1-40,P1-40,P1-40 Spike,P1-40 Spike,P1-40 Spike +F,Std 5,Std 5,Std 5,L20-20,L20-20,L20-20,P2-20,P2-20,P2-20,ChkStd 0,ChkStd 0,ChkStd 0 +G,MC: 10ppt S5,MC: 10ppt S5,MC: 10ppt S5,L20-40,L20-40,L20-40,P2-40,P2-40,P2-40,P4-40 Dup,P4-40 Dup,P4-40 Dup +H,L18-20,L18-20,L18-20,L20-80,L20-80,L20-80,P3-20,P3-20,P3-20,ChkStd 4,ChkStd 4,ChkStd 4 +,,,,,,,,,,,, +,1,2,3,4,5,6,7,8,9,10,11,12 +A,1,1,1,50,50,50,50,50,50,50,50,50 +B,1,1,1,50,50,50,1,1,1,50,50,50 +C,1,1,1,50,50,50,50,50,50,50,50,50 +D,1,1,1,50,50,50,1,1,1,50,50,50 +E,1,1,1,50,50,50,50,50,50,50,50,50 +F,1,1,1,50,50,50,50,50,50,1,1,1 +G,1,1,1,50,50,50,50,50,50,50,50,50 +H,50,50,50,50,50,50,50,50,50,1,1,1 diff --git a/CO2xN/Porewater/Sulfide/2026/Raw Data/20260518_LTREB_H2S_STD.csv b/CO2xN/Porewater/Sulfide/2026/Raw Data/20260518_LTREB_H2S_STD.csv new file mode 100644 index 0000000..c79396d --- /dev/null +++ b/CO2xN/Porewater/Sulfide/2026/Raw Data/20260518_LTREB_H2S_STD.csv @@ -0,0 +1,29 @@ +,1,2,3,4,5,6,7,8,9,10,11,12 +A,0.054,0.056,0.054,0.069,0.065,0.066,0.047,0.046,0.05,0.045,0.045,0.045 +B,0.145,0.147,0.14,0.151,0.14,0.223,0.046,0.044,0.045,0.045,0.046,0.045 +C,0.295,0.304,0.295,0.349,0.271,0.334,0.045,0.047,0.045,0.046,0.046,0.047 +D,0.478,0.467,0.557,0.557,0.438,0.406,0.052,0.046,0.054,0.049,0.047,0.046 +E,0.895,0.906,0.844,0.839,0.787,0.743,0.046,0.044,0.046,0.045,0.045,0.045 +F,1.674,1.428,1.28,1.415,1.182,1.23,0.046,0.045,0.045,0.045,0.045,0.046 +G,1.622,1.762,1.552,1.276,1.423,1.164,0.045,0.045,0.047,0.045,0.045,0.045 +H,0.047,0.047,0.045,0.047,0.045,0.048,0.046,0.051,0.047,0.045,0.046,0.045 +,,,,,,,,,,,, +,1,2,3,4,5,6,7,8,9,10,11,12 +A,,,,Std 0,Std 0,Std 0,,,,,, +B,,,,Std 1,Std 1,Std 1,,,,,, +C,,,,Std 2,Std 2,Std 2,,,,,, +D,,,,Std 3,Std 3,Std 3,,,,,, +E,,,,Std 4,Std 4,Std 4,,,,,, +F,,,,Std 5,Std 5,Std 5,,,,,, +G,,,,MC: 10ppt S5,MC: 10ppt S5,MC: 10ppt S5,,,,,, +H,,,,,,,,,,,, +,,,,,,,,,,,, +,1,2,3,4,5,6,7,8,9,10,11,12 +A,,,,1,1,1,,,,,, +B,,,,1,1,1,,,,,, +C,,,,1,1,1,,,,,, +D,,,,1,1,1,,,,,, +E,,,,1,1,1,,,,,, +F,,,,1,1,1,,,,,, +G,,,,1,1,1,,,,,, +H,,,,,,,,,,,, diff --git a/CO2xN/Porewater/Sulfide/2026/Raw Data/20260519_LTREB_H2S_Plate5.csv b/CO2xN/Porewater/Sulfide/2026/Raw Data/20260519_LTREB_H2S_Plate5.csv new file mode 100644 index 0000000..22b2e8e --- /dev/null +++ b/CO2xN/Porewater/Sulfide/2026/Raw Data/20260519_LTREB_H2S_Plate5.csv @@ -0,0 +1,29 @@ +,1,2,3,4,5,6,7,8,9,10,11,12 +A,0.065,0.06,0.064,0.513,0.411,0.413,0.336,0.357,0.327,0.383,0.382,0.357 +B,0.139,0.132,0.143,0.196,0.202,0.191,0.067,0.06,0.061,0.443,0.458,0.396 +C,0.233,0.241,0.234,0.3,0.275,0.279,0.372,0.316,0.33,0.125,0.12,0.123 +D,0.443,0.459,0.392,0.219,0.228,0.206,0.378,0.513,0.484,0.555,0.693,0.7 +E,0.747,0.86,0.762,0.259,0.283,0.25,0.149,0.187,0.179,0.469,0.441,0.455 +F,1.266,1.185,1.176,0.122,0.134,0.125,0.221,0.254,0.268,0.061,0.057,0.06 +G,1.406,1.432,1.36,0.27,0.249,0.261,0.272,0.253,0.212,0.122,0.123,0.129 +H,0.3,0.352,0.324,0.17,0.186,0.186,0.487,0.476,0.505,0.874,1.008,0.852 +,,,,,,,,,,,, +,1,2,3,4,5,6,7,8,9,10,11,12 +A,Std 0,Std 0,Std 0,P5-40,P5-40,P5-40,P9-40,P9-40,P9-40,P12-20,P12-20,P12-20 +B,Std 1,Std 1,Std 1,P6-20,P6-20,P6-20,ChkStd 0,ChkStd 0,ChkStd 0,P12-40,P12-40,P12-40 +C,Std 2,Std 2,Std 2,P6-40,P6-40,P6-40,P9-40 Dup,P9-40 Dup,P9-40 Dup,P3-20,P3-20,P3-20 +D,Std 3,Std 3,Std 3,P7-20,P7-20,P7-20,ChkStd 3,ChkStd 3,ChkStd 3,P5-20 Spike,P5-20 Spike,P5-20 Spike +E,Std 4,Std 4,Std 4,P7-40,P7-40,P7-40,P10-20,P10-20,P10-20,P10-20 Spike,P10-20 Spike,P10-20 Spike +F,Std 5,Std 5,Std 5,P8-20,P8-20,P8-20,P10-40,P10-40,P10-40,ChkStd 0,ChkStd 0,ChkStd 0 +G,MC: 10ppt S5,MC: 10ppt S5,MC: 10ppt S5,P8-40,P8-40,P8-40,P11-20,P11-20,P11-20,P3-20 Dup,P3-20 Dup,P3-20 Dup +H,P5-20,P5-20,P5-20,P9-20,P9-20,P9-20,P11-40,P11-40,P11-40,ChkStd 4,ChkStd 4,ChkStd 4 +,,,,,,,,,,,, +,1,2,3,4,5,6,7,8,9,10,11,12 +A,1,1,1,50,50,50,50,50,50,50,50,50 +B,1,1,1,50,50,50,1,1,1,50,50,50 +C,1,1,1,50,50,50,50,50,50,50,50,50 +D,1,1,1,50,50,50,1,1,1,50,50,50 +E,1,1,1,50,50,50,50,50,50,50,50,50 +F,1,1,1,50,50,50,50,50,50,1,1,1 +G,1,1,1,50,50,50,50,50,50,50,50,50 +H,50,50,50,50,50,50,50,50,50,1,1,1 diff --git a/CO2xN/Porewater/Sulfide/2026/Raw Data/20260519_LTREB_H2S_STD.csv b/CO2xN/Porewater/Sulfide/2026/Raw Data/20260519_LTREB_H2S_STD.csv new file mode 100644 index 0000000..1b0e605 --- /dev/null +++ b/CO2xN/Porewater/Sulfide/2026/Raw Data/20260519_LTREB_H2S_STD.csv @@ -0,0 +1,29 @@ +,1,2,3,4,5,6,7,8,9,10,11,12 +A,0.066,0.067,0.066,0.046,0.045,0.045,0.046,0.045,0.045,0.046,0.046,0.045 +B,0.124,0.128,0.134,0.045,0.044,0.045,0.046,0.044,0.044,0.044,0.044,0.044 +C,0.28,0.232,0.249,0.045,0.045,0.045,0.044,0.045,0.044,0.044,0.044,0.047 +D,0.409,0.724,0.435,0.044,0.045,0.045,0.044,0.044,0.044,0.044,0.044,0.044 +E,0.665,0.608,0.6,0.044,0.045,0.045,0.044,0.045,0.045,0.045,0.044,0.044 +F,1.351,1.156,1.186,0.044,0.044,0.044,0.044,0.044,0.044,0.044,0.045,0.044 +G,1.327,1.166,0.981,0.044,0.044,0.044,0.044,0.046,0.044,0.044,0.044,0.045 +H,0.045,0.044,0.046,0.045,0.045,0.044,0.045,0.045,0.046,0.044,0.045,0.046 +,,,,,,,,,,,, +,1,2,3,4,5,6,7,8,9,10,11,12 +A,Std 0,Std 0,Std 0,,,,,,,,, +B,Std 1,Std 1,Std 1,,,,,,,,, +C,Std 2,Std 2,Std 2,,,,,,,,, +D,Std 3,Std 3,Std 3,,,,,,,,, +E,Std 4,Std 4,Std 4,,,,,,,,, +F,Std 5,Std 5,Std 5,,,,,,,,, +G,MC: 10ppt S5,MC: 10ppt S5,MC: 10ppt S5,,,,,,,,, +H,,,,,,,,,,,, +,,,,,,,,,,,, +,1,2,3,4,5,6,7,8,9,10,11,12 +A,1,1,1,,,,,,,,, +B,1,1,1,,,,,,,,, +C,1,1,1,,,,,,,,, +D,1,1,1,,,,,,,,, +E,1,1,1,,,,,,,,, +F,1,1,1,,,,,,,,, +G,1,1,1,,,,,,,,, +H,,,,,,,,,,,, diff --git a/CO2xN/Porewater/Sulfide/2026/Raw Data/20260601_LTREB_H2S_Rerun_Plate1.csv b/CO2xN/Porewater/Sulfide/2026/Raw Data/20260601_LTREB_H2S_Rerun_Plate1.csv new file mode 100644 index 0000000..f45e334 --- /dev/null +++ b/CO2xN/Porewater/Sulfide/2026/Raw Data/20260601_LTREB_H2S_Rerun_Plate1.csv @@ -0,0 +1,29 @@ +,1,2,3,4,5,6,7,8,9,10,11,12 +A,0.065,0.065,0.065,2.093,1.895,1.898,0.951,0.861,0.858,1.112,1.131,1.071 +B,0.131,0.14,0.179,0.691,0.822,0.845,0.066,0.065,0.062,0.647,0.718,0.614 +C,0.283,0.25,0.279,0.516,0.528,0.539,0.884,1.008,0.964,0.471,0.464,0.488 +D,0.483,0.506,0.444,0.181,0.181,0.188,0.457,0.483,0.462,1.431,1.6,1.491 +E,0.808,0.833,0.819,0.178,0.193,0.192,1.36,1.432,1.228,1.257,1.549,1.603 +F,1.401,1.397,1.294,0.412,0.507,0.502,1.695,1.816,1.775,0.064,0.062,0.068 +G,1.352,1.275,1.408,0.636,0.661,0.755,2.503,2.576,2.93,2.175,1.988,2.104 +H,1.219,1.282,1.284,0.624,0.616,0.529,2.227,1.986,1.706,0.777,0.814,0.785 +,,,,,,,,,,,, +,1,2,3,4,5,6,7,8,9,10,11,12 +A,Std 0,Std 0,Std 0,,,,P3-40,P3-40,P3-40,,, +B,Std 1,Std 1,Std 1,Ch4-80,Ch4-80,Ch4-80,ChkStd 0,ChkStd 0,ChkStd 0,,, +C,Std 2,Std 2,Std 2,Ch4-40,Ch4-40,Ch4-40,P3-40 Dup,P3-40 Dup,P3-40 Dup,,, +D,Std 3,Std 3,Std 3,Ch8-5,Ch8-5,Ch8-5,ChkStd 3,ChkStd 3,ChkStd 3,,, +E,Std 4,Std 4,Std 4,L18-20,L18-20,L18-20,,,, P4-20 Spike, P4-20 Spike, P4-20 Spike +F,Std 5,Std 5,Std 5,L11-40,L11-40,L11-40,,,,ChkStd 0,ChkStd 0,ChkStd 0 +G,MC: 10ppt S5,MC: 10ppt S5,MC: 10ppt S5,L13-40,L13-40,L13-40,,,,,, +H,,,,L16-80,L16-80,L16-80,,,,ChkStd 4,ChkStd 4,ChkStd 4 +,,,,,,,,,,,, +,1,2,3,4,5,6,7,8,9,10,11,12 +A,1,1,1,1,1,1,1,1,1,1,1,1 +B,1,1,1,100,100,100,1,1,1,100,100,100 +C,1,1,1,100,100,100,1,1,1,100,100,100 +D,1,1,1,50,50,50,1,1,1,1,1,1 +E,1,1,1,1,1,1,1,1,1,1,1,1 +F,1,1,1,50,50,50,1,1,1,1,1,1 +G,1,1,1,50,50,50,1,1,1,100,100,100 +H,1,1,1,50,50,50,1,1,1,1,1,1 diff --git a/CO2xN/Porewater/Sulfide/2026/Raw Data/20260601_LTREB_H2S_Rerun_Plate2.csv b/CO2xN/Porewater/Sulfide/2026/Raw Data/20260601_LTREB_H2S_Rerun_Plate2.csv new file mode 100644 index 0000000..a66544a --- /dev/null +++ b/CO2xN/Porewater/Sulfide/2026/Raw Data/20260601_LTREB_H2S_Rerun_Plate2.csv @@ -0,0 +1,29 @@ +,1,2,3,4,5,6,7,8,9,10,11,12 +A,0.066,0.065,0.061,0.393,0.431,0.415,0.421,0.494,0.473,0.045,0.045,0.046 +B,0.143,0.14,0.148,0.43,0.554,0.509,0.067,0.067,0.069,0.044,0.044,0.044 +C,0.261,0.255,0.237,0.497,0.476,0.565,0.488,0.511,0.525,0.044,0.044,0.046 +D,0.377,0.446,0.478,0.225,0.237,0.234,0.452,0.449,0.408,0.441,0.487,0.476 +E,0.804,0.814,0.861,0.511,0.482,0.516,0.262,0.224,0.241,0.482,0.493,0.548 +F,1.264,1.222,1.207,0.223,0.242,0.225,0.044,0.044,0.044,0.064,0.062,0.064 +G,1.261,1.319,1.343,0.169,0.143,0.14,0.044,0.045,0.044,0.044,0.044,0.044 +H,0.171,0.179,0.192,0.247,0.209,0.201,0.045,0.045,0.046,0.764,0.812,0.784 +,,,,,,,,,,,, +,1,2,3,4,5,6,7,8,9,10,11,12 +A,Std 0,Std 0,Std 0,,,,,,,,, +B,Std 1,Std 1,Std 1,,,,ChkStd 0,ChkStd 0,ChkStd 0,,, +C,Std 2,Std 2,Std 2,,,,,,,,, +D,Std 3,Std 3,Std 3,,,,ChkStd 3,ChkStd 3,ChkStd 3,,, +E,Std 4,Std 4,Std 4,,,,,,,,, +F,Std 5,Std 5,Std 5,,,,,,,ChkStd 0,ChkStd 0,ChkStd 0 +G,MC: 10ppt S5,MC: 10ppt S5,MC: 10ppt S5,P4-20,P4-20,P4-20,,,,,, +H,,,,P8-20,P8-20,P8-20,,,,ChkStd 4,ChkStd 4,ChkStd 4 +,,,,,,,,,,,, +,1,2,3,4,5,6,7,8,9,10,11,12 +A,1,1,1,100,100,100,25,25,25,,, +B,1,1,1,100,100,100,1,1,1,,, +C,1,1,1,100,100,100,25,25,25,,, +D,1,1,1,100,100,100,1,1,1,100,100,100 +E,1,1,1,100,100,100,25,25,25,25,25,25 +F,1,1,1,25,25,25,,,,1,1,1 +G,1,1,1,25,25,25,,,,,, +H,100,100,100,25,25,25,,,,1,1,1 diff --git a/CO2xN/Porewater/Sulfide/2026/Raw Data/20260601_LTREB_H2S_STD.csv b/CO2xN/Porewater/Sulfide/2026/Raw Data/20260601_LTREB_H2S_STD.csv new file mode 100644 index 0000000..8c5969f --- /dev/null +++ b/CO2xN/Porewater/Sulfide/2026/Raw Data/20260601_LTREB_H2S_STD.csv @@ -0,0 +1,29 @@ +,1,2,3,4,5,6,7,8,9,10,11,12 +A,0.063,0.063,0.072,0.047,0.046,0.047,0.045,0.046,0.046,0.045,0.044,0.045 +B,0.154,0.13,0.124,0.044,0.044,0.045,0.049,0.044,0.045,0.044,0.044,0.044 +C,0.261,0.251,0.228,0.044,0.045,0.045,0.044,0.044,0.044,0.045,0.045,0.046 +D,0.422,0.52,0.469,0.044,0.045,0.045,0.045,0.044,0.044,0.044,0.044,0.045 +E,0.671,0.631,0.672,0.044,0.044,0.045,0.045,0.044,0.044,0.047,0.045,0.045 +F,1.152,1.331,1.309,0.044,0.044,0.044,0.044,0.044,0.044,0.044,0.045,0.044 +G,1.283,1.178,1.293,0.044,0.045,0.045,0.045,0.045,0.044,0.044,0.044,0.044 +H,0.046,0.046,0.045,0.045,0.048,0.044,0.044,0.046,0.047,0.044,0.045,0.045 +,,,,,,,,,,,, +,1,2,3,4,5,6,7,8,9,10,11,12 +A,Std 0,Std 0,Std 0,,,,,,,,, +B,Std 1,Std 1,Std 1,,,,,,,,, +C,Std 2,Std 2,Std 2,,,,,,,,, +D,Std 3,Std 3,Std 3,,,,,,,,, +E,Std 4,Std 4,Std 4,,,,,,,,, +F,Std 5,Std 5,Std 5,,,,,,,,, +G,MC: 10ppt S5,MC: 10ppt S5,MC: 10ppt S5,,,,,,,,, +H,,,,,,,,,,,, +,,,,,,,,,,,, +,1,2,3,4,5,6,7,8,9,10,11,12 +A,1,1,1,,,,,,,,, +B,1,1,1,,,,,,,,, +C,1,1,1,,,,,,,,, +D,1,1,1,,,,,,,,, +E,1,1,1,,,,,,,,, +F,1,1,1,,,,,,,,, +G,1,1,1,,,,,,,,, +H,,,,,,,,,,,, diff --git a/CO2xN/Porewater/Sulfide/2026/Ready for Review/GCReW_CO2xN_Porewater_H2S_202605.pdf b/CO2xN/Porewater/Sulfide/2026/Ready for Review/GCReW_CO2xN_Porewater_H2S_202605.pdf new file mode 100644 index 0000000..50be7f8 Binary files /dev/null and b/CO2xN/Porewater/Sulfide/2026/Ready for Review/GCReW_CO2xN_Porewater_H2S_202605.pdf differ diff --git a/CO2xNxPhrag/Porewater/Sulfide/2026/Datasheets/2026May_LTREB_H2S_Datasheets.pdf b/CO2xNxPhrag/Porewater/Sulfide/2026/Datasheets/2026May_LTREB_H2S_Datasheets.pdf new file mode 100644 index 0000000..ab81103 Binary files /dev/null and b/CO2xNxPhrag/Porewater/Sulfide/2026/Datasheets/2026May_LTREB_H2S_Datasheets.pdf differ diff --git a/CO2xNxPhrag/Porewater/Sulfide/2026/Datasheets/2026May_LTREB_H2S_Datasheets.xlsx b/CO2xNxPhrag/Porewater/Sulfide/2026/Datasheets/2026May_LTREB_H2S_Datasheets.xlsx new file mode 100644 index 0000000..ae0f9aa Binary files /dev/null and b/CO2xNxPhrag/Porewater/Sulfide/2026/Datasheets/2026May_LTREB_H2S_Datasheets.xlsx differ diff --git a/CO2xNxPhrag/Porewater/Sulfide/2026/GCReW_CO2xNxPhrag_Porewater_H2S_202605.Rmd b/CO2xNxPhrag/Porewater/Sulfide/2026/GCReW_CO2xNxPhrag_Porewater_H2S_202605.Rmd new file mode 100644 index 0000000..fdb2dfc --- /dev/null +++ b/CO2xNxPhrag/Porewater/Sulfide/2026/GCReW_CO2xNxPhrag_Porewater_H2S_202605.Rmd @@ -0,0 +1,1452 @@ +--- +title: "CO2xNxPhrag: Porewater Sulfide" +author: "Month Year Samples" +date: "`r Sys.Date()`" +output: + pdf_document: + toc: false + number_sections: false +geometry: left=2cm,right=2cm,top=1cm,bottom=2cm +--- +## Code Set up +```{r setup, include=FALSE} + +library(dplyr) +library(broom) +library(ggplot2) +library(ggpubr) +library(stringr) +library(purrr) +library(tidyverse) +library(here) +library(data.table) +library(matrixStats) +library(gridExtra) +library(grid) +library(plater) +library(raster) +library(knitr) +library(readxl) +library(ggrepel) +library(ggpattern) + +``` + +## run information +```{r Information to be changed} + +##Before or After Reruns (YES or NO) +After_Reruns = "YES" +#If NO will not write final data file + #And Will Write a Rerun File + +###things that need to be changed + +sample_month = "May" +sample_year = "2026" +Run_Date = as.Date("05/19/2026", format = "%m/%d/%Y") +Run_by = "Melanie Giessner"#Instrument user +Script_run_by ="Melanie"#Code user + +Run_notes=""#any notes from run + +#Import Plate Data + +plates<- c("Plate1","Plate2","Plate3","Plate4","Plate5","rrPlate1","rrPlate2") + +folder_path_rawdata <- paste0("Raw Data") +Raw_plates <- list.files(path = folder_path_rawdata, full.names = TRUE,pattern = "Plate") +head(Raw_plates) + + +#Import Run Date for Each Plate for Std curve qaqc +Run_dates <- tibble( + Plate = plates, + Run_Date = c("05/18/2026","05/18/2026","05/18/2026","05/18/2026","05/19/2026","06/01/2026","06/01/2026") + ) + + Run_dates <- Run_dates %>% mutate(Run_Date = as.Date(Run_Date, tryFormats = c("%Y-%m-%d", "%m/%d/%Y", "%m/%d/%y"))) + +# Define the file path for QAQC log file - NO Need to change just check year +log_path <- "Processed Data/LTREB_2M_H2S_QAQC_2026.csv" + +# Define final path for data be sure to change year and month and run number +final_path <- "Processed Data/GCReW_CO2xNxPhrag_Porewater_H2S_2026.csv" +rerun_path <- "Processed Data/GCReW_CO2xNxPhrag_Porewater_H2S_2026_reruns.csv" + + +``` + +```{r Set Up Code - constants and QAQC cutoffs, include=FALSE} + +#Flag cutoffs + r2_cutoff = 0.985 #this is the level below which we want to rerun or consider a curve + cv_flag_stds = 10 #this is the maximum cv allowed for standards + p_value_chkstds = 0.05 #the p-value for the t-test between check standards must be greater than this + p_value_MC = 0.05 #the p-value for the t-test between matrix checks and top std must be greater than this + cv_flag_sample = 10 #this is the maximum cv allowed for samples + dups_perc_diff = 15.5 #this is the maximum percent difference allowed between duplicates + high_recovery_cutoff = 120 #this is the maximum percent recovery of SO4 allowed in spiked samples + low_recovery_cutoff = 80 #this is the minimum percent recovery of SO4 allowed in spiked samples + +#Standard concentrations - Update if running different standard curve: +# standard units are in uM + standards <- tibble( + IDs = c("Std 0", "Std 1", "Std 2", "Std 3", "Std 4", "Std 5"), + Conc = c(0, 5.0, 12.5, 25.0, 50.0, 100.0) + ) #uM + + chk_standards <- tibble( + IDs = c("ChkStd 0", "ChkStd 3", "ChkStd 4"), + Conc = c(0, 25.0, 50.0) + ) #uM + + mtx_standards <- tibble( + IDs = c("MC: 10ppt S5"), + Conc = c(100) + ) #uM + +#Spike concentration calc + #spike for these samples was 50 uL of the 100uM standard + Con1 <- 1000000 #conversion factor value for spike volumes (uL -> L) + spk_std <- 100 # uM S2- standard used + spkvol <- 50 # uL volume of spike added + spk_Conc <- spk_std*(spkvol/Con1) # umoles of S2- added to each spiked sample + sample_vol <- 250 # the sample volume without the spike is 250 uL + samp_vol_a <- 300 # the sample volume + +#Top standard Concentration- Update if running different standard curve: + Top_STD = 100 + + sigdigs = 3 + + +#Metadata file path +Raw_Metadata = here(".." , "GCReW", "GCReW_Project_Treatment_Metadata.csv") + +``` + + +##Read in metadata and create similar sample IDs for matching to samples +```{r pull in metadata for later, include=FALSE} + +#read in metadata + +raw_metadata <- read.csv(Raw_Metadata) +#clean up columns in metadata file: +#Pull out only SMARTX Rows +#Create a Sample_Name column to match the SEAL +metadata <- raw_metadata %>% + filter(grepl("Phrag", Nickname, ignore.case = TRUE)) %>% + mutate(Sample_Name = paste0(Sample.ID)) %>% + mutate(Month = sample_month) %>% + mutate(Year = sample_year) %>% + rename( + Sample_ID = Sample.ID, + Plot_Name = Plot, + ) %>% + dplyr::select(-Temp_Treatment) %>% + mutate(Treatment = ifelse( + CO2_Treatment == "Elevated" & + N_Treatment == "Amended", + "eCO2_N", + ifelse( + CO2_Treatment == "Elevated" & + N_Treatment == "Ambient", + "eCO2", + ifelse(CO2_Treatment == "Ambient" & + N_Treatment == "Amended" , "N" , "Ambient") + ) + )) %>% filter(SubPlot %like% "A") %>% mutate(Sample_ID=gsub("A","",Sample_ID)) + +#Bring in the collection date and any field notes if relevant +#collection_metadata <- read.csv(Collection_Dates) +#then we will merge the collection date for SMARTX based on the project and the chambers + +``` + + + +##Read in data +```{r read in plates,echo=FALSE,include=FALSE} + +#read in the csv files +dat<-read_plates( + files = Raw_plates,#list of all file paths + plate_names = plates , #list of plate names + well_ids_column = "Wells", # name to give column of well IDs (optional) + sep = "," # separator used in the csv file (optional) +) %>% + rename("Abs"=values, + "IDs"=values.2, + "Dilution"=values.3) +head(dat) + +``` + +##Remove High CV Stds +```{r, echo=FALSE} + +#filter for STDs +H2S_stds_raw <- dat %>% subset(IDs %like% "Std" | IDs %like% "Chk" | IDs %like% "MC") + +#Add in STD values +H2S_stds <- left_join(H2S_stds_raw, standards, by = "IDs") + +#Calculate CVs and add flags +H2S_STD_cv <- H2S_stds %>% group_by(Plate, IDs) %>% mutate(CV = cv(Abs)) %>% mutate(CV_Flag = ifelse(CV >= cv_flag_stds, "CV_High", "CV_Good")) %>% ungroup() + +#calculate new cv getting best cv from points if cv was high +H2S_STD_cv_new <- H2S_STD_cv %>% group_by(Plate, IDs) %>% + mutate(CV_New = map_dbl(row_number(), ~cv(Abs[-.x]))) %>% #Calculate CVs without 1 point + mutate(Removed = ifelse( #Choose Lowest CV if CV is high + CV_Flag == "CV_High", + ifelse( + CV_New == min(CV_New), + "RMVD", + "KEPT"), "CV_Good"), +CV2 = ifelse(CV_Flag == "CV_High", min(CV_New), CV), +Abs_rm = ifelse(Removed == "RMVD", NA, Abs)) %>% + mutate(Mean_Abs2 = mean(Abs_rm, na.rm = TRUE)) %>% + mutate(CV_Flag2 = ifelse(CV2 >= cv_flag_stds, "CV_High", "CV_Good")) %>% ungroup() + +#organize data +H2S_STD_CV_fin <- H2S_STD_cv_new %>% dplyr::select(Plate, + Wells, + Abs, + Removed, + IDs, + Dilution, + Conc, + Mean_Abs2, + CV2, + CV_Flag2) %>% + mutate(Mean_Abs = Mean_Abs2, CV_Flag = CV_Flag2, CV = CV2) %>% + dplyr::select(Plate, + Wells, Abs, + Removed, + IDs, + Dilution, + Conc, + Mean_Abs, + CV, + CV_Flag) + + +``` + + +##Check R2 & Remove Standards if Necessary +```{r, echo=FALSE} +split_data <- H2S_STD_CV_fin %>% filter(IDs %like% "Std") %>% filter(!IDs %like% "Chk") %>% dplyr::select(Plate, IDs, Conc, Mean_Abs, Abs, Removed, CV_Flag) %>% filter(!Removed == "RMVD") %>% #Split Data by Plate + distinct() %>% + group_by(Plate) %>% + group_split() + +#run regression and get coefficients by Run +Slope_H2S_raw_list <- map(split_data, ~ .x %>% mutate(Curve = "H2S", + R2 = summary(lm(Abs ~ Conc, data = .))$adj.r.squared , + Slope = coef(lm(Abs ~ Conc, data = .))[2], + Intercept = coef(lm(Abs ~ Conc, data = .))[1])) + + + Slope_H2S_raw <- bind_rows(Slope_H2S_raw_list) + + #check R2 and flag + Slope_H2S_Std_Crvs <- Slope_H2S_raw %>% dplyr::select(Plate, Curve, R2, Slope, Intercept) %>% distinct() %>% mutate(R2_Flag = ifelse(R2 >= r2_cutoff, "R2_Good", "R2_Bad")) + + #join standard curve CVs and regression values + R2_Check_Raw <- left_join(Slope_H2S_Std_Crvs, H2S_STD_CV_fin, by = "Plate") + + R2_Check <- R2_Check_Raw %>% + dplyr::select(Plate, + IDs, + Abs, + Removed, + Mean_Abs, + Conc, + R2, + Slope, + Intercept, + CV_Flag, + CV, + R2_Flag) %>% filter(IDs %like% "Std") %>% filter(!IDs %like% "Chk") %>% + distinct() + + #calculate concentrations from standard curve and separate removable points + + R2_Split <- R2_Check %>% mutate(RMVBL = ifelse(IDs %in% c("Std 0", "Std 1", "Std 5"), "No", "Yes")) %>% group_by(Plate) %>% dplyr::select(-Abs, -Removed) %>% distinct() %>% group_split() + + R2_New <- map( + R2_Split, + ~ .x %>% mutate( + Curve = "H2S", + R2_New = map_dbl(row_number(), ~ + summary(lm( + Mean_Abs[-.x] ~ Conc[-.x], data = pick(Mean_Abs, Conc) + ))$adj.r.squared) , + Slope_New = map_dbl(row_number(), ~ + coef(lm( + Mean_Abs[-.x] ~ Conc[-.x], data = pick(Mean_Abs, Conc) + ))[2]) , + Intercept_New = map_dbl(row_number(), ~ + coef(lm( + Mean_Abs[-.x] ~ Conc[-.x], data = pick(Mean_Abs, Conc) + ))[1]) + ) + ) %>% bind_rows() + + R2_Check_RMVBL <- R2_New %>% mutate(R2_New = round(R2_New, digits = 8), + CV = round(CV, digits = 8)) %>% group_by(Plate) %>% mutate(R2_New = ifelse(IDs %in% c("Std 0", "Std 1", "Std 5"), NA, R2_New)) %>% mutate(R2_RMV = ifelse( + R2_Flag == "R2_Bad", + ifelse(R2_New == max(R2_New, na.rm = TRUE), "RMVD", "KEPT"), + "R2_Good" + )) %>% mutate(R2_RMV_CV = ifelse( + R2_RMV == "R2_Good", + ifelse(CV_Flag == "CV_High", ifelse(CV == max(CV), "RMVD", "KEPT"), "KEPT"), + R2_RMV + )) %>% mutate(R2_RMVD = ifelse(is.na(R2_RMV_CV), "KEPT", R2_RMV_CV)) %>% dplyr::select(-R2_RMV, -R2_RMV_CV) + +R2_Removed_forPair <- R2_Check_RMVBL %>% dplyr::select(Plate, IDs, R2_RMVD) %>% distinct() + +H2S_STDs_Pair <- H2S_STD_CV_fin %>% filter(IDs %like% "Std") %>% filter(!IDs %like% "Chk") %>% dplyr::select(Plate, IDs, Conc, Mean_Abs, Abs, Removed, CV_Flag) %>% filter(!Removed == "RMVD") %>% distinct() %>% left_join(R2_Removed_forPair) + + + R2_Check_fin <- H2S_STDs_Pair %>% mutate(STD_ABS_rmv = ifelse(R2_RMVD == "RMVD", NA, Abs)) %>% group_by(Plate) %>% mutate(Points = ifelse("RMVD" %in% R2_RMVD, "Point_Removed", "ALL_KEPT")) %>% dplyr::select(Plate, IDs, Conc, STD_ABS_rmv, CV_Flag, Points) %>% ungroup() %>% na.omit() + + #separate plates for new regression + split_data_rmv <- R2_Check_fin %>% + distinct() %>% + group_by(Plate) %>% + group_split() + + #get new standard curve values + Slope_H2S_raw_list_rm <- map(split_data_rmv, ~ .x %>% mutate(Curve = "H2S", + R2 = summary(lm(STD_ABS_rmv ~ Conc, data = .))$adj.r.squared , + Slope = coef(lm(STD_ABS_rmv ~ Conc, data = .))[2], + Intercept = coef(lm(STD_ABS_rmv ~ Conc, data = .))[1])) + + Slope_H2S_raw_rm <- bind_rows(Slope_H2S_raw_list_rm) + + Slope_H2S_Std_Crvs_rm <- Slope_H2S_raw_rm %>% dplyr::select(Plate, Curve, R2, Slope, Intercept, CV_Flag, Points) %>% distinct() %>% mutate(R2_Flag = ifelse(R2 >= r2_cutoff, "R2_Good", "R2_Bad")) + + +``` + + +## Plot Standard Curves +```{r Plot all Standard Curves together, echo=FALSE} +##this is to see if there are any stds or plates that look off + +#Plot Std Crvs by plate +H2S_Curve <- ggplot(Slope_H2S_raw_rm, aes(STD_ABS_rmv, Conc, color = Plate, linetype = Points)) + geom_point(size = 3) + + geom_smooth(method = "lm", formula = "y ~ x", se = FALSE) + labs(title = "H2S Standard Curves", x = "Absorbance", y = "Concentration (uM)") + + theme_classic() +H2S_Curve + +#Add dates to plate and format data +STD_run_date <- left_join(Run_dates, Slope_H2S_Std_Crvs_rm, by = join_by(Plate)) +new_log_stds <- STD_run_date %>% dplyr::select(Plate, + Curve, + R2, + Slope, + Intercept, + Run_Date) %>% mutate(R2 = round(R2, digits = 4), Slope = round(Slope, digits = 4), Intercept = round(Intercept, digits = 4), ) %>% mutate(Run = "Current Runs") + + +#read in log file and format +log <- read.csv(log_path) +log_2 <- log %>% mutate(Run_Date = as.Date(as.character(Run_Date), tryFormats = c("%Y-%m-%d", "%m/%d/%Y")), Run = "Past Runs") +log_3 <- log_2[, -c(1)] +log_4 <- rbind(log_3, new_log_stds) + +unique_log <- log_4 %>% distinct(Plate,Curve,R2,Slope,Intercept,.keep_all = TRUE) + +#Calculate Mean and SD and calculate 2SD range for slope and intercept +mean_slope <- mean(unique_log$Slope, na.rm = TRUE) +sd_slope <- sd(unique_log$Slope, na.rm = TRUE) + +hi_2sd_slope <- mean_slope + 2*sd_slope + +lo_2sd_slope <- mean_slope - 2*sd_slope + +mean_int <- mean(unique_log$Intercept, na.rm = TRUE) +sd_int <- sd(unique_log$Intercept, na.rm = TRUE) + +hi_2sd_int <- mean_int + 2*sd_int + +lo_2sd_int <- mean_int - 2*sd_int + +#Plot Slope log +Slopes_chk <- ggplot(unique_log, aes(x = Run_Date, y = Slope, col = Run)) + + ylim(0.0045,0.018) + + scale_color_manual(values = c("Past Runs" = "grey27", "Current Runs" = "cyan3")) + + geom_abline(intercept = mean_slope - 2*sd_slope, slope = 0, linetype = "dashed", linewidth = 1.5, col = "red" )+ + geom_abline(intercept = mean_slope + 2*sd_slope, slope = 0, linetype = "dashed", linewidth = 1.5, col = "red" )+ + geom_point(size = 2) + + theme_classic()+ + ggtitle("Slope Log") + +#Plot Intercept log +ints_chk <- ggplot(unique_log, aes(x = Run_Date, y = Intercept, col = Run)) + + ylim(0.03, 0.15) + + scale_color_manual(values = c("Past Runs" = "grey27", "Current Runs" = "cyan3")) + + geom_abline(intercept = mean_int - 2*sd_int, slope = 0, linetype = "dashed", linewidth = 1.5, col = "red" )+ + geom_abline(intercept = mean_int + 2*sd_int, slope = 0, linetype = "dashed", linewidth = 1.5, col = "red" )+ + geom_point(size = 2) + + theme_classic()+ + ggtitle("Intercept Log") + +ints_chk + +Slopes_chk + + + +#Get done of original runs +Date_1 <-as.Date(new_log_stds$Run_Date[which(new_log_stds$Plate == "Plate1")]) + +#Check if Std Crvs are Within range and see if dates are close enough for combination +stdcrv_tagged <- new_log_stds %>% mutate( + In_Range_Slope = ifelse( + Slope >= hi_2sd_slope | + Slope <= lo_2sd_slope, + "Out of Range", + "In Range" + ), + In_Range_Int = ifelse( + Intercept >= hi_2sd_int | + Intercept <= lo_2sd_int, + "Out of Range", + "In Range" + ) +) %>% mutate( + Slope = ifelse(In_Range_Slope == "Out of Range", NA, Slope), + Intercept = ifelse(In_Range_Int == "Out of Range", NA, Intercept) +) %>% mutate(Date_Diff = abs(difftime(Date_1, Run_Date, units = "days"))) %>% mutate(Date_Close = ifelse(Date_Diff <= 2, "Yes", "No")) %>% mutate(Slope_Flag = ifelse(is.na(Slope), "Slope_Bad" , "Slope_Good"), Int_Flag = ifelse(is.na(Intercept), "Intercept_Bad" , "Intercept_Good")) %>% mutate( + Slope = ifelse(is.na(Intercept) | R2 <= r2_cutoff, NA, Slope), + Intercept = ifelse(is.na(Slope)| R2 <= r2_cutoff, NA, Intercept), + Curve_RMVD = ifelse(is.na(Slope) | + is.na(Intercept) | R2 <= r2_cutoff , "RMVD", "KEPT") +) + +#Calculate Combo Std Crv +stdcrv_filtered <- stdcrv_tagged %>% filter(Date_Close == "Yes") +stdcrv_filtered_no <- stdcrv_tagged %>% filter(Date_Close == "No") +mean_slope_fin <- mean(stdcrv_filtered$Slope, na.rm = TRUE) +mean_slope_no <- mean(stdcrv_filtered_no$Slope, na.rm = TRUE) +mean_int_fin <- mean(stdcrv_filtered$Intercept, na.rm = TRUE) +mean_int_no <- mean(stdcrv_filtered_no$Intercept, na.rm = TRUE) + +#Attach Slope and Intercept to Plates +Std_crv_calc <- stdcrv_tagged %>% mutate(Slope_Calc = ifelse(Date_Close == "Yes", mean_slope_fin, mean_slope_no), Int_Calc = ifelse(Date_Close == "Yes", mean_int_fin, mean_int_no)) %>% dplyr::select(Plate, Slope_Calc, Int_Calc, Curve_RMVD, Slope_Flag, Int_Flag) %>% as.data.frame() + +std_curves <- Std_crv_calc %>% dplyr::select(Plate, Curve_RMVD) %>% filter(Curve_RMVD != "RMVD") %>% distinct() + +Curve_Flags <- Std_crv_calc %>% dplyr::select(Plate, Slope_Flag, Int_Flag) %>% distinct() + +Curve_Flags_forJoin <- Curve_Flags %>% mutate(Slope_Flag = ifelse(Slope_Flag %like% "Good", "", Slope_Flag), Int_Flag = ifelse(Int_Flag %like% "Good", "", Int_Flag)) + + +Std_crv_calc <-Std_crv_calc %>% distinct() +``` + +## Return Flags For Standard Curve +```{r, echo=FALSE} + +STD_CRV_flags <- full_join(Slope_H2S_Std_Crvs_rm, Run_dates, by = join_by(Plate)) + +STD_CRV_flags_table1 <- STD_CRV_flags %>% dplyr::select(Plate, R2_Flag, CV_Flag) + +STD_CRV_flags_table2 <- Std_crv_calc %>% dplyr::select(Plate, Curve_RMVD) %>% mutate(Curve_RMVD = ifelse(Curve_RMVD == "RMVD", "REMOVED", Curve_RMVD)) + +knitr::kable(STD_CRV_flags_table1, format="markdown") + +knitr::kable(STD_CRV_flags_table2, format="markdown") + + +``` + +## Method Detection Limit +```{r, echo=FALSE} + +#get only lowest standard + STD_MDL_df <- H2S_STD_CV_fin %>% filter(IDs == "Std 1" + #, Removed != "RMVD" + ) %>% dplyr::select(Plate, Mean_Abs, IDs) %>% distinct() + + STD0_df <- H2S_STD_CV_fin %>% filter(IDs == "Std 0" + #, Removed != "RMVD" + ) %>% dplyr::select(Plate, Mean_Abs, IDs) %>% distinct() +#calculate the standard deviation of abs +stddev_mdl <- sd(STD_MDL_df$Mean_Abs) + +#Calculate Mean Std 0 +std0_mean <- mean(STD0_df$Mean_Abs) + +#calculate n +n <- length(STD_MDL_df$Mean_Abs) + +#Identify the proper Student's T for n-1 +StudentsT <-qt(.99,(n-1)) + +#Multiply Standard deviation by Student's T +STD_var <- (stddev_mdl*StudentsT) +MDL <- STD_var + std0_mean + +MDL_df <- as.data.frame(MDL) + +MDL_Plot <- ggplot() + + geom_bar(stat = 'identity', data = STD_MDL_df, aes(x = Plate, y = Mean_Abs, fill = IDs)) + + geom_bar(data = STD0_df, aes(x = Plate, y = Mean_Abs, fill = IDs), stat = 'identity') + + scale_fill_manual(name = "Standard:", values = c("Std 0" = "lightgreen", "Std 1" = "cornflowerblue")) + + geom_hline(yintercept = MDL, linetype = "dashed", linewidth = 1.5, color = "blue3") + + geom_label_repel(data = MDL_df, aes(x = 1.25, y = MDL + 0.015), label = paste0("MDL: ", signif(MDL, digits = sigdigs)), alpha = 0.7, color = "blue3") + + ggtitle(label = "H2S Minimum Detection Limit") + + labs(y = "Mean Absorbance") + + theme_classic() + +MDL_Plot +``` + +## Compare Check Standards to Standards +```{r, echo = FALSE} + +#subset datasets for comparison + +std0 <- subset(H2S_STD_CV_fin, IDs == "Std 0"& Plate %in% std_curves$Plate & !Removed == "RMVD") +std3 <- subset(H2S_STD_CV_fin, IDs == "Std 3"& Plate %in% std_curves$Plate & !Removed == "RMVD") +std4 <- subset(H2S_STD_CV_fin, IDs == "Std 4" & Plate %in% std_curves$Plate & !Removed == "RMVD") +std5 <- subset(H2S_STD_CV_fin, IDs == "Std 5" & Plate %in% std_curves$Plate & !Removed == "RMVD") + + +H2S_CHK_STD_CV_fin <- H2S_STD_CV_fin %>% filter(IDs %like% "ChkStd" | IDs %like% "ppt") +#Tag Check Standards and perform T Test +H2S_CHKs_a <- H2S_CHK_STD_CV_fin %>% + mutate(Std_ID = case_when( + IDs == "ChkStd 0" ~ paste0("Std 0"), + IDs == "ChkStd 3" ~ paste0("Std 3"), + IDs == "ChkStd 4" ~ paste0("Std 4"), + IDs %like% "S5" ~ paste0("Std 5") + ), + Chk_Abs = Abs, + Chk_Removed = Removed, + Chk_IDs = IDs, + Chk_Mean_Abs = Mean_Abs, + Chk_cv_flag = CV_Flag + ) %>% filter(!Chk_Removed == "RMVD") %>% + group_by(Std_ID,Plate) %>% + mutate( + Chk_pvalue = case_when( + Chk_IDs == "ChkStd 0" ~ t.test(std0$Abs, Chk_Abs,var.equal = T)$p.value[1], + Chk_IDs == "ChkStd 3" ~ t.test(std3$Abs, Chk_Abs,var.equal = T)$p.value[1], + Chk_IDs == "ChkStd 4" ~ t.test(std4$Abs, Chk_Abs,var.equal = T)$p.value[1], + Chk_IDs == "MC: 10ppt S5" ~ t.test(std5$Abs, Chk_Abs,var.equal = T)$p.value[1], + Chk_IDs == "MC: 20ppt S5" ~ t.test(std5$Abs, Chk_Abs,var.equal = T)$p.value[1] + ))%>% + ungroup() %>% + dplyr::select(Std_ID, Chk_IDs, Chk_pvalue, Chk_cv_flag, Chk_Mean_Abs, Plate) %>% distinct(.keep_all = TRUE) + +H2S_CHKs_1 <- H2S_CHKs_a %>% dplyr::select(-Chk_Mean_Abs) + +#Get Standard Values and set values for standards with no variance +H2S_STD_forCHK_a <- H2S_STD_CV_fin %>% filter(IDs %in% c("Std 0", "Std 3", "Std 4", "Std 5") ) %>% + mutate(Std_ID = IDs +) %>% filter(!Removed == "RMVD") %>% + dplyr::select(Plate, Std_ID, IDs, CV_Flag, Mean_Abs) %>% distinct(.keep_all = TRUE) + +H2S_STD_forCHK <- H2S_STD_forCHK_a %>% dplyr::select( -Mean_Abs) + +#join check standards with standards +Chk_Std_join <- full_join(H2S_CHKs_1, H2S_STD_forCHK, by = join_by(Std_ID, Plate)) + + +#flag data +Chk_Std_flags <- Chk_Std_join %>% mutate( + Chk_Flag_pv= ifelse( + Chk_pvalue > p_value_chkstds , + "Chk_Good", + "Chk_Bad" + ) + +) %>% mutate(CHK_Flag = paste0(gsub(" ", "", IDs), Chk_Flag_pv)) %>% + mutate(CHK_CV_Flag = paste0("Chk",gsub(" ", "", IDs), Chk_cv_flag)) + + #Organize Data for Plotting and Flagging +Chk_Flags <- Chk_Std_flags %>% group_by(Plate) %>% + mutate(Chk_Flag = ifelse(any(CHK_Flag %like% "Bad"), "Chk_Bad", "Chk_Good"), Chk_cv_flag = ifelse(any(CHK_CV_Flag %like% "High"), "Chk_CV_High", "Chk_CV_Good")) %>% + ungroup() %>% + mutate(CHK_CV_Flags = ifelse(CHK_CV_Flag %like% "High", paste0(gsub(" ", "", IDs), Chk_cv_flag), "Good")) %>% mutate(CHKs_Flag = ifelse(CHK_Flag %like% "Bad", CHK_Flag, "Good")) + +H2S_CHKs_plot <- H2S_CHKs_a %>% rename(IDs = Chk_IDs, Mean_Abs = Chk_Mean_Abs) %>% mutate(Type = "Check") %>% dplyr::select(-Chk_cv_flag,-Chk_pvalue) + +H2S_Std_chkplot <- H2S_STD_forCHK_a %>% dplyr::select(IDs, Mean_Abs, Std_ID, Plate) %>% mutate(Type = "Standard") + +Chk_flags_plot <- Chk_Flags %>% dplyr::select(Std_ID, Plate, CHKs_Flag, Chk_Flag_pv) %>% group_by(Std_ID,Plate) %>% distinct(.keep_all = TRUE) %>% mutate(Check_Flag = ifelse(Chk_Flag_pv %like% "Good", "Good", "Bad")) + +H2S_Chks_bind <- rbind(H2S_CHKs_plot, H2S_Std_chkplot) + +H2S_Chks_bind_1 <- left_join(H2S_Chks_bind, Chk_flags_plot, by = join_by(Std_ID,Plate)) + +H2S_Chks_plot_bind_a <- H2S_Chks_bind_1 %>% mutate(Plot_ID = ifelse(IDs %like% "Chk" | IDs %like% "MC", substr(IDs, 4, 8), IDs)) %>% mutate(Plot_ID = ifelse(Plot_ID %like% "10pp", "Matrix: 10ppt", Plot_ID )) +H2S_Chks_plot_bind <-H2S_Chks_plot_bind_a %>% filter(str_detect(Type, "Check")) %>% mutate(Plot_ID =as.factor(Plot_ID)) + +Check_Val <- H2S_Chks_plot_bind_a %>% filter(!str_detect(Type, "Check")) %>% group_by(Plot_ID) %>% mutate(Z = mean(Mean_Abs)) %>% dplyr::select(Plot_ID, Z) %>% distinct(.keep_all = TRUE) %>% filter(!Plot_ID %like% "10pp") %>% mutate(Plot_ID = ifelse(Plot_ID %like% "Std 5", "Matrix: 10ppt", Plot_ID )) %>% mutate(Plot_ID = as.factor(Plot_ID)) + +#Plot Check Standards +H2S_chk_plot <- ggplot(data = H2S_Chks_plot_bind, aes(x = Plate, y = Mean_Abs)) + + geom_bar(stat = 'identity', + position = position_dodge2(preserve = "single"), linewidth = 0.75, aes(fill = Check_Flag)) + + geom_hline(data = Check_Val, aes(yintercept = Z), linetype = "dashed", linewidth = 1, color = "darkblue") + + facet_wrap(.~Plot_ID) + + ylim(0, max(H2S_Chks_plot_bind$Mean_Abs) + 0.2) + + geom_label_repel(data = Check_Val, aes( x = "Plate1", y = Z + 0.25), label = "Mean Target Arbsorbance", alpha = 0.7, color = "darkblue") + + scale_fill_manual(values = c("Good" = "darkgreen", "Bad" = "darkred")) + + theme_classic() + labs(x = " ", y = "Absorbance", title = + "Check Stds: H2S with Confidence Interval") + + theme(legend.position = "bottom", axis.text.x = element_text( + angle = 90, + vjust = 0.5, + hjust = 1)) + + +H2S_chk_plot + +``` + +## Display Any Check Flags +```{r, echo=FALSE} +Chk_Flag_1 <- Chk_Flags %>% dplyr::select(Plate, CHKs_Flag) %>% filter(CHKs_Flag != "Good") + +CHK_CV_Flag_1 <- Chk_Flags %>% dplyr::select(Plate, CHK_CV_Flags) %>% filter(CHK_CV_Flags != "Good") + +knitr::kable(Chk_Flag_1, format="markdown") + +knitr::kable(CHK_CV_Flag_1, format="markdown") + +``` + + +##Calculate Sulfide Concentrations & Add Concentration Flags +```{r Calculate Sulfide Concentrations,echo=FALSE,include=FALSE} + +High_Std <- H2S_STD_CV_fin %>% filter(IDs == "Std 5") %>% mutate(Mean_Abs = round(Mean_Abs, digits = 4)) %>% ungroup() %>% dplyr::select(Plate, Mean_Abs) %>% distinct(.keep_all = TRUE) %>% rename(High_DL = Mean_Abs) + +#filter out stds and other experiments +raw_data <- dat %>% + filter(!str_detect(IDs, "Std")) %>% + filter(!str_detect(IDs, "MC")) + +#Calculate Concentrations and fix zeroes/negative values and flag conc + +joined_data <- right_join(Std_crv_calc, raw_data, by = join_by(Plate)) + +calc_data <- joined_data %>% mutate(Conc = ((Abs - Int_Calc) / Slope_Calc)*Dilution) %>% mutate(Conc = ifelse(Conc <= 0, 0, Conc)) + +dl_data <- right_join(High_Std, calc_data, by = join_by(Plate)) + +``` + +##Remove High CV Samples and Average +```{r, echo=FALSE} + +#Calculate CVs +H2S_SPL_cv <- dl_data %>% group_by(Plate, IDs) %>% mutate(Mean_Conc = mean(Conc)) %>% mutate(Conc_SD = sd(Conc)) %>% mutate(CV = cv(Conc)) %>% mutate(CV_Flag = ifelse(CV >= cv_flag_stds, "CV_High", "CV_Good")) %>% mutate(Mean_Abs = mean(Abs)) %>% mutate(Conc_Flag = ifelse(Mean_Abs < MDL, "bdl", ifelse(Mean_Abs > High_DL, "adl", "Within_Range"))) %>% ungroup() + +#calculate new cv getting best cv from points if cv was high +H2S_SPL_cv_new <- H2S_SPL_cv %>% group_by(Plate, IDs) %>% + mutate(CV_New = map_dbl(row_number(), ~cv(Conc[-.x]))) %>% #Calculate CVs without 1 point + mutate(Removed = ifelse( #Choose Lowest CV if CV is high + CV_Flag == "CV_High", + ifelse( + CV_New == min(CV_New), + "RMVD", + "KEPT"), "CV_Good"), +CV2 = ifelse(CV_Flag == "CV_High", min(CV_New), CV), +Conc_rm = ifelse(Removed == "RMVD", NA, Conc)) %>% + mutate(Mean_Conc2 = mean(Conc_rm, na.rm = TRUE)) %>% + mutate(CV_Flag2 = ifelse(CV2 >= cv_flag_sample, "CV_High", "CV_Good")) %>% + mutate(Conc_SD2 = sd(Conc_rm, na.rm = TRUE)) %>% ungroup() + +H2S_SPL_CV_fin <- H2S_SPL_cv_new %>% dplyr::select(Plate, + Wells, + Conc, + Removed, + IDs, + Dilution, + Conc, + Mean_Conc2, + Conc_SD2, + CV2, + CV_Flag2, + Conc_Flag) %>% + mutate(Mean_Conc = Mean_Conc2, CV_Flag = CV_Flag2, SD_Conc = Conc_SD2, CV = CV2) %>% + dplyr::select(Plate, Conc, + Removed, + IDs, + Dilution, + Mean_Conc, + SD_Conc, + CV, + CV_Flag, + Conc_Flag) + +``` + +## Plot Samples +```{r, echo=FALSE} + +#Filter samples and mark reruns +H2S_Spl_pre_viz <- H2S_SPL_cv_new %>% mutate(IDs = toupper(IDs)) %>% + filter(str_detect(IDs, "P")) %>% + filter(!str_detect(IDs, "DUP")) %>% + filter(!str_detect(IDs, "SPIKE")) %>% + dplyr::select(Plate, IDs, Mean_Conc, Conc_SD, CV_Flag) %>% distinct(.keep_all = TRUE) %>% mutate(IDs = ifelse(Plate %like% "rr", paste0(IDs, "_RR"), IDs)) + +#Plot Samples before corrections +H2S_Spl_Plot_Pre <- ggplot(H2S_Spl_pre_viz, aes(y = Mean_Conc, x = IDs, fill = CV_Flag)) + + geom_bar(stat = 'identity', + position = position_dodge2(), + linewidth = 0.75, + col = "white") + + scale_fill_manual(values = c( + "CV_Good" = "green2", + "CV_High" = "pink2" + )) + + labs(y = "Sulfide (uM)", x = "Sample ID") + + geom_errorbar( + aes(ymin = Mean_Conc - Conc_SD, ymax = Mean_Conc + Conc_SD), + width = 0.3, + position = position_dodge(.1) + ) + + theme_classic() + + theme(legend.position = "bottom", axis.text.x = element_text( + angle = 90, + vjust = 0.5, + hjust = 1) + ) + + ggtitle("Sample triplicate means and sd dev before bad reps removed") + + +H2S_Spl_Plot_Pre + +H2S_Spl_rmv_viz <- H2S_SPL_CV_fin %>% mutate(IDs = toupper(IDs)) %>% + filter(str_detect(IDs, "P")) %>% + filter(!str_detect(IDs, "DUP")) %>% + filter(!str_detect(IDs, "SPIKE")) %>% + dplyr::select(Plate, IDs, Mean_Conc, SD_Conc, CV_Flag, Conc_Flag) %>% distinct(.keep_all = TRUE) %>% mutate(IDs = ifelse(Plate %like% "rr", paste0(IDs, "_RR"), IDs)) + +#Plot samples after Corrections +H2S_Spl_Plot_CV <- ggplot(H2S_Spl_rmv_viz, aes(y = Mean_Conc, x = IDs, fill = CV_Flag)) + + geom_bar(aes(col = Conc_Flag), stat = 'identity', + position = position_dodge(), + linewidth = 0.75) + + scale_fill_manual(values = c( + "CV_Good" = "green2", + "CV_High" = "pink2" + )) + + scale_color_manual(values = c("Within_Range" = "darkgreen", "adl" = "red3", "bdl" = "blue3" )) + + labs(y = "Sulfide (uM)", x = "Sample ID") + + geom_errorbar( + aes(ymin = Mean_Conc - SD_Conc, ymax = Mean_Conc + SD_Conc), + width = 0.3, + position = position_dodge(.1) + ) + + theme_classic() + + theme(legend.position = "bottom", axis.text.x = element_text( + angle = 90, + vjust = 0.5, + hjust = 1), + strip.text = element_blank(), + strip.background = element_blank() + ) + + ggtitle("Sample triplicate means and sd dev after bad reps removed") + + +H2S_Spl_Plot_CV + + + +``` + + +## Duplicate QAQC + +```{r,echo=FALSE} + +#pull out any rows that have "Dup" in the ID column and tag reruns +DUP_start <- H2S_SPL_CV_fin %>% mutate(Dup_ID = gsub(" ", "", substr(IDs, 1, 6)), + Dup = ifelse(IDs %like% "Dup", "Dup", "Org")) %>% mutate(Dup_ID = ifelse(Plate %like% "rr", paste0(Dup_ID, "_RR"), Dup_ID)) + +#separate dups from originals and tag for pairing + +dups_only <- DUP_start %>% filter(Dup == "Dup") %>% dplyr::select(Dup_ID, Mean_Conc, SD_Conc, Plate) %>% rename(Dup_Conc = Mean_Conc, Dup_SD = SD_Conc) %>% distinct(.keep_all = TRUE) + +no_dups <- DUP_start %>% filter(!Dup == "Dup") + +dup_spls_l <- dups_only %>% dplyr::select(Dup_ID) %>% distinct(.keep_all = TRUE) + +dup_spls <- no_dups %>% filter(Dup_ID %in% as.vector(dup_spls_l$Dup_ID)) %>% dplyr::select(Dup_ID, Mean_Conc, SD_Conc, Plate, IDs) %>% distinct(.keep_all = TRUE) + +dup_join <- full_join(dups_only, dup_spls, by = join_by(Dup_ID, Plate)) %>% na.omit() + +#Calculate Percent difference and Flag +dup_flags <- dup_join %>% + mutate(Diff_P = (abs(100 * (Mean_Conc - Dup_Conc) / mean(c(Mean_Conc, Dup_Conc))))) %>% + mutate(Dup_Flag = ifelse(Diff_P >= dups_perc_diff, "Dup_Bad", "Dup_Good")) + +#oraganize data for flagging and plotting +dup_flags_1 <- dup_flags %>% dplyr::select(Dup_ID, Dup_Flag, Diff_P, Plate) + +Dup_for_plot_1 <- DUP_start %>% dplyr::select(Plate, Mean_Conc, Dup_ID, IDs) %>% distinct(.keep_all = TRUE) %>% filter(Dup_ID %in% as.vector(dup_spls_l$Dup_ID)) %>% + left_join(dup_flags_1, by = join_by(Dup_ID, Plate)) %>% + mutate(Dup = ifelse(IDs %like% "Dup", "Duplicate", "Original")) %>% + dplyr::select(-IDs, -Mean_Conc, -Dup) %>% distinct(.keep_all = TRUE) %>% na.omit + +#plot Data +Dup_Plot <- ggplot(Dup_for_plot_1, + aes( + x = Plate, + y = Diff_P + )) + + geom_bar( + aes(fill = Dup_Flag), + stat = 'identity', + position = position_dodge2(preserve = "single"), + linewidth = 0.9 + ) + + geom_label_repel(data = as.data.frame(1), aes(x = "Plate1", y=17.5), label= "Percent Difference Cutoff", color = "red3", alpha = 0.7) + + geom_hline(aes(yintercept = dups_perc_diff), linetype = "dashed", linewidth = 1.5, color = "red3") + + labs(y = "Percent Difference", x = "Sample ID") + + scale_fill_manual(values = c( + "Dup_Good" = "darkgreen", + "Dup_Bad" = "darkred" + )) + + theme_classic()+ + theme(legend.position = "bottom") + + ggtitle("H2S Duplicates") + +Dup_Plot + + +``` + +## Display Dup Flags + +```{r, echo=FALSE} +Dup_Flag_1 <- dup_flags %>% group_by(Plate) %>% mutate(Dup_Flags = ifelse("Dup_Bad" %in% Dup_Flag, "Dup_Bad", "Dup_Good")) %>% dplyr::select(Plate, Dup_Flags) %>% rename(Dup_Flag = Dup_Flags) %>% distinct(.keep_all = TRUE) + +Dup_Flags_1 <-Dup_Flag_1 %>% mutate(Dup_Flags = paste0(Dup_Flag, "-", Plate)) + +Dup_Flags_2 <- Dup_Flags_1 %>% dplyr::select(Plate, Dup_Flag) %>% group_by(Plate) %>% mutate(Duplicate_Flag = ifelse("Dup_Bad" %in% Dup_Flag, "Dup_Bad", "")) %>% dplyr::select(Plate, Duplicate_Flag) %>% rename(Dup_Flag = Duplicate_Flag) %>% distinct(.keep_all = TRUE) + +Bad_Dups <- dup_flags %>% filter(str_detect(Dup_Flag, "Dup_Bad")) + +Bad_D_N <- length(Bad_Dups$Dup_Flag) + +Total_D_N <- length(dup_flags$Dup_Flag) + +ifelse(Bad_D_N/Total_D_N > 0.4, paste0("<60% of Dups Pass, Rerun"), paste0(">60% Dups Pass") ) + +Duplicate_Flag <- ifelse(Bad_D_N/Total_D_N > 0.4, paste0(" >40% Dups Fail"), "" ) + +knitr::kable(Dup_Flag_1, format="markdown") + + +``` + +## Spike QAQC +```{r, echo=FALSE} +#pull out any rows that have "Spk" in the ID column +SPK_start <- H2S_SPL_CV_fin %>% mutate(Spk_ID = gsub(" ", "", substr(IDs, 1, 6)), + Spk = ifelse(IDs %like% "Spike", "Spk", "Org")) %>% mutate(Spk_ID = ifelse(Plate %like% "rr", paste0(Spk_ID, "_RR"), Spk_ID)) +#separate spikes from originals +spks_only <- SPK_start %>% filter(Spk == "Spk") %>% dplyr::select(Spk_ID, Mean_Conc, SD_Conc, Dilution, Plate) %>% rename(Spk_Conc = Mean_Conc, + Spk_SD = SD_Conc, + Spk_Dilution = Dilution) %>% distinct(.keep_all = TRUE) + +no_spks <- SPK_start %>% filter(!Spk == "Spk") + +spls_l <- no_spks %>% dplyr::select(Spk_ID) %>% distinct(.keep_all = TRUE) + +spk_spls_l <- spks_only %>% dplyr::select(Spk_ID) %>% distinct(.keep_all = TRUE) + +spk_spls <- no_spks %>% filter(Spk_ID %in% as.vector(spk_spls_l$Spk_ID)) %>% dplyr::select(Spk_ID, Mean_Conc, SD_Conc, Plate, IDs, Dilution) %>% distinct(.keep_all = TRUE) + +SPK_only <- spks_only %>% filter(Spk_ID %in% as.vector(spls_l$Spk_ID)) + +spk_join <- full_join(SPK_only, spk_spls, by = join_by(Spk_ID, Plate)) + +#Calculate recovery and flag data +spk_flags <- spk_join %>% mutate( + Spl_mol = (sample_vol / Con1) * (Mean_Conc / Dilution), + Spk_mol = ((sample_vol + spkvol) / Con1) * (Spk_Conc / Spk_Dilution), + Spk_exp = Spl_mol + spk_Conc, + Spk_recovery = (Spk_mol/Spk_exp) * 100) %>% + mutate( + Spk_Flag = ifelse( + Spk_recovery >= high_recovery_cutoff | + Spk_recovery <= low_recovery_cutoff, + "Spk_Bad", + "Spk_Good" + ) + ) + +#organize data for flagging and plotting +spk_flags_1 <- spk_flags %>% dplyr::select(Spk_ID, Spk_Flag, Spk_recovery, Plate) %>% na.omit() + +Spk_for_plot_a <- SPK_start %>% dplyr::select(Plate, Mean_Conc, Spk_ID, IDs) %>% + distinct(.keep_all = TRUE) %>% + filter(Spk_ID %in% as.vector(spk_spls_l$Spk_ID)) %>% + left_join(spk_flags_1, by = join_by(Spk_ID, Plate)) %>% + mutate(Spk = ifelse(IDs %like% "Spike", "Spike", "Original")) %>% + filter(Spk_ID %in% as.vector(spls_l$Spk_ID)) + +Spk_for_plot_1 <- Spk_for_plot_a %>% dplyr::select(Plate, Spk_ID, Spk_recovery, Spk_Flag) %>% na.omit() %>% distinct(.keep_all = TRUE) + +#plot data +Spk_Plot <- ggplot(Spk_for_plot_1, + aes( + x = Plate, + y = Spk_recovery + )) + + geom_rect(aes(xmin=0, xmax=Inf, ymin=low_recovery_cutoff, ymax=high_recovery_cutoff), alpha = 0.25, fill ="palegreen") + + geom_bar( aes(fill = Spk_Flag), + stat = 'identity', + position = position_dodge2(preserve = "single"), + linewidth = 0.9 + ) + + geom_hline(aes(yintercept = high_recovery_cutoff), linetype = "dashed", color = "green3", linewidth = 1.5) + + geom_hline(aes(yintercept = low_recovery_cutoff), linetype = "dashed", color = "green3", linewidth = 1.5) + + geom_label_repel(data = as.data.frame(1),aes(x = "Plate1", y=high_recovery_cutoff - 7.5), label= "Acceptable Recovery Range", color = "darkgreen", alpha = 0.7) + + labs(y = "Spike Recovery (%)", x = "Plate") + + scale_fill_manual(values = c( + "Spk_Good" = "darkgreen", + "Spk_Bad" = "darkred" + )) + + theme_classic() + + theme(legend.position = "bottom") + + ggtitle("H2S Spikes") + +Spk_Plot + + +``` + +## Display Spike Flags +```{r, echo=FALSE} + +#Check if all Spikes are paired +ifelse(all(as.vector(spk_spls_l$Spk_ID) %in% as.vector(spls_l$Spk_ID)), paste0("Spikes Paired"), paste0("Spike Missing Pair")) + +#Format Data frame +Spk_Flag_1 <- spk_flags %>% dplyr::select(Plate, IDs, Spk_Flag) %>% na.omit() + +#Attach Plate to Flag +Spk_Flags_1 <-Spk_Flag_1 %>% group_by(Plate) %>% mutate(Spk_Flags_T = ifelse( "Spk_Bad" %in% Spk_Flag, paste0("Spk_Bad"), paste0("Spk_Good"))) %>% mutate(Spk_Flags = paste0(Spk_Flags_T, "-", Plate))%>% ungroup() +#If any Spikes in Plate are bad, then flag plate +Spk_Flags_2 <- Spk_Flags_1 %>% dplyr::select(Plate, Spk_Flag) %>% group_by(Plate) %>% mutate(Spike_Flag = ifelse("Spk_Bad" %in% Spk_Flag, "Spk_Bad", "")) %>% dplyr::select(Plate, Spike_Flag) %>% rename(Spk_Flag = Spike_Flag) %>% distinct(.keep_all = TRUE) + +Spk_disp <- Spk_Flags_1 %>% dplyr::select(Plate, Spk_Flags_T) %>% rename(Spike_Flag = Spk_Flags_T) %>% distinct(.keep_all = TRUE) %>% na.omit() + +knitr::kable(Spk_disp, format="markdown") + +bad <- Spk_Flag_1 %>% filter(Spk_Flag %like% "Bad") + +length_bad <- length(as.vector(bad$Spk_Flag)) + +length_all <- length(as.vector(Spk_Flag_1$Spk_Flag)) + +ifelse(length_bad/length_all > 0.4, paste0("<60% of Spikes Pass, Rerun"), paste0("Spikes Pass") ) + +Spike_Flag <- ifelse(length_bad/length_all > 0.4, paste0(">40% Spikes Fail"), "" ) + +``` + + +## Merge samples with Metadata & check all samples are present +```{r check sample ids with metadata, echo=FALSE} +#Get Samples Only +H2S_spls_md <- H2S_SPL_CV_fin %>% mutate(IDs = toupper(IDs)) %>% + filter(str_detect(IDs, "P")) %>% + filter(!str_detect(IDs, "DUP")) %>% + filter(!str_detect(IDs, "SPIKE")) + +#Check for reruns and replace +H2S_spl_rrn <- H2S_spls_md %>%group_by(IDs,Plate) %>% + filter(Plate %like% "rr") %>% ungroup() %>% + dplyr::select(IDs, Mean_Conc, Conc_Flag, Dilution) %>% + rename(RRN_Conc = Mean_Conc, Conc_Flag_rr = Conc_Flag, Dilution_rr = Dilution) %>% + distinct(.keep_all = TRUE) + +RRN_IDs <- as.vector(H2S_spl_rrn$IDs) + +H2S_spl_og <- H2S_spls_md %>% + filter(!Plate %like% "rr") %>% + dplyr::select(IDs, Mean_Conc, Conc_Flag, Plate, CV_Flag, Dilution, CV) %>% + distinct(.keep_all = TRUE) %>% + mutate(Rerun = ifelse(IDs %in% RRN_IDs, "RRN", "Org")) + +H2S_spl_rr_join <- full_join(H2S_spl_rrn,H2S_spl_og, by = join_by(IDs) ) + +Samples_Tagged <- H2S_spl_rr_join %>% mutate( + Conc = ifelse(Rerun == "RRN", RRN_Conc, Mean_Conc), + Conc_Flag = ifelse(Rerun == "RRN", Conc_Flag_rr, Conc_Flag), + Dilution = ifelse(Rerun == "RRN", Dilution_rr, Dilution) +) %>% dplyr::select(IDs, Conc, Conc_Flag, CV_Flag, Plate, Dilution, CV) %>% rename(Sample_ID = IDs) %>% ungroup() %>% group_by(Sample_ID) %>% mutate( + Min_CV = ifelse(CV == min(CV), "KEEP", "RMV"), # get if CV is lowest of reruns + Within_Range = "Within_Range" %in% Conc_Flag, #Get if any are within range + BDL = "bdl" %in% Conc_Flag, #get if any are below detection limit + Max_Dil = max(Dilution), #get maximum dilution of reruns + Min_Dil = min(Dilution),#get minimum dilution of reruns + All_Good = all(Conc_Flag == "Within_Range") & all(CV_Flag == "CV_Good"), #get if all are within range and good cv + CV_Check = CV == min(CV[which(Dilution == Max_Dil)]), #Get if CV is lowest of highest dilution for reruns + Number = length(Conc) #get number of times ran +) %>% ungroup() %>% + mutate(Remove = ifelse(Number == 1, #check if sample was reran + "KEEP", + ifelse(All_Good, #check if multiple samples meet all criteria + ifelse(Min_CV == "KEEP", #Keep only lowest CV + "KEEP1", + "RMV1"), + ifelse(Conc_Flag == "Within_Range" & CV_Flag == "CV_Good", #If only one sample meets all criteria keep that one + "KEEP2", ifelse(Conc_Flag == "Within_Range", "KEEP2a", + ifelse(!(Within_Range) & BDL, #Check if none are within range but are under detection limit + ifelse(Dilution == Min_Dil, #keep lowest dilution + "KEEP3", + "RMV3"), + ifelse(!(Within_Range) & CV_Check, #if all are above detection limit keep lowest CV of highest dilution + "KEEP4", + "RMV4") + ) + ) + )))) + +Samples <- Samples_Tagged %>% filter(Remove %like% "KEEP") + +#check to see if all samples are present in the metadata +all_present <- all(metadata$Sample_ID %in% Samples$Sample_ID) + +if (all_present) { + message("All sample IDs are present in data") +} else { + message("Some sample IDs are missing from data.") + + # Optional: Which ones are missing? + missing_ids <- setdiff(metadata$Sample_ID, Samples$Sample_ID) + print(missing_ids) +} + + +#merge metadata with sample run data +merged_data <- metadata %>% + mutate(Sample_ID = paste0("\\b", Sample_ID, "\\b")) %>% + fuzzyjoin::regex_left_join(Samples, ., by = c(Sample_ID = "Sample_ID")) + +#might want to include a flag or something to see that all the samples are included? + +``` + + +##Add Flags +```{r, echo=FALSE} + +#Get only bad flags for each plate and check +Chk_Flags_All <- Chk_Flags %>% dplyr::select(Plate, CHKs_Flag) %>% filter(CHKs_Flag %like% "Bad") %>% na.omit() %>% distinct(.keep_all = TRUE) %>% group_by(Plate) %>% + summarise( + CHKSTD_Flags = paste(CHKs_Flag, collapse = ", "), + .groups = 'drop' # Drops the grouping structure after summarizing + ) + + +STD_Flags_All <- STD_CRV_flags %>% dplyr::select(Plate, R2_Flag, CV_Flag) %>% mutate(STDCV_Flags = paste0("STD", CV_Flag)) %>% dplyr::select(-CV_Flag) %>% mutate( + R2_Flag = ifelse(R2_Flag %like% "Good", NA, R2_Flag), + STDCV_Flags = ifelse(STDCV_Flags %like% "Good", NA, STDCV_Flags) +) %>% na.omit() + +Flags_Int <- tibble(Plate = c(plates)) + +#Join Flags + +Flags_Joined_1 <-left_join(Flags_Int, Dup_Flags_2, by = join_by(Plate)) + +Flags_Joined_2 <- left_join(Flags_Joined_1, Spk_Flags_2, by = join_by(Plate)) + +Flags_Joined_3 <- left_join(Flags_Joined_2, Chk_Flags_All, by = join_by(Plate)) + +Flags_Joined_4 <- left_join(Flags_Joined_3, STD_Flags_All, by = join_by(Plate)) + +Flags_Joined <- left_join(Flags_Joined_4, Curve_Flags_forJoin, by = join_by(Plate)) + + +Flags_Joined[Flags_Joined == "NA"] <- NA + +#Merge Flags into one column +Flags <- Flags_Joined %>% replace(is.na(.), "") %>% mutate( + H2S_Flags = paste0( + Spk_Flag, + " ", + Dup_Flag, + " ", + CHKSTD_Flags, + " ", + R2_Flag, + " ", + STDCV_Flags, + " ", + Slope_Flag, + " ", + Int_Flag + ) +) %>% dplyr::select(Plate, H2S_Flags) + +#Add Flags to data +flagged_data <- left_join(merged_data, Flags, by = join_by(Plate)) + + +df_all_clean <- flagged_data %>% dplyr::select(-Plate) + +``` + +##Organize Data +```{r, echo=FALSE} +#check results +#head(Samples) + +#pull out what we need + +df_all_clean_cols <- df_all_clean %>% + dplyr::select( + Site, + Project, + Year, + Month, + Community, + Nickname, + Plot_Name, + SubPlot, + Depth_cm, + CO2_Treatment, + N_Treatment, + Conc, + Conc_Flag, + CV_Flag, + H2S_Flags + ) + +final_data_labeled <- df_all_clean_cols %>% + mutate( + Run_notes = Run_notes,# new column with notes about the run + Analysis_rundate = Run_Date) + +#rename columns +org_labeled_fin_data <- final_data_labeled %>% + rename( + H2S_Conc_uM = Conc, + H2S_Conc_Flag = Conc_Flag, + Plot = Plot_Name, + H2S_CV_Flag = CV_Flag + ) + +#Order Columns for Final Data Frame +All_Clean_Data <- org_labeled_fin_data %>% + dplyr::select( + Site, + Project, + Year, + Month, + Community, + Nickname, + Plot, + SubPlot, + Depth_cm, + CO2_Treatment, + N_Treatment, + H2S_Conc_uM, + H2S_Conc_Flag, + H2S_CV_Flag, + H2S_Flags, + Analysis_rundate, + Run_notes + ) +#head(Samples1) + +``` + +## Visualize Data +```{r Visualize Data, echo=FALSE} +cat("Visualize Data") + +### Ammonia +H2S_forplot <- All_Clean_Data + +color1 <- c("P1", "P2", "P3", "P4") +color2 <- c("P5", "P6", "P7", "P8") +color3 <- c("P10", "P9", "P11", "P12") + + +H2S_forplot <- H2S_forplot %>% + mutate( + Treatment1 = ifelse( + CO2_Treatment == "Elevated" & + N_Treatment == "Amended", + "eCO2 & eN", + ifelse( + CO2_Treatment == "Elevated" & + N_Treatment == "Ambient", + "eCO2 & aN", + ifelse( + CO2_Treatment == "Ambient" & + N_Treatment == "Amended" , + "aCO2 & eN" , + "aCO2 & aN" + ) + ) + ) + ) %>% + mutate(Treatment = ifelse( + SubPlot == "A", + ifelse( + CO2_Treatment == "Elevated" & + N_Treatment == "Amended", + "eCO2_eN_Phrag", + ifelse( + CO2_Treatment == "Elevated" & + N_Treatment == "Ambient", + "eCO2_aN_Phrag", + ifelse( + CO2_Treatment == "Ambient" & + N_Treatment == "Amended" , + "aCO2_eN_Phrag" , + "aCO2_aN_Phrag" + ) + ) + ), + ifelse( + CO2_Treatment == "Elevated" & + N_Treatment == "Amended", + "eCO2_eN_Native", + ifelse( + CO2_Treatment == "Elevated" & + N_Treatment == "Ambient", + "eCO2_aN_Native", + ifelse( + CO2_Treatment == "Ambient" & + N_Treatment == "Amended" , + "aCO2_eN_Native" , + "aCO2_aN_Native" + ) + ) + ) + )) %>% + mutate(CO2_Treatment = ifelse(CO2_Treatment == "Ambient", "aCO2", "eCO2")) %>% + mutate(N_Treatment = ifelse(N_Treatment == "Ambient", "aN", "eN")) %>% + mutate( + Plot_Color = case_when( + Plot %in% color1 ~ "Color1", + Plot %in% color2 ~ "Color2", + Plot %in% color3 ~ "Color3" + ) + ) + + +H2S_forplot <- H2S_forplot[order(H2S_forplot$Depth_cm), ] + +viz_H2S_plot_v2 <- ggplot( + data = H2S_forplot, + aes( + x = factor(as.factor(CO2_Treatment), levels = c("eCO2", "aCO2")), + y = H2S_Conc_uM, + fill = as.factor(Treatment), + color = as.factor(Treatment), + pattern = as.factor(Treatment) + ) +) + + geom_bar_pattern( + stat = "identity", + position = position_dodge2(padding = 0.25, preserve = "single"), + pattern_angle = 45, + pattern_density = 0.1, + pattern_spacing = 0.025, + pattern_key_scale_factor = 0.6 + ) + + facet_grid(Depth_cm ~ N_Treatment, scales = "fixed") + + scale_fill_manual( + values = c( + "eCO2_eN_Phrag" = "#DB5461", + "eCO2_aN_Phrag" = "#454ADE", + "aCO2_eN_Phrag" = "white", + "aCO2_aN_Phrag" = "white", + "eCO2_eN_Native" = "#DB5461", + "eCO2_aN_Native" = "#454ADE", + "aCO2_eN_Native" = "white", + "aCO2_aN_Native" = "white" + ), + name = "Treatment:", + breaks = c( + "eCO2_eN_Phrag", + "eCO2_aN_Phrag", + "aCO2_aN_Phrag", + "aCO2_eN_Phrag", + "eCO2_eN_Native", + "eCO2_aN_Native", + "aCO2_aN_Native", + "aCO2_eN_Native" + ), + labels = c( + "eCO2_eN_Phrag", + "eCO2_aN_Phrag", + "aCO2_aN_Phrag", + "aCO2_eN_Phrag", + "eCO2_eN_Native", + "eCO2_aN_Native", + "aCO2_aN_Native", + "aCO2_eN_Native" + ) + + ) + + scale_color_manual( + values = c( + "eCO2_eN_Phrag" = "#DB5461", + "eCO2_aN_Phrag" = "#454ADE", + "aCO2_eN_Phrag" = "#DB5461", + "aCO2_aN_Phrag" = "#454ADE", + "eCO2_eN_Native" = "#DB5461", + "eCO2_aN_Native" = "#454ADE", + "aCO2_eN_Native" = "#DB5461", + "aCO2_aN_Native" = "#454ADE" + ), + name = "Treatment:", + breaks = c( + "eCO2_eN_Phrag", + "eCO2_aN_Phrag", + "aCO2_aN_Phrag", + "aCO2_eN_Phrag", + "eCO2_eN_Native", + "eCO2_aN_Native", + "aCO2_aN_Native", + "aCO2_eN_Native" + ), + labels = c( + "eCO2_eN_Phrag", + "eCO2_aN_Phrag", + "aCO2_aN_Phrag", + "aCO2_eN_Phrag", + "eCO2_eN_Native", + "eCO2_aN_Native", + "aCO2_aN_Native", + "aCO2_eN_Native" + ) + + ) + + scale_pattern_manual( + values = c( + "eCO2_eN_Phrag" = "stripe", + "eCO2_aN_Phrag" = "stripe", + "aCO2_eN_Phrag" = "stripe", + "aCO2_aN_Phrag" = "stripe", + "eCO2_eN_Native" = "none", + "eCO2_aN_Native" = "none", + "aCO2_eN_Native" = "none", + "aCO2_aN_Native" = "none" + ), + name = "Treatment:", + breaks = c( + "eCO2_eN_Phrag", + "eCO2_aN_Phrag", + "aCO2_aN_Phrag", + "aCO2_eN_Phrag", + "eCO2_eN_Native", + "eCO2_aN_Native", + "aCO2_aN_Native", + "aCO2_eN_Native" + ), + labels = c( + "eCO2_eN_Phrag", + "eCO2_aN_Phrag", + "aCO2_aN_Phrag", + "aCO2_eN_Phrag", + "eCO2_eN_Native", + "eCO2_aN_Native", + "aCO2_aN_Native", + "aCO2_eN_Native" + ) + ) + + theme_classic() + + labs( + x = " ", + y = "H2S (uM)", + title = "CO2xNxPhrag: Porewater Sulfide", + fill = "CO2 Treatment:", + color = "N Treatment:", + pattern = "Subplot:" + ) + + theme(legend.position = "right") + + scale_x_discrete(drop = TRUE) + + theme( + axis.text.x = element_text(angle = 0, hjust = 0.5), + panel.border = element_rect( + color = "black", + fill = NA, + linewidth = 0.8 + ) + ) + + coord_flip() +print(viz_H2S_plot_v2) + + +``` + +```{r, echo = FALSE} +#make plot + +H2S_forplot <- H2S_forplot %>% + mutate(Sub_Plot = ifelse(SubPlot == "A", "Phrag", "Native")) + +viz_H2S_plot_2 <- ggplot(data = H2S_forplot, aes(x = H2S_Conc_uM, y = as.numeric(Depth_cm), color = Plot_Color)) + + geom_point(size = 3) + + geom_path(linewidth = 1) + + scale_color_manual( + values = c( + "Color1" = "#FFD500", + "Color2" = "#00D0FF", + "Color3" = "#FF0075" + + ), + labels = c("1", "2", "3") + ) + + facet_grid(Treatment1 ~ ., scales = "fixed") + + labs( + x = "H2S (uM)", + y = "Depth (cm)", + title = "CO2xNxPhrag: Porewater H2S by Replicate", + color = "Replicate" + ) + + scale_y_reverse(breaks = c(20, 40), limits = c(45, 15)) + + theme_classic() + + theme( + axis.text.x = element_text(angle = 0, hjust = 0.5), + panel.border = element_rect( + color = "black", + fill = NA, + linewidth = 0.8 + ) + ) + +viz_H2S_plot_2 +``` + + +##Export Data +```{r, echo=FALSE} +write.csv(unique_log, log_path) + Rerun_Data <- All_Clean_Data %>% filter(H2S_Conc_Flag != "Within Range" | H2S_CV_Flag %like% "High") + +if(After_Reruns == "YES"){ + write.csv(All_Clean_Data, final_path)} else { + write.csv(Rerun_Data, rerun_path) } +#end +``` + + +### END \ No newline at end of file diff --git a/CO2xNxPhrag/Porewater/Sulfide/2026/GCReW_CO2xNxPhrag_Porewater_H2S_Template.Rmd b/CO2xNxPhrag/Porewater/Sulfide/2026/GCReW_CO2xNxPhrag_Porewater_H2S_Template.Rmd new file mode 100644 index 0000000..fdb2dfc --- /dev/null +++ b/CO2xNxPhrag/Porewater/Sulfide/2026/GCReW_CO2xNxPhrag_Porewater_H2S_Template.Rmd @@ -0,0 +1,1452 @@ +--- +title: "CO2xNxPhrag: Porewater Sulfide" +author: "Month Year Samples" +date: "`r Sys.Date()`" +output: + pdf_document: + toc: false + number_sections: false +geometry: left=2cm,right=2cm,top=1cm,bottom=2cm +--- +## Code Set up +```{r setup, include=FALSE} + +library(dplyr) +library(broom) +library(ggplot2) +library(ggpubr) +library(stringr) +library(purrr) +library(tidyverse) +library(here) +library(data.table) +library(matrixStats) +library(gridExtra) +library(grid) +library(plater) +library(raster) +library(knitr) +library(readxl) +library(ggrepel) +library(ggpattern) + +``` + +## run information +```{r Information to be changed} + +##Before or After Reruns (YES or NO) +After_Reruns = "YES" +#If NO will not write final data file + #And Will Write a Rerun File + +###things that need to be changed + +sample_month = "May" +sample_year = "2026" +Run_Date = as.Date("05/19/2026", format = "%m/%d/%Y") +Run_by = "Melanie Giessner"#Instrument user +Script_run_by ="Melanie"#Code user + +Run_notes=""#any notes from run + +#Import Plate Data + +plates<- c("Plate1","Plate2","Plate3","Plate4","Plate5","rrPlate1","rrPlate2") + +folder_path_rawdata <- paste0("Raw Data") +Raw_plates <- list.files(path = folder_path_rawdata, full.names = TRUE,pattern = "Plate") +head(Raw_plates) + + +#Import Run Date for Each Plate for Std curve qaqc +Run_dates <- tibble( + Plate = plates, + Run_Date = c("05/18/2026","05/18/2026","05/18/2026","05/18/2026","05/19/2026","06/01/2026","06/01/2026") + ) + + Run_dates <- Run_dates %>% mutate(Run_Date = as.Date(Run_Date, tryFormats = c("%Y-%m-%d", "%m/%d/%Y", "%m/%d/%y"))) + +# Define the file path for QAQC log file - NO Need to change just check year +log_path <- "Processed Data/LTREB_2M_H2S_QAQC_2026.csv" + +# Define final path for data be sure to change year and month and run number +final_path <- "Processed Data/GCReW_CO2xNxPhrag_Porewater_H2S_2026.csv" +rerun_path <- "Processed Data/GCReW_CO2xNxPhrag_Porewater_H2S_2026_reruns.csv" + + +``` + +```{r Set Up Code - constants and QAQC cutoffs, include=FALSE} + +#Flag cutoffs + r2_cutoff = 0.985 #this is the level below which we want to rerun or consider a curve + cv_flag_stds = 10 #this is the maximum cv allowed for standards + p_value_chkstds = 0.05 #the p-value for the t-test between check standards must be greater than this + p_value_MC = 0.05 #the p-value for the t-test between matrix checks and top std must be greater than this + cv_flag_sample = 10 #this is the maximum cv allowed for samples + dups_perc_diff = 15.5 #this is the maximum percent difference allowed between duplicates + high_recovery_cutoff = 120 #this is the maximum percent recovery of SO4 allowed in spiked samples + low_recovery_cutoff = 80 #this is the minimum percent recovery of SO4 allowed in spiked samples + +#Standard concentrations - Update if running different standard curve: +# standard units are in uM + standards <- tibble( + IDs = c("Std 0", "Std 1", "Std 2", "Std 3", "Std 4", "Std 5"), + Conc = c(0, 5.0, 12.5, 25.0, 50.0, 100.0) + ) #uM + + chk_standards <- tibble( + IDs = c("ChkStd 0", "ChkStd 3", "ChkStd 4"), + Conc = c(0, 25.0, 50.0) + ) #uM + + mtx_standards <- tibble( + IDs = c("MC: 10ppt S5"), + Conc = c(100) + ) #uM + +#Spike concentration calc + #spike for these samples was 50 uL of the 100uM standard + Con1 <- 1000000 #conversion factor value for spike volumes (uL -> L) + spk_std <- 100 # uM S2- standard used + spkvol <- 50 # uL volume of spike added + spk_Conc <- spk_std*(spkvol/Con1) # umoles of S2- added to each spiked sample + sample_vol <- 250 # the sample volume without the spike is 250 uL + samp_vol_a <- 300 # the sample volume + +#Top standard Concentration- Update if running different standard curve: + Top_STD = 100 + + sigdigs = 3 + + +#Metadata file path +Raw_Metadata = here(".." , "GCReW", "GCReW_Project_Treatment_Metadata.csv") + +``` + + +##Read in metadata and create similar sample IDs for matching to samples +```{r pull in metadata for later, include=FALSE} + +#read in metadata + +raw_metadata <- read.csv(Raw_Metadata) +#clean up columns in metadata file: +#Pull out only SMARTX Rows +#Create a Sample_Name column to match the SEAL +metadata <- raw_metadata %>% + filter(grepl("Phrag", Nickname, ignore.case = TRUE)) %>% + mutate(Sample_Name = paste0(Sample.ID)) %>% + mutate(Month = sample_month) %>% + mutate(Year = sample_year) %>% + rename( + Sample_ID = Sample.ID, + Plot_Name = Plot, + ) %>% + dplyr::select(-Temp_Treatment) %>% + mutate(Treatment = ifelse( + CO2_Treatment == "Elevated" & + N_Treatment == "Amended", + "eCO2_N", + ifelse( + CO2_Treatment == "Elevated" & + N_Treatment == "Ambient", + "eCO2", + ifelse(CO2_Treatment == "Ambient" & + N_Treatment == "Amended" , "N" , "Ambient") + ) + )) %>% filter(SubPlot %like% "A") %>% mutate(Sample_ID=gsub("A","",Sample_ID)) + +#Bring in the collection date and any field notes if relevant +#collection_metadata <- read.csv(Collection_Dates) +#then we will merge the collection date for SMARTX based on the project and the chambers + +``` + + + +##Read in data +```{r read in plates,echo=FALSE,include=FALSE} + +#read in the csv files +dat<-read_plates( + files = Raw_plates,#list of all file paths + plate_names = plates , #list of plate names + well_ids_column = "Wells", # name to give column of well IDs (optional) + sep = "," # separator used in the csv file (optional) +) %>% + rename("Abs"=values, + "IDs"=values.2, + "Dilution"=values.3) +head(dat) + +``` + +##Remove High CV Stds +```{r, echo=FALSE} + +#filter for STDs +H2S_stds_raw <- dat %>% subset(IDs %like% "Std" | IDs %like% "Chk" | IDs %like% "MC") + +#Add in STD values +H2S_stds <- left_join(H2S_stds_raw, standards, by = "IDs") + +#Calculate CVs and add flags +H2S_STD_cv <- H2S_stds %>% group_by(Plate, IDs) %>% mutate(CV = cv(Abs)) %>% mutate(CV_Flag = ifelse(CV >= cv_flag_stds, "CV_High", "CV_Good")) %>% ungroup() + +#calculate new cv getting best cv from points if cv was high +H2S_STD_cv_new <- H2S_STD_cv %>% group_by(Plate, IDs) %>% + mutate(CV_New = map_dbl(row_number(), ~cv(Abs[-.x]))) %>% #Calculate CVs without 1 point + mutate(Removed = ifelse( #Choose Lowest CV if CV is high + CV_Flag == "CV_High", + ifelse( + CV_New == min(CV_New), + "RMVD", + "KEPT"), "CV_Good"), +CV2 = ifelse(CV_Flag == "CV_High", min(CV_New), CV), +Abs_rm = ifelse(Removed == "RMVD", NA, Abs)) %>% + mutate(Mean_Abs2 = mean(Abs_rm, na.rm = TRUE)) %>% + mutate(CV_Flag2 = ifelse(CV2 >= cv_flag_stds, "CV_High", "CV_Good")) %>% ungroup() + +#organize data +H2S_STD_CV_fin <- H2S_STD_cv_new %>% dplyr::select(Plate, + Wells, + Abs, + Removed, + IDs, + Dilution, + Conc, + Mean_Abs2, + CV2, + CV_Flag2) %>% + mutate(Mean_Abs = Mean_Abs2, CV_Flag = CV_Flag2, CV = CV2) %>% + dplyr::select(Plate, + Wells, Abs, + Removed, + IDs, + Dilution, + Conc, + Mean_Abs, + CV, + CV_Flag) + + +``` + + +##Check R2 & Remove Standards if Necessary +```{r, echo=FALSE} +split_data <- H2S_STD_CV_fin %>% filter(IDs %like% "Std") %>% filter(!IDs %like% "Chk") %>% dplyr::select(Plate, IDs, Conc, Mean_Abs, Abs, Removed, CV_Flag) %>% filter(!Removed == "RMVD") %>% #Split Data by Plate + distinct() %>% + group_by(Plate) %>% + group_split() + +#run regression and get coefficients by Run +Slope_H2S_raw_list <- map(split_data, ~ .x %>% mutate(Curve = "H2S", + R2 = summary(lm(Abs ~ Conc, data = .))$adj.r.squared , + Slope = coef(lm(Abs ~ Conc, data = .))[2], + Intercept = coef(lm(Abs ~ Conc, data = .))[1])) + + + Slope_H2S_raw <- bind_rows(Slope_H2S_raw_list) + + #check R2 and flag + Slope_H2S_Std_Crvs <- Slope_H2S_raw %>% dplyr::select(Plate, Curve, R2, Slope, Intercept) %>% distinct() %>% mutate(R2_Flag = ifelse(R2 >= r2_cutoff, "R2_Good", "R2_Bad")) + + #join standard curve CVs and regression values + R2_Check_Raw <- left_join(Slope_H2S_Std_Crvs, H2S_STD_CV_fin, by = "Plate") + + R2_Check <- R2_Check_Raw %>% + dplyr::select(Plate, + IDs, + Abs, + Removed, + Mean_Abs, + Conc, + R2, + Slope, + Intercept, + CV_Flag, + CV, + R2_Flag) %>% filter(IDs %like% "Std") %>% filter(!IDs %like% "Chk") %>% + distinct() + + #calculate concentrations from standard curve and separate removable points + + R2_Split <- R2_Check %>% mutate(RMVBL = ifelse(IDs %in% c("Std 0", "Std 1", "Std 5"), "No", "Yes")) %>% group_by(Plate) %>% dplyr::select(-Abs, -Removed) %>% distinct() %>% group_split() + + R2_New <- map( + R2_Split, + ~ .x %>% mutate( + Curve = "H2S", + R2_New = map_dbl(row_number(), ~ + summary(lm( + Mean_Abs[-.x] ~ Conc[-.x], data = pick(Mean_Abs, Conc) + ))$adj.r.squared) , + Slope_New = map_dbl(row_number(), ~ + coef(lm( + Mean_Abs[-.x] ~ Conc[-.x], data = pick(Mean_Abs, Conc) + ))[2]) , + Intercept_New = map_dbl(row_number(), ~ + coef(lm( + Mean_Abs[-.x] ~ Conc[-.x], data = pick(Mean_Abs, Conc) + ))[1]) + ) + ) %>% bind_rows() + + R2_Check_RMVBL <- R2_New %>% mutate(R2_New = round(R2_New, digits = 8), + CV = round(CV, digits = 8)) %>% group_by(Plate) %>% mutate(R2_New = ifelse(IDs %in% c("Std 0", "Std 1", "Std 5"), NA, R2_New)) %>% mutate(R2_RMV = ifelse( + R2_Flag == "R2_Bad", + ifelse(R2_New == max(R2_New, na.rm = TRUE), "RMVD", "KEPT"), + "R2_Good" + )) %>% mutate(R2_RMV_CV = ifelse( + R2_RMV == "R2_Good", + ifelse(CV_Flag == "CV_High", ifelse(CV == max(CV), "RMVD", "KEPT"), "KEPT"), + R2_RMV + )) %>% mutate(R2_RMVD = ifelse(is.na(R2_RMV_CV), "KEPT", R2_RMV_CV)) %>% dplyr::select(-R2_RMV, -R2_RMV_CV) + +R2_Removed_forPair <- R2_Check_RMVBL %>% dplyr::select(Plate, IDs, R2_RMVD) %>% distinct() + +H2S_STDs_Pair <- H2S_STD_CV_fin %>% filter(IDs %like% "Std") %>% filter(!IDs %like% "Chk") %>% dplyr::select(Plate, IDs, Conc, Mean_Abs, Abs, Removed, CV_Flag) %>% filter(!Removed == "RMVD") %>% distinct() %>% left_join(R2_Removed_forPair) + + + R2_Check_fin <- H2S_STDs_Pair %>% mutate(STD_ABS_rmv = ifelse(R2_RMVD == "RMVD", NA, Abs)) %>% group_by(Plate) %>% mutate(Points = ifelse("RMVD" %in% R2_RMVD, "Point_Removed", "ALL_KEPT")) %>% dplyr::select(Plate, IDs, Conc, STD_ABS_rmv, CV_Flag, Points) %>% ungroup() %>% na.omit() + + #separate plates for new regression + split_data_rmv <- R2_Check_fin %>% + distinct() %>% + group_by(Plate) %>% + group_split() + + #get new standard curve values + Slope_H2S_raw_list_rm <- map(split_data_rmv, ~ .x %>% mutate(Curve = "H2S", + R2 = summary(lm(STD_ABS_rmv ~ Conc, data = .))$adj.r.squared , + Slope = coef(lm(STD_ABS_rmv ~ Conc, data = .))[2], + Intercept = coef(lm(STD_ABS_rmv ~ Conc, data = .))[1])) + + Slope_H2S_raw_rm <- bind_rows(Slope_H2S_raw_list_rm) + + Slope_H2S_Std_Crvs_rm <- Slope_H2S_raw_rm %>% dplyr::select(Plate, Curve, R2, Slope, Intercept, CV_Flag, Points) %>% distinct() %>% mutate(R2_Flag = ifelse(R2 >= r2_cutoff, "R2_Good", "R2_Bad")) + + +``` + + +## Plot Standard Curves +```{r Plot all Standard Curves together, echo=FALSE} +##this is to see if there are any stds or plates that look off + +#Plot Std Crvs by plate +H2S_Curve <- ggplot(Slope_H2S_raw_rm, aes(STD_ABS_rmv, Conc, color = Plate, linetype = Points)) + geom_point(size = 3) + + geom_smooth(method = "lm", formula = "y ~ x", se = FALSE) + labs(title = "H2S Standard Curves", x = "Absorbance", y = "Concentration (uM)") + + theme_classic() +H2S_Curve + +#Add dates to plate and format data +STD_run_date <- left_join(Run_dates, Slope_H2S_Std_Crvs_rm, by = join_by(Plate)) +new_log_stds <- STD_run_date %>% dplyr::select(Plate, + Curve, + R2, + Slope, + Intercept, + Run_Date) %>% mutate(R2 = round(R2, digits = 4), Slope = round(Slope, digits = 4), Intercept = round(Intercept, digits = 4), ) %>% mutate(Run = "Current Runs") + + +#read in log file and format +log <- read.csv(log_path) +log_2 <- log %>% mutate(Run_Date = as.Date(as.character(Run_Date), tryFormats = c("%Y-%m-%d", "%m/%d/%Y")), Run = "Past Runs") +log_3 <- log_2[, -c(1)] +log_4 <- rbind(log_3, new_log_stds) + +unique_log <- log_4 %>% distinct(Plate,Curve,R2,Slope,Intercept,.keep_all = TRUE) + +#Calculate Mean and SD and calculate 2SD range for slope and intercept +mean_slope <- mean(unique_log$Slope, na.rm = TRUE) +sd_slope <- sd(unique_log$Slope, na.rm = TRUE) + +hi_2sd_slope <- mean_slope + 2*sd_slope + +lo_2sd_slope <- mean_slope - 2*sd_slope + +mean_int <- mean(unique_log$Intercept, na.rm = TRUE) +sd_int <- sd(unique_log$Intercept, na.rm = TRUE) + +hi_2sd_int <- mean_int + 2*sd_int + +lo_2sd_int <- mean_int - 2*sd_int + +#Plot Slope log +Slopes_chk <- ggplot(unique_log, aes(x = Run_Date, y = Slope, col = Run)) + + ylim(0.0045,0.018) + + scale_color_manual(values = c("Past Runs" = "grey27", "Current Runs" = "cyan3")) + + geom_abline(intercept = mean_slope - 2*sd_slope, slope = 0, linetype = "dashed", linewidth = 1.5, col = "red" )+ + geom_abline(intercept = mean_slope + 2*sd_slope, slope = 0, linetype = "dashed", linewidth = 1.5, col = "red" )+ + geom_point(size = 2) + + theme_classic()+ + ggtitle("Slope Log") + +#Plot Intercept log +ints_chk <- ggplot(unique_log, aes(x = Run_Date, y = Intercept, col = Run)) + + ylim(0.03, 0.15) + + scale_color_manual(values = c("Past Runs" = "grey27", "Current Runs" = "cyan3")) + + geom_abline(intercept = mean_int - 2*sd_int, slope = 0, linetype = "dashed", linewidth = 1.5, col = "red" )+ + geom_abline(intercept = mean_int + 2*sd_int, slope = 0, linetype = "dashed", linewidth = 1.5, col = "red" )+ + geom_point(size = 2) + + theme_classic()+ + ggtitle("Intercept Log") + +ints_chk + +Slopes_chk + + + +#Get done of original runs +Date_1 <-as.Date(new_log_stds$Run_Date[which(new_log_stds$Plate == "Plate1")]) + +#Check if Std Crvs are Within range and see if dates are close enough for combination +stdcrv_tagged <- new_log_stds %>% mutate( + In_Range_Slope = ifelse( + Slope >= hi_2sd_slope | + Slope <= lo_2sd_slope, + "Out of Range", + "In Range" + ), + In_Range_Int = ifelse( + Intercept >= hi_2sd_int | + Intercept <= lo_2sd_int, + "Out of Range", + "In Range" + ) +) %>% mutate( + Slope = ifelse(In_Range_Slope == "Out of Range", NA, Slope), + Intercept = ifelse(In_Range_Int == "Out of Range", NA, Intercept) +) %>% mutate(Date_Diff = abs(difftime(Date_1, Run_Date, units = "days"))) %>% mutate(Date_Close = ifelse(Date_Diff <= 2, "Yes", "No")) %>% mutate(Slope_Flag = ifelse(is.na(Slope), "Slope_Bad" , "Slope_Good"), Int_Flag = ifelse(is.na(Intercept), "Intercept_Bad" , "Intercept_Good")) %>% mutate( + Slope = ifelse(is.na(Intercept) | R2 <= r2_cutoff, NA, Slope), + Intercept = ifelse(is.na(Slope)| R2 <= r2_cutoff, NA, Intercept), + Curve_RMVD = ifelse(is.na(Slope) | + is.na(Intercept) | R2 <= r2_cutoff , "RMVD", "KEPT") +) + +#Calculate Combo Std Crv +stdcrv_filtered <- stdcrv_tagged %>% filter(Date_Close == "Yes") +stdcrv_filtered_no <- stdcrv_tagged %>% filter(Date_Close == "No") +mean_slope_fin <- mean(stdcrv_filtered$Slope, na.rm = TRUE) +mean_slope_no <- mean(stdcrv_filtered_no$Slope, na.rm = TRUE) +mean_int_fin <- mean(stdcrv_filtered$Intercept, na.rm = TRUE) +mean_int_no <- mean(stdcrv_filtered_no$Intercept, na.rm = TRUE) + +#Attach Slope and Intercept to Plates +Std_crv_calc <- stdcrv_tagged %>% mutate(Slope_Calc = ifelse(Date_Close == "Yes", mean_slope_fin, mean_slope_no), Int_Calc = ifelse(Date_Close == "Yes", mean_int_fin, mean_int_no)) %>% dplyr::select(Plate, Slope_Calc, Int_Calc, Curve_RMVD, Slope_Flag, Int_Flag) %>% as.data.frame() + +std_curves <- Std_crv_calc %>% dplyr::select(Plate, Curve_RMVD) %>% filter(Curve_RMVD != "RMVD") %>% distinct() + +Curve_Flags <- Std_crv_calc %>% dplyr::select(Plate, Slope_Flag, Int_Flag) %>% distinct() + +Curve_Flags_forJoin <- Curve_Flags %>% mutate(Slope_Flag = ifelse(Slope_Flag %like% "Good", "", Slope_Flag), Int_Flag = ifelse(Int_Flag %like% "Good", "", Int_Flag)) + + +Std_crv_calc <-Std_crv_calc %>% distinct() +``` + +## Return Flags For Standard Curve +```{r, echo=FALSE} + +STD_CRV_flags <- full_join(Slope_H2S_Std_Crvs_rm, Run_dates, by = join_by(Plate)) + +STD_CRV_flags_table1 <- STD_CRV_flags %>% dplyr::select(Plate, R2_Flag, CV_Flag) + +STD_CRV_flags_table2 <- Std_crv_calc %>% dplyr::select(Plate, Curve_RMVD) %>% mutate(Curve_RMVD = ifelse(Curve_RMVD == "RMVD", "REMOVED", Curve_RMVD)) + +knitr::kable(STD_CRV_flags_table1, format="markdown") + +knitr::kable(STD_CRV_flags_table2, format="markdown") + + +``` + +## Method Detection Limit +```{r, echo=FALSE} + +#get only lowest standard + STD_MDL_df <- H2S_STD_CV_fin %>% filter(IDs == "Std 1" + #, Removed != "RMVD" + ) %>% dplyr::select(Plate, Mean_Abs, IDs) %>% distinct() + + STD0_df <- H2S_STD_CV_fin %>% filter(IDs == "Std 0" + #, Removed != "RMVD" + ) %>% dplyr::select(Plate, Mean_Abs, IDs) %>% distinct() +#calculate the standard deviation of abs +stddev_mdl <- sd(STD_MDL_df$Mean_Abs) + +#Calculate Mean Std 0 +std0_mean <- mean(STD0_df$Mean_Abs) + +#calculate n +n <- length(STD_MDL_df$Mean_Abs) + +#Identify the proper Student's T for n-1 +StudentsT <-qt(.99,(n-1)) + +#Multiply Standard deviation by Student's T +STD_var <- (stddev_mdl*StudentsT) +MDL <- STD_var + std0_mean + +MDL_df <- as.data.frame(MDL) + +MDL_Plot <- ggplot() + + geom_bar(stat = 'identity', data = STD_MDL_df, aes(x = Plate, y = Mean_Abs, fill = IDs)) + + geom_bar(data = STD0_df, aes(x = Plate, y = Mean_Abs, fill = IDs), stat = 'identity') + + scale_fill_manual(name = "Standard:", values = c("Std 0" = "lightgreen", "Std 1" = "cornflowerblue")) + + geom_hline(yintercept = MDL, linetype = "dashed", linewidth = 1.5, color = "blue3") + + geom_label_repel(data = MDL_df, aes(x = 1.25, y = MDL + 0.015), label = paste0("MDL: ", signif(MDL, digits = sigdigs)), alpha = 0.7, color = "blue3") + + ggtitle(label = "H2S Minimum Detection Limit") + + labs(y = "Mean Absorbance") + + theme_classic() + +MDL_Plot +``` + +## Compare Check Standards to Standards +```{r, echo = FALSE} + +#subset datasets for comparison + +std0 <- subset(H2S_STD_CV_fin, IDs == "Std 0"& Plate %in% std_curves$Plate & !Removed == "RMVD") +std3 <- subset(H2S_STD_CV_fin, IDs == "Std 3"& Plate %in% std_curves$Plate & !Removed == "RMVD") +std4 <- subset(H2S_STD_CV_fin, IDs == "Std 4" & Plate %in% std_curves$Plate & !Removed == "RMVD") +std5 <- subset(H2S_STD_CV_fin, IDs == "Std 5" & Plate %in% std_curves$Plate & !Removed == "RMVD") + + +H2S_CHK_STD_CV_fin <- H2S_STD_CV_fin %>% filter(IDs %like% "ChkStd" | IDs %like% "ppt") +#Tag Check Standards and perform T Test +H2S_CHKs_a <- H2S_CHK_STD_CV_fin %>% + mutate(Std_ID = case_when( + IDs == "ChkStd 0" ~ paste0("Std 0"), + IDs == "ChkStd 3" ~ paste0("Std 3"), + IDs == "ChkStd 4" ~ paste0("Std 4"), + IDs %like% "S5" ~ paste0("Std 5") + ), + Chk_Abs = Abs, + Chk_Removed = Removed, + Chk_IDs = IDs, + Chk_Mean_Abs = Mean_Abs, + Chk_cv_flag = CV_Flag + ) %>% filter(!Chk_Removed == "RMVD") %>% + group_by(Std_ID,Plate) %>% + mutate( + Chk_pvalue = case_when( + Chk_IDs == "ChkStd 0" ~ t.test(std0$Abs, Chk_Abs,var.equal = T)$p.value[1], + Chk_IDs == "ChkStd 3" ~ t.test(std3$Abs, Chk_Abs,var.equal = T)$p.value[1], + Chk_IDs == "ChkStd 4" ~ t.test(std4$Abs, Chk_Abs,var.equal = T)$p.value[1], + Chk_IDs == "MC: 10ppt S5" ~ t.test(std5$Abs, Chk_Abs,var.equal = T)$p.value[1], + Chk_IDs == "MC: 20ppt S5" ~ t.test(std5$Abs, Chk_Abs,var.equal = T)$p.value[1] + ))%>% + ungroup() %>% + dplyr::select(Std_ID, Chk_IDs, Chk_pvalue, Chk_cv_flag, Chk_Mean_Abs, Plate) %>% distinct(.keep_all = TRUE) + +H2S_CHKs_1 <- H2S_CHKs_a %>% dplyr::select(-Chk_Mean_Abs) + +#Get Standard Values and set values for standards with no variance +H2S_STD_forCHK_a <- H2S_STD_CV_fin %>% filter(IDs %in% c("Std 0", "Std 3", "Std 4", "Std 5") ) %>% + mutate(Std_ID = IDs +) %>% filter(!Removed == "RMVD") %>% + dplyr::select(Plate, Std_ID, IDs, CV_Flag, Mean_Abs) %>% distinct(.keep_all = TRUE) + +H2S_STD_forCHK <- H2S_STD_forCHK_a %>% dplyr::select( -Mean_Abs) + +#join check standards with standards +Chk_Std_join <- full_join(H2S_CHKs_1, H2S_STD_forCHK, by = join_by(Std_ID, Plate)) + + +#flag data +Chk_Std_flags <- Chk_Std_join %>% mutate( + Chk_Flag_pv= ifelse( + Chk_pvalue > p_value_chkstds , + "Chk_Good", + "Chk_Bad" + ) + +) %>% mutate(CHK_Flag = paste0(gsub(" ", "", IDs), Chk_Flag_pv)) %>% + mutate(CHK_CV_Flag = paste0("Chk",gsub(" ", "", IDs), Chk_cv_flag)) + + #Organize Data for Plotting and Flagging +Chk_Flags <- Chk_Std_flags %>% group_by(Plate) %>% + mutate(Chk_Flag = ifelse(any(CHK_Flag %like% "Bad"), "Chk_Bad", "Chk_Good"), Chk_cv_flag = ifelse(any(CHK_CV_Flag %like% "High"), "Chk_CV_High", "Chk_CV_Good")) %>% + ungroup() %>% + mutate(CHK_CV_Flags = ifelse(CHK_CV_Flag %like% "High", paste0(gsub(" ", "", IDs), Chk_cv_flag), "Good")) %>% mutate(CHKs_Flag = ifelse(CHK_Flag %like% "Bad", CHK_Flag, "Good")) + +H2S_CHKs_plot <- H2S_CHKs_a %>% rename(IDs = Chk_IDs, Mean_Abs = Chk_Mean_Abs) %>% mutate(Type = "Check") %>% dplyr::select(-Chk_cv_flag,-Chk_pvalue) + +H2S_Std_chkplot <- H2S_STD_forCHK_a %>% dplyr::select(IDs, Mean_Abs, Std_ID, Plate) %>% mutate(Type = "Standard") + +Chk_flags_plot <- Chk_Flags %>% dplyr::select(Std_ID, Plate, CHKs_Flag, Chk_Flag_pv) %>% group_by(Std_ID,Plate) %>% distinct(.keep_all = TRUE) %>% mutate(Check_Flag = ifelse(Chk_Flag_pv %like% "Good", "Good", "Bad")) + +H2S_Chks_bind <- rbind(H2S_CHKs_plot, H2S_Std_chkplot) + +H2S_Chks_bind_1 <- left_join(H2S_Chks_bind, Chk_flags_plot, by = join_by(Std_ID,Plate)) + +H2S_Chks_plot_bind_a <- H2S_Chks_bind_1 %>% mutate(Plot_ID = ifelse(IDs %like% "Chk" | IDs %like% "MC", substr(IDs, 4, 8), IDs)) %>% mutate(Plot_ID = ifelse(Plot_ID %like% "10pp", "Matrix: 10ppt", Plot_ID )) +H2S_Chks_plot_bind <-H2S_Chks_plot_bind_a %>% filter(str_detect(Type, "Check")) %>% mutate(Plot_ID =as.factor(Plot_ID)) + +Check_Val <- H2S_Chks_plot_bind_a %>% filter(!str_detect(Type, "Check")) %>% group_by(Plot_ID) %>% mutate(Z = mean(Mean_Abs)) %>% dplyr::select(Plot_ID, Z) %>% distinct(.keep_all = TRUE) %>% filter(!Plot_ID %like% "10pp") %>% mutate(Plot_ID = ifelse(Plot_ID %like% "Std 5", "Matrix: 10ppt", Plot_ID )) %>% mutate(Plot_ID = as.factor(Plot_ID)) + +#Plot Check Standards +H2S_chk_plot <- ggplot(data = H2S_Chks_plot_bind, aes(x = Plate, y = Mean_Abs)) + + geom_bar(stat = 'identity', + position = position_dodge2(preserve = "single"), linewidth = 0.75, aes(fill = Check_Flag)) + + geom_hline(data = Check_Val, aes(yintercept = Z), linetype = "dashed", linewidth = 1, color = "darkblue") + + facet_wrap(.~Plot_ID) + + ylim(0, max(H2S_Chks_plot_bind$Mean_Abs) + 0.2) + + geom_label_repel(data = Check_Val, aes( x = "Plate1", y = Z + 0.25), label = "Mean Target Arbsorbance", alpha = 0.7, color = "darkblue") + + scale_fill_manual(values = c("Good" = "darkgreen", "Bad" = "darkred")) + + theme_classic() + labs(x = " ", y = "Absorbance", title = + "Check Stds: H2S with Confidence Interval") + + theme(legend.position = "bottom", axis.text.x = element_text( + angle = 90, + vjust = 0.5, + hjust = 1)) + + +H2S_chk_plot + +``` + +## Display Any Check Flags +```{r, echo=FALSE} +Chk_Flag_1 <- Chk_Flags %>% dplyr::select(Plate, CHKs_Flag) %>% filter(CHKs_Flag != "Good") + +CHK_CV_Flag_1 <- Chk_Flags %>% dplyr::select(Plate, CHK_CV_Flags) %>% filter(CHK_CV_Flags != "Good") + +knitr::kable(Chk_Flag_1, format="markdown") + +knitr::kable(CHK_CV_Flag_1, format="markdown") + +``` + + +##Calculate Sulfide Concentrations & Add Concentration Flags +```{r Calculate Sulfide Concentrations,echo=FALSE,include=FALSE} + +High_Std <- H2S_STD_CV_fin %>% filter(IDs == "Std 5") %>% mutate(Mean_Abs = round(Mean_Abs, digits = 4)) %>% ungroup() %>% dplyr::select(Plate, Mean_Abs) %>% distinct(.keep_all = TRUE) %>% rename(High_DL = Mean_Abs) + +#filter out stds and other experiments +raw_data <- dat %>% + filter(!str_detect(IDs, "Std")) %>% + filter(!str_detect(IDs, "MC")) + +#Calculate Concentrations and fix zeroes/negative values and flag conc + +joined_data <- right_join(Std_crv_calc, raw_data, by = join_by(Plate)) + +calc_data <- joined_data %>% mutate(Conc = ((Abs - Int_Calc) / Slope_Calc)*Dilution) %>% mutate(Conc = ifelse(Conc <= 0, 0, Conc)) + +dl_data <- right_join(High_Std, calc_data, by = join_by(Plate)) + +``` + +##Remove High CV Samples and Average +```{r, echo=FALSE} + +#Calculate CVs +H2S_SPL_cv <- dl_data %>% group_by(Plate, IDs) %>% mutate(Mean_Conc = mean(Conc)) %>% mutate(Conc_SD = sd(Conc)) %>% mutate(CV = cv(Conc)) %>% mutate(CV_Flag = ifelse(CV >= cv_flag_stds, "CV_High", "CV_Good")) %>% mutate(Mean_Abs = mean(Abs)) %>% mutate(Conc_Flag = ifelse(Mean_Abs < MDL, "bdl", ifelse(Mean_Abs > High_DL, "adl", "Within_Range"))) %>% ungroup() + +#calculate new cv getting best cv from points if cv was high +H2S_SPL_cv_new <- H2S_SPL_cv %>% group_by(Plate, IDs) %>% + mutate(CV_New = map_dbl(row_number(), ~cv(Conc[-.x]))) %>% #Calculate CVs without 1 point + mutate(Removed = ifelse( #Choose Lowest CV if CV is high + CV_Flag == "CV_High", + ifelse( + CV_New == min(CV_New), + "RMVD", + "KEPT"), "CV_Good"), +CV2 = ifelse(CV_Flag == "CV_High", min(CV_New), CV), +Conc_rm = ifelse(Removed == "RMVD", NA, Conc)) %>% + mutate(Mean_Conc2 = mean(Conc_rm, na.rm = TRUE)) %>% + mutate(CV_Flag2 = ifelse(CV2 >= cv_flag_sample, "CV_High", "CV_Good")) %>% + mutate(Conc_SD2 = sd(Conc_rm, na.rm = TRUE)) %>% ungroup() + +H2S_SPL_CV_fin <- H2S_SPL_cv_new %>% dplyr::select(Plate, + Wells, + Conc, + Removed, + IDs, + Dilution, + Conc, + Mean_Conc2, + Conc_SD2, + CV2, + CV_Flag2, + Conc_Flag) %>% + mutate(Mean_Conc = Mean_Conc2, CV_Flag = CV_Flag2, SD_Conc = Conc_SD2, CV = CV2) %>% + dplyr::select(Plate, Conc, + Removed, + IDs, + Dilution, + Mean_Conc, + SD_Conc, + CV, + CV_Flag, + Conc_Flag) + +``` + +## Plot Samples +```{r, echo=FALSE} + +#Filter samples and mark reruns +H2S_Spl_pre_viz <- H2S_SPL_cv_new %>% mutate(IDs = toupper(IDs)) %>% + filter(str_detect(IDs, "P")) %>% + filter(!str_detect(IDs, "DUP")) %>% + filter(!str_detect(IDs, "SPIKE")) %>% + dplyr::select(Plate, IDs, Mean_Conc, Conc_SD, CV_Flag) %>% distinct(.keep_all = TRUE) %>% mutate(IDs = ifelse(Plate %like% "rr", paste0(IDs, "_RR"), IDs)) + +#Plot Samples before corrections +H2S_Spl_Plot_Pre <- ggplot(H2S_Spl_pre_viz, aes(y = Mean_Conc, x = IDs, fill = CV_Flag)) + + geom_bar(stat = 'identity', + position = position_dodge2(), + linewidth = 0.75, + col = "white") + + scale_fill_manual(values = c( + "CV_Good" = "green2", + "CV_High" = "pink2" + )) + + labs(y = "Sulfide (uM)", x = "Sample ID") + + geom_errorbar( + aes(ymin = Mean_Conc - Conc_SD, ymax = Mean_Conc + Conc_SD), + width = 0.3, + position = position_dodge(.1) + ) + + theme_classic() + + theme(legend.position = "bottom", axis.text.x = element_text( + angle = 90, + vjust = 0.5, + hjust = 1) + ) + + ggtitle("Sample triplicate means and sd dev before bad reps removed") + + +H2S_Spl_Plot_Pre + +H2S_Spl_rmv_viz <- H2S_SPL_CV_fin %>% mutate(IDs = toupper(IDs)) %>% + filter(str_detect(IDs, "P")) %>% + filter(!str_detect(IDs, "DUP")) %>% + filter(!str_detect(IDs, "SPIKE")) %>% + dplyr::select(Plate, IDs, Mean_Conc, SD_Conc, CV_Flag, Conc_Flag) %>% distinct(.keep_all = TRUE) %>% mutate(IDs = ifelse(Plate %like% "rr", paste0(IDs, "_RR"), IDs)) + +#Plot samples after Corrections +H2S_Spl_Plot_CV <- ggplot(H2S_Spl_rmv_viz, aes(y = Mean_Conc, x = IDs, fill = CV_Flag)) + + geom_bar(aes(col = Conc_Flag), stat = 'identity', + position = position_dodge(), + linewidth = 0.75) + + scale_fill_manual(values = c( + "CV_Good" = "green2", + "CV_High" = "pink2" + )) + + scale_color_manual(values = c("Within_Range" = "darkgreen", "adl" = "red3", "bdl" = "blue3" )) + + labs(y = "Sulfide (uM)", x = "Sample ID") + + geom_errorbar( + aes(ymin = Mean_Conc - SD_Conc, ymax = Mean_Conc + SD_Conc), + width = 0.3, + position = position_dodge(.1) + ) + + theme_classic() + + theme(legend.position = "bottom", axis.text.x = element_text( + angle = 90, + vjust = 0.5, + hjust = 1), + strip.text = element_blank(), + strip.background = element_blank() + ) + + ggtitle("Sample triplicate means and sd dev after bad reps removed") + + +H2S_Spl_Plot_CV + + + +``` + + +## Duplicate QAQC + +```{r,echo=FALSE} + +#pull out any rows that have "Dup" in the ID column and tag reruns +DUP_start <- H2S_SPL_CV_fin %>% mutate(Dup_ID = gsub(" ", "", substr(IDs, 1, 6)), + Dup = ifelse(IDs %like% "Dup", "Dup", "Org")) %>% mutate(Dup_ID = ifelse(Plate %like% "rr", paste0(Dup_ID, "_RR"), Dup_ID)) + +#separate dups from originals and tag for pairing + +dups_only <- DUP_start %>% filter(Dup == "Dup") %>% dplyr::select(Dup_ID, Mean_Conc, SD_Conc, Plate) %>% rename(Dup_Conc = Mean_Conc, Dup_SD = SD_Conc) %>% distinct(.keep_all = TRUE) + +no_dups <- DUP_start %>% filter(!Dup == "Dup") + +dup_spls_l <- dups_only %>% dplyr::select(Dup_ID) %>% distinct(.keep_all = TRUE) + +dup_spls <- no_dups %>% filter(Dup_ID %in% as.vector(dup_spls_l$Dup_ID)) %>% dplyr::select(Dup_ID, Mean_Conc, SD_Conc, Plate, IDs) %>% distinct(.keep_all = TRUE) + +dup_join <- full_join(dups_only, dup_spls, by = join_by(Dup_ID, Plate)) %>% na.omit() + +#Calculate Percent difference and Flag +dup_flags <- dup_join %>% + mutate(Diff_P = (abs(100 * (Mean_Conc - Dup_Conc) / mean(c(Mean_Conc, Dup_Conc))))) %>% + mutate(Dup_Flag = ifelse(Diff_P >= dups_perc_diff, "Dup_Bad", "Dup_Good")) + +#oraganize data for flagging and plotting +dup_flags_1 <- dup_flags %>% dplyr::select(Dup_ID, Dup_Flag, Diff_P, Plate) + +Dup_for_plot_1 <- DUP_start %>% dplyr::select(Plate, Mean_Conc, Dup_ID, IDs) %>% distinct(.keep_all = TRUE) %>% filter(Dup_ID %in% as.vector(dup_spls_l$Dup_ID)) %>% + left_join(dup_flags_1, by = join_by(Dup_ID, Plate)) %>% + mutate(Dup = ifelse(IDs %like% "Dup", "Duplicate", "Original")) %>% + dplyr::select(-IDs, -Mean_Conc, -Dup) %>% distinct(.keep_all = TRUE) %>% na.omit + +#plot Data +Dup_Plot <- ggplot(Dup_for_plot_1, + aes( + x = Plate, + y = Diff_P + )) + + geom_bar( + aes(fill = Dup_Flag), + stat = 'identity', + position = position_dodge2(preserve = "single"), + linewidth = 0.9 + ) + + geom_label_repel(data = as.data.frame(1), aes(x = "Plate1", y=17.5), label= "Percent Difference Cutoff", color = "red3", alpha = 0.7) + + geom_hline(aes(yintercept = dups_perc_diff), linetype = "dashed", linewidth = 1.5, color = "red3") + + labs(y = "Percent Difference", x = "Sample ID") + + scale_fill_manual(values = c( + "Dup_Good" = "darkgreen", + "Dup_Bad" = "darkred" + )) + + theme_classic()+ + theme(legend.position = "bottom") + + ggtitle("H2S Duplicates") + +Dup_Plot + + +``` + +## Display Dup Flags + +```{r, echo=FALSE} +Dup_Flag_1 <- dup_flags %>% group_by(Plate) %>% mutate(Dup_Flags = ifelse("Dup_Bad" %in% Dup_Flag, "Dup_Bad", "Dup_Good")) %>% dplyr::select(Plate, Dup_Flags) %>% rename(Dup_Flag = Dup_Flags) %>% distinct(.keep_all = TRUE) + +Dup_Flags_1 <-Dup_Flag_1 %>% mutate(Dup_Flags = paste0(Dup_Flag, "-", Plate)) + +Dup_Flags_2 <- Dup_Flags_1 %>% dplyr::select(Plate, Dup_Flag) %>% group_by(Plate) %>% mutate(Duplicate_Flag = ifelse("Dup_Bad" %in% Dup_Flag, "Dup_Bad", "")) %>% dplyr::select(Plate, Duplicate_Flag) %>% rename(Dup_Flag = Duplicate_Flag) %>% distinct(.keep_all = TRUE) + +Bad_Dups <- dup_flags %>% filter(str_detect(Dup_Flag, "Dup_Bad")) + +Bad_D_N <- length(Bad_Dups$Dup_Flag) + +Total_D_N <- length(dup_flags$Dup_Flag) + +ifelse(Bad_D_N/Total_D_N > 0.4, paste0("<60% of Dups Pass, Rerun"), paste0(">60% Dups Pass") ) + +Duplicate_Flag <- ifelse(Bad_D_N/Total_D_N > 0.4, paste0(" >40% Dups Fail"), "" ) + +knitr::kable(Dup_Flag_1, format="markdown") + + +``` + +## Spike QAQC +```{r, echo=FALSE} +#pull out any rows that have "Spk" in the ID column +SPK_start <- H2S_SPL_CV_fin %>% mutate(Spk_ID = gsub(" ", "", substr(IDs, 1, 6)), + Spk = ifelse(IDs %like% "Spike", "Spk", "Org")) %>% mutate(Spk_ID = ifelse(Plate %like% "rr", paste0(Spk_ID, "_RR"), Spk_ID)) +#separate spikes from originals +spks_only <- SPK_start %>% filter(Spk == "Spk") %>% dplyr::select(Spk_ID, Mean_Conc, SD_Conc, Dilution, Plate) %>% rename(Spk_Conc = Mean_Conc, + Spk_SD = SD_Conc, + Spk_Dilution = Dilution) %>% distinct(.keep_all = TRUE) + +no_spks <- SPK_start %>% filter(!Spk == "Spk") + +spls_l <- no_spks %>% dplyr::select(Spk_ID) %>% distinct(.keep_all = TRUE) + +spk_spls_l <- spks_only %>% dplyr::select(Spk_ID) %>% distinct(.keep_all = TRUE) + +spk_spls <- no_spks %>% filter(Spk_ID %in% as.vector(spk_spls_l$Spk_ID)) %>% dplyr::select(Spk_ID, Mean_Conc, SD_Conc, Plate, IDs, Dilution) %>% distinct(.keep_all = TRUE) + +SPK_only <- spks_only %>% filter(Spk_ID %in% as.vector(spls_l$Spk_ID)) + +spk_join <- full_join(SPK_only, spk_spls, by = join_by(Spk_ID, Plate)) + +#Calculate recovery and flag data +spk_flags <- spk_join %>% mutate( + Spl_mol = (sample_vol / Con1) * (Mean_Conc / Dilution), + Spk_mol = ((sample_vol + spkvol) / Con1) * (Spk_Conc / Spk_Dilution), + Spk_exp = Spl_mol + spk_Conc, + Spk_recovery = (Spk_mol/Spk_exp) * 100) %>% + mutate( + Spk_Flag = ifelse( + Spk_recovery >= high_recovery_cutoff | + Spk_recovery <= low_recovery_cutoff, + "Spk_Bad", + "Spk_Good" + ) + ) + +#organize data for flagging and plotting +spk_flags_1 <- spk_flags %>% dplyr::select(Spk_ID, Spk_Flag, Spk_recovery, Plate) %>% na.omit() + +Spk_for_plot_a <- SPK_start %>% dplyr::select(Plate, Mean_Conc, Spk_ID, IDs) %>% + distinct(.keep_all = TRUE) %>% + filter(Spk_ID %in% as.vector(spk_spls_l$Spk_ID)) %>% + left_join(spk_flags_1, by = join_by(Spk_ID, Plate)) %>% + mutate(Spk = ifelse(IDs %like% "Spike", "Spike", "Original")) %>% + filter(Spk_ID %in% as.vector(spls_l$Spk_ID)) + +Spk_for_plot_1 <- Spk_for_plot_a %>% dplyr::select(Plate, Spk_ID, Spk_recovery, Spk_Flag) %>% na.omit() %>% distinct(.keep_all = TRUE) + +#plot data +Spk_Plot <- ggplot(Spk_for_plot_1, + aes( + x = Plate, + y = Spk_recovery + )) + + geom_rect(aes(xmin=0, xmax=Inf, ymin=low_recovery_cutoff, ymax=high_recovery_cutoff), alpha = 0.25, fill ="palegreen") + + geom_bar( aes(fill = Spk_Flag), + stat = 'identity', + position = position_dodge2(preserve = "single"), + linewidth = 0.9 + ) + + geom_hline(aes(yintercept = high_recovery_cutoff), linetype = "dashed", color = "green3", linewidth = 1.5) + + geom_hline(aes(yintercept = low_recovery_cutoff), linetype = "dashed", color = "green3", linewidth = 1.5) + + geom_label_repel(data = as.data.frame(1),aes(x = "Plate1", y=high_recovery_cutoff - 7.5), label= "Acceptable Recovery Range", color = "darkgreen", alpha = 0.7) + + labs(y = "Spike Recovery (%)", x = "Plate") + + scale_fill_manual(values = c( + "Spk_Good" = "darkgreen", + "Spk_Bad" = "darkred" + )) + + theme_classic() + + theme(legend.position = "bottom") + + ggtitle("H2S Spikes") + +Spk_Plot + + +``` + +## Display Spike Flags +```{r, echo=FALSE} + +#Check if all Spikes are paired +ifelse(all(as.vector(spk_spls_l$Spk_ID) %in% as.vector(spls_l$Spk_ID)), paste0("Spikes Paired"), paste0("Spike Missing Pair")) + +#Format Data frame +Spk_Flag_1 <- spk_flags %>% dplyr::select(Plate, IDs, Spk_Flag) %>% na.omit() + +#Attach Plate to Flag +Spk_Flags_1 <-Spk_Flag_1 %>% group_by(Plate) %>% mutate(Spk_Flags_T = ifelse( "Spk_Bad" %in% Spk_Flag, paste0("Spk_Bad"), paste0("Spk_Good"))) %>% mutate(Spk_Flags = paste0(Spk_Flags_T, "-", Plate))%>% ungroup() +#If any Spikes in Plate are bad, then flag plate +Spk_Flags_2 <- Spk_Flags_1 %>% dplyr::select(Plate, Spk_Flag) %>% group_by(Plate) %>% mutate(Spike_Flag = ifelse("Spk_Bad" %in% Spk_Flag, "Spk_Bad", "")) %>% dplyr::select(Plate, Spike_Flag) %>% rename(Spk_Flag = Spike_Flag) %>% distinct(.keep_all = TRUE) + +Spk_disp <- Spk_Flags_1 %>% dplyr::select(Plate, Spk_Flags_T) %>% rename(Spike_Flag = Spk_Flags_T) %>% distinct(.keep_all = TRUE) %>% na.omit() + +knitr::kable(Spk_disp, format="markdown") + +bad <- Spk_Flag_1 %>% filter(Spk_Flag %like% "Bad") + +length_bad <- length(as.vector(bad$Spk_Flag)) + +length_all <- length(as.vector(Spk_Flag_1$Spk_Flag)) + +ifelse(length_bad/length_all > 0.4, paste0("<60% of Spikes Pass, Rerun"), paste0("Spikes Pass") ) + +Spike_Flag <- ifelse(length_bad/length_all > 0.4, paste0(">40% Spikes Fail"), "" ) + +``` + + +## Merge samples with Metadata & check all samples are present +```{r check sample ids with metadata, echo=FALSE} +#Get Samples Only +H2S_spls_md <- H2S_SPL_CV_fin %>% mutate(IDs = toupper(IDs)) %>% + filter(str_detect(IDs, "P")) %>% + filter(!str_detect(IDs, "DUP")) %>% + filter(!str_detect(IDs, "SPIKE")) + +#Check for reruns and replace +H2S_spl_rrn <- H2S_spls_md %>%group_by(IDs,Plate) %>% + filter(Plate %like% "rr") %>% ungroup() %>% + dplyr::select(IDs, Mean_Conc, Conc_Flag, Dilution) %>% + rename(RRN_Conc = Mean_Conc, Conc_Flag_rr = Conc_Flag, Dilution_rr = Dilution) %>% + distinct(.keep_all = TRUE) + +RRN_IDs <- as.vector(H2S_spl_rrn$IDs) + +H2S_spl_og <- H2S_spls_md %>% + filter(!Plate %like% "rr") %>% + dplyr::select(IDs, Mean_Conc, Conc_Flag, Plate, CV_Flag, Dilution, CV) %>% + distinct(.keep_all = TRUE) %>% + mutate(Rerun = ifelse(IDs %in% RRN_IDs, "RRN", "Org")) + +H2S_spl_rr_join <- full_join(H2S_spl_rrn,H2S_spl_og, by = join_by(IDs) ) + +Samples_Tagged <- H2S_spl_rr_join %>% mutate( + Conc = ifelse(Rerun == "RRN", RRN_Conc, Mean_Conc), + Conc_Flag = ifelse(Rerun == "RRN", Conc_Flag_rr, Conc_Flag), + Dilution = ifelse(Rerun == "RRN", Dilution_rr, Dilution) +) %>% dplyr::select(IDs, Conc, Conc_Flag, CV_Flag, Plate, Dilution, CV) %>% rename(Sample_ID = IDs) %>% ungroup() %>% group_by(Sample_ID) %>% mutate( + Min_CV = ifelse(CV == min(CV), "KEEP", "RMV"), # get if CV is lowest of reruns + Within_Range = "Within_Range" %in% Conc_Flag, #Get if any are within range + BDL = "bdl" %in% Conc_Flag, #get if any are below detection limit + Max_Dil = max(Dilution), #get maximum dilution of reruns + Min_Dil = min(Dilution),#get minimum dilution of reruns + All_Good = all(Conc_Flag == "Within_Range") & all(CV_Flag == "CV_Good"), #get if all are within range and good cv + CV_Check = CV == min(CV[which(Dilution == Max_Dil)]), #Get if CV is lowest of highest dilution for reruns + Number = length(Conc) #get number of times ran +) %>% ungroup() %>% + mutate(Remove = ifelse(Number == 1, #check if sample was reran + "KEEP", + ifelse(All_Good, #check if multiple samples meet all criteria + ifelse(Min_CV == "KEEP", #Keep only lowest CV + "KEEP1", + "RMV1"), + ifelse(Conc_Flag == "Within_Range" & CV_Flag == "CV_Good", #If only one sample meets all criteria keep that one + "KEEP2", ifelse(Conc_Flag == "Within_Range", "KEEP2a", + ifelse(!(Within_Range) & BDL, #Check if none are within range but are under detection limit + ifelse(Dilution == Min_Dil, #keep lowest dilution + "KEEP3", + "RMV3"), + ifelse(!(Within_Range) & CV_Check, #if all are above detection limit keep lowest CV of highest dilution + "KEEP4", + "RMV4") + ) + ) + )))) + +Samples <- Samples_Tagged %>% filter(Remove %like% "KEEP") + +#check to see if all samples are present in the metadata +all_present <- all(metadata$Sample_ID %in% Samples$Sample_ID) + +if (all_present) { + message("All sample IDs are present in data") +} else { + message("Some sample IDs are missing from data.") + + # Optional: Which ones are missing? + missing_ids <- setdiff(metadata$Sample_ID, Samples$Sample_ID) + print(missing_ids) +} + + +#merge metadata with sample run data +merged_data <- metadata %>% + mutate(Sample_ID = paste0("\\b", Sample_ID, "\\b")) %>% + fuzzyjoin::regex_left_join(Samples, ., by = c(Sample_ID = "Sample_ID")) + +#might want to include a flag or something to see that all the samples are included? + +``` + + +##Add Flags +```{r, echo=FALSE} + +#Get only bad flags for each plate and check +Chk_Flags_All <- Chk_Flags %>% dplyr::select(Plate, CHKs_Flag) %>% filter(CHKs_Flag %like% "Bad") %>% na.omit() %>% distinct(.keep_all = TRUE) %>% group_by(Plate) %>% + summarise( + CHKSTD_Flags = paste(CHKs_Flag, collapse = ", "), + .groups = 'drop' # Drops the grouping structure after summarizing + ) + + +STD_Flags_All <- STD_CRV_flags %>% dplyr::select(Plate, R2_Flag, CV_Flag) %>% mutate(STDCV_Flags = paste0("STD", CV_Flag)) %>% dplyr::select(-CV_Flag) %>% mutate( + R2_Flag = ifelse(R2_Flag %like% "Good", NA, R2_Flag), + STDCV_Flags = ifelse(STDCV_Flags %like% "Good", NA, STDCV_Flags) +) %>% na.omit() + +Flags_Int <- tibble(Plate = c(plates)) + +#Join Flags + +Flags_Joined_1 <-left_join(Flags_Int, Dup_Flags_2, by = join_by(Plate)) + +Flags_Joined_2 <- left_join(Flags_Joined_1, Spk_Flags_2, by = join_by(Plate)) + +Flags_Joined_3 <- left_join(Flags_Joined_2, Chk_Flags_All, by = join_by(Plate)) + +Flags_Joined_4 <- left_join(Flags_Joined_3, STD_Flags_All, by = join_by(Plate)) + +Flags_Joined <- left_join(Flags_Joined_4, Curve_Flags_forJoin, by = join_by(Plate)) + + +Flags_Joined[Flags_Joined == "NA"] <- NA + +#Merge Flags into one column +Flags <- Flags_Joined %>% replace(is.na(.), "") %>% mutate( + H2S_Flags = paste0( + Spk_Flag, + " ", + Dup_Flag, + " ", + CHKSTD_Flags, + " ", + R2_Flag, + " ", + STDCV_Flags, + " ", + Slope_Flag, + " ", + Int_Flag + ) +) %>% dplyr::select(Plate, H2S_Flags) + +#Add Flags to data +flagged_data <- left_join(merged_data, Flags, by = join_by(Plate)) + + +df_all_clean <- flagged_data %>% dplyr::select(-Plate) + +``` + +##Organize Data +```{r, echo=FALSE} +#check results +#head(Samples) + +#pull out what we need + +df_all_clean_cols <- df_all_clean %>% + dplyr::select( + Site, + Project, + Year, + Month, + Community, + Nickname, + Plot_Name, + SubPlot, + Depth_cm, + CO2_Treatment, + N_Treatment, + Conc, + Conc_Flag, + CV_Flag, + H2S_Flags + ) + +final_data_labeled <- df_all_clean_cols %>% + mutate( + Run_notes = Run_notes,# new column with notes about the run + Analysis_rundate = Run_Date) + +#rename columns +org_labeled_fin_data <- final_data_labeled %>% + rename( + H2S_Conc_uM = Conc, + H2S_Conc_Flag = Conc_Flag, + Plot = Plot_Name, + H2S_CV_Flag = CV_Flag + ) + +#Order Columns for Final Data Frame +All_Clean_Data <- org_labeled_fin_data %>% + dplyr::select( + Site, + Project, + Year, + Month, + Community, + Nickname, + Plot, + SubPlot, + Depth_cm, + CO2_Treatment, + N_Treatment, + H2S_Conc_uM, + H2S_Conc_Flag, + H2S_CV_Flag, + H2S_Flags, + Analysis_rundate, + Run_notes + ) +#head(Samples1) + +``` + +## Visualize Data +```{r Visualize Data, echo=FALSE} +cat("Visualize Data") + +### Ammonia +H2S_forplot <- All_Clean_Data + +color1 <- c("P1", "P2", "P3", "P4") +color2 <- c("P5", "P6", "P7", "P8") +color3 <- c("P10", "P9", "P11", "P12") + + +H2S_forplot <- H2S_forplot %>% + mutate( + Treatment1 = ifelse( + CO2_Treatment == "Elevated" & + N_Treatment == "Amended", + "eCO2 & eN", + ifelse( + CO2_Treatment == "Elevated" & + N_Treatment == "Ambient", + "eCO2 & aN", + ifelse( + CO2_Treatment == "Ambient" & + N_Treatment == "Amended" , + "aCO2 & eN" , + "aCO2 & aN" + ) + ) + ) + ) %>% + mutate(Treatment = ifelse( + SubPlot == "A", + ifelse( + CO2_Treatment == "Elevated" & + N_Treatment == "Amended", + "eCO2_eN_Phrag", + ifelse( + CO2_Treatment == "Elevated" & + N_Treatment == "Ambient", + "eCO2_aN_Phrag", + ifelse( + CO2_Treatment == "Ambient" & + N_Treatment == "Amended" , + "aCO2_eN_Phrag" , + "aCO2_aN_Phrag" + ) + ) + ), + ifelse( + CO2_Treatment == "Elevated" & + N_Treatment == "Amended", + "eCO2_eN_Native", + ifelse( + CO2_Treatment == "Elevated" & + N_Treatment == "Ambient", + "eCO2_aN_Native", + ifelse( + CO2_Treatment == "Ambient" & + N_Treatment == "Amended" , + "aCO2_eN_Native" , + "aCO2_aN_Native" + ) + ) + ) + )) %>% + mutate(CO2_Treatment = ifelse(CO2_Treatment == "Ambient", "aCO2", "eCO2")) %>% + mutate(N_Treatment = ifelse(N_Treatment == "Ambient", "aN", "eN")) %>% + mutate( + Plot_Color = case_when( + Plot %in% color1 ~ "Color1", + Plot %in% color2 ~ "Color2", + Plot %in% color3 ~ "Color3" + ) + ) + + +H2S_forplot <- H2S_forplot[order(H2S_forplot$Depth_cm), ] + +viz_H2S_plot_v2 <- ggplot( + data = H2S_forplot, + aes( + x = factor(as.factor(CO2_Treatment), levels = c("eCO2", "aCO2")), + y = H2S_Conc_uM, + fill = as.factor(Treatment), + color = as.factor(Treatment), + pattern = as.factor(Treatment) + ) +) + + geom_bar_pattern( + stat = "identity", + position = position_dodge2(padding = 0.25, preserve = "single"), + pattern_angle = 45, + pattern_density = 0.1, + pattern_spacing = 0.025, + pattern_key_scale_factor = 0.6 + ) + + facet_grid(Depth_cm ~ N_Treatment, scales = "fixed") + + scale_fill_manual( + values = c( + "eCO2_eN_Phrag" = "#DB5461", + "eCO2_aN_Phrag" = "#454ADE", + "aCO2_eN_Phrag" = "white", + "aCO2_aN_Phrag" = "white", + "eCO2_eN_Native" = "#DB5461", + "eCO2_aN_Native" = "#454ADE", + "aCO2_eN_Native" = "white", + "aCO2_aN_Native" = "white" + ), + name = "Treatment:", + breaks = c( + "eCO2_eN_Phrag", + "eCO2_aN_Phrag", + "aCO2_aN_Phrag", + "aCO2_eN_Phrag", + "eCO2_eN_Native", + "eCO2_aN_Native", + "aCO2_aN_Native", + "aCO2_eN_Native" + ), + labels = c( + "eCO2_eN_Phrag", + "eCO2_aN_Phrag", + "aCO2_aN_Phrag", + "aCO2_eN_Phrag", + "eCO2_eN_Native", + "eCO2_aN_Native", + "aCO2_aN_Native", + "aCO2_eN_Native" + ) + + ) + + scale_color_manual( + values = c( + "eCO2_eN_Phrag" = "#DB5461", + "eCO2_aN_Phrag" = "#454ADE", + "aCO2_eN_Phrag" = "#DB5461", + "aCO2_aN_Phrag" = "#454ADE", + "eCO2_eN_Native" = "#DB5461", + "eCO2_aN_Native" = "#454ADE", + "aCO2_eN_Native" = "#DB5461", + "aCO2_aN_Native" = "#454ADE" + ), + name = "Treatment:", + breaks = c( + "eCO2_eN_Phrag", + "eCO2_aN_Phrag", + "aCO2_aN_Phrag", + "aCO2_eN_Phrag", + "eCO2_eN_Native", + "eCO2_aN_Native", + "aCO2_aN_Native", + "aCO2_eN_Native" + ), + labels = c( + "eCO2_eN_Phrag", + "eCO2_aN_Phrag", + "aCO2_aN_Phrag", + "aCO2_eN_Phrag", + "eCO2_eN_Native", + "eCO2_aN_Native", + "aCO2_aN_Native", + "aCO2_eN_Native" + ) + + ) + + scale_pattern_manual( + values = c( + "eCO2_eN_Phrag" = "stripe", + "eCO2_aN_Phrag" = "stripe", + "aCO2_eN_Phrag" = "stripe", + "aCO2_aN_Phrag" = "stripe", + "eCO2_eN_Native" = "none", + "eCO2_aN_Native" = "none", + "aCO2_eN_Native" = "none", + "aCO2_aN_Native" = "none" + ), + name = "Treatment:", + breaks = c( + "eCO2_eN_Phrag", + "eCO2_aN_Phrag", + "aCO2_aN_Phrag", + "aCO2_eN_Phrag", + "eCO2_eN_Native", + "eCO2_aN_Native", + "aCO2_aN_Native", + "aCO2_eN_Native" + ), + labels = c( + "eCO2_eN_Phrag", + "eCO2_aN_Phrag", + "aCO2_aN_Phrag", + "aCO2_eN_Phrag", + "eCO2_eN_Native", + "eCO2_aN_Native", + "aCO2_aN_Native", + "aCO2_eN_Native" + ) + ) + + theme_classic() + + labs( + x = " ", + y = "H2S (uM)", + title = "CO2xNxPhrag: Porewater Sulfide", + fill = "CO2 Treatment:", + color = "N Treatment:", + pattern = "Subplot:" + ) + + theme(legend.position = "right") + + scale_x_discrete(drop = TRUE) + + theme( + axis.text.x = element_text(angle = 0, hjust = 0.5), + panel.border = element_rect( + color = "black", + fill = NA, + linewidth = 0.8 + ) + ) + + coord_flip() +print(viz_H2S_plot_v2) + + +``` + +```{r, echo = FALSE} +#make plot + +H2S_forplot <- H2S_forplot %>% + mutate(Sub_Plot = ifelse(SubPlot == "A", "Phrag", "Native")) + +viz_H2S_plot_2 <- ggplot(data = H2S_forplot, aes(x = H2S_Conc_uM, y = as.numeric(Depth_cm), color = Plot_Color)) + + geom_point(size = 3) + + geom_path(linewidth = 1) + + scale_color_manual( + values = c( + "Color1" = "#FFD500", + "Color2" = "#00D0FF", + "Color3" = "#FF0075" + + ), + labels = c("1", "2", "3") + ) + + facet_grid(Treatment1 ~ ., scales = "fixed") + + labs( + x = "H2S (uM)", + y = "Depth (cm)", + title = "CO2xNxPhrag: Porewater H2S by Replicate", + color = "Replicate" + ) + + scale_y_reverse(breaks = c(20, 40), limits = c(45, 15)) + + theme_classic() + + theme( + axis.text.x = element_text(angle = 0, hjust = 0.5), + panel.border = element_rect( + color = "black", + fill = NA, + linewidth = 0.8 + ) + ) + +viz_H2S_plot_2 +``` + + +##Export Data +```{r, echo=FALSE} +write.csv(unique_log, log_path) + Rerun_Data <- All_Clean_Data %>% filter(H2S_Conc_Flag != "Within Range" | H2S_CV_Flag %like% "High") + +if(After_Reruns == "YES"){ + write.csv(All_Clean_Data, final_path)} else { + write.csv(Rerun_Data, rerun_path) } +#end +``` + + +### END \ No newline at end of file diff --git a/CO2xNxPhrag/Porewater/Sulfide/2026/Processed Data/GCReW_CO2xNxPhrag_Porewater_H2S_2026.csv b/CO2xNxPhrag/Porewater/Sulfide/2026/Processed Data/GCReW_CO2xNxPhrag_Porewater_H2S_2026.csv new file mode 100644 index 0000000..a17c1be --- /dev/null +++ b/CO2xNxPhrag/Porewater/Sulfide/2026/Processed Data/GCReW_CO2xNxPhrag_Porewater_H2S_2026.csv @@ -0,0 +1,25 @@ +"","Site","Project","Year","Month","Community","Nickname","Plot","SubPlot","Depth_cm","CO2_Treatment","N_Treatment","H2S_Conc_uM","H2S_Conc_Flag","H2S_CV_Flag","H2S_Flags","Analysis_rundate","Run_notes" +"1","GCReW","CO2xNxPhrag","2026","May","PHAU","Phrag","P3","A",40,"Ambient","Amended",68.8086956521739,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad, Std4Chk_Bad ",2026-05-19,"" +"2","GCReW","CO2xNxPhrag","2026","May","PHAU","Phrag","P4","A",20,"Elevated","Amended",93.0434782608696,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad, Std4Chk_Bad ",2026-05-19,"" +"3","GCReW","CO2xNxPhrag","2026","May","PHAU","Phrag","P8","A",20,"Ambient","Ambient",231.086956521739,"Within_Range","CV_Good","Spk_Bad Std3Chk_Bad, Std5Chk_Bad ",2026-05-19,"" +"4","GCReW","CO2xNxPhrag","2026","May","PHAU","Phrag","P1","A",20,"Ambient","Ambient",431.766381766382,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad, Std4Chk_Bad ",2026-05-19,"" +"5","GCReW","CO2xNxPhrag","2026","May","PHAU","Phrag","P4","A",40,"Elevated","Amended",562.820512820513,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad, Std4Chk_Bad ",2026-05-19,"" +"6","GCReW","CO2xNxPhrag","2026","May","PHAU","Phrag","P1","A",40,"Ambient","Ambient",876.923076923077,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad, Std4Chk_Bad ",2026-05-19,"" +"7","GCReW","CO2xNxPhrag","2026","May","PHAU","Phrag","P2","A",20,"Elevated","Ambient",408.974358974359,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad, Std4Chk_Bad ",2026-05-19,"" +"8","GCReW","CO2xNxPhrag","2026","May","PHAU","Phrag","P2","A",40,"Elevated","Ambient",755.128205128205,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad, Std4Chk_Bad ",2026-05-19,"" +"9","GCReW","CO2xNxPhrag","2026","May","PHAU","Phrag","P5","A",40,"Elevated","Ambient",1361.96581196581,"Within_Range","CV_Good","Spk_Bad Std3Chk_Bad, Std5Chk_Bad ",2026-05-19,"" +"10","GCReW","CO2xNxPhrag","2026","May","PHAU","Phrag","P9","A",40,"Elevated","Amended",1054.2735042735,"Within_Range","CV_Good","Spk_Bad Std3Chk_Bad, Std5Chk_Bad ",2026-05-19,"" +"11","GCReW","CO2xNxPhrag","2026","May","PHAU","Phrag","P12","A",20,"Ambient","Amended",1199.57264957265,"Within_Range","CV_Good","Spk_Bad Std3Chk_Bad, Std5Chk_Bad ",2026-05-19,"" +"12","GCReW","CO2xNxPhrag","2026","May","PHAU","Phrag","P6","A",20,"Ambient","Amended",440.31339031339,"Within_Range","CV_Good","Spk_Bad Std3Chk_Bad, Std5Chk_Bad ",2026-05-19,"" +"13","GCReW","CO2xNxPhrag","2026","May","PHAU","Phrag","P12","A",40,"Ambient","Amended",1448.8603988604,"Within_Range","CV_Good","Spk_Bad Std3Chk_Bad, Std5Chk_Bad ",2026-05-19,"" +"14","GCReW","CO2xNxPhrag","2026","May","PHAU","Phrag","P6","A",40,"Ambient","Amended",817.806267806268,"Within_Range","CV_Good","Spk_Bad Std3Chk_Bad, Std5Chk_Bad ",2026-05-19,"" +"15","GCReW","CO2xNxPhrag","2026","May","PHAU","Phrag","P3","A",20,"Ambient","Amended",2.50997150997151,"bdl","CV_Good","Spk_Bad Std3Chk_Bad, Std5Chk_Bad ",2026-05-19,"" +"16","GCReW","CO2xNxPhrag","2026","May","PHAU","Phrag","P7","A",20,"Elevated","Amended",531.481481481482,"Within_Range","CV_Good","Spk_Bad Std3Chk_Bad, Std5Chk_Bad ",2026-05-19,"" +"17","GCReW","CO2xNxPhrag","2026","May","PHAU","Phrag","P7","A",40,"Elevated","Amended",729.487179487179,"Within_Range","CV_Good","Spk_Bad Std3Chk_Bad, Std5Chk_Bad ",2026-05-19,"" +"18","GCReW","CO2xNxPhrag","2026","May","PHAU","Phrag","P10","A",20,"Elevated","Ambient",383.333333333333,"Within_Range","CV_Good","Spk_Bad Std3Chk_Bad, Std5Chk_Bad ",2026-05-19,"" +"19","GCReW","CO2xNxPhrag","2026","May","PHAU","Phrag","P10","A",40,"Elevated","Ambient",716.666666666667,"Within_Range","CV_Good","Spk_Bad Std3Chk_Bad, Std5Chk_Bad ",2026-05-19,"" +"20","GCReW","CO2xNxPhrag","2026","May","PHAU","Phrag","P8","A",40,"Ambient","Ambient",712.393162393162,"Within_Range","CV_Good","Spk_Bad Std3Chk_Bad, Std5Chk_Bad ",2026-05-19,"" +"21","GCReW","CO2xNxPhrag","2026","May","PHAU","Phrag","P11","A",20,"Ambient","Ambient",723.076923076923,"Within_Range","CV_Good","Spk_Bad Std3Chk_Bad, Std5Chk_Bad ",2026-05-19,"" +"22","GCReW","CO2xNxPhrag","2026","May","PHAU","Phrag","P5","A",20,"Elevated","Ambient",934.615384615385,"Within_Range","CV_Good","Spk_Bad Std3Chk_Bad, Std5Chk_Bad ",2026-05-19,"" +"23","GCReW","CO2xNxPhrag","2026","May","PHAU","Phrag","P9","A",20,"Elevated","Amended",396.153846153846,"Within_Range","CV_Good","Spk_Bad Std3Chk_Bad, Std5Chk_Bad ",2026-05-19,"" +"24","GCReW","CO2xNxPhrag","2026","May","PHAU","Phrag","P11","A",40,"Ambient","Ambient",1692.45014245014,"Within_Range","CV_Good","Spk_Bad Std3Chk_Bad, Std5Chk_Bad ",2026-05-19,"" diff --git a/CO2xNxPhrag/Porewater/Sulfide/2026/Processed Data/LTREB_2M_H2S_QAQC_2026.csv b/CO2xNxPhrag/Porewater/Sulfide/2026/Processed Data/LTREB_2M_H2S_QAQC_2026.csv new file mode 100644 index 0000000..4ba0270 --- /dev/null +++ b/CO2xNxPhrag/Porewater/Sulfide/2026/Processed Data/LTREB_2M_H2S_QAQC_2026.csv @@ -0,0 +1,221 @@ +"","Plate","Curve","R2","Slope","Intercept","Run_Date","Run" +"1",NA,"H2S",0.991219025,0.01093912,0.100689277,2025-09-22,"Past Runs" +"2",NA,"H2S",0.993877242,0.011939201,0.06915697,2025-09-22,"Past Runs" +"3",NA,"H2S",0.993801685,0.00988706,0.089656986,2025-09-22,"Past Runs" +"4",NA,"H2S",0.98902287,0.011446925,0.096027164,2025-09-19,"Past Runs" +"5",NA,"H2S",0.994548336,0.011899625,0.083277661,2025-09-19,"Past Runs" +"6",NA,"H2S",0.992796039,0.009941877,0.087862342,2025-09-19,"Past Runs" +"7",NA,"H2S",0.997865585,0.011856306,0.066974671,2025-09-19,"Past Runs" +"8",NA,"H2S",0.986077314,0.012606847,0.075308108,2025-09-19,"Past Runs" +"9",NA,"H2S",0.992846269,0.01106119,0.083271756,2025-09-19,"Past Runs" +"10",NA,"H2S",0.989586556,0.012257337,0.086131432,2025-09-18,"Past Runs" +"11",NA,"H2S",0.994028851,0.011363046,0.089013852,2025-09-18,"Past Runs" +"12",NA,"H2S",0.986483002,0.012786783,0.079924043,2025-09-18,"Past Runs" +"13",NA,"H2S",0.987456283,0.010471189,0.097437793,2025-09-18,"Past Runs" +"14",NA,"H2S",0.990170085,0.011201815,0.080205858,2025-09-18,"Past Runs" +"15",NA,"H2S",0.994921447,0.011747968,0.0821679,2025-09-18,"Past Runs" +"16",NA,"H2S",0.988565262,0.011839841,0.069910825,2025-07-16,"Past Runs" +"17",NA,"H2S",0.991619504,0.011745192,0.081514125,2025-07-16,"Past Runs" +"18",NA,"H2S",0.990299632,0.011051745,0.072271651,2025-07-16,"Past Runs" +"19",NA,"H2S",0.991820501,0.011030978,0.107305831,2025-07-16,"Past Runs" +"20",NA,"H2S",0.987843267,0.011940853,0.084781412,2025-07-16,"Past Runs" +"21",NA,"H2S",0.992091938,0.011957557,0.080297784,2025-07-16,"Past Runs" +"22",NA,"H2S",0.991711318,0.011277024,0.093205964,2025-07-16,"Past Runs" +"23",NA,"H2S",0.990221806,0.012007601,0.081764155,2025-07-15,"Past Runs" +"24",NA,"H2S",0.985259661,0.010168475,0.104301957,2025-07-15,"Past Runs" +"25",NA,"H2S",0.988492907,0.011813071,0.068994131,2025-07-16,"Past Runs" +"26",NA,"H2S",0.994149685,0.013418056,0.072423824,2025-07-15,"Past Runs" +"27",NA,"H2S",0.991748191,0.011735538,0.088628605,2025-07-15,"Past Runs" +"28",NA,"H2S",0.989333168,0.012411661,0.088435965,2025-07-15,"Past Runs" +"29",NA,"H2S",0.992931678,0.011946484,0.10370681,2025-07-14,"Past Runs" +"30",NA,"H2S",0.99409875,0.011778654,0.091418456,2025-07-14,"Past Runs" +"31",NA,"H2S",0.988158507,0.010797151,0.091271836,2025-07-14,"Past Runs" +"32",NA,"H2S",0.992095456,0.010752828,0.104719179,2025-07-14,"Past Runs" +"33",NA,"H2S",0.99451618,0.011110069,0.090558393,2025-07-14,"Past Runs" +"34",NA,"H2S",0.992226742,0.012274256,0.095585343,2025-08-27,"Past Runs" +"35",NA,"H2S",0.989946431,0.01162827,0.097001612,2025-08-27,"Past Runs" +"36",NA,"H2S",0.988459596,0.011593871,0.102538661,2025-08-27,"Past Runs" +"37",NA,"H2S",0.984009845,0.01077442,0.094690475,2025-08-08,"Past Runs" +"38",NA,"H2S",0.991998684,0.012003707,0.087888803,2025-08-08,"Past Runs" +"39",NA,"H2S",0.988472937,0.013654087,0.080747996,2025-08-08,"Past Runs" +"40",NA,"H2S",0.989644138,0.011187528,0.100376401,2025-08-08,"Past Runs" +"41",NA,"H2S",0.991253241,0.01240335,0.091781398,2025-07-28,"Past Runs" +"42",NA,"H2S",0.985302046,0.010983613,0.096511057,2025-07-28,"Past Runs" +"43",NA,"H2S",0.989746609,0.012199156,0.083958107,2025-07-28,"Past Runs" +"44",NA,"H2S",0.983978644,0.01257192,0.082066064,2025-07-28,"Past Runs" +"45",NA,"H2S",0.985041184,0.013253135,0.095890286,2025-06-23,"Past Runs" +"46",NA,"H2S",0.988479922,0.012770225,0.097515258,2025-06-23,"Past Runs" +"47",NA,"H2S",0.986622245,0.014490479,0.088550945,2025-06-23,"Past Runs" +"48",NA,"H2S",0.98593674,0.012464999,0.101324152,2025-06-23,"Past Runs" +"49",NA,"H2S",0.992217588,0.011106834,0.087410369,2025-06-03,"Past Runs" +"50",NA,"H2S",0.994571071,0.01266079,0.086043319,2025-06-03,"Past Runs" +"51",NA,"H2S",0.987008654,0.01202734,0.088509886,2025-06-03,"Past Runs" +"52",NA,"H2S",0.991890557,0.010510502,0.089450704,2025-06-03,"Past Runs" +"53",NA,"H2S",0.990808319,0.011660482,0.083892866,2025-06-03,"Past Runs" +"54",NA,"H2S",0.99195308,0.012188907,0.076050353,2025-06-03,"Past Runs" +"55",NA,"H2S",0.990300427,0.011117767,0.095151906,2025-06-03,"Past Runs" +"56",NA,"H2S",0.990287741,0.012773563,0.085475942,2025-06-02,"Past Runs" +"57",NA,"H2S",0.985219853,0.012034496,0.101191716,2025-06-02,"Past Runs" +"58",NA,"H2S",0.990742934,0.012442945,0.09150939,2025-06-02,"Past Runs" +"59",NA,"H2S",0.988190426,0.012914305,0.098581692,2025-06-02,"Past Runs" +"60",NA,"H2S",0.989470668,0.01309737,0.091276263,2025-06-02,"Past Runs" +"61",NA,"H2S",0.985446517,0.012512003,0.101529112,2025-06-02,"Past Runs" +"62",NA,"H2S",0.989516031,0.009990116,0.090615023,2025-05-29,"Past Runs" +"63",NA,"H2S",0.989050067,0.009114036,0.092492755,2025-05-29,"Past Runs" +"64",NA,"H2S",0.992170999,0.009329021,0.090250992,2025-05-27,"Past Runs" +"65",NA,"H2S",0.991744664,0.009917044,0.078245698,2025-05-27,"Past Runs" +"66",NA,"H2S",0.994352551,0.009616728,0.087789906,2025-05-27,"Past Runs" +"67",NA,"H2S",0.985006054,0.009610255,0.07704108,2025-05-27,"Past Runs" +"68",NA,"H2S",0.993274803,0.009359273,0.090591475,2025-05-27,"Past Runs" +"69",NA,"H2S",0.986045229,0.011531354,0.077709532,2024-11-18,"Past Runs" +"70",NA,"H2S",0.986196268,0.011480984,0.07703203,2024-11-18,"Past Runs" +"71",NA,"H2S",0.985787929,0.009948554,0.091199531,2024-11-18,"Past Runs" +"72",NA,"H2S",0.988947878,0.010495862,0.093284593,2024-11-18,"Past Runs" +"73",NA,"H2S",0.988264781,0.010127226,0.080001514,2024-10-28,"Past Runs" +"74",NA,"H2S",0.988125768,0.009325271,0.097513836,2024-10-28,"Past Runs" +"75",NA,"H2S",0.99758753,0.011945752,0.067197191,2024-10-28,"Past Runs" +"76",NA,"H2S",0.993078174,0.009645972,0.08151815,2024-10-07,"Past Runs" +"77",NA,"H2S",0.986071127,0.009987862,0.086021444,2024-10-04,"Past Runs" +"78",NA,"H2S",0.986143404,0.009891411,0.079796142,2024-10-04,"Past Runs" +"79",NA,"H2S",0.99164056,0.009670319,0.086201323,2024-10-03,"Past Runs" +"80",NA,"H2S",0.992085737,0.009733216,0.067611651,2024-10-03,"Past Runs" +"81",NA,"H2S",0.992009962,0.01118999,0.069642654,2024-10-03,"Past Runs" +"82",NA,"H2S",0.985288821,0.010925627,0.071179528,2024-10-03,"Past Runs" +"83",NA,"H2S",0.995390082,0.011330148,0.070037534,2024-10-03,"Past Runs" +"84",NA,"H2S",0.994790512,0.009796019,0.071794375,2024-10-01,"Past Runs" +"85",NA,"H2S",0.989580278,0.010755502,0.087527355,2024-10-01,"Past Runs" +"86",NA,"H2S",0.990511071,0.009855933,0.084838618,2024-10-01,"Past Runs" +"87",NA,"H2S",0.992652978,0.009918529,0.082342296,2024-10-01,"Past Runs" +"88",NA,"H2S",0.986832476,0.010348222,0.095254617,2024-09-23,"Past Runs" +"89",NA,"H2S",0.993120795,0.012220049,0.075212346,2024-09-23,"Past Runs" +"90",NA,"H2S",0.997632416,0.009657487,0.072204384,2024-09-25,"Past Runs" +"91",NA,"H2S",0.988833662,0.010418036,0.079942507,2024-09-24,"Past Runs" +"92",NA,"H2S",0.989425359,0.010908767,0.079669724,2024-09-24,"Past Runs" +"93",NA,"H2S",0.9939478,0.011206242,0.073020732,2024-09-24,"Past Runs" +"94",NA,"H2S",0.992036143,0.010398233,0.086327041,2024-09-24,"Past Runs" +"95",NA,"H2S",0.986162946,0.010280929,0.083188885,2024-09-24,"Past Runs" +"96",NA,"H2S",0.987800455,0.011372072,0.073224086,2024-09-23,"Past Runs" +"97",NA,"H2S",0.997485183,0.011409313,0.06519985,2024-09-23,"Past Runs" +"98",NA,"H2S",0.989099616,0.009735423,0.086474227,2024-09-19,"Past Runs" +"99",NA,"H2S",0.985472997,0.010406102,0.081660091,2024-09-19,"Past Runs" +"100",NA,"H2S",0.985753501,0.011560614,0.084016281,2024-09-19,"Past Runs" +"101",NA,"H2S",0.997161027,0.011775527,0.069868502,2024-09-18,"Past Runs" +"102",NA,"H2S",0.989061589,0.010749066,0.094634117,2024-09-18,"Past Runs" +"103",NA,"H2S",0.988308897,0.010324402,0.093490431,2024-09-18,"Past Runs" +"104",NA,"H2S",0.988282091,0.011748716,0.090496556,2024-09-18,"Past Runs" +"105",NA,"H2S",0.990611188,0.011004901,0.08215848,2024-09-09,"Past Runs" +"106",NA,"H2S",0.992687363,0.011700541,0.077148047,2024-08-30,"Past Runs" +"107",NA,"H2S",0.988249032,0.010524088,0.096531712,2024-09-03,"Past Runs" +"108",NA,"H2S",0.988532329,0.010996494,0.084496543,2024-09-03,"Past Runs" +"109",NA,"H2S",0.989712544,0.011101339,0.099050983,2024-09-03,"Past Runs" +"110",NA,"H2S",0.986439831,0.010996091,0.08776573,2024-08-30,"Past Runs" +"111",NA,"H2S",0.989313189,0.010457844,0.084754346,2024-08-30,"Past Runs" +"112",NA,"H2S",0.990177739,0.010268758,0.087174996,2024-08-30,"Past Runs" +"113",NA,"H2S",0.985866463,0.010585417,0.09737672,2024-08-30,"Past Runs" +"114",NA,"H2S",0.99044815,0.011181375,0.077015013,2024-08-30,"Past Runs" +"115",NA,"H2S",0.99053911,0.011535354,0.07384657,2024-08-29,"Past Runs" +"116",NA,"H2S",0.985015156,0.009782729,0.093669731,2024-08-29,"Past Runs" +"117",NA,"H2S",0.990100963,0.011025989,0.095480695,2024-08-29,"Past Runs" +"118",NA,"H2S",0.986738056,0.011094002,0.090055999,2024-08-29,"Past Runs" +"119",NA,"H2S",0.994093709,0.010473948,0.080691929,2024-08-29,"Past Runs" +"120",NA,"H2S",0.986192277,0.011543972,0.085092199,2024-08-07,"Past Runs" +"121",NA,"H2S",0.989960946,0.010741325,0.089432284,2024-08-07,"Past Runs" +"122",NA,"H2S",0.986951933,0.011912043,0.085700427,2024-08-07,"Past Runs" +"123",NA,"H2S",0.991998444,0.010555363,0.079000944,2024-08-07,"Past Runs" +"124",NA,"H2S",0.985536677,0.011846101,0.081424587,2024-07-29,"Past Runs" +"125",NA,"H2S",0.989595015,0.01224124,0.098524648,2024-07-29,"Past Runs" +"126",NA,"H2S",0.986188356,0.010118538,0.089341935,2024-07-25,"Past Runs" +"127",NA,"H2S",0.992411811,0.012549456,0.078491188,2024-07-25,"Past Runs" +"128",NA,"H2S",0.986593659,0.012390759,0.091396714,2024-07-25,"Past Runs" +"129",NA,"H2S",0.987105229,0.011378377,0.09863995,2024-07-25,"Past Runs" +"130",NA,"H2S",0.985994152,0.011415216,0.08057319,2024-07-25,"Past Runs" +"131",NA,"H2S",0.990738705,0.011295641,0.084048401,2024-07-31,"Past Runs" +"132",NA,"H2S",0.987136133,0.011450047,0.079739708,2024-07-29,"Past Runs" +"133",NA,"H2S",0.99126783,0.013018999,0.08407446,2024-07-29,"Past Runs" +"134",NA,"H2S",0.991454138,0.01254834,0.090174827,2024-07-29,"Past Runs" +"135",NA,"H2S",0.99018676,0.010771473,0.09900375,2024-07-24,"Past Runs" +"136",NA,"H2S",0.984822062,0.011740029,0.096632577,2024-07-24,"Past Runs" +"137",NA,"H2S",0.993424378,0.012468772,0.07384182,2024-07-19,"Past Runs" +"138",NA,"H2S",0.989184664,0.01069962,0.08457192,2024-07-19,"Past Runs" +"139",NA,"H2S",0.989831855,0.011217555,0.074495287,2024-07-19,"Past Runs" +"140",NA,"H2S",0.988637133,0.011247898,0.09116868,2024-07-19,"Past Runs" +"141",NA,"H2S",0.990494512,0.012004154,0.08805378,2024-07-19,"Past Runs" +"142",NA,"H2S",0.988124802,0.011667535,0.091833244,2024-07-19,"Past Runs" +"143",NA,"H2S",0.990863942,0.010234964,0.079436097,2024-07-18,"Past Runs" +"144",NA,"H2S",0.983817166,0.010882717,0.094621893,2024-07-18,"Past Runs" +"145",NA,"H2S",0.990198017,0.011687802,0.081889383,2024-07-18,"Past Runs" +"146",NA,"H2S",0.987899965,0.01159855,0.091733041,2024-07-18,"Past Runs" +"147",NA,"H2S",0.989060685,0.011495464,0.099538763,2024-07-18,"Past Runs" +"148",NA,"H2S",0.986916133,0.009342433,0.095298628,2024-07-18,"Past Runs" +"149",NA,"H2S",0.984427464,0.011641613,0.092097982,2024-07-19,"Past Runs" +"150",NA,"H2S",0.990912834,0.010479158,0.086080607,2024-07-19,"Past Runs" +"151",NA,"H2S",0.987412326,0.010983562,0.094991681,2024-07-18,"Past Runs" +"152",NA,"H2S",0.986465804,0.011418341,0.090477665,2024-07-18,"Past Runs" +"153",NA,"H2S",0.987068169,0.011199063,0.089853992,2024-07-18,"Past Runs" +"154",NA,"H2S",0.989037854,0.011295078,0.081699567,2024-07-17,"Past Runs" +"155",NA,"H2S",0.992083054,0.012185227,0.07626707,2024-07-17,"Past Runs" +"156",NA,"H2S",0.992139993,0.011646417,0.077884912,2024-07-17,"Past Runs" +"157",NA,"H2S",0.993165626,0.012227159,0.072878643,2024-07-17,"Past Runs" +"158",NA,"H2S",0.991179678,0.010917098,0.077263615,2024-07-17,"Past Runs" +"159",NA,"H2S",0.994482296,0.010706488,0.074416857,2024-07-17,"Past Runs" +"160",NA,"H2S",0.993221658,0.011432212,0.085152764,2024-07-15,"Past Runs" +"161",NA,"H2S",0.991012311,0.012163061,0.075124953,2024-07-05,"Past Runs" +"162",NA,"H2S",0.985644961,0.012042341,0.087343444,2024-07-05,"Past Runs" +"163",NA,"H2S",0.990282541,0.011631377,0.089041685,2024-07-05,"Past Runs" +"164",NA,"H2S",0.987824676,0.011559837,0.066632483,2024-07-05,"Past Runs" +"165",NA,"H2S",0.987863383,0.012339206,0.093894911,2024-07-03,"Past Runs" +"166",NA,"H2S",0.994315831,0.012786291,0.087233216,2024-07-03,"Past Runs" +"167",NA,"H2S",0.988339045,0.011649182,0.091537982,2024-07-03,"Past Runs" +"168",NA,"H2S",0.988950697,0.014678212,0.09163757,2023-11-14,"Past Runs" +"169",NA,"H2S",0.990040026,0.012259376,0.107676904,2023-11-14,"Past Runs" +"170",NA,"H2S",0.992010649,0.010954084,0.079408389,2024-05-29,"Past Runs" +"171",NA,"H2S",0.989206107,0.010763348,0.088663974,2024-05-29,"Past Runs" +"172",NA,"H2S",0.990869031,0.010939769,0.092318935,2024-05-29,"Past Runs" +"173",NA,"H2S",0.985767699,0.010729643,0.084530357,2024-05-29,"Past Runs" +"174",NA,"H2S",0.990353193,0.011621645,0.084002879,2024-05-28,"Past Runs" +"175",NA,"H2S",0.987684582,0.01183304,0.076585822,2024-05-28,"Past Runs" +"176",NA,"H2S",0.990127271,0.010373918,0.082859368,2024-05-28,"Past Runs" +"177",NA,"H2S",0.992091943,0.011632631,0.078949694,2024-05-28,"Past Runs" +"178",NA,"H2S",0.991295752,0.011015224,0.083816625,2024-05-23,"Past Runs" +"179",NA,"H2S",0.987251905,0.011995579,0.078461365,2024-05-23,"Past Runs" +"180",NA,"H2S",0.991135851,0.011944649,0.090053389,2024-05-23,"Past Runs" +"181",NA,"H2S",0.987847657,0.013334201,0.076212686,2024-05-22,"Past Runs" +"182",NA,"H2S",0.98858924,0.010019939,0.074402064,2024-05-22,"Past Runs" +"183",NA,"H2S",0.992678091,0.012147509,0.085708498,2024-05-22,"Past Runs" +"184",NA,"H2S",0.993578596,0.012248114,0.078688178,2024-05-22,"Past Runs" +"185",NA,"H2S",0.992362286,0.01333791,0.069302726,2024-05-21,"Past Runs" +"186",NA,"H2S",0.989216329,0.012520477,0.080249778,2024-05-21,"Past Runs" +"187",NA,"H2S",0.986391164,0.012989122,0.080584704,2024-05-21,"Past Runs" +"188","Plate1","H2S",0.9936,0.0095,0.0909,2025-05-27,"Past Runs" +"189","Plate2","H2S",0.9942,0.009,0.0831,2025-05-27,"Past Runs" +"190","Plate3","H2S",0.9939,0.0095,0.0892,2025-05-27,"Past Runs" +"191","Plate4","H2S",0.9985,0.0101,0.0762,2025-05-27,"Past Runs" +"192","Plate5","H2S",0.9972,0.0096,0.0866,2025-05-27,"Past Runs" +"193","Plate6","H2S",0.9985,0.0101,0.0762,2025-05-27,"Past Runs" +"194","Plate7","H2S",0.9985,0.0101,0.0762,2025-05-27,"Past Runs" +"195","Plate_rr","H2S",0.9906,0.0131,0.0934,2025-06-02,"Past Runs" +"196","Plate1","H2S",0.9801,0.0114,0.1116,2025-07-14,"Past Runs" +"197","Plate2","H2S",0.9881,0.0107,0.1167,2025-07-14,"Past Runs" +"198","Plate3","H2S",0.9796,0.0113,0.1195,2025-07-14,"Past Runs" +"199","Plate4","H2S",0.9888,0.0115,0.1123,2025-07-14,"Past Runs" +"200","Plate5","H2S",0.9961,0.012,0.1021,2025-07-14,"Past Runs" +"201","Plate6","H2S",0.9961,0.012,0.1021,2025-07-14,"Past Runs" +"202","Plate7","H2S",0.994,0.0128,0.0806,2025-07-15,"Past Runs" +"203","Plate8","H2S",0.9928,0.0115,0.0903,2025-07-15,"Past Runs" +"204","Plate9","H2S",0.9974,0.0117,0.0896,2025-07-15,"Past Runs" +"205","Plate10","H2S",0.9962,0.0134,0.0672,2025-07-15,"Past Runs" +"206","Plate_rr","H2S",0.9994,0.0124,0.0564,2025-07-16,"Past Runs" +"207","Plate1","H2S",0.9862,0.012,0.1023,2025-09-18,"Past Runs" +"208","Plate2","H2S",0.9977,0.0107,0.082,2025-09-18,"Past Runs" +"209","Plate3","H2S",0.9949,0.0109,0.0927,2025-09-18,"Past Runs" +"210","Plate4","H2S",0.9978,0.0126,0.0764,2025-09-18,"Past Runs" +"211","Plate5","H2S",0.9933,0.0112,0.0942,2025-09-18,"Past Runs" +"212","Plate6","H2S",0.9978,0.0121,0.0843,2025-09-18,"Past Runs" +"213","Plate_rr","H2S",0.9982,0.011,0.0827,2025-09-19,"Past Runs" +"214","Plate1","H2S",0.9909,0.012,0.0971,2026-05-18,"Current Runs" +"215","Plate2","H2S",0.9917,0.012,0.0926,2026-05-18,"Current Runs" +"216","Plate3","H2S",0.9863,0.0119,0.1118,2026-05-18,"Current Runs" +"217","Plate4","H2S",0.9961,0.0115,0.0897,2026-05-18,"Current Runs" +"218","Plate5","H2S",0.9915,0.0113,0.0938,2026-05-19,"Current Runs" +"219","rrPlate1","H2S",0.9866,0.0128,0.1203,2026-06-01,"Current Runs" +"220","rrPlate2","H2S",0.9922,0.0115,0.0987,2026-06-01,"Current Runs" diff --git a/CO2xNxPhrag/Porewater/Sulfide/2026/Raw Data/20260518_LTREB_H2S_Plate1.csv b/CO2xNxPhrag/Porewater/Sulfide/2026/Raw Data/20260518_LTREB_H2S_Plate1.csv new file mode 100644 index 0000000..cd20397 --- /dev/null +++ b/CO2xNxPhrag/Porewater/Sulfide/2026/Raw Data/20260518_LTREB_H2S_Plate1.csv @@ -0,0 +1,29 @@ +,1,2,3,4,5,6,7,8,9,10,11,12 +A,0.063,0.061,0.063,0.775,0.887,0.907,0.407,0.39,0.385,0.763,0.752,0.685 +B,0.141,0.16,0.148,0.94,0.751,0.839,0.066,0.064,0.063,0.703,0.551,0.74 +C,0.248,0.258,0.237,0.544,0.515,0.494,0.378,0.338,0.327,0.72,0.635,0.658 +D,0.482,0.571,0.431,0.697,0.692,0.633,0.454,0.537,0.404,0.575,0.773,0.831 +E,0.955,0.941,0.736,0.684,0.717,0.705,0.58,0.509,0.61,0.979,0.858,0.726 +F,1.373,1.231,1.255,0.838,0.896,0.895,0.787,0.971,0.895,0.065,0.063,0.061 +G,1.405,1.462,1.3,0.85,0.987,0.882,0.323,0.341,0.348,0.655,0.681,0.688 +H,0.467,0.469,0.479,0.695,0.749,0.762,0.479,0.586,0.575,0.839,0.789,0.791 +,,,,,,,,,,,, +,1,2,3,4,5,6,7,8,9,10,11,12 +A,Std 0,Std 0,Std 0,L1-40,L1-40,L1-40,L4-20,L4-20,L4-20,L5-80,L5-80,L5-80 +B,Std 1,Std 1,Std 1,L1-80,L1-80,L1-80,ChkStd 0,ChkStd 0,ChkStd 0,L6-20,L6-20,L6-20 +C,Std 2,Std 2,Std 2,L2-20,L2-20,L2-20,L4-20 Dup,L4-20 Dup,L4-20 Dup,L6-40,L6-40,L6-40 +D,Std 3,Std 3,Std 3,L2-40,L2-40,L2-40,ChkStd 3,ChkStd 3,ChkStd 3,L1-20 Spike,L1-20 Spike,L1-20 Spike +E,Std 4,Std 4,Std 4,L2-80,L2-80,L2-80,L4-40,L4-40,L4-40,L4-40 Spike,L4-40 Spike,L4-40 Spike +F,Std 5,Std 5,Std 5,L3-20,L3-20,L3-20,L4-80,L4-80,L4-80,ChkStd 0,ChkStd 0,ChkStd 0 +G,MC: 10ppt S5,MC: 10ppt S5,MC: 10ppt S5,L3-40,L3-40,L3-40,L5-20,L5-20,L5-20,L6-40 Dup,L6-40 Dup,L6-40 Dup +H,L1-20,L1-20,L1-20,L3-80,L3-80,L3-80,L5-40,L5-40,L5-40,ChkStd 4,ChkStd 4,ChkStd 4 +,,,,,,,,,,,, +,1,2,3,4,5,6,7,8,9,10,11,12 +A,1,1,1,50,50,50,50,50,50,50,50,50 +B,1,1,1,50,50,50,1,1,1,50,50,50 +C,1,1,1,50,50,50,50,50,50,50,50,50 +D,1,1,1,50,50,50,1,1,1,50,50,50 +E,1,1,1,50,50,50,50,50,50,50,50,50 +F,1,1,1,50,50,50,50,50,50,1,1,1 +G,1,1,1,50,50,50,50,50,50,50,50,50 +H,50,50,50,50,50,50,50,50,50,1,1,1 diff --git a/CO2xNxPhrag/Porewater/Sulfide/2026/Raw Data/20260518_LTREB_H2S_Plate2.csv b/CO2xNxPhrag/Porewater/Sulfide/2026/Raw Data/20260518_LTREB_H2S_Plate2.csv new file mode 100644 index 0000000..7a1e4e7 --- /dev/null +++ b/CO2xNxPhrag/Porewater/Sulfide/2026/Raw Data/20260518_LTREB_H2S_Plate2.csv @@ -0,0 +1,29 @@ +,1,2,3,4,5,6,7,8,9,10,11,12 +A,0.062,0.063,0.065,0.436,0.43,0.394,0.816,0.704,0.653,0.464,0.529,0.358 +B,0.148,0.138,0.19,0.513,0.464,0.483,0.065,0.063,0.063,0.596,0.709,0.531 +C,0.221,0.275,0.222,0.623,0.726,0.674,0.831,0.699,0.645,0.337,0.306,0.4 +D,0.546,0.429,0.474,0.535,0.521,0.511,0.418,0.458,0.406,0.927,1.072,1.004 +E,0.775,0.97,0.713,0.586,0.542,0.546,0.542,0.576,0.461,0.795,0.703,0.919 +F,1.008,0.67,0.868,0.794,0.743,0.72,0.658,0.61,0.591,0.064,0.062,0.063 +G,1.418,1.487,1.351,0.358,0.324,0.333,0.694,0.676,0.807,0.355,0.351,0.348 +H,0.687,0.743,0.773,0.439,0.395,0.447,0.494,0.528,0.519,1.282,1.244,1.267 +,,,,,,,,,,,, +,1,2,3,4,5,6,7,8,9,10,11,12 +A,Std 0,Std 0,Std 0,L7-20,L7-20,L7-20,L9-80,L9-80,L9-80,L11-40,L11-40,L11-40 +B,Std 1,Std 1,Std 1,L7-40,L7-40,L7-40,ChkStd 0,ChkStd 0,ChkStd 0,L11-80,L11-80,L11-80 +C,Std 2,Std 2,Std 2,L7-80,L7-80,L7-80,L9-80 Dup,L9-80 Dup,L9-80 Dup,L12-20,L12-20,L12-20 +D,Std 3,Std 3,Std 3,L8-20,L8-20,L8-20,ChkStd 3,ChkStd 3,ChkStd 3,L6-80 Spike,L6-80 Spike,L6-80 Spike +E,Std 4,Std 4,Std 4,L8-40,L8-40,L8-40,L10-20,L10-20,L10-20,L10-20 Spike,L10-20 Spike,L10-20 Spike +F,ChkStd 4,ChkStd 4,ChkStd 4,L8-80,L8-80,L8-80,L10-40,L10-40,L10-40,ChkStd 0,ChkStd 0,ChkStd 0 +G,MC: 10ppt S5,MC: 10ppt S5,MC: 10ppt S5,L9-20,L9-20,L9-20,L10-80,L10-80,L10-80,L12-20 Dup,L12-20 Dup,L12-20 Dup +H,L6-80,L6-80,L6-80,L9-40,L9-40,L9-40,L11-20,L11-20,L11-20,Std 5,Std 5,Std 5 +,,,,,,,,,,,, +,1,2,3,4,5,6,7,8,9,10,11,12 +A,1,1,1,50,50,50,50,50,50,50,50,50 +B,1,1,1,50,50,50,1,1,1,50,50,50 +C,1,1,1,50,50,50,50,50,50,50,50,50 +D,1,1,1,50,50,50,1,1,1,50,50,50 +E,1,1,1,50,50,50,50,50,50,50,50,50 +F,1,1,1,50,50,50,50,50,50,1,1,1 +G,1,1,1,50,50,50,50,50,50,50,50,50 +H,50,50,50,50,50,50,50,50,50,1,1,1 diff --git a/CO2xNxPhrag/Porewater/Sulfide/2026/Raw Data/20260518_LTREB_H2S_Plate3.csv b/CO2xNxPhrag/Porewater/Sulfide/2026/Raw Data/20260518_LTREB_H2S_Plate3.csv new file mode 100644 index 0000000..4fbfd70 --- /dev/null +++ b/CO2xNxPhrag/Porewater/Sulfide/2026/Raw Data/20260518_LTREB_H2S_Plate3.csv @@ -0,0 +1,29 @@ +,1,2,3,4,5,6,7,8,9,10,11,12 +A,0.059,0.061,0.061,0.613,0.702,0.606,0.652,0.729,0.675,0.36,0.327,0.331 +B,0.181,0.13,0.237,0.33,0.343,0.312,0.06,0.06,0.061,0.751,0.658,0.743 +C,0.255,0.236,0.254,0.631,0.777,0.674,0.658,0.818,0.61,0.541,0.523,0.516 +D,0.482,0.421,0.465,0.578,0.554,0.511,0.4,0.445,0.447,0.712,0.633,0.792 +E,0.811,0.73,0.716,0.385,0.444,0.428,0.625,0.621,0.705,0.954,0.776,1.055 +F,1.314,1.197,1.34,0.682,0.671,0.591,0.678,0.696,0.648,0.065,0.061,0.062 +G,1.494,1.357,1.344,0.743,0.627,0.759,0.564,0.514,0.62,0.453,0.52,0.477 +H,0.474,0.457,0.43,0.637,0.568,0.662,0.557,0.631,0.514,0.745,0.859,0.966 +,,,,,,,,,,,, +,1,2,3,4,5,6,7,8,9,10,11,12 +A,Std 0,Std 0,Std 0,L12-80,L12-80,L12-80,L15-40,L15-40,L15-40,L17-20,L17-20,L17-20 +B,Std 1,Std 1,Std 1,L13-20,L13-20,L13-20,ChkStd 0,ChkStd 0,ChkStd 0,L17-40,L17-40,L17-40 +C,Std 2,Std 2,Std 2,L13-40,L13-40,L13-40,L15-40 Dup,L15-40 Dup,L15-40 Dup,L17-80,L17-80,L17-80 +D,Std 3,Std 3,Std 3,L13-80,L13-80,L13-80,ChkStd 3,ChkStd 3,ChkStd 3,L12-40 Spike,L12-40 Spike,L12-40 Spike +E,Std 4,Std 4,Std 4,L14-20,L14-20,L14-20,L15-80,L15-80,L15-80,L15-80 Spike,L15-80 Spike,L15-80 Spike +F,Std 5,Std 5,Std 5,L14-40,L14-40,L14-40,L16-20,L16-20,L16-20,ChkStd 0,ChkStd 0,ChkStd 0 +G,MC: 10ppt S5,MC: 10ppt S5,MC: 10ppt S5,L14-80,L14-80,L14-80,L16-40,L16-40,L16-40,L17-80 Dup,L17-80 Dup,L17-80 Dup +H,L12-40,L12-40,L12-40,L15-20,L15-20,L15-20,L16-80,L16-80,L16-80,ChkStd 4,ChkStd 4,ChkStd 4 +,,,,,,,,,,,, +,1,2,3,4,5,6,7,8,9,10,11,12 +A,1,1,1,50,50,50,50,50,50,50,50,50 +B,1,1,1,50,50,50,1,1,1,50,50,50 +C,1,1,1,50,50,50,50,50,50,50,50,50 +D,1,1,1,50,50,50,1,1,1,50,50,50 +E,1,1,1,50,50,50,50,50,50,50,50,50 +F,1,1,1,50,50,50,50,50,50,1,1,1 +G,1,1,1,50,50,50,50,50,50,50,50,50 +H,50,50,50,50,50,50,50,50,50,1,1,1 diff --git a/CO2xNxPhrag/Porewater/Sulfide/2026/Raw Data/20260518_LTREB_H2S_Plate4.csv b/CO2xNxPhrag/Porewater/Sulfide/2026/Raw Data/20260518_LTREB_H2S_Plate4.csv new file mode 100644 index 0000000..8b25dee --- /dev/null +++ b/CO2xNxPhrag/Porewater/Sulfide/2026/Raw Data/20260518_LTREB_H2S_Plate4.csv @@ -0,0 +1,29 @@ +,1,2,3,4,5,6,7,8,9,10,11,12 +A,0.066,0.061,0.063,0.419,0.446,0.434,0.196,0.191,0.196,0.086,0.095,0.086 +B,0.123,0.152,0.152,0.545,0.546,0.548,0.063,0.06,0.063,0.099,0.091,0.09 +C,0.249,0.238,0.216,0.684,0.688,0.728,0.195,0.215,0.195,0.212,0.231,0.232 +D,0.5,0.447,0.401,0.807,0.852,0.821,0.372,0.428,0.543,0.429,0.366,0.516 +E,0.822,0.84,0.853,0.873,0.749,0.919,0.269,0.309,0.288,0.61,0.627,0.652 +F,1.215,1.234,1.239,0.528,0.553,0.561,0.18,0.19,0.197,0.066,0.077,0.063 +G,1.396,1.407,1.403,0.724,0.681,0.646,0.258,0.278,0.274,0.209,0.198,0.202 +H,0.069,0.068,0.07,0.65,0.765,0.694,0.065,0.071,0.064,0.776,0.689,0.677 +,,,,,,,,,,,, +,1,2,3,4,5,6,7,8,9,10,11,12 +A,Std 0,Std 0,Std 0,L18-40,L18-40,L18-40,P1-20,P1-20,P1-20,P3-40,P3-40,P3-40 +B,Std 1,Std 1,Std 1,L18-80,L18-80,L18-80,ChkStd 0,ChkStd 0,ChkStd 0,P4-20,P4-20,P4-20 +C,Std 2,Std 2,Std 2,L19-20,L19-20,L19-20,P1-20 Dup,P1-20 Dup,P1-20 Dup,P4-40,P4-40,P4-40 +D,Std 3,Std 3,Std 3,L19-40,L19-40,L19-40,ChkStd 3,ChkStd 3,ChkStd 3,L18-20 Spike,L18-20 Spike,L18-20 Spike +E,Std 4,Std 4,Std 4,L19-80,L19-80,L19-80,P1-40,P1-40,P1-40,P1-40 Spike,P1-40 Spike,P1-40 Spike +F,Std 5,Std 5,Std 5,L20-20,L20-20,L20-20,P2-20,P2-20,P2-20,ChkStd 0,ChkStd 0,ChkStd 0 +G,MC: 10ppt S5,MC: 10ppt S5,MC: 10ppt S5,L20-40,L20-40,L20-40,P2-40,P2-40,P2-40,P4-40 Dup,P4-40 Dup,P4-40 Dup +H,L18-20,L18-20,L18-20,L20-80,L20-80,L20-80,P3-20,P3-20,P3-20,ChkStd 4,ChkStd 4,ChkStd 4 +,,,,,,,,,,,, +,1,2,3,4,5,6,7,8,9,10,11,12 +A,1,1,1,50,50,50,50,50,50,50,50,50 +B,1,1,1,50,50,50,1,1,1,50,50,50 +C,1,1,1,50,50,50,50,50,50,50,50,50 +D,1,1,1,50,50,50,1,1,1,50,50,50 +E,1,1,1,50,50,50,50,50,50,50,50,50 +F,1,1,1,50,50,50,50,50,50,1,1,1 +G,1,1,1,50,50,50,50,50,50,50,50,50 +H,50,50,50,50,50,50,50,50,50,1,1,1 diff --git a/CO2xNxPhrag/Porewater/Sulfide/2026/Raw Data/20260518_LTREB_H2S_STD.csv b/CO2xNxPhrag/Porewater/Sulfide/2026/Raw Data/20260518_LTREB_H2S_STD.csv new file mode 100644 index 0000000..c79396d --- /dev/null +++ b/CO2xNxPhrag/Porewater/Sulfide/2026/Raw Data/20260518_LTREB_H2S_STD.csv @@ -0,0 +1,29 @@ +,1,2,3,4,5,6,7,8,9,10,11,12 +A,0.054,0.056,0.054,0.069,0.065,0.066,0.047,0.046,0.05,0.045,0.045,0.045 +B,0.145,0.147,0.14,0.151,0.14,0.223,0.046,0.044,0.045,0.045,0.046,0.045 +C,0.295,0.304,0.295,0.349,0.271,0.334,0.045,0.047,0.045,0.046,0.046,0.047 +D,0.478,0.467,0.557,0.557,0.438,0.406,0.052,0.046,0.054,0.049,0.047,0.046 +E,0.895,0.906,0.844,0.839,0.787,0.743,0.046,0.044,0.046,0.045,0.045,0.045 +F,1.674,1.428,1.28,1.415,1.182,1.23,0.046,0.045,0.045,0.045,0.045,0.046 +G,1.622,1.762,1.552,1.276,1.423,1.164,0.045,0.045,0.047,0.045,0.045,0.045 +H,0.047,0.047,0.045,0.047,0.045,0.048,0.046,0.051,0.047,0.045,0.046,0.045 +,,,,,,,,,,,, +,1,2,3,4,5,6,7,8,9,10,11,12 +A,,,,Std 0,Std 0,Std 0,,,,,, +B,,,,Std 1,Std 1,Std 1,,,,,, +C,,,,Std 2,Std 2,Std 2,,,,,, +D,,,,Std 3,Std 3,Std 3,,,,,, +E,,,,Std 4,Std 4,Std 4,,,,,, +F,,,,Std 5,Std 5,Std 5,,,,,, +G,,,,MC: 10ppt S5,MC: 10ppt S5,MC: 10ppt S5,,,,,, +H,,,,,,,,,,,, +,,,,,,,,,,,, +,1,2,3,4,5,6,7,8,9,10,11,12 +A,,,,1,1,1,,,,,, +B,,,,1,1,1,,,,,, +C,,,,1,1,1,,,,,, +D,,,,1,1,1,,,,,, +E,,,,1,1,1,,,,,, +F,,,,1,1,1,,,,,, +G,,,,1,1,1,,,,,, +H,,,,,,,,,,,, diff --git a/CO2xNxPhrag/Porewater/Sulfide/2026/Raw Data/20260519_LTREB_H2S_Plate5.csv b/CO2xNxPhrag/Porewater/Sulfide/2026/Raw Data/20260519_LTREB_H2S_Plate5.csv new file mode 100644 index 0000000..96efd09 --- /dev/null +++ b/CO2xNxPhrag/Porewater/Sulfide/2026/Raw Data/20260519_LTREB_H2S_Plate5.csv @@ -0,0 +1,29 @@ +,1,2,3,4,5,6,7,8,9,10,11,12 +A,0.065,0.06,0.064,0.513,0.411,0.413,0.336,0.357,0.327,0.383,0.382,0.357 +B,0.139,0.132,0.143,0.196,0.202,0.191,0.067,0.06,0.061,0.443,0.458,0.396 +C,0.233,0.241,0.234,0.3,0.275,0.279,0.372,0.316,0.33,0.125,0.12,0.123 +D,0.443,0.459,0.392,0.219,0.228,0.206,0.378,0.513,0.484,0.555,0.693,0.7 +E,0.747,0.86,0.762,0.259,0.283,0.25,0.149,0.187,0.179,0.469,0.441,0.455 +F,1.266,1.185,1.176,0.122,0.134,0.125,0.221,0.254,0.268,0.061,0.057,0.06 +G,1.406,1.432,1.36,0.27,0.249,0.261,0.272,0.253,0.212,0.122,0.123,0.129 +H,0.3,0.352,0.324,0.17,0.186,0.186,0.487,0.476,0.505,0.874,1.008,0.852 +,,,,,,,,,,,, +,1,2,3,4,5,6,7,8,9,10,11,12 +A,Std 0,Std 0,Std 0,P5-40,P5-40,P5-40,P9-40,P9-40,P9-40,P12-20,P12-20,P12-20 +B,Std 1,Std 1,Std 1,P6-20,P6-20,P6-20,ChkStd 0,ChkStd 0,ChkStd 0,P12-40,P12-40,P12-40 +C,Std 2,Std 2,Std 2,P6-40,P6-40,P6-40,P9-40 Dup,P9-40 Dup,P9-40 Dup,P3-20,P3-20,P3-20 +D,Std 3,Std 3,Std 3,P7-20,P7-20,P7-20,ChkStd 3,ChkStd 3,ChkStd 3,P5-20 Spike,P5-20 Spike,P5-20 Spike +E,Std 4,Std 4,Std 4,P7-40,P7-40,P7-40,P10-20,P10-20,P10-20,P10-20 Spike,P10-20 Spike,P10-20 Spike +F,Std 5,Std 5,Std 5,P8-20,P8-20,P8-20,P10-40,P10-40,P10-40,ChkStd 0,ChkStd 0,ChkStd 0 +G,MC: 10ppt S5,MC: 10ppt S5,MC: 10ppt S5,P8-40,P8-40,P8-40,P11-20,P11-20,P11-20,P3-20 Dup,P3-20 Dup,P3-20 Dup +H,P5-20,P5-20,P5-20,P9-20,P9-20,P9-20,P11-40,P11-40,P11-40,ChkStd 4,ChkStd 4,ChkStd 4 +,,,,,,,,,,,, +,1,2,3,4,5,6,7,8,9,10,11,12 +A,1,1,1,50,50,50,50,50,50,50,50,50 +B,1,1,1,50,50,50,1,1,1,50,50,50 +C,1,1,1,50,50,50,50,50,50,1,1,1 +D,1,1,1,50,50,50,1,1,1,50,50,50 +E,1,1,1,50,50,50,50,50,50,50,50,50 +F,1,1,1,50,50,50,50,50,50,1,1,1 +G,1,1,1,50,50,50,50,50,50,1,1,1 +H,50,50,50,50,50,50,50,50,50,1,1,1 diff --git a/CO2xNxPhrag/Porewater/Sulfide/2026/Raw Data/20260519_LTREB_H2S_STD.csv b/CO2xNxPhrag/Porewater/Sulfide/2026/Raw Data/20260519_LTREB_H2S_STD.csv new file mode 100644 index 0000000..1b0e605 --- /dev/null +++ b/CO2xNxPhrag/Porewater/Sulfide/2026/Raw Data/20260519_LTREB_H2S_STD.csv @@ -0,0 +1,29 @@ +,1,2,3,4,5,6,7,8,9,10,11,12 +A,0.066,0.067,0.066,0.046,0.045,0.045,0.046,0.045,0.045,0.046,0.046,0.045 +B,0.124,0.128,0.134,0.045,0.044,0.045,0.046,0.044,0.044,0.044,0.044,0.044 +C,0.28,0.232,0.249,0.045,0.045,0.045,0.044,0.045,0.044,0.044,0.044,0.047 +D,0.409,0.724,0.435,0.044,0.045,0.045,0.044,0.044,0.044,0.044,0.044,0.044 +E,0.665,0.608,0.6,0.044,0.045,0.045,0.044,0.045,0.045,0.045,0.044,0.044 +F,1.351,1.156,1.186,0.044,0.044,0.044,0.044,0.044,0.044,0.044,0.045,0.044 +G,1.327,1.166,0.981,0.044,0.044,0.044,0.044,0.046,0.044,0.044,0.044,0.045 +H,0.045,0.044,0.046,0.045,0.045,0.044,0.045,0.045,0.046,0.044,0.045,0.046 +,,,,,,,,,,,, +,1,2,3,4,5,6,7,8,9,10,11,12 +A,Std 0,Std 0,Std 0,,,,,,,,, +B,Std 1,Std 1,Std 1,,,,,,,,, +C,Std 2,Std 2,Std 2,,,,,,,,, +D,Std 3,Std 3,Std 3,,,,,,,,, +E,Std 4,Std 4,Std 4,,,,,,,,, +F,Std 5,Std 5,Std 5,,,,,,,,, +G,MC: 10ppt S5,MC: 10ppt S5,MC: 10ppt S5,,,,,,,,, +H,,,,,,,,,,,, +,,,,,,,,,,,, +,1,2,3,4,5,6,7,8,9,10,11,12 +A,1,1,1,,,,,,,,, +B,1,1,1,,,,,,,,, +C,1,1,1,,,,,,,,, +D,1,1,1,,,,,,,,, +E,1,1,1,,,,,,,,, +F,1,1,1,,,,,,,,, +G,1,1,1,,,,,,,,, +H,,,,,,,,,,,, diff --git a/CO2xNxPhrag/Porewater/Sulfide/2026/Raw Data/20260601_LTREB_H2S_Rerun_Plate1.csv b/CO2xNxPhrag/Porewater/Sulfide/2026/Raw Data/20260601_LTREB_H2S_Rerun_Plate1.csv new file mode 100644 index 0000000..c3df766 --- /dev/null +++ b/CO2xNxPhrag/Porewater/Sulfide/2026/Raw Data/20260601_LTREB_H2S_Rerun_Plate1.csv @@ -0,0 +1,29 @@ +,1,2,3,4,5,6,7,8,9,10,11,12 +A,0.065,0.065,0.065,2.093,1.895,1.898,0.951,0.861,0.858,1.112,1.131,1.071 +B,0.131,0.14,0.179,0.691,0.822,0.845,0.066,0.065,0.062,0.647,0.718,0.614 +C,0.283,0.25,0.279,0.516,0.528,0.539,0.884,1.008,0.964,0.471,0.464,0.488 +D,0.483,0.506,0.444,0.181,0.181,0.188,0.457,0.483,0.462,1.431,1.6,1.491 +E,0.808,0.833,0.819,0.178,0.193,0.192,1.36,1.432,1.228,1.257,1.549,1.603 +F,1.401,1.397,1.294,0.412,0.507,0.502,1.695,1.816,1.775,0.064,0.062,0.068 +G,1.352,1.275,1.408,0.636,0.661,0.755,2.503,2.576,2.93,2.175,1.988,2.104 +H,1.219,1.282,1.284,0.624,0.616,0.529,2.227,1.986,1.706,0.777,0.814,0.785 +,,,,,,,,,,,, +,1,2,3,4,5,6,7,8,9,10,11,12 +A,Std 0,Std 0,Std 0,,,,P3-40,P3-40,P3-40,,, +B,Std 1,Std 1,Std 1,Ch4-80,Ch4-80,Ch4-80,ChkStd 0,ChkStd 0,ChkStd 0,,, +C,Std 2,Std 2,Std 2,Ch4-40,Ch4-40,Ch4-40,P3-40 Dup,P3-40 Dup,P3-40 Dup,,, +D,Std 3,Std 3,Std 3,Ch8-5,Ch8-5,Ch8-5,ChkStd 3,ChkStd 3,ChkStd 3, Ch2-5 Spike, Ch2-5 Spike, Ch2-5 Spike +E,Std 4,Std 4,Std 4,L18-20,L18-20,L18-20,,,, P4-20 Spike, P4-20 Spike, P4-20 Spike +F,Std 5,Std 5,Std 5,L11-40,L11-40,L11-40,,,,ChkStd 0,ChkStd 0,ChkStd 0 +G,MC: 10ppt S5,MC: 10ppt S5,MC: 10ppt S5,L13-40,L13-40,L13-40,,,,,, +H,,,,L16-80,L16-80,L16-80,,,,ChkStd 4,ChkStd 4,ChkStd 4 +,,,,,,,,,,,, +,1,2,3,4,5,6,7,8,9,10,11,12 +A,1,1,1,1,1,1,1,1,1,1,1,1 +B,1,1,1,100,100,100,1,1,1,100,100,100 +C,1,1,1,100,100,100,1,1,1,100,100,100 +D,1,1,1,50,50,50,1,1,1,1,1,1 +E,1,1,1,1,1,1,1,1,1,1,1,1 +F,1,1,1,50,50,50,1,1,1,1,1,1 +G,1,1,1,50,50,50,1,1,1,100,100,100 +H,1,1,1,50,50,50,1,1,1,1,1,1 diff --git a/CO2xNxPhrag/Porewater/Sulfide/2026/Raw Data/20260601_LTREB_H2S_Rerun_Plate2.csv b/CO2xNxPhrag/Porewater/Sulfide/2026/Raw Data/20260601_LTREB_H2S_Rerun_Plate2.csv new file mode 100644 index 0000000..a66544a --- /dev/null +++ b/CO2xNxPhrag/Porewater/Sulfide/2026/Raw Data/20260601_LTREB_H2S_Rerun_Plate2.csv @@ -0,0 +1,29 @@ +,1,2,3,4,5,6,7,8,9,10,11,12 +A,0.066,0.065,0.061,0.393,0.431,0.415,0.421,0.494,0.473,0.045,0.045,0.046 +B,0.143,0.14,0.148,0.43,0.554,0.509,0.067,0.067,0.069,0.044,0.044,0.044 +C,0.261,0.255,0.237,0.497,0.476,0.565,0.488,0.511,0.525,0.044,0.044,0.046 +D,0.377,0.446,0.478,0.225,0.237,0.234,0.452,0.449,0.408,0.441,0.487,0.476 +E,0.804,0.814,0.861,0.511,0.482,0.516,0.262,0.224,0.241,0.482,0.493,0.548 +F,1.264,1.222,1.207,0.223,0.242,0.225,0.044,0.044,0.044,0.064,0.062,0.064 +G,1.261,1.319,1.343,0.169,0.143,0.14,0.044,0.045,0.044,0.044,0.044,0.044 +H,0.171,0.179,0.192,0.247,0.209,0.201,0.045,0.045,0.046,0.764,0.812,0.784 +,,,,,,,,,,,, +,1,2,3,4,5,6,7,8,9,10,11,12 +A,Std 0,Std 0,Std 0,,,,,,,,, +B,Std 1,Std 1,Std 1,,,,ChkStd 0,ChkStd 0,ChkStd 0,,, +C,Std 2,Std 2,Std 2,,,,,,,,, +D,Std 3,Std 3,Std 3,,,,ChkStd 3,ChkStd 3,ChkStd 3,,, +E,Std 4,Std 4,Std 4,,,,,,,,, +F,Std 5,Std 5,Std 5,,,,,,,ChkStd 0,ChkStd 0,ChkStd 0 +G,MC: 10ppt S5,MC: 10ppt S5,MC: 10ppt S5,P4-20,P4-20,P4-20,,,,,, +H,,,,P8-20,P8-20,P8-20,,,,ChkStd 4,ChkStd 4,ChkStd 4 +,,,,,,,,,,,, +,1,2,3,4,5,6,7,8,9,10,11,12 +A,1,1,1,100,100,100,25,25,25,,, +B,1,1,1,100,100,100,1,1,1,,, +C,1,1,1,100,100,100,25,25,25,,, +D,1,1,1,100,100,100,1,1,1,100,100,100 +E,1,1,1,100,100,100,25,25,25,25,25,25 +F,1,1,1,25,25,25,,,,1,1,1 +G,1,1,1,25,25,25,,,,,, +H,100,100,100,25,25,25,,,,1,1,1 diff --git a/CO2xNxPhrag/Porewater/Sulfide/2026/Raw Data/20260601_LTREB_H2S_STD.csv b/CO2xNxPhrag/Porewater/Sulfide/2026/Raw Data/20260601_LTREB_H2S_STD.csv new file mode 100644 index 0000000..8c5969f --- /dev/null +++ b/CO2xNxPhrag/Porewater/Sulfide/2026/Raw Data/20260601_LTREB_H2S_STD.csv @@ -0,0 +1,29 @@ +,1,2,3,4,5,6,7,8,9,10,11,12 +A,0.063,0.063,0.072,0.047,0.046,0.047,0.045,0.046,0.046,0.045,0.044,0.045 +B,0.154,0.13,0.124,0.044,0.044,0.045,0.049,0.044,0.045,0.044,0.044,0.044 +C,0.261,0.251,0.228,0.044,0.045,0.045,0.044,0.044,0.044,0.045,0.045,0.046 +D,0.422,0.52,0.469,0.044,0.045,0.045,0.045,0.044,0.044,0.044,0.044,0.045 +E,0.671,0.631,0.672,0.044,0.044,0.045,0.045,0.044,0.044,0.047,0.045,0.045 +F,1.152,1.331,1.309,0.044,0.044,0.044,0.044,0.044,0.044,0.044,0.045,0.044 +G,1.283,1.178,1.293,0.044,0.045,0.045,0.045,0.045,0.044,0.044,0.044,0.044 +H,0.046,0.046,0.045,0.045,0.048,0.044,0.044,0.046,0.047,0.044,0.045,0.045 +,,,,,,,,,,,, +,1,2,3,4,5,6,7,8,9,10,11,12 +A,Std 0,Std 0,Std 0,,,,,,,,, +B,Std 1,Std 1,Std 1,,,,,,,,, +C,Std 2,Std 2,Std 2,,,,,,,,, +D,Std 3,Std 3,Std 3,,,,,,,,, +E,Std 4,Std 4,Std 4,,,,,,,,, +F,Std 5,Std 5,Std 5,,,,,,,,, +G,MC: 10ppt S5,MC: 10ppt S5,MC: 10ppt S5,,,,,,,,, +H,,,,,,,,,,,, +,,,,,,,,,,,, +,1,2,3,4,5,6,7,8,9,10,11,12 +A,1,1,1,,,,,,,,, +B,1,1,1,,,,,,,,, +C,1,1,1,,,,,,,,, +D,1,1,1,,,,,,,,, +E,1,1,1,,,,,,,,, +F,1,1,1,,,,,,,,, +G,1,1,1,,,,,,,,, +H,,,,,,,,,,,, diff --git a/CO2xNxPhrag/Porewater/Sulfide/2026/Ready for Review/GCReW_CO2xNxPhrag_Porewater_H2S_202605.pdf b/CO2xNxPhrag/Porewater/Sulfide/2026/Ready for Review/GCReW_CO2xNxPhrag_Porewater_H2S_202605.pdf new file mode 100644 index 0000000..8da58cf Binary files /dev/null and b/CO2xNxPhrag/Porewater/Sulfide/2026/Ready for Review/GCReW_CO2xNxPhrag_Porewater_H2S_202605.pdf differ diff --git a/GENX (WIP)/Porewater/CH4/2026/Processed Data/ShimadzuGC_Slope_QAQC.csv b/GENX (WIP)/Porewater/CH4/2026/Processed Data/ShimadzuGC_Slope_QAQC.csv index 3ddabac..e44774b 100644 --- a/GENX (WIP)/Porewater/CH4/2026/Processed Data/ShimadzuGC_Slope_QAQC.csv +++ b/GENX (WIP)/Porewater/CH4/2026/Processed Data/ShimadzuGC_Slope_QAQC.csv @@ -1,86 +1,81 @@ -"","Analysis","Run_Date","Run_by","Curve_top","curve","slope","intercept","R2" -"1","CH4",NA,"Alia Al-Haj","10 ppm","Slope_Ch4_low",0.001594508,-0.209011794,0.996021498 -"2","CH4",NA,"Alia Al-Haj","100 ppm","Slope_Ch4_high",0.001562326,0.096462426,0.99965305 -"3","N2O",NA,"Alia Al-Haj","5 ppm","Slope_N2O_low",0.000192023,0.07848462,0.994078525 -"4","N2O",NA,"Alia Al-Haj","50.2 ppm","Slope_N2O_high",0.000282245,-0.4992549,0.996064359 -"5","CO2",NA,"Alia Al-Haj","2000 ppm","Slope_CO2_low",0.000282245,-0.4992549,NA -"6","CO2",NA,"Alia Al-Haj","20000 ppm","Slope_CO2_high",0.001549502,38.64567509,0.99969067 -"7","CO2",NA,"Alia Al-Haj","2000 ppm","Slope_CO2_low",0.001589347,-22.53271377,0.998033031 -"8","CH4",NA,"Alia Al-Haj","10 ppm","Slope_Ch4_low",0.001635071,-0.415802812,0.998936972 -"9","CH4",NA,"Alia Al-Haj","100 ppm","Slope_Ch4_high",0.001610517,-0.260179312,0.999589693 -"10","N2O",NA,"Alia Al-Haj","5 ppm","Slope_N2O_low",0.000332544,0.02720789,0.998943899 -"11","N2O",NA,"Alia Al-Haj","50.2 ppm","Slope_N2O_high",0.000374813,-0.364855129,0.999519714 -"12","CO2",NA,"Alia Al-Haj","2000 ppm","Slope_CO2_low",0.00436988,-39.16440688,0.999556381 -"13","CO2",NA,"Alia Al-Haj","20000 ppm","Slope_CO2_high",0.005427037,-410.701602,0.997695695 -"14","CH4",NA,"Alia Al-Haj","10 ppm","Slope_Ch4_low",0.001699272,-0.36364615,0.999365585 -"15","CH4",NA,"Alia Al-Haj","100 ppm","Slope_Ch4_high",0.001645721,-0.302217089,0.999820016 -"16","N2O",NA,"Alia Al-Haj","5 ppm","Slope_N2O_low",0.000307201,-0.129813571,0.996864375 -"17","N2O",NA,"Alia Al-Haj","50.2 ppm","Slope_N2O_high",0.00039424,-1.239997568,0.996491404 -"18","CO2",NA,"Alia Al-Haj","2000 ppm","Slope_CO2_low",0.014290722,-133.2216274,0.992711707 -"19","CO2",NA,"Alia Al-Haj","20000 ppm","Slope_CO2_high",0.019925561,-758.9107959,0.993153873 -"20","CH4",NA,"Alia Al-Haj","10 ppm","Slope_Ch4_low",0.001696157,-0.374152258,0.998989143 -"21","CH4",NA,"Alia Al-Haj","100 ppm","Slope_Ch4_high",0.001674034,-0.444470486,0.999847769 -"22","N2O",NA,"Alia Al-Haj","5 ppm","Slope_N2O_low",0.00030473,-0.128294418,0.996339544 -"23","N2O",NA,"Alia Al-Haj","50.2 ppm","Slope_N2O_high",0.000390151,-1.194079817,0.995910931 -"24","CO2",NA,"Alia Al-Haj","2000 ppm","Slope_CO2_low",0.030108212,-111.5177493,0.997665945 -"25","CO2",NA,"Alia Al-Haj","20000 ppm","Slope_CO2_high",0.03615844,-461.2407842,0.997105868 -"26","CH4",NA,"Alia Al-Haj","10 ppm","Slope_Ch4_low",0.001651161,-0.418451745,0.999069805 -"27","CH4",NA,"Alia Al-Haj","100 ppm","Slope_Ch4_high",0.001653724,-0.733668141,0.99965238 -"28","N2O",NA,"Alia Al-Haj","5 ppm","Slope_N2O_low",0.000338477,-0.110108749,0.997794532 -"29","N2O",NA,"Alia Al-Haj","50.2 ppm","Slope_N2O_high",0.000432669,-1.385832789,0.995237819 -"30","CO2",NA,"Alia Al-Haj","2000 ppm","Slope_CO2_low",0.112693619,-328.4347803,0.924017275 -"31","CO2",NA,"Alia Al-Haj","20000 ppm","Slope_CO2_high",0.164084335,-1184.21134,0.992753219 -"32","CH4",NA,"Alia Al-Haj","10 ppm","Slope_Ch4_low",0.001579414,-0.579743712,0.99556935 -"33","CH4",NA,"Alia Al-Haj","100 ppm","Slope_Ch4_high",0.001609223,-0.93744807,0.999588886 -"34","N2O",NA,"Alia Al-Haj","5 ppm","Slope_N2O_low",0.000342319,-0.113011403,0.996718446 -"35","N2O",NA,"Alia Al-Haj","50.2 ppm","Slope_N2O_high",0.000430913,-1.093446824,0.998159291 -"36","CO2",NA,"Alia Al-Haj","2000 ppm","Slope_CO2_low",0.007639638,-84.45916741,0.990777611 -"37","CO2",NA,"Alia Al-Haj","20000 ppm","Slope_CO2_high",0.009554308,-523.2397059,0.99603398 -"38","CH4",NA,"Alia Al-Haj","10 ppm","Slope_Ch4_low",0.00165936,-0.312663578,0.999071246 -"39","CH4",NA,"Alia Al-Haj","100 ppm","Slope_Ch4_high",0.001646187,-0.137654017,0.999539695 -"40","N2O",NA,"Alia Al-Haj","5 ppm","Slope_N2O_low",0.000336766,-0.06088351,0.998663728 -"41","N2O",NA,"Alia Al-Haj","50.2 ppm","Slope_N2O_high",0.000430927,-1.058115228,0.997680069 -"42","CO2",NA,"Alia Al-Haj","2000 ppm","Slope_CO2_low",0.015447726,-97.53592352,0.99373914 -"43","CO2",NA,"Alia Al-Haj","20000 ppm","Slope_CO2_high",0.021712672,-679.3005284,0.995487146 -"44","CH4",NA,"Alia Al-Haj","10 ppm","Slope_Ch4_low",0.001688226,-0.341546607,0.998896003 -"45","CH4",NA,"Alia Al-Haj","100 ppm","Slope_Ch4_high",0.001673795,-5.829652752,0.999908126 -"46","N2O",NA,"Alia Al-Haj","5 ppm","Slope_N2O_low",0.000376812,-0.053248093,0.994890434 -"47","N2O",NA,"Alia Al-Haj","50.2 ppm","Slope_N2O_high",0.000686765,-14.1991256,0.978836198 -"48","CO2",NA,"Alia Al-Haj","2000 ppm","Slope_CO2_low",0.027385279,-68.87873048,0.998032791 -"49","CO2",NA,"Alia Al-Haj","20000 ppm","Slope_CO2_high",0.03698406,-969.5293802,0.991611983 -"50","CH4",NA,"Melanie Giessner","1006 ppm","Slope_Ch4_high",0.00163827853907655,-1.29911336693767,0.999758978498107 -"51","CH4",NA,"Melanie Giessner","1006 ppm","Slope_Ch4_high",0.00166059310119176,-0.887510807353799,0.999759398782963 -"52","CH4",NA,"Melanie Giessner","10 ppm","Slope_Ch4_low",0.00162531566412859,-0.404115803545286,0.998255092920635 -"53","CH4",NA,"Melanie Giessner","10 ppm","Slope_Ch4_low",0.001647438270003,-0.249557905607749,0.995051472554768 -"54","CO2",NA,"Melanie Giessner","50100 ppm","Slope_CO2_high",0.00303024201185944,-2361.64392240232,0.990992596749143 -"55","CO2",NA,"Melanie Giessner","50100 ppm","Slope_CO2_high",0.003316713728449,-2251.48137475922,0.99116375263879 -"56","CO2",NA,"Melanie Giessner","2000 ppm","Slope_CO2_low",0.00229924941233948,-77.4705442683676,0.985266371742737 -"57","CO2",NA,"Melanie Giessner","2000 ppm","Slope_CO2_low",0.00247647434485168,-68.9384262763201,0.991306452816991 -"58","N2O",NA,"Melanie Giessner","500 ppm","Slope_N2O_high",0.000644077772770428,-26.7094976529205,0.98889152320231 -"59","N2O",NA,"Melanie Giessner","500 ppm","Slope_N2O_high",0.000828481814375763,-14.5876555955748,0.995876920382143 -"60","N2O",NA,"Melanie Giessner","5 ppm","Slope_N2O_low",0.000317344020435228,-0.201386449831287,0.996257109013672 -"61","N2O",NA,"Melanie Giessner","5 ppm","Slope_N2O_low",0.000499972753593854,-0.0186733696828502,0.999019433709326 -"62","CH4",NA,"Melanie Giessner","1006 ppm","Slope_Ch4_high",0.00163827853907655,-1.29911336693767,0.999758978498107 -"63","CH4",NA,"Melanie Giessner","1006 ppm","Slope_Ch4_high",0.00166059310119176,-0.887510807353799,0.999759398782963 -"64","CH4",NA,"Melanie Giessner","10 ppm","Slope_Ch4_low",0.00162531566412859,-0.404115803545286,0.998255092920635 -"65","CH4",NA,"Melanie Giessner","10 ppm","Slope_Ch4_low",0.001647438270003,-0.249557905607749,0.995051472554768 -"66","CO2",NA,"Melanie Giessner","50100 ppm","Slope_CO2_high",0.00303024201185944,-2361.64392240232,0.990992596749143 -"67","CO2",NA,"Melanie Giessner","50100 ppm","Slope_CO2_high",0.003316713728449,-2251.48137475922,0.99116375263879 -"68","CO2",NA,"Melanie Giessner","2000 ppm","Slope_CO2_low",0.00229924941233948,-77.4705442683676,0.985266371742737 -"69","CO2",NA,"Melanie Giessner","2000 ppm","Slope_CO2_low",0.00247647434485168,-68.9384262763201,0.991306452816991 -"70","N2O",NA,"Melanie Giessner","500 ppm","Slope_N2O_high",0.000644077772770428,-26.7094976529205,0.98889152320231 -"71","N2O",NA,"Melanie Giessner","500 ppm","Slope_N2O_high",0.000828481814375763,-14.5876555955748,0.995876920382143 -"72","N2O",NA,"Melanie Giessner","5 ppm","Slope_N2O_low",0.000317344020435228,-0.201386449831287,0.996257109013672 -"73","N2O",NA,"Melanie Giessner","5 ppm","Slope_N2O_low",0.000499972753593854,-0.0186733696828502,0.999019433709326 -"74","CH4",2026-04-17,"Melanie Giessner","1006 ppm","Slope_Ch4_high",0.00163827853907655,-1.29911336693767,0.999758978498107 -"75","CH4",2026-05-01,"Melanie Giessner","1006 ppm","Slope_Ch4_high",0.00166059310119176,-0.887510807353799,0.999759398782963 -"76","CH4",2026-04-17,"Melanie Giessner","10 ppm","Slope_Ch4_low",0.00162531566412859,-0.404115803545286,0.998255092920635 -"77","CH4",2026-05-01,"Melanie Giessner","10 ppm","Slope_Ch4_low",0.001647438270003,-0.249557905607749,0.995051472554768 -"78","CO2",2026-04-17,"Melanie Giessner","50100 ppm","Slope_CO2_high",0.00303024201185944,-2361.64392240232,0.990992596749143 -"79","CO2",2026-05-01,"Melanie Giessner","50100 ppm","Slope_CO2_high",0.003316713728449,-2251.48137475922,0.99116375263879 -"80","CO2",2026-04-17,"Melanie Giessner","2000 ppm","Slope_CO2_low",0.00229924941233948,-77.4705442683676,0.985266371742737 -"81","CO2",2026-05-01,"Melanie Giessner","2000 ppm","Slope_CO2_low",0.00247647434485168,-68.9384262763201,0.991306452816991 -"82","N2O",2026-04-17,"Melanie Giessner","500 ppm","Slope_N2O_high",0.000644077772770428,-26.7094976529205,0.98889152320231 -"83","N2O",2026-05-01,"Melanie Giessner","500 ppm","Slope_N2O_high",0.000828481814375763,-14.5876555955748,0.995876920382143 -"84","N2O",2026-04-17,"Melanie Giessner","5 ppm","Slope_N2O_low",0.000317344020435228,-0.201386449831287,0.996257109013672 -"85","N2O",2026-05-01,"Melanie Giessner","5 ppm","Slope_N2O_low",0.000499972753593854,-0.0186733696828502,0.999019433709326 +,Analysis,Run_Date,Run_by,Curve_top,curve,slope,intercept,R2 +1,CH4,7/9/2024,Alia Al-Haj,10 ppm,Slope_CH4_low,0.001594508,-0.209011794,0.996021498 +2,CH4,7/9/2024,Alia Al-Haj,100 ppm,Slope_CH4_high,0.001562326,0.096462426,0.99965305 +3,N2O,7/9/2024,Alia Al-Haj,5 ppm,Slope_N2O_low,0.000192023,0.07848462,0.994078525 +4,N2O,7/9/2024,Alia Al-Haj,50.2 ppm,Slope_N2O_high,0.000282245,-0.4992549,0.996064359 +5,CO2,7/9/2024,Alia Al-Haj,2000 ppm,Slope_CO2_low,0.000282245,-0.4992549,NA +6,CO2,7/9/2024,Alia Al-Haj,20000 ppm,Slope_CO2_high,0.001549502,38.64567509,0.99969067 +7,CO2,7/9/2024,Alia Al-Haj,2000 ppm,Slope_CO2_low,0.001589347,-22.53271377,0.998033031 +8,CO2,7/9/2024,Alia Al-Haj,20000 ppm,Slope_CO2_high,0.001549502,38.64567509,0.99969067 +9,CH4,7/9/2024,Alia Al-Haj,10 ppm,Slope_CH4_low,0.001594508,-0.209011794,0.996021498 +10,CH4,7/9/2024,Alia Al-Haj,100 ppm,Slope_CH4_high,0.001562326,0.096462426,0.99965305 +11,N2O,7/9/2024,Alia Al-Haj,5 ppm,Slope_N2O_low,0.000192023,0.07848462,0.994078525 +12,N2O,7/9/2024,Alia Al-Haj,50.2 ppm,Slope_N2O_high,0.000282245,-0.4992549,0.996064359 +13,CO2,7/9/2024,Alia Al-Haj,2000 ppm,Slope_CO2_low,0.001589347,-22.53271377,0.998033031 +14,CO2,7/9/2024,Alia Al-Haj,20000 ppm,Slope_CO2_high,0.001549502,38.64567509,0.99969067 +15,CH4,6/3/2025,Alia Al-Haj,10 ppm,Slope_CH4_low,0.001635071,-0.415802812,0.998936972 +16,CH4,6/3/2025,Alia Al-Haj,100 ppm,Slope_CH4_high,0.001610517,-0.260179312,0.999589693 +17,N2O,6/3/2025,Alia Al-Haj,5 ppm,Slope_N2O_low,0.000332544,0.02720789,0.998943899 +18,N2O,6/3/2025,Alia Al-Haj,50.2 ppm,Slope_N2O_high,0.000374813,-0.364855129,0.999519714 +19,CO2,6/3/2025,Alia Al-Haj,2000 ppm,Slope_CO2_low,0.00436988,-39.16440688,0.999556381 +20,CO2,6/3/2025,Alia Al-Haj,20000 ppm,Slope_CO2_high,0.005427037,-410.701602,0.997695695 +21,CH4,9/23/2025,Alia Al-Haj,10 ppm,Slope_CH4_low,0.001699272,-0.36364615,0.999365585 +22,CH4,9/23/2025,Alia Al-Haj,100 ppm,Slope_CH4_high,0.001645721,-0.302217089,0.999820016 +23,N2O,9/23/2025,Alia Al-Haj,5 ppm,Slope_N2O_low,0.000307201,-0.129813571,0.996864375 +24,N2O,9/23/2025,Alia Al-Haj,50.2 ppm,Slope_N2O_high,0.00039424,-1.239997568,0.996491404 +25,CO2,9/23/2025,Alia Al-Haj,2000 ppm,Slope_CO2_low,0.014290722,-133.2216274,0.992711707 +26,CO2,9/23/2025,Alia Al-Haj,20000 ppm,Slope_CO2_high,0.019925561,-758.9107959,0.993153873 +27,CH4,9/24/2025,Alia Al-Haj,10 ppm,Slope_CH4_low,0.001699272,-0.36364615,0.999365585 +28,CH4,9/24/2025,Alia Al-Haj,100 ppm,Slope_CH4_high,0.001645721,-0.302217089,0.999820016 +29,N2O,9/24/2025,Alia Al-Haj,5 ppm,Slope_N2O_low,0.000307201,-0.129813571,0.996864375 +30,N2O,9/24/2025,Alia Al-Haj,50.2 ppm,Slope_N2O_high,0.00039424,-1.239997568,0.996491404 +31,CO2,9/24/2025,Alia Al-Haj,2000 ppm,Slope_CO2_low,0.014290722,-133.2216274,0.992711707 +32,CO2,9/24/2025,Alia Al-Haj,20000 ppm,Slope_CO2_high,0.019925561,-758.9107959,0.993153873 +33,CH4,9/24/2025,Alia Al-Haj,10 ppm,Slope_CH4_low,0.001696157,-0.374152258,0.998989143 +34,CH4,9/24/2025,Alia Al-Haj,100 ppm,Slope_CH4_high,0.001674034,-0.444470486,0.999847769 +35,N2O,9/24/2025,Alia Al-Haj,5 ppm,Slope_N2O_low,0.00030473,-0.128294418,0.996339544 +36,N2O,9/24/2025,Alia Al-Haj,50.2 ppm,Slope_N2O_high,0.000390151,-1.194079817,0.995910931 +37,CO2,9/24/2025,Alia Al-Haj,2000 ppm,Slope_CO2_low,0.030108212,-111.5177493,0.997665945 +38,CO2,9/24/2025,Alia Al-Haj,20000 ppm,Slope_CO2_high,0.03615844,-461.2407842,0.997105868 +39,CH4,9/30/2025,Alia Al-Haj,10 ppm,Slope_CH4_low,0.001651161,-0.418451745,0.999069805 +40,CH4,9/30/2025,Alia Al-Haj,100 ppm,Slope_CH4_high,0.001653724,-0.733668141,0.99965238 +41,N2O,9/30/2025,Alia Al-Haj,5 ppm,Slope_N2O_low,0.000338477,-0.110108749,0.997794532 +42,N2O,9/30/2025,Alia Al-Haj,50.2 ppm,Slope_N2O_high,0.000432669,-1.385832789,0.995237819 +43,CO2,9/30/2025,Alia Al-Haj,2000 ppm,Slope_CO2_low,0.112693619,-328.4347803,0.924017275 +44,CO2,9/30/2025,Alia Al-Haj,20000 ppm,Slope_CO2_high,0.164084335,-1184.21134,0.992753219 +45,CH4,10/2/2025,Alia Al-Haj,10 ppm,Slope_CH4_low,0.001579414,-0.579743712,0.99556935 +46,CH4,10/2/2025,Alia Al-Haj,100 ppm,Slope_CH4_high,0.001609223,-0.93744807,0.999588886 +47,N2O,10/2/2025,Alia Al-Haj,5 ppm,Slope_N2O_low,0.000342319,-0.113011403,0.996718446 +48,N2O,10/2/2025,Alia Al-Haj,50.2 ppm,Slope_N2O_high,0.000430913,-1.093446824,0.998159291 +49,CO2,10/2/2025,Alia Al-Haj,2000 ppm,Slope_CO2_low,0.007639638,-84.45916741,0.990777611 +50,CO2,10/2/2025,Alia Al-Haj,20000 ppm,Slope_CO2_high,0.009554308,-523.2397059,0.99603398 +51,CH4,10/7/2025,Alia Al-Haj,10 ppm,Slope_CH4_low,0.00165936,-0.312663578,0.999071246 +52,CH4,10/7/2025,Alia Al-Haj,100 ppm,Slope_CH4_high,0.001646187,-0.137654017,0.999539695 +53,N2O,10/7/2025,Alia Al-Haj,5 ppm,Slope_N2O_low,0.000336766,-0.06088351,0.998663728 +54,N2O,10/7/2025,Alia Al-Haj,50.2 ppm,Slope_N2O_high,0.000430927,-1.058115228,0.997680069 +55,CO2,10/7/2025,Alia Al-Haj,2000 ppm,Slope_CO2_low,0.015447726,-97.53592352,0.99373914 +56,CO2,10/7/2025,Alia Al-Haj,20000 ppm,Slope_CO2_high,0.021712672,-679.3005284,0.995487146 +57,CH4,10/8/2025,Alia Al-Haj,10 ppm,Slope_CH4_low,0.001688226,-0.341546607,0.998896003 +58,CH4,10/8/2025,Alia Al-Haj,100 ppm,Slope_CH4_high,0.001673795,-5.829652752,0.999908126 +59,N2O,10/8/2025,Alia Al-Haj,5 ppm,Slope_N2O_low,0.000376812,-0.053248093,0.994890434 +60,N2O,10/8/2025,Alia Al-Haj,50.2 ppm,Slope_N2O_high,0.000686765,-14.1991256,0.978836198 +61,CO2,10/8/2025,Alia Al-Haj,2000 ppm,Slope_CO2_low,0.027385279,-68.87873048,0.998032791 +62,CO2,10/8/2025,Alia Al-Haj,20000 ppm,Slope_CO2_high,0.03698406,-969.5293802,0.991611983 +63,CH4,10/8/2025,Alia Al-Haj,10 ppm,Slope_CH4_low,0.001688226,-0.341546607,0.998896003 +64,CH4,10/8/2025,Alia Al-Haj,100 ppm,Slope_CH4_high,0.001673795,-5.829652752,0.999908126 +65,N2O,10/8/2025,Alia Al-Haj,5 ppm,Slope_N2O_low,0.000376812,-0.053248093,0.994890434 +66,N2O,10/8/2025,Alia Al-Haj,50.2 ppm,Slope_N2O_high,0.000686765,-14.1991256,0.978836198 +67,CO2,10/8/2025,Alia Al-Haj,2000 ppm,Slope_CO2_low,0.027385279,-68.87873048,0.998032791 +68,CO2,10/8/2025,Alia Al-Haj,20000 ppm,Slope_CO2_high,0.03698406,-969.5293802,0.991611983 +69,CH4,4/17/2026,Melanie Giessner,1006 ppm,Slope_Ch4_high,0.001638279,-1.299113367,0.999758978 +70,CH4,5/1/2026,Melanie Giessner,1006 ppm,Slope_Ch4_high,0.001660593,-0.887510807,0.999759399 +71,CH4,4/17/2026,Melanie Giessner,10 ppm,Slope_Ch4_low,0.001625316,-0.404115804,0.998255093 +72,CH4,5/1/2026,Melanie Giessner,10 ppm,Slope_Ch4_low,0.001647438,-0.249557906,0.995051473 +73,CO2,4/17/2026,Melanie Giessner,50100 ppm,Slope_CO2_high,0.003030242,-2361.643922,0.990992597 +74,CO2,5/1/2026,Melanie Giessner,50100 ppm,Slope_CO2_high,0.003316714,-2251.481375,0.991163753 +75,CO2,4/17/2026,Melanie Giessner,2000 ppm,Slope_CO2_low,0.002299249,-77.47054427,0.985266372 +76,CO2,5/1/2026,Melanie Giessner,2000 ppm,Slope_CO2_low,0.002476474,-68.93842628,0.991306453 +77,N2O,4/17/2026,Melanie Giessner,500 ppm,Slope_N2O_high,0.000644078,-26.70949765,0.988891523 +78,N2O,5/1/2026,Melanie Giessner,500 ppm,Slope_N2O_high,0.000828482,-14.5876556,0.99587692 +79,N2O,4/17/2026,Melanie Giessner,5 ppm,Slope_N2O_low,0.000317344,-0.20138645,0.996257109 +80,N2O,5/1/2026,Melanie Giessner,5 ppm,Slope_N2O_low,0.000499973,-0.01867337,0.999019434 diff --git a/GENX (WIP)/Porewater/CH4/2026/Processed Data/ShimadzuGC_Slope_QAQC_1.csv b/GENX (WIP)/Porewater/CH4/2026/Processed Data/ShimadzuGC_Slope_QAQC_1.csv new file mode 100644 index 0000000..a34f388 --- /dev/null +++ b/GENX (WIP)/Porewater/CH4/2026/Processed Data/ShimadzuGC_Slope_QAQC_1.csv @@ -0,0 +1,80 @@ +"","Analysis","Run_Date","Run_by","Curve_top","curve","slope","intercept","R2" +"1","CH4",NA,"Alia Al-Haj","10 ppm","Slope_Ch4_low",0.001594508,-0.209011794,0.996021498 +"2","CH4",NA,"Alia Al-Haj","100 ppm","Slope_Ch4_high",0.001562326,0.096462426,0.99965305 +"3","N2O",NA,"Alia Al-Haj","5 ppm","Slope_N2O_low",0.000192023,0.07848462,0.994078525 +"4","N2O",NA,"Alia Al-Haj","50.2 ppm","Slope_N2O_high",0.000282245,-0.4992549,0.996064359 +"5","CO2",NA,"Alia Al-Haj","2000 ppm","Slope_CO2_low",0.000282245,-0.4992549,NA +"6","CO2",NA,"Alia Al-Haj","20000 ppm","Slope_CO2_high",0.001549502,38.64567509,0.99969067 +"7","CO2",NA,"Alia Al-Haj","2000 ppm","Slope_CO2_low",0.001589347,-22.53271377,0.998033031 +"8","CH4",NA,"Alia Al-Haj","10 ppm","Slope_Ch4_low",0.001635071,-0.415802812,0.998936972 +"9","CH4",NA,"Alia Al-Haj","100 ppm","Slope_Ch4_high",0.001610517,-0.260179312,0.999589693 +"10","N2O",NA,"Alia Al-Haj","5 ppm","Slope_N2O_low",0.000332544,0.02720789,0.998943899 +"11","N2O",NA,"Alia Al-Haj","50.2 ppm","Slope_N2O_high",0.000374813,-0.364855129,0.999519714 +"12","CO2",NA,"Alia Al-Haj","2000 ppm","Slope_CO2_low",0.00436988,-39.16440688,0.999556381 +"13","CO2",NA,"Alia Al-Haj","20000 ppm","Slope_CO2_high",0.005427037,-410.701602,0.997695695 +"14","CH4",NA,"Alia Al-Haj","10 ppm","Slope_Ch4_low",0.001699272,-0.36364615,0.999365585 +"15","CH4",NA,"Alia Al-Haj","100 ppm","Slope_Ch4_high",0.001645721,-0.302217089,0.999820016 +"16","N2O",NA,"Alia Al-Haj","5 ppm","Slope_N2O_low",0.000307201,-0.129813571,0.996864375 +"17","N2O",NA,"Alia Al-Haj","50.2 ppm","Slope_N2O_high",0.00039424,-1.239997568,0.996491404 +"18","CO2",NA,"Alia Al-Haj","2000 ppm","Slope_CO2_low",0.014290722,-133.2216274,0.992711707 +"19","CO2",NA,"Alia Al-Haj","20000 ppm","Slope_CO2_high",0.019925561,-758.9107959,0.993153873 +"20","CH4",NA,"Alia Al-Haj","10 ppm","Slope_Ch4_low",0.001699272,-0.36364615,0.999365585 +"21","CH4",NA,"Alia Al-Haj","100 ppm","Slope_Ch4_high",0.001645721,-0.302217089,0.999820016 +"22","N2O",NA,"Alia Al-Haj","5 ppm","Slope_N2O_low",0.000307201,-0.129813571,0.996864375 +"23","N2O",NA,"Alia Al-Haj","50.2 ppm","Slope_N2O_high",0.00039424,-1.239997568,0.996491404 +"24","CO2",NA,"Alia Al-Haj","2000 ppm","Slope_CO2_low",0.014290722,-133.2216274,0.992711707 +"25","CO2",NA,"Alia Al-Haj","20000 ppm","Slope_CO2_high",0.019925561,-758.9107959,0.993153873 +"26","CH4",NA,"Alia Al-Haj","10 ppm","Slope_Ch4_low",0.001696157,-0.374152258,0.998989143 +"27","CH4",NA,"Alia Al-Haj","100 ppm","Slope_Ch4_high",0.001674034,-0.444470486,0.999847769 +"28","N2O",NA,"Alia Al-Haj","5 ppm","Slope_N2O_low",0.00030473,-0.128294418,0.996339544 +"29","N2O",NA,"Alia Al-Haj","50.2 ppm","Slope_N2O_high",0.000390151,-1.194079817,0.995910931 +"30","CO2",NA,"Alia Al-Haj","2000 ppm","Slope_CO2_low",0.030108212,-111.5177493,0.997665945 +"31","CO2",NA,"Alia Al-Haj","20000 ppm","Slope_CO2_high",0.03615844,-461.2407842,0.997105868 +"32","CH4",NA,"Alia Al-Haj","10 ppm","Slope_Ch4_low",0.001651161,-0.418451745,0.999069805 +"33","CH4",NA,"Alia Al-Haj","100 ppm","Slope_Ch4_high",0.001653724,-0.733668141,0.99965238 +"34","N2O",NA,"Alia Al-Haj","5 ppm","Slope_N2O_low",0.000338477,-0.110108749,0.997794532 +"35","N2O",NA,"Alia Al-Haj","50.2 ppm","Slope_N2O_high",0.000432669,-1.385832789,0.995237819 +"36","CO2",NA,"Alia Al-Haj","2000 ppm","Slope_CO2_low",0.112693619,-328.4347803,0.924017275 +"37","CO2",NA,"Alia Al-Haj","20000 ppm","Slope_CO2_high",0.164084335,-1184.21134,0.992753219 +"38","CH4",NA,"Alia Al-Haj","10 ppm","Slope_Ch4_low",0.001579414,-0.579743712,0.99556935 +"39","CH4",NA,"Alia Al-Haj","100 ppm","Slope_Ch4_high",0.001609223,-0.93744807,0.999588886 +"40","N2O",NA,"Alia Al-Haj","5 ppm","Slope_N2O_low",0.000342319,-0.113011403,0.996718446 +"41","N2O",NA,"Alia Al-Haj","50.2 ppm","Slope_N2O_high",0.000430913,-1.093446824,0.998159291 +"42","CO2",NA,"Alia Al-Haj","2000 ppm","Slope_CO2_low",0.007639638,-84.45916741,0.990777611 +"43","CO2",NA,"Alia Al-Haj","20000 ppm","Slope_CO2_high",0.009554308,-523.2397059,0.99603398 +"44","CH4",NA,"Alia Al-Haj","10 ppm","Slope_Ch4_low",0.00165936,-0.312663578,0.999071246 +"45","CH4",NA,"Alia Al-Haj","100 ppm","Slope_Ch4_high",0.001646187,-0.137654017,0.999539695 +"46","N2O",NA,"Alia Al-Haj","5 ppm","Slope_N2O_low",0.000336766,-0.06088351,0.998663728 +"47","N2O",NA,"Alia Al-Haj","50.2 ppm","Slope_N2O_high",0.000430927,-1.058115228,0.997680069 +"48","CO2",NA,"Alia Al-Haj","2000 ppm","Slope_CO2_low",0.015447726,-97.53592352,0.99373914 +"49","CO2",NA,"Alia Al-Haj","20000 ppm","Slope_CO2_high",0.021712672,-679.3005284,0.995487146 +"50","CH4",NA,"Alia Al-Haj","10 ppm","Slope_Ch4_low",0.001688226,-0.341546607,0.998896003 +"51","CH4",NA,"Alia Al-Haj","100 ppm","Slope_Ch4_high",0.001673795,-5.829652752,0.999908126 +"52","N2O",NA,"Alia Al-Haj","5 ppm","Slope_N2O_low",0.000376812,-0.053248093,0.994890434 +"53","N2O",NA,"Alia Al-Haj","50.2 ppm","Slope_N2O_high",0.000686765,-14.1991256,0.978836198 +"54","CO2",NA,"Alia Al-Haj","2000 ppm","Slope_CO2_low",0.027385279,-68.87873048,0.998032791 +"55","CO2",NA,"Alia Al-Haj","20000 ppm","Slope_CO2_high",0.03698406,-969.5293802,0.991611983 +"56","CH4",NA,"Melanie Giessner","1006 ppm","Slope_Ch4_high",0.00163827853907655,-1.29911336693767,0.999758978498107 +"57","CH4",NA,"Melanie Giessner","1006 ppm","Slope_Ch4_high",0.00166059310119176,-0.887510807353799,0.999759398782963 +"58","CH4",NA,"Melanie Giessner","10 ppm","Slope_Ch4_low",0.00162531566412859,-0.404115803545286,0.998255092920635 +"59","CH4",NA,"Melanie Giessner","10 ppm","Slope_Ch4_low",0.001647438270003,-0.249557905607749,0.995051472554768 +"60","CO2",NA,"Melanie Giessner","50100 ppm","Slope_CO2_high",0.00303024201185944,-2361.64392240232,0.990992596749143 +"61","CO2",NA,"Melanie Giessner","50100 ppm","Slope_CO2_high",0.003316713728449,-2251.48137475922,0.99116375263879 +"62","CO2",NA,"Melanie Giessner","2000 ppm","Slope_CO2_low",0.00229924941233948,-77.4705442683676,0.985266371742737 +"63","CO2",NA,"Melanie Giessner","2000 ppm","Slope_CO2_low",0.00247647434485168,-68.9384262763201,0.991306452816991 +"64","N2O",NA,"Melanie Giessner","500 ppm","Slope_N2O_high",0.000644077772770428,-26.7094976529205,0.98889152320231 +"65","N2O",NA,"Melanie Giessner","500 ppm","Slope_N2O_high",0.000828481814375763,-14.5876555955748,0.995876920382143 +"66","N2O",NA,"Melanie Giessner","5 ppm","Slope_N2O_low",0.000317344020435228,-0.201386449831287,0.996257109013672 +"67","N2O",NA,"Melanie Giessner","5 ppm","Slope_N2O_low",0.000499972753593854,-0.0186733696828502,0.999019433709326 +"68","CH4",2026-04-17,"Melanie Giessner","1006 ppm","Slope_Ch4_high",0.00163827853907655,-1.29911336693767,0.999758978498107 +"69","CH4",2026-05-01,"Melanie Giessner","1006 ppm","Slope_Ch4_high",0.00166059310119176,-0.887510807353799,0.999759398782963 +"70","CH4",2026-04-17,"Melanie Giessner","10 ppm","Slope_Ch4_low",0.00162531566412859,-0.404115803545286,0.998255092920635 +"71","CH4",2026-05-01,"Melanie Giessner","10 ppm","Slope_Ch4_low",0.001647438270003,-0.249557905607749,0.995051472554768 +"72","CO2",2026-04-17,"Melanie Giessner","50100 ppm","Slope_CO2_high",0.00303024201185944,-2361.64392240232,0.990992596749143 +"73","CO2",2026-05-01,"Melanie Giessner","50100 ppm","Slope_CO2_high",0.003316713728449,-2251.48137475922,0.99116375263879 +"74","CO2",2026-04-17,"Melanie Giessner","2000 ppm","Slope_CO2_low",0.00229924941233948,-77.4705442683676,0.985266371742737 +"75","CO2",2026-05-01,"Melanie Giessner","2000 ppm","Slope_CO2_low",0.00247647434485168,-68.9384262763201,0.991306452816991 +"76","N2O",2026-04-17,"Melanie Giessner","500 ppm","Slope_N2O_high",0.000644077772770428,-26.7094976529205,0.98889152320231 +"77","N2O",2026-05-01,"Melanie Giessner","500 ppm","Slope_N2O_high",0.000828481814375763,-14.5876555955748,0.995876920382143 +"78","N2O",2026-04-17,"Melanie Giessner","5 ppm","Slope_N2O_low",0.000317344020435228,-0.201386449831287,0.996257109013672 +"79","N2O",2026-05-01,"Melanie Giessner","5 ppm","Slope_N2O_low",0.000499972753593854,-0.0186733696828502,0.999019433709326 diff --git a/GENX (WIP)/Porewater/Sulfide/2026/.RDataTmp b/GENX (WIP)/Porewater/Sulfide/2026/.RDataTmp deleted file mode 100644 index 91589fe..0000000 Binary files a/GENX (WIP)/Porewater/Sulfide/2026/.RDataTmp and /dev/null differ diff --git a/GENX (WIP)/Porewater/Sulfide/2026/Datasheets/20260520_May_GENX_H2S_Datasheet.xlsx b/GENX (WIP)/Porewater/Sulfide/2026/Datasheets/20260520_May_GENX_H2S_Datasheet.xlsx new file mode 100644 index 0000000..c38570b Binary files /dev/null and b/GENX (WIP)/Porewater/Sulfide/2026/Datasheets/20260520_May_GENX_H2S_Datasheet.xlsx differ diff --git a/GENX (WIP)/Porewater/Sulfide/2026/Datasheets/2026May_GENX_H2S_Datasheet.pdf b/GENX (WIP)/Porewater/Sulfide/2026/Datasheets/2026May_GENX_H2S_Datasheet.pdf new file mode 100644 index 0000000..a70687d Binary files /dev/null and b/GENX (WIP)/Porewater/Sulfide/2026/Datasheets/2026May_GENX_H2S_Datasheet.pdf differ diff --git a/GENX (WIP)/Porewater/Sulfide/2026/GCReW_GENX_Porewater_H2S_202605.Rmd b/GENX (WIP)/Porewater/Sulfide/2026/GCReW_GENX_Porewater_H2S_202605.Rmd new file mode 100644 index 0000000..40b878f --- /dev/null +++ b/GENX (WIP)/Porewater/Sulfide/2026/GCReW_GENX_Porewater_H2S_202605.Rmd @@ -0,0 +1,1323 @@ +--- +title: "GENX: Porewater Sulfide" +author: "Month Year Samples" +date: "`r Sys.Date()`" +output: + pdf_document: + toc: false + number_sections: false +geometry: left=2cm,right=2cm,top=1cm,bottom=2cm +--- + + +## Code Set up +```{r setup, include=FALSE} + +library(dplyr) +library(broom) +library(ggplot2) +library(ggpubr) +library(stringr) +library(purrr) +library(tidyverse) +library(here) +library(data.table) +library(matrixStats) +library(gridExtra) +library(grid) +library(plater) +library(raster) +library(knitr) +library(readxl) +library(ggrepel) + +``` + +## run information +```{r Information to be changed} + +##Before or After Reruns (YES or NO) +After_Reruns = "NO" +#If NO will not write final data file + #And Will Write a Rerun File + +###things that need to be changed + +sample_month = "May" +sample_year = "2026" +Run_Date = as.Date("5/20/2026", format = "%m/%d/%Y") +Run_by = "Melanie Giessner"#Instrument user +Script_run_by ="Melanie Giessner"#Code user + +Run_notes="Ch1-80 not collected"#any notes from run + +#Import Plate Data + +plates<- c("Plate1","Plate2","Plate3","Plate4","rrPlate1","rrPlate2") + +folder_path_rawdata <- paste0("Raw Data") +Raw_plates <- list.files(path = folder_path_rawdata, full.names = TRUE,pattern = "Plate") +head(Raw_plates) + +#Import Run Date for Each Plate for Std curve qaqc +Run_dates <- tibble( + Plate = plates, + Run_Date = c("05/19/2026","05/19/2026","05/19/2026","05/20/2026","06/01/2026","06/01/2026") + ) + + Run_dates <- Run_dates %>% mutate(Run_Date = as.Date(Run_Date, tryFormats = c("%Y-%m-%d", "%m/%d/%Y", "%m/%d/%y"))) + +# Define the file path for QAQC log file - NO Need to change just check year +log_path <- "Processed Data/SMARTX_H2S_QAQC_2026.csv" + +# Define final path for data be sure to change year and month and run number +final_path <- "Processed Data/GCReW_GENX_Porewater_H2S_202605.csv" +rerun_path <- "Processed Data/GCReW_GENX_Porewater_H2S_202605_reruns.csv" + + +``` + +```{r Set Up Code - constants and QAQC cutoffs, include=FALSE} + +#Flag cutoffs + r2_cutoff = 0.985 #this is the level below which we want to rerun or consider a curve + cv_flag_stds = 10 #this is the maximum cv allowed for standards + p_value_chkstds = 0.05 #the p-value for the t-test between check standards must be greater than this + p_value_MC = 0.05 #the p-value for the t-test between matrix checks and top std must be greater than this + cv_flag_sample = 10 #this is the maximum cv allowed for samples + dups_perc_diff = 15.5 #this is the maximum percent difference allowed between duplicates + high_recovery_cutoff = 120 #this is the maximum percent recovery of SO4 allowed in spiked samples + low_recovery_cutoff = 80 #this is the minimum percent recovery of SO4 allowed in spiked samples + +#Standard concentrations - Update if running different standard curve: +# standard units are in uM + standards <- tibble( + IDs = c("Std 0", "Std 1", "Std 2", "Std 3", "Std 4", "Std 5"), + Conc = c(0, 5.0, 12.5, 25.0, 50.0, 100.0) + ) #uM + + chk_standards <- tibble( + IDs = c("ChkStd 0", "ChkStd 3", "ChkStd 4"), + Conc = c(0, 25.0, 50.0) + ) #uM + + mtx_standards <- tibble( + IDs = c("MC: 10ppt S5"), + Conc = c(100) + ) #uM + +#Spike concentration calc + #spike for these samples was 50 uL of the 100uM standard + Con1 <- 1000000 #conversion factor value for spike volumes (uL -> L) + spk_std <- 100 # uM S2- standard used + spkvol <- 50 # uL volume of spike added + spk_Conc <- spk_std*(spkvol/Con1) # umoles of S2- added to each spiked sample + sample_vol <- 250 # the sample volume without the spike is 250 uL + samp_vol_a <- 300 # the sample volume + +#Top standard Concentration- Update if running different standard curve: + Top_STD = 100 + + +#Metadata file path +Raw_Metadata = here(".." , "GCReW", "GCReW_Project_Treatment_Metadata.csv") + +#Significant Digits +sigdigs <- 3 + +``` + + +##Read in metadata and create similar sample IDs for matching to samples +```{r pull in metadata for later, include=FALSE} + +#read in the raw metadata file +raw_metadata <- read.csv(Raw_Metadata) + +#clean up columns in metadata file: + #Pull out only SMARTX Rows + #Create a Sample_Name column to match the SEAL +metadata <- raw_metadata %>% + filter(grepl("GENX", Project, ignore.case = TRUE)) %>% + mutate(Sample_Name = Sample.ID) %>% + mutate(Month = sample_month) %>% + mutate(Year = sample_year) %>% + rename( + Sample_ID = Sample.ID, + ) %>% + dplyr::select(-N_Treatment) + + +``` + + +##Read in data +```{r read in plates,echo=FALSE,include=FALSE} + +#read in the csv files +dat<-read_plates( + files = Raw_plates,#list of all file paths + plate_names = plates , #list of plate names + well_ids_column = "Wells", # name to give column of well IDs (optional) + sep = "," # separator used in the csv file (optional) +) %>% + rename("Abs"=values, + "IDs"=values.2, + "Dilution"=values.3) +head(dat) + +``` + +##Remove High CV Stds +```{r, echo=FALSE} + +#filter for STDs +H2S_stds_raw <- dat %>% subset(IDs %like% "Std" | IDs %like% "Chk" | IDs %like% "MC") + +#Add in STD values +H2S_stds <- left_join(H2S_stds_raw, standards, by = "IDs") + +#Calculate CVs and add flags +H2S_STD_cv <- H2S_stds %>% group_by(Plate, IDs) %>% mutate(CV = cv(Abs)) %>% mutate(CV_Flag = ifelse(CV >= cv_flag_stds, "CV_High", "CV_Good")) %>% ungroup() + +#calculate new cv getting best cv from points if cv was high +H2S_STD_cv_new <- H2S_STD_cv %>% group_by(Plate, IDs) %>% + mutate(CV_New = map_dbl(row_number(), ~cv(Abs[-.x]))) %>% #Calculate CVs without 1 point + mutate(Removed = ifelse( #Choose Lowest CV if CV is high + CV_Flag == "CV_High", + ifelse( + CV_New == min(CV_New), + "RMVD", + "KEPT"), "CV_Good"), +CV2 = ifelse(CV_Flag == "CV_High", min(CV_New), CV), +Abs_rm = ifelse(Removed == "RMVD", NA, Abs)) %>% + mutate(Mean_Abs2 = mean(Abs_rm, na.rm = TRUE)) %>% + mutate(CV_Flag2 = ifelse(CV2 >= cv_flag_stds, "CV_High", "CV_Good")) %>% ungroup() + +#organize data +H2S_STD_CV_fin <- H2S_STD_cv_new %>% dplyr::select(Plate, + Wells, + Abs, + Removed, + IDs, + Dilution, + Conc, + Mean_Abs2, + CV2, + CV_Flag2) %>% + mutate(Mean_Abs = Mean_Abs2, CV_Flag = CV_Flag2, CV = CV2) %>% + dplyr::select(Plate, + Wells, Abs, + Removed, + IDs, + Dilution, + Conc, + Mean_Abs, + CV, + CV_Flag) + + +``` + + +##Check R2 & Remove Standards if Necessary +```{r, echo=FALSE} +split_data <- H2S_STD_CV_fin %>% filter(IDs %like% "Std") %>% filter(!IDs %like% "Chk") %>% dplyr::select(Plate, IDs, Conc, Mean_Abs, Abs, Removed, CV_Flag) %>% filter(!Removed == "RMVD") %>% #Split Data by Plate + distinct() %>% + group_by(Plate) %>% + group_split() + +#run regression and get coefficients by Run +Slope_H2S_raw_list <- map(split_data, ~ .x %>% mutate(Curve = "H2S", + R2 = summary(lm(Abs ~ Conc, data = .))$adj.r.squared , + Slope = coef(lm(Abs ~ Conc, data = .))[2], + Intercept = coef(lm(Abs ~ Conc, data = .))[1])) + + + Slope_H2S_raw <- bind_rows(Slope_H2S_raw_list) + + #check R2 and flag + Slope_H2S_Std_Crvs <- Slope_H2S_raw %>% dplyr::select(Plate, Curve, R2, Slope, Intercept) %>% distinct() %>% mutate(R2_Flag = ifelse(R2 >= r2_cutoff, "R2_Good", "R2_Bad")) + + #join standard curve CVs and regression values + R2_Check_Raw <- left_join(Slope_H2S_Std_Crvs, H2S_STD_CV_fin, by = "Plate") + + R2_Check <- R2_Check_Raw %>% + dplyr::select(Plate, + IDs, + Abs, + Removed, + Mean_Abs, + Conc, + R2, + Slope, + Intercept, + CV_Flag, + CV, + R2_Flag) %>% filter(IDs %like% "Std") %>% filter(!IDs %like% "Chk") %>% + distinct() + + #calculate concentrations from standard curve and separate removable points + + R2_Split <- R2_Check %>% mutate(RMVBL = ifelse(IDs %in% c("Std 0", "Std 1", "Std 5"), "No", "Yes")) %>% group_by(Plate) %>% dplyr::select(-Abs, -Removed) %>% distinct() %>% group_split() + + R2_New <- map( + R2_Split, + ~ .x %>% mutate( + Curve = "H2S", + R2_New = map_dbl(row_number(), ~ + summary(lm( + Mean_Abs[-.x] ~ Conc[-.x], data = pick(Mean_Abs, Conc) + ))$adj.r.squared) , + Slope_New = map_dbl(row_number(), ~ + coef(lm( + Mean_Abs[-.x] ~ Conc[-.x], data = pick(Mean_Abs, Conc) + ))[2]) , + Intercept_New = map_dbl(row_number(), ~ + coef(lm( + Mean_Abs[-.x] ~ Conc[-.x], data = pick(Mean_Abs, Conc) + ))[1]) + ) + ) %>% bind_rows() + + R2_Check_RMVBL <- R2_New %>% mutate(R2_New = round(R2_New, digits = 8), + CV = round(CV, digits = 8)) %>% group_by(Plate) %>% mutate(R2_New = ifelse(IDs %in% c("Std 0", "Std 1", "Std 5"), NA, R2_New)) %>% mutate(R2_RMV = ifelse( + R2_Flag == "R2_Bad", + ifelse(R2_New == max(R2_New, na.rm = TRUE), "RMVD", "KEPT"), + "R2_Good" + )) %>% mutate(R2_RMV_CV = ifelse( + R2_RMV == "R2_Good", + ifelse(CV_Flag == "CV_High", ifelse(CV == max(CV), "RMVD", "KEPT"), "KEPT"), + R2_RMV + )) %>% mutate(R2_RMVD = ifelse(is.na(R2_RMV_CV), "KEPT", R2_RMV_CV)) %>% dplyr::select(-R2_RMV, -R2_RMV_CV) + +R2_Removed_forPair <- R2_Check_RMVBL %>% dplyr::select(Plate, IDs, R2_RMVD) %>% distinct() + +H2S_STDs_Pair <- H2S_STD_CV_fin %>% filter(IDs %like% "Std") %>% filter(!IDs %like% "Chk") %>% dplyr::select(Plate, IDs, Conc, Mean_Abs, Abs, Removed, CV_Flag) %>% filter(!Removed == "RMVD") %>% distinct() %>% left_join(R2_Removed_forPair) + + + R2_Check_fin <- H2S_STDs_Pair %>% mutate(STD_ABS_rmv = ifelse(R2_RMVD == "RMVD", NA, Abs)) %>% group_by(Plate) %>% mutate(Points = ifelse("RMVD" %in% R2_RMVD, "Point_Removed", "ALL_KEPT")) %>% dplyr::select(Plate, IDs, Conc, STD_ABS_rmv, CV_Flag, Points) %>% ungroup() %>% na.omit() + + #separate plates for new regression + split_data_rmv <- R2_Check_fin %>% + distinct() %>% + group_by(Plate) %>% + group_split() + + #get new standard curve values + Slope_H2S_raw_list_rm <- map(split_data_rmv, ~ .x %>% mutate(Curve = "H2S", + R2 = summary(lm(STD_ABS_rmv ~ Conc, data = .))$adj.r.squared , + Slope = coef(lm(STD_ABS_rmv ~ Conc, data = .))[2], + Intercept = coef(lm(STD_ABS_rmv ~ Conc, data = .))[1])) + + Slope_H2S_raw_rm <- bind_rows(Slope_H2S_raw_list_rm) + + Slope_H2S_Std_Crvs_rm <- Slope_H2S_raw_rm %>% dplyr::select(Plate, Curve, R2, Slope, Intercept, CV_Flag, Points) %>% distinct() %>% mutate(R2_Flag = ifelse(R2 >= r2_cutoff, "R2_Good", "R2_Bad")) + + +``` + + +## Plot Standard Curves +```{r Plot all Standard Curves together, echo=FALSE} +##this is to see if there are any stds or plates that look off + +#Plot Std Crvs by plate +H2S_Curve <- ggplot(Slope_H2S_raw_rm, aes(STD_ABS_rmv, Conc, color = Plate, linetype = Points)) + geom_point(size = 3) + + geom_smooth(method = "lm", formula = "y ~ x", se = FALSE) + labs(title = "H2S Standard Curves", x = "Absorbance", y = "Concentration (uM)") + + theme_classic() +H2S_Curve + +#Add dates to plate and format data +STD_run_date <- left_join(Run_dates, Slope_H2S_Std_Crvs_rm, by = join_by(Plate)) +new_log_stds <- STD_run_date %>% dplyr::select(Plate, + Curve, + R2, + Slope, + Intercept, + Run_Date) %>% mutate(R2 = round(R2, digits = 4), Slope = round(Slope, digits = 4), Intercept = round(Intercept, digits = 4), ) %>% mutate(Run = "Current Runs") + + +#read in log file and format +log <- read.csv(log_path) +log_2 <- log %>% mutate(Run_Date = as.Date(as.character(Run_Date), tryFormats = c("%Y-%m-%d", "%m/%d/%Y")), Run = "Past Runs") +log_3 <- log_2[, -c(1)] +log_4 <- rbind(log_3, new_log_stds) + +unique_log <- log_4 %>% distinct(Plate,Curve,R2,Slope,Intercept,.keep_all = TRUE) + +#Calculate Mean and SD and calculate 2SD range for slope and intercept +mean_slope <- mean(unique_log$Slope, na.rm = TRUE) +sd_slope <- sd(unique_log$Slope, na.rm = TRUE) + +hi_2sd_slope <- mean_slope + 2*sd_slope + +lo_2sd_slope <- mean_slope - 2*sd_slope + +mean_int <- mean(unique_log$Intercept, na.rm = TRUE) +sd_int <- sd(unique_log$Intercept, na.rm = TRUE) + +hi_2sd_int <- mean_int + 2*sd_int + +lo_2sd_int <- mean_int - 2*sd_int + +#Plot Slope log +Slopes_chk <- ggplot(unique_log, aes(x = Run_Date, y = Slope, col = Run)) + + ylim(0.0045,0.018) + + scale_color_manual(values = c("Past Runs" = "grey27", "Current Runs" = "cyan3")) + + geom_abline(intercept = mean_slope - 2*sd_slope, slope = 0, linetype = "dashed", linewidth = 1.5, col = "red" )+ + geom_abline(intercept = mean_slope + 2*sd_slope, slope = 0, linetype = "dashed", linewidth = 1.5, col = "red" )+ + geom_point(size = 2) + + theme_classic()+ + ggtitle("Slope Log") + +#Plot Intercept log +ints_chk <- ggplot(unique_log, aes(x = Run_Date, y = Intercept, col = Run)) + + ylim(0.03, 0.15) + + scale_color_manual(values = c("Past Runs" = "grey27", "Current Runs" = "cyan3")) + + geom_abline(intercept = mean_int - 2*sd_int, slope = 0, linetype = "dashed", linewidth = 1.5, col = "red" )+ + geom_abline(intercept = mean_int + 2*sd_int, slope = 0, linetype = "dashed", linewidth = 1.5, col = "red" )+ + geom_point(size = 2) + + theme_classic()+ + ggtitle("Intercept Log") + +ints_chk + +Slopes_chk + + + +#Get done of original runs +Date_1 <-as.Date(new_log_stds$Run_Date[which(new_log_stds$Plate == "Plate1")]) + +#Check if Std Crvs are Within range and see if dates are close enough for combination +stdcrv_tagged <- new_log_stds %>% mutate( + In_Range_Slope = ifelse( + Slope >= hi_2sd_slope | + Slope <= lo_2sd_slope, + "Out of Range", + "In Range" + ), + In_Range_Int = ifelse( + Intercept >= hi_2sd_int | + Intercept <= lo_2sd_int, + "Out of Range", + "In Range" + ) +) %>% mutate( + Slope = ifelse(In_Range_Slope == "Out of Range", NA, Slope), + Intercept = ifelse(In_Range_Int == "Out of Range", NA, Intercept) +) %>% mutate(Date_Diff = abs(difftime(Date_1, Run_Date, units = "days"))) %>% mutate(Date_Close = ifelse(Date_Diff <= 2, "Yes", "No")) %>% mutate(Slope_Flag = ifelse(is.na(Slope), "Slope_Bad" , "Slope_Good"), Int_Flag = ifelse(is.na(Intercept), "Intercept_Bad" , "Intercept_Good")) %>% mutate( + Slope = ifelse(is.na(Intercept) | R2 <= r2_cutoff, NA, Slope), + Intercept = ifelse(is.na(Slope)| R2 <= r2_cutoff, NA, Intercept), + Curve_RMVD = ifelse(is.na(Slope) | + is.na(Intercept) | R2 <= r2_cutoff , "RMVD", "KEPT") +) + +#Calculate Combo Std Crv +stdcrv_filtered <- stdcrv_tagged %>% filter(Date_Close == "Yes") +stdcrv_filtered_no <- stdcrv_tagged %>% filter(Date_Close == "No") +mean_slope_fin <- mean(stdcrv_filtered$Slope, na.rm = TRUE) +mean_slope_no <- mean(stdcrv_filtered_no$Slope, na.rm = TRUE) +mean_int_fin <- mean(stdcrv_filtered$Intercept, na.rm = TRUE) +mean_int_no <- mean(stdcrv_filtered_no$Intercept, na.rm = TRUE) + +#Attach Slope and Intercept to Plates +Std_crv_calc <- stdcrv_tagged %>% mutate(Slope_Calc = ifelse(Date_Close == "Yes", mean_slope_fin, mean_slope_no), Int_Calc = ifelse(Date_Close == "Yes", mean_int_fin, mean_int_no)) %>% dplyr::select(Plate, Slope_Calc, Int_Calc, Curve_RMVD, Slope_Flag, Int_Flag) %>% as.data.frame() + +std_curves <- Std_crv_calc %>% dplyr::select(Plate, Curve_RMVD) %>% filter(Curve_RMVD != "RMVD") %>% distinct() + +Curve_Flags <- Std_crv_calc %>% dplyr::select(Plate, Slope_Flag, Int_Flag) %>% distinct() + +Curve_Flags_forJoin <- Curve_Flags %>% mutate(Slope_Flag = ifelse(Slope_Flag %like% "Good", "", Slope_Flag), Int_Flag = ifelse(Int_Flag %like% "Good", "", Int_Flag)) + + +Std_crv_calc <-Std_crv_calc %>% distinct() +``` + +## Return Flags For Standard Curve +```{r, echo=FALSE} + +STD_CRV_flags <- full_join(Slope_H2S_Std_Crvs_rm, Run_dates, by = join_by(Plate)) + +STD_CRV_flags_table1 <- STD_CRV_flags %>% dplyr::select(Plate, R2_Flag, CV_Flag) + +STD_CRV_flags_table2 <- Std_crv_calc %>% dplyr::select(Plate, Curve_RMVD) %>% mutate(Curve_RMVD = ifelse(Curve_RMVD == "RMVD", "REMOVED", Curve_RMVD)) + +knitr::kable(STD_CRV_flags_table1, format="markdown") + +knitr::kable(STD_CRV_flags_table2, format="markdown") + + +``` + +## Method Detection Limit +```{r, echo=FALSE} + +#get only lowest standard + STD_MDL_df <- H2S_STD_CV_fin %>% filter(IDs == "Std 1" + #, Removed != "RMVD" + ) %>% dplyr::select(Plate, Mean_Abs, IDs) %>% distinct() + + STD0_df <- H2S_STD_CV_fin %>% filter(IDs == "Std 0" + #, Removed != "RMVD" + ) %>% dplyr::select(Plate, Mean_Abs, IDs) %>% distinct() +#calculate the standard deviation of abs +stddev_mdl <- sd(STD_MDL_df$Mean_Abs) + +#Calculate Mean Std 0 +std0_mean <- mean(STD0_df$Mean_Abs) + +#calculate n +n <- length(STD_MDL_df$Mean_Abs) + +#Identify the proper Student's T for n-1 +StudentsT <-qt(.99,(n-1)) + +#Multiply Standard deviation by Student's T +STD_var <- (stddev_mdl*StudentsT) +MDL <- STD_var + std0_mean + +MDL_df <- as.data.frame(MDL) + +MDL_Plot <- ggplot() + + geom_bar(stat = 'identity', data = STD_MDL_df, aes(x = Plate, y = Mean_Abs, fill = IDs)) + + geom_bar(data = STD0_df, aes(x = Plate, y = Mean_Abs, fill = IDs), stat = 'identity') + + scale_fill_manual(name = "Standard:", values = c("Std 0" = "lightgreen", "Std 1" = "cornflowerblue")) + + geom_hline(yintercept = MDL, linetype = "dashed", linewidth = 1.5, color = "blue3") + + geom_label_repel(data = MDL_df, aes(x = 1.25, y = MDL + 0.015), label = paste0("MDL: ", signif(MDL, digits = sigdigs)), alpha = 0.7, color = "blue3") + + ggtitle(label = "H2S Minimum Detection Limit") + + labs(y = "Mean Absorbance") + + theme_classic() + +MDL_Plot +``` + +## Compare Check Standards to Standards +```{r, echo = FALSE} + +#subset datasets for comparison + +std0 <- subset(H2S_STD_CV_fin, IDs == "Std 0"& Plate %in% std_curves$Plate & !Removed == "RMVD") +std3 <- subset(H2S_STD_CV_fin, IDs == "Std 3"& Plate %in% std_curves$Plate & !Removed == "RMVD") +std4 <- subset(H2S_STD_CV_fin, IDs == "Std 4" & Plate %in% std_curves$Plate & !Removed == "RMVD") +std5 <- subset(H2S_STD_CV_fin, IDs == "Std 5" & Plate %in% std_curves$Plate & !Removed == "RMVD") + + +H2S_CHK_STD_CV_fin <- H2S_STD_CV_fin %>% filter(IDs %like% "ChkStd" | IDs %like% "ppt") +#Tag Check Standards and perform T Test +H2S_CHKs_a <- H2S_CHK_STD_CV_fin %>% + mutate(Std_ID = case_when( + IDs == "ChkStd 0" ~ paste0("Std 0"), + IDs == "ChkStd 3" ~ paste0("Std 3"), + IDs == "ChkStd 4" ~ paste0("Std 4"), + IDs %like% "S5" ~ paste0("Std 5") + ), + Chk_Abs = Abs, + Chk_Removed = Removed, + Chk_IDs = IDs, + Chk_Mean_Abs = Mean_Abs, + Chk_cv_flag = CV_Flag + ) %>% filter(!Chk_Removed == "RMVD") %>% + group_by(Std_ID,Plate) %>% + mutate( + Chk_pvalue = case_when( + Chk_IDs == "ChkStd 0" ~ t.test(std0$Abs, Chk_Abs,var.equal = T)$p.value[1], + Chk_IDs == "ChkStd 3" ~ t.test(std3$Abs, Chk_Abs,var.equal = T)$p.value[1], + Chk_IDs == "ChkStd 4" ~ t.test(std4$Abs, Chk_Abs,var.equal = T)$p.value[1], + Chk_IDs == "MC: 10ppt S5" ~ t.test(std5$Abs, Chk_Abs,var.equal = T)$p.value[1], + Chk_IDs == "MC: 20ppt S5" ~ t.test(std5$Abs, Chk_Abs,var.equal = T)$p.value[1] + ))%>% + ungroup() %>% + dplyr::select(Std_ID, Chk_IDs, Chk_pvalue, Chk_cv_flag, Chk_Mean_Abs, Plate) %>% distinct(.keep_all = TRUE) + +H2S_CHKs_1 <- H2S_CHKs_a %>% dplyr::select(-Chk_Mean_Abs) + +#Get Standard Values and set values for standards with no variance +H2S_STD_forCHK_a <- H2S_STD_CV_fin %>% filter(IDs %in% c("Std 0", "Std 3", "Std 4", "Std 5") ) %>% + mutate(Std_ID = IDs +) %>% filter(!Removed == "RMVD") %>% + dplyr::select(Plate, Std_ID, IDs, CV_Flag, Mean_Abs) %>% distinct(.keep_all = TRUE) + +H2S_STD_forCHK <- H2S_STD_forCHK_a %>% dplyr::select( -Mean_Abs) + +#join check standards with standards +Chk_Std_join <- full_join(H2S_CHKs_1, H2S_STD_forCHK, by = join_by(Std_ID, Plate)) + + +#flag data +Chk_Std_flags <- Chk_Std_join %>% mutate( + Chk_Flag_pv= ifelse( + Chk_pvalue > p_value_chkstds , + "Chk_Good", + "Chk_Bad" + ) + +) %>% mutate(CHK_Flag = paste0(gsub(" ", "", IDs), Chk_Flag_pv)) %>% + mutate(CHK_CV_Flag = paste0("Chk",gsub(" ", "", IDs), Chk_cv_flag)) + + #Organize Data for Plotting and Flagging +Chk_Flags <- Chk_Std_flags %>% group_by(Plate) %>% + mutate(Chk_Flag = ifelse(any(CHK_Flag %like% "Bad"), "Chk_Bad", "Chk_Good"), Chk_cv_flag = ifelse(any(CHK_CV_Flag %like% "High"), "Chk_CV_High", "Chk_CV_Good")) %>% + ungroup() %>% + mutate(CHK_CV_Flags = ifelse(CHK_CV_Flag %like% "High", paste0(gsub(" ", "", IDs), Chk_cv_flag), "Good")) %>% mutate(CHKs_Flag = ifelse(CHK_Flag %like% "Bad", CHK_Flag, "Good")) + +H2S_CHKs_plot <- H2S_CHKs_a %>% rename(IDs = Chk_IDs, Mean_Abs = Chk_Mean_Abs) %>% mutate(Type = "Check") %>% dplyr::select(-Chk_cv_flag,-Chk_pvalue) + +H2S_Std_chkplot <- H2S_STD_forCHK_a %>% dplyr::select(IDs, Mean_Abs, Std_ID, Plate) %>% mutate(Type = "Standard") + +Chk_flags_plot <- Chk_Flags %>% dplyr::select(Std_ID, Plate, CHKs_Flag, Chk_Flag_pv) %>% group_by(Std_ID,Plate) %>% distinct(.keep_all = TRUE) %>% mutate(Check_Flag = ifelse(Chk_Flag_pv %like% "Good", "Good", "Bad")) + +H2S_Chks_bind <- rbind(H2S_CHKs_plot, H2S_Std_chkplot) + +H2S_Chks_bind_1 <- left_join(H2S_Chks_bind, Chk_flags_plot, by = join_by(Std_ID,Plate)) + +H2S_Chks_plot_bind_a <- H2S_Chks_bind_1 %>% mutate(Plot_ID = ifelse(IDs %like% "Chk" | IDs %like% "MC", substr(IDs, 4, 8), IDs)) %>% mutate(Plot_ID = ifelse(Plot_ID %like% "10pp", "Matrix: 10ppt", Plot_ID )) +H2S_Chks_plot_bind <-H2S_Chks_plot_bind_a %>% filter(str_detect(Type, "Check")) %>% mutate(Plot_ID =as.factor(Plot_ID)) + +Check_Val <- H2S_Chks_plot_bind_a %>% filter(!str_detect(Plot_ID, "Check")) %>% group_by(Plot_ID) %>% mutate(Z = mean(Mean_Abs)) %>% dplyr::select(Plot_ID, Z) %>% distinct(.keep_all = TRUE) %>% filter(!Plot_ID %like% "10pp") %>% mutate(Plot_ID = ifelse(Plot_ID %like% "Std 5", "Matrix: 10ppt", Plot_ID )) %>% mutate(Plot_ID = as.factor(Plot_ID)) + +#Plot Check Standards +H2S_chk_plot <- ggplot(data = H2S_Chks_plot_bind, aes(x = Plate, y = Mean_Abs)) + + geom_bar(stat = 'identity', + position = position_dodge2(preserve = "single"), linewidth = 0.75, aes(fill = Check_Flag)) + + geom_hline(data = Check_Val, aes(yintercept = Z), linetype = "dashed", linewidth = 1, color = "darkblue") + + facet_wrap(.~Plot_ID) + + ylim(0, max(H2S_Chks_plot_bind$Mean_Abs) + 0.2) + + geom_label_repel(data = Check_Val, aes( x = "Plate1", y = Z + 0.25), label = "Mean Target Arbsorbance", alpha = 0.7, color = "darkblue") + + scale_fill_manual(values = c("Good" = "darkgreen", "Bad" = "darkred")) + + theme_classic() + labs(x = " ", y = "Absorbance", title = + "Check Stds: H2S with Confidence Interval") + + theme(legend.position = "bottom", axis.text.x = element_text( + angle = 90, + vjust = 0.5, + hjust = 1)) + + +H2S_chk_plot + +``` + +## Display Any Check Flags +```{r, echo=FALSE} +Chk_Flag_1 <- Chk_Flags %>% dplyr::select(Plate, CHKs_Flag) %>% filter(CHKs_Flag != "Good") + +CHK_CV_Flag_1 <- Chk_Flags %>% dplyr::select(Plate, CHK_CV_Flags) %>% filter(CHK_CV_Flags != "Good") + +knitr::kable(Chk_Flag_1, format="markdown") + +knitr::kable(CHK_CV_Flag_1, format="markdown") + +``` + + +##Calculate Sulfide Concentrations & Add Concentration Flags +```{r Calculate Sulfide Concentrations,echo=FALSE,include=FALSE} + +High_Std <- H2S_STD_CV_fin %>% filter(IDs == "Std 5") %>% mutate(Mean_Abs = round(Mean_Abs, digits = 4)) %>% ungroup() %>% dplyr::select(Plate, Mean_Abs) %>% distinct(.keep_all = TRUE) %>% rename(High_DL = Mean_Abs) + +#filter out stds and other experiments +raw_data <- dat %>% + filter(!str_detect(IDs, "Std")) %>% + filter(!str_detect(IDs, "MC")) + +#Calculate Concentrations and fix zeroes/negative values and flag conc + +joined_data <- right_join(Std_crv_calc, raw_data, by = join_by(Plate)) + +calc_data <- joined_data %>% mutate(Conc = ((Abs - Int_Calc) / Slope_Calc)*Dilution) %>% mutate(Conc = ifelse(Conc <= 0, 0, Conc)) + +dl_data <- right_join(High_Std, calc_data, by = join_by(Plate)) + +``` + +##Remove High CV Samples and Average +```{r, echo=FALSE} + +#Calculate CVs +H2S_SPL_cv <- dl_data %>% group_by(Plate, IDs) %>% mutate(Mean_Conc = mean(Conc)) %>% mutate(Conc_SD = sd(Conc)) %>% mutate(CV = cv(Conc)) %>% mutate(CV_Flag = ifelse(CV >= cv_flag_stds, "CV_High", "CV_Good")) %>% mutate(Mean_Abs = mean(Abs)) %>% mutate(Conc_Flag = ifelse(Mean_Abs < MDL, "bdl", ifelse(Mean_Abs > High_DL, "adl", "Within_Range"))) %>% ungroup() + +#calculate new cv getting best cv from points if cv was high +H2S_SPL_cv_new <- H2S_SPL_cv %>% group_by(Plate, IDs) %>% + mutate(CV_New = map_dbl(row_number(), ~cv(Conc[-.x]))) %>% #Calculate CVs without 1 point + mutate(Removed = ifelse( #Choose Lowest CV if CV is high + CV_Flag == "CV_High", + ifelse( + CV_New == min(CV_New), + "RMVD", + "KEPT"), "CV_Good"), +CV2 = ifelse(CV_Flag == "CV_High", min(CV_New), CV), +Conc_rm = ifelse(Removed == "RMVD", NA, Conc)) %>% + mutate(Mean_Conc2 = mean(Conc_rm, na.rm = TRUE)) %>% + mutate(CV_Flag2 = ifelse(CV2 >= cv_flag_sample, "CV_High", "CV_Good")) %>% + mutate(Conc_SD2 = sd(Conc_rm, na.rm = TRUE)) %>% ungroup() + +H2S_SPL_CV_fin <- H2S_SPL_cv_new %>% dplyr::select(Plate, + Wells, + Conc, + Removed, + IDs, + Dilution, + Conc, + Mean_Conc2, + Conc_SD2, + CV2, + CV_Flag2, + Conc_Flag) %>% + mutate(Mean_Conc = Mean_Conc2, CV_Flag = CV_Flag2, SD_Conc = Conc_SD2, CV = CV2) %>% + dplyr::select(Plate, Conc, + Removed, + IDs, + Dilution, + Mean_Conc, + SD_Conc, + CV, + CV_Flag, + Conc_Flag) + +``` + +## Plot Samples +```{r, echo=FALSE} + +#Filter samples and mark reruns +H2S_Spl_pre_viz <- H2S_SPL_cv_new %>% mutate(IDs = toupper(IDs)) %>% + filter(grepl("CH", IDs)) %>% + filter(!str_detect(IDs, "DUP")) %>% + filter(!str_detect(IDs, "SPIKE")) %>% + dplyr::select(Plate, IDs, Mean_Conc, Conc_SD, CV_Flag) %>% distinct(.keep_all = TRUE) %>% mutate(IDs = ifelse(Plate %like% "rr", paste0(IDs, "_RR"), IDs)) #%>% mutate(ForPlot = ifelse(row_number() <= 80, "A", "B")) + +#Plot Samples before corrections +H2S_Spl_Plot_Pre <- ggplot(H2S_Spl_pre_viz, aes(y = Mean_Conc, x = IDs, fill = CV_Flag)) + + geom_bar(stat = 'identity', + position = position_dodge2(), + linewidth = 0.75, + col = "white") + + scale_fill_manual(values = c( + "CV_Good" = "green2", + "CV_High" = "pink2" + )) + + labs(y = "Sulfide (uM)", x = "Sample ID") + + geom_errorbar( + aes(ymin = Mean_Conc - Conc_SD, ymax = Mean_Conc + Conc_SD), + width = 0.3, + position = position_dodge(.1) + ) + + theme_classic() + + #facet_wrap(~ ForPlot ,, scale = "free_x", ncol = 1) + + theme(legend.position = "bottom", axis.text.x = element_text( + angle = 90, + vjust = 0.5, + hjust = 1) + ) + + ggtitle("Sample triplicate means and sd dev before bad reps removed") + + +H2S_Spl_Plot_Pre + +H2S_Spl_rmv_viz <- H2S_SPL_CV_fin %>% mutate(IDs = toupper(IDs)) %>% + filter(grepl("CH", IDs)) %>% + filter(!str_detect(IDs, "DUP")) %>% + filter(!str_detect(IDs, "SPIKE")) %>% + dplyr::select(Plate, IDs, Mean_Conc, SD_Conc, CV_Flag, Conc_Flag) %>% distinct(.keep_all = TRUE) %>% mutate(IDs = ifelse(Plate %like% "rr", paste0(IDs, "_RR"), IDs)) #%>% mutate(ForPlot = ifelse(row_number() <= 80, "A", "B")) + +#Plot samples after Corrections +H2S_Spl_Plot_CV <- ggplot(H2S_Spl_rmv_viz, aes(y = Mean_Conc, x = IDs, fill = CV_Flag)) + + geom_bar(aes(col = Conc_Flag), stat = 'identity', + position = position_dodge(), + linewidth = 0.75) + + scale_fill_manual(values = c( + "CV_Good" = "green2", + "CV_High" = "pink2" + )) + + scale_color_manual(values = c("Within_Range" = "darkgreen", "adl" = "red3", "bdl" = "blue3" )) + + labs(y = "Sulfide (uM)", x = "Sample ID") + + geom_errorbar( + aes(ymin = Mean_Conc - SD_Conc, ymax = Mean_Conc + SD_Conc), + width = 0.3, + position = position_dodge(.1) + ) + + theme_classic() + +# facet_wrap(~ForPlot, scales = "free_x", ncol = 1) + + theme(legend.position = "bottom", axis.text.x = element_text( + angle = 90, + vjust = 0.5, + hjust = 1), + strip.text = element_blank(), + strip.background = element_blank() + ) + + ggtitle("Sample triplicate means and sd dev after bad reps removed") + + +H2S_Spl_Plot_CV + + + +``` + + +## Duplicate QAQC + +```{r,echo=FALSE} + +#pull out any rows that have "Dup" in the ID column and tag reruns +DUP_start <- H2S_SPL_CV_fin %>% mutate(Dup_ID = gsub(" ", "", substr(IDs, 1, 6)), + Dup = ifelse(IDs %like% "Dup", "Dup", "Org")) %>% mutate(Dup_ID = ifelse(Plate %like% "rr", paste0(Dup_ID, "_RR"), Dup_ID)) + +#separate dups from originals and tag for pairing + +dups_only <- DUP_start %>% filter(Dup == "Dup") %>% dplyr::select(Dup_ID, Mean_Conc, SD_Conc, Plate) %>% rename(Dup_Conc = Mean_Conc, Dup_SD = SD_Conc) %>% distinct(.keep_all = TRUE) + +no_dups <- DUP_start %>% filter(!Dup == "Dup") + +dup_spls_l <- dups_only %>% dplyr::select(Dup_ID) %>% distinct(.keep_all = TRUE) + +dup_spls <- no_dups %>% filter(Dup_ID %in% as.vector(dup_spls_l$Dup_ID)) %>% dplyr::select(Dup_ID, Mean_Conc, SD_Conc, Plate, IDs) %>% distinct(.keep_all = TRUE) + +dup_join <- full_join(dups_only, dup_spls, by = join_by(Dup_ID, Plate)) %>% na.omit() + +#Calculate Percent difference and Flag +dup_flags <- dup_join %>% + mutate(Diff_P = (abs(100 * (Mean_Conc - Dup_Conc) / mean(c(Mean_Conc, Dup_Conc))))) %>% + mutate(Dup_Flag = ifelse(Diff_P >= dups_perc_diff, "Dup_Bad", "Dup_Good")) + +#oraganize data for flagging and plotting +dup_flags_1 <- dup_flags %>% dplyr::select(Dup_ID, Dup_Flag, Diff_P, Plate) + +Dup_for_plot_1 <- DUP_start %>% dplyr::select(Plate, Mean_Conc, Dup_ID, IDs) %>% distinct(.keep_all = TRUE) %>% filter(Dup_ID %in% as.vector(dup_spls_l$Dup_ID)) %>% + left_join(dup_flags_1, by = join_by(Dup_ID, Plate)) %>% + mutate(Dup = ifelse(IDs %like% "Dup", "Duplicate", "Original")) %>% + dplyr::select(-IDs, -Mean_Conc, -Dup) %>% distinct(.keep_all = TRUE) %>% na.omit + +#plot Data +Dup_Plot <- ggplot(Dup_for_plot_1, + aes( + x = Plate, + y = Diff_P + )) + + geom_bar( + aes(fill = Dup_Flag), + stat = 'identity', + position = position_dodge2(preserve = "single"), + linewidth = 0.9 + ) + + geom_label_repel(data = as.data.frame(1), aes(x = "Plate1", y=17.5), label= "Percent Difference Cutoff", color = "red3", alpha = 0.7) + + geom_hline(aes(yintercept = dups_perc_diff), linetype = "dashed", linewidth = 1.5, color = "red3") + + labs(y = "Percent Difference", x = "Sample ID") + + scale_fill_manual(values = c( + "Dup_Good" = "darkgreen", + "Dup_Bad" = "darkred" + )) + + theme_classic()+ + theme(legend.position = "bottom") + + ggtitle("H2S Duplicates") + +Dup_Plot + + +``` + +## Display Dup Flags + +```{r, echo=FALSE} +Dup_Flag_1 <- dup_flags %>% group_by(Plate) %>% mutate(Dup_Flags = ifelse("Dup_Bad" %in% Dup_Flag, "Dup_Bad", "Dup_Good")) %>% dplyr::select(Plate, Dup_Flags) %>% rename(Dup_Flag = Dup_Flags) %>% distinct(.keep_all = TRUE) + +Dup_Flags_1 <-Dup_Flag_1 %>% mutate(Dup_Flags = paste0(Dup_Flag, "-", Plate)) + +Dup_Flags_2 <- Dup_Flags_1 %>% dplyr::select(Plate, Dup_Flag) %>% group_by(Plate) %>% mutate(Duplicate_Flag = ifelse("Dup_Bad" %in% Dup_Flag, "Dup_Bad", "")) %>% dplyr::select(Plate, Duplicate_Flag) %>% rename(Dup_Flag = Duplicate_Flag) %>% distinct(.keep_all = TRUE) + +Bad_Dups <- dup_flags %>% filter(str_detect(Dup_Flag, "Dup_Bad")) + +Bad_D_N <- length(Bad_Dups$Dup_Flag) + +Total_D_N <- length(dup_flags$Dup_Flag) + +ifelse(Bad_D_N/Total_D_N > 0.4, paste0("<60% of Dups Pass, Rerun"), paste0(">60% Dups Pass") ) + +Duplicate_Flag <- ifelse(Bad_D_N/Total_D_N > 0.4, paste0(" >40% Dups Fail"), "" ) + +knitr::kable(Dup_Flag_1, format="markdown") + + +``` + +## Spike QAQC +```{r, echo=FALSE} +#pull out any rows that have "Spk" in the ID column +SPK_start <- H2S_SPL_CV_fin %>% mutate(Spk_ID = gsub(" ", "", substr(IDs, 1, 6)), + Spk = ifelse(IDs %like% "Spike", "Spk", "Org")) %>% mutate(Spk_ID = ifelse(Plate %like% "rr", paste0(Spk_ID, "_RR"), Spk_ID)) +#separate spikes from originals +spks_only <- SPK_start %>% filter(Spk == "Spk") %>% dplyr::select(Spk_ID, Mean_Conc, SD_Conc, Dilution, Plate) %>% rename(Spk_Conc = Mean_Conc, + Spk_SD = SD_Conc, + Spk_Dilution = Dilution) %>% distinct(.keep_all = TRUE) + +no_spks <- SPK_start %>% filter(!Spk == "Spk") + +spls_l <- no_spks %>% dplyr::select(Spk_ID) %>% distinct(.keep_all = TRUE) + +spk_spls_l <- spks_only %>% dplyr::select(Spk_ID) %>% distinct(.keep_all = TRUE) + +spk_spls <- no_spks %>% filter(Spk_ID %in% as.vector(spk_spls_l$Spk_ID)) %>% dplyr::select(Spk_ID, Mean_Conc, SD_Conc, Plate, IDs, Dilution) %>% distinct(.keep_all = TRUE) + +SPK_only <- spks_only %>% filter(Spk_ID %in% as.vector(spls_l$Spk_ID)) + +spk_join <- full_join(SPK_only, spk_spls, by = join_by(Spk_ID, Plate)) + +#Calculate recovery and flag data +spk_flags <- spk_join %>% mutate( + Spl_mol = (sample_vol / Con1) * (Mean_Conc / Dilution), + Spk_mol = ((sample_vol + spkvol) / Con1) * (Spk_Conc / Spk_Dilution), + Spk_exp = Spl_mol + spk_Conc, + Spk_recovery = (Spk_mol/Spk_exp) * 100) %>% + mutate( + Spk_Flag = ifelse( + Spk_recovery >= high_recovery_cutoff | + Spk_recovery <= low_recovery_cutoff, + "Spk_Bad", + "Spk_Good" + ) + ) + +#organize data for flagging and plotting +spk_flags_1 <- spk_flags %>% dplyr::select(Spk_ID, Spk_Flag, Spk_recovery, Plate) %>% na.omit() + +Spk_for_plot_a <- SPK_start %>% dplyr::select(Plate, Mean_Conc, Spk_ID, IDs) %>% + distinct(.keep_all = TRUE) %>% + filter(Spk_ID %in% as.vector(spk_spls_l$Spk_ID)) %>% + left_join(spk_flags_1, by = join_by(Spk_ID, Plate)) %>% + mutate(Spk = ifelse(IDs %like% "Spike", "Spike", "Original")) %>% + filter(Spk_ID %in% as.vector(spls_l$Spk_ID)) + +Spk_for_plot_1 <- Spk_for_plot_a %>% dplyr::select(Plate, Spk_ID, Spk_recovery, Spk_Flag) %>% na.omit() %>% distinct(.keep_all = TRUE) + +#plot data +Spk_Plot <- ggplot(Spk_for_plot_1, + aes( + x = Plate, + y = Spk_recovery + )) + + geom_rect(aes(xmin=0, xmax=Inf, ymin=low_recovery_cutoff, ymax=high_recovery_cutoff), alpha = 0.25, fill ="palegreen") + + geom_bar( aes(fill = Spk_Flag), + stat = 'identity', + position = position_dodge2(preserve = "single"), + linewidth = 0.9 + ) + + geom_hline(aes(yintercept = high_recovery_cutoff), linetype = "dashed", color = "green3", linewidth = 1.5) + + geom_hline(aes(yintercept = low_recovery_cutoff), linetype = "dashed", color = "green3", linewidth = 1.5) + + geom_label_repel(data = as.data.frame(1),aes(x = "Plate1", y=high_recovery_cutoff - 7.5), label= "Acceptable Recovery Range", color = "darkgreen", alpha = 0.7) + + labs(y = "Spike Recovery (%)", x = "Plate") + + scale_fill_manual(values = c( + "Spk_Good" = "darkgreen", + "Spk_Bad" = "darkred" + )) + + theme_classic() + + theme(legend.position = "bottom") + + ggtitle("H2S Spikes") + +Spk_Plot + + +``` + +## Display Spike Flags +```{r, echo=FALSE} + +#Check if all Spikes are paired +ifelse(all(as.vector(spk_spls_l$Spk_ID) %in% as.vector(spls_l$Spk_ID)), paste0("Spikes Paired"), paste0("Spike Missing Pair")) + +#Format Data frame +Spk_Flag_1 <- spk_flags %>% dplyr::select(Plate, IDs, Spk_Flag) %>% na.omit() + +#Attach Plate to Flag +Spk_Flags_1 <-Spk_Flag_1 %>% group_by(Plate) %>% mutate(Spk_Flags_T = ifelse( "Spk_Bad" %in% Spk_Flag, paste0("Spk_Bad"), paste0("Spk_Good"))) %>% mutate(Spk_Flags = paste0(Spk_Flags_T, "-", Plate))%>% ungroup() +#If any Spikes in Plate are bad, then flag plate +Spk_Flags_2 <- Spk_Flags_1 %>% dplyr::select(Plate, Spk_Flag) %>% group_by(Plate) %>% mutate(Spike_Flag = ifelse("Spk_Bad" %in% Spk_Flag, "Spk_Bad", "")) %>% dplyr::select(Plate, Spike_Flag) %>% rename(Spk_Flag = Spike_Flag) %>% distinct(.keep_all = TRUE) + +Spk_disp <- Spk_Flags_1 %>% dplyr::select(Plate, Spk_Flags_T) %>% rename(Spike_Flag = Spk_Flags_T) %>% distinct(.keep_all = TRUE) %>% na.omit() + +knitr::kable(Spk_disp, format="markdown") + +bad <- Spk_Flag_1 %>% filter(Spk_Flag %like% "Bad") + +length_bad <- length(as.vector(bad$Spk_Flag)) + +length_all <- length(as.vector(Spk_Flag_1$Spk_Flag)) + +ifelse(length_bad/length_all > 0.4, paste0("<60% of Spikes Pass, Rerun"), paste0("Spikes Pass") ) + +Spike_Flag <- ifelse(length_bad/length_all > 0.4, paste0(">40% Spikes Fail"), "" ) + +``` + + +## Merge samples with Metadata & check all samples are present +```{r check sample ids with metadata, echo=FALSE} +#Get Samples Only +H2S_spls_md <- H2S_SPL_CV_fin %>% # mutate(IDs = toupper(IDs)) %>% + filter(grepl("^Ch\\d{1,2}-", IDs)) %>% + filter(!str_detect(IDs, "Dup")) %>% + filter(!str_detect(IDs, "Spike")) + +#Check for reruns and replace +H2S_spl_rrn <- H2S_spls_md %>%group_by(IDs,Plate) %>% + filter(Plate %like% "rr") %>% ungroup() %>% + dplyr::select(IDs, Mean_Conc, Conc_Flag, Dilution) %>% + rename(RRN_Conc = Mean_Conc, Conc_Flag_rr = Conc_Flag, Dilution_rr = Dilution) %>% + distinct(.keep_all = TRUE) + +RRN_IDs <- as.vector(H2S_spl_rrn$IDs) + +H2S_spl_og <- H2S_spls_md %>% + filter(!Plate %like% "rr") %>% + dplyr::select(IDs, Mean_Conc, Conc_Flag, Plate, CV_Flag, Dilution, CV) %>% + distinct(.keep_all = TRUE) %>% + mutate(Rerun = ifelse(IDs %in% RRN_IDs, "RRN", "Org")) + +H2S_spl_rr_join <- full_join(H2S_spl_rrn,H2S_spl_og, by = join_by(IDs) ) + +Samples_Tagged <- H2S_spl_rr_join %>% mutate( + Conc = ifelse(Rerun == "RRN", RRN_Conc, Mean_Conc), + Conc_Flag = ifelse(Rerun == "RRN", Conc_Flag_rr, Conc_Flag), + Dilution = ifelse(Rerun == "RRN", Dilution_rr, Dilution) +) %>% dplyr::select(IDs, Conc, Conc_Flag, CV_Flag, Plate, Dilution, CV) %>% rename(Sample_ID = IDs) %>% ungroup() %>% group_by(Sample_ID) %>% mutate( + Min_CV = ifelse(CV == min(CV), "KEEP", "RMV"), # get if CV is lowest of reruns + Within_Range = "Within_Range" %in% Conc_Flag, #Get if any are within range + BDL = "bdl" %in% Conc_Flag, #get if any are below detection limit + Max_Dil = max(Dilution), #get maximum dilution of reruns + Min_Dil = min(Dilution),#get minimum dilution of reruns + All_Good = all(Conc_Flag == "Within_Range") & all(CV_Flag == "CV_Good"), #get if all are within range and good cv + CV_Check = CV == min(CV[which(Dilution == Max_Dil)]), #Get if CV is lowest of highest dilution for reruns + Number = length(Conc) #get number of times ran +) %>% ungroup() %>% + mutate(Remove = ifelse(Number == 1, #check if sample was reran + "KEEP", + ifelse(All_Good, #check if multiple samples meet all criteria + ifelse(Min_CV == "KEEP", #Keep only lowest CV + "KEEP1", + "RMV1"), + ifelse(Conc_Flag == "Within_Range" & CV_Flag == "CV_Good", #If only one sample meets all criteria keep that one + "KEEP2", ifelse(Conc_Flag == "Within_Range", "KEEP2a", + ifelse(!(Within_Range) & BDL, #Check if none are within range but are under detection limit + ifelse(Dilution == Min_Dil, #keep lowest dilution + "KEEP3", + "RMV3"), + ifelse(!(Within_Range) & CV_Check, #if all are above detection limit keep lowest CV of highest dilution + "KEEP4", + "RMV4") + ) + ) + )))) + +Samples <- Samples_Tagged %>% filter(Remove %like% "KEEP") + +#check to see if all samples are present in the metadata +all_present <- all(metadata$Sample_Name %in% Samples$Sample_ID) + +if (all_present) { + message("All sample IDs are present in data") +} else { + message("Some sample IDs are missing from data.") + + # Optional: Which ones are missing? + missing_ids <- setdiff(metadata$Sample_Name, Samples$Sample_ID) + print(missing_ids) +} + + +#merge metadata with sample run data +merged_data <- metadata %>% + mutate(Sample_ID = paste0("\\b", Sample_ID, "\\b")) %>% + fuzzyjoin::regex_left_join(Samples, ., by = c(Sample_ID = "Sample_Name")) + +#might want to include a flag or something to see that all the samples are included? + +``` + + +##Add Flags +```{r, echo=FALSE} + +#Get only bad flags for each plate and check +Chk_Flags_All <- Chk_Flags %>% dplyr::select(Plate, CHKs_Flag) %>% filter(CHKs_Flag %like% "Bad") %>% na.omit() %>% distinct(.keep_all = TRUE) %>% group_by(Plate) %>% + summarise( + CHKSTD_Flags = paste(CHKs_Flag, collapse = ", "), + .groups = 'drop' # Drops the grouping structure after summarizing + ) + + +STD_Flags_All <- STD_CRV_flags %>% dplyr::select(Plate, R2_Flag, CV_Flag) %>% mutate(STDCV_Flags = paste0("STD", CV_Flag)) %>% dplyr::select(-CV_Flag) %>% mutate( + R2_Flag = ifelse(R2_Flag %like% "Good", NA, R2_Flag), + STDCV_Flags = ifelse(STDCV_Flags %like% "Good", NA, STDCV_Flags) +) %>% na.omit() + +Flags_Int <- tibble(Plate = c(plates)) + +#Join Flags + +Flags_Joined_1 <-left_join(Flags_Int, Dup_Flags_2, by = join_by(Plate)) + +Flags_Joined_2 <- left_join(Flags_Joined_1, Spk_Flags_2, by = join_by(Plate)) + +Flags_Joined_3 <- left_join(Flags_Joined_2, Chk_Flags_All, by = join_by(Plate)) + +Flags_Joined_4 <- left_join(Flags_Joined_3, STD_Flags_All, by = join_by(Plate)) + +Flags_Joined <- left_join(Flags_Joined_4, Curve_Flags_forJoin, by = join_by(Plate)) + + +Flags_Joined[Flags_Joined == "NA"] <- NA + +#Merge Flags into one column +Flags <- Flags_Joined %>% replace(is.na(.), "") %>% mutate( + H2S_Flags = paste0( + Spk_Flag, + " ", + Dup_Flag, + " ", + CHKSTD_Flags, + " ", + R2_Flag, + " ", + STDCV_Flags, + " ", + Slope_Flag, + " ", + Int_Flag + ) +) %>% dplyr::select(Plate, H2S_Flags) + +#Add Flags to data +flagged_data <- left_join(merged_data, Flags, by = join_by(Plate)) + + +df_all_clean <- flagged_data %>% dplyr::select(-Plate) + +``` + +##Organize Data +```{r, echo=FALSE} +#check results +#head(Samples) + +#pull out what we need + +df_all_clean_cols <- df_all_clean %>% + dplyr::select( + Site, + Project, + Year, + Month, + Community, + Nickname, + Plot, + Depth_cm, + CO2_Treatment, + Temp_Treatment, + Conc, + Conc_Flag, + CV_Flag, + H2S_Flags + ) + +final_data_labeled <- df_all_clean_cols %>% + mutate( + Run_notes = Run_notes,# new column with notes about the run + Analysis_rundate = Run_Date) + +#rename columns +org_labeled_fin_data <- final_data_labeled %>% + rename( + H2S_Conc_uM = Conc, + H2S_Conc_Flag = Conc_Flag, + H2S_CV_Flag = CV_Flag + ) + +#Order Columns for Final Data Frame +All_Clean_Data <- org_labeled_fin_data %>% + dplyr::select( + Site, + Project, + Year, + Month, + Community, + Nickname, + Plot, + Depth_cm, + CO2_Treatment, + Temp_Treatment, + H2S_Conc_uM, + H2S_Conc_Flag, + H2S_CV_Flag, + H2S_Flags, + Analysis_rundate, + Run_notes + ) +#head(Samples1) + +``` + +## Visualize Data +```{r Visualize Data, fig.height=10, echo=FALSE} +cat("Visualize Data") + +### Ammonia +H2S_forplot <- All_Clean_Data + +H2S_forplot$Depth_cm <- + as.numeric(H2S_forplot$Depth_cm) +H2S_forplot <- H2S_forplot[order(H2S_forplot$Depth_cm), ] + +#group the data for plotting +H2S_forplot <- H2S_forplot %>% + group_by(Depth_cm) %>% + mutate(row_num = factor(row_number())) %>% # create row_num as factor per group + ungroup() %>% + mutate(Treatment = paste0("+", Temp_Treatment, " " ,"C")) %>% mutate(Treatment = factor(Treatment, levels = c( + "+0 C", + "+0.75 C", + "+1.5 C", + "+2.25 C", + "+3 C", + "+3.75 C", + "+4.5 C", + "+5.25 C", + "+6 C"))) + +#create plot +viz_H2S_plot <- ggplot(data = H2S_forplot, aes( + x = as.factor(Temp_Treatment), + y = H2S_Conc_uM, + fill = as.factor(Treatment) +)) + + geom_col(stat = "identity", + position = position_dodge2(padding = 0.25, + width = 1.5, + preserve = "single" )) + + facet_grid(as.numeric(Depth_cm) ~ ., + scales = "free_x") + + scale_fill_manual( + breaks = c( + "+0 C", + "+0.75 C", + "+1.5 C", + "+2.25 C", + "+3 C", + "+3.75 C", + "+4.5 C", + "+5.25 C", + "+6 C"), + values = c( + "+0 C" = "#fc9ca2", + "+0.75 C" = "#fb747d", + "+1.5 C" = "#fa4c58", + "+2.25 C" = "#f92432", + "+3 C" = "#e30613", + "+3.75 C" = "#c70512", + "+4.5 C" = "#9f040e", + "+5.25 C" = "#77030b", + "+6 C" = "#500207"), + name = "Treatment:", + ) + + theme_classic() + + labs( + x = " ", + y = "H2S Conc (uM)", + title = "GENX: Porewater H2S" + ) + + theme(legend.position = "right") + + scale_x_discrete(drop = TRUE, limits = rev) + + theme( + axis.text.x = element_text(angle = 0, hjust = 0.5), + panel.border = element_rect( + color = "black", + fill = NA, + linewidth = 0.8), + legend.key = element_rect("black") + ) + + coord_flip() +print(viz_H2S_plot) + +``` +\newpage + +\newpage +```{r Visualize Data by Rep, fig.height=8.5, echo=FALSE} + +#get replicate value and treatment info +H2S_forplot <- H2S_forplot %>% + mutate(Replicate = case_when( + Plot == "Ch1" ~ "1", + Plot == "Ch2" ~ "2", + Plot == "Ch3" ~ "1", + Plot == "Ch4" ~ "1", + Plot == "Ch5" ~ "1", + Plot == "Ch6" ~ "2", + Plot == "Ch7" ~ "1", + Plot == "Ch8" ~ "1", + Plot == "Ch9" ~ "2", + Plot == "Ch10" ~ "1", + Plot == "Ch11" ~ "1", + Plot == "Ch12" ~ "1", + + + ) + ) + +#make plot +viz_H2S_plot_2 <- ggplot(data = H2S_forplot, + aes(x = H2S_Conc_uM, y = Depth_cm, color = Replicate)) + + geom_point(size = 3) + + geom_path(linewidth = 1) + + scale_color_manual(values = c( + "1" = "#FFD500", + "2" = "#00D0FF" + )) + + facet_grid(factor( + Treatment, + levels = c("+0 C", + "+0.75 C", + "+1.5 C", + "+2.25 C", + "+3 C", + "+3.75 C", + "+4.5 C", + "+5.25 C", + "+6 C")) ~ ., scales = "free_x") + + labs(x = "H2S Conc (uM)", + y = "Depth (cm)", + title = "GENX: Porewater H2S by Replicate") + + scale_y_reverse(breaks = c(5, 20, 40, 80), + limits = c(85, 0)) + + xlim(5.7, 6500) + + theme_classic() + + theme( + axis.text.x = element_text(angle = 0, hjust = 0.5), + panel.border = element_rect( + color = "black", + fill = NA, + linewidth = 0.8 + ) + ) + +viz_H2S_plot_2 + +``` + + + + + +##Export Data +```{r, echo=FALSE} +write.csv(unique_log, log_path) + + Rerun_Data <- All_Clean_Data %>% filter(H2S_Conc_Flag != "Within Range" | H2S_CV_Flag %like% "High") + +if(After_Reruns == "YES"){ + write.csv(All_Clean_Data, final_path)} else { + write.csv(Rerun_Data, rerun_path) } +#end +``` + + +### END \ No newline at end of file diff --git a/GENX (WIP)/Porewater/Sulfide/2026/GCReW_GENX_Porewater_H2S_Template.Rmd b/GENX (WIP)/Porewater/Sulfide/2026/GCReW_GENX_Porewater_H2S_Template.Rmd index c83c158..f37c6cd 100644 --- a/GENX (WIP)/Porewater/Sulfide/2026/GCReW_GENX_Porewater_H2S_Template.Rmd +++ b/GENX (WIP)/Porewater/Sulfide/2026/GCReW_GENX_Porewater_H2S_Template.Rmd @@ -37,50 +37,42 @@ library(ggrepel) ```{r Information to be changed} ##Before or After Reruns (YES or NO) -After_Reruns = "YES" +After_Reruns = "NO" #If NO will not write final data file #And Will Write a Rerun File ###things that need to be changed -sample_month = "MONTH" -sample_year = "YEAR" -Run_Date = as.Date("DATE", format = "%m/%d/%Y") -Run_by = "NAME"#Instrument user -Script_run_by ="NAME"#Code user +sample_month = "May" +sample_year = "2026" +Run_Date = as.Date("5/20/2026", format = "%m/%d/%Y") +Run_by = "Melanie Giessner"#Instrument user +Script_run_by ="Melanie Giessner"#Code user -Run_notes=""#any notes from run +Run_notes="Ch1-80 not collected"#any notes from run #Import Plate Data -plates<- c("Plate1","Plate2","Plate3","Plate4","Plate5","Plate6","Plate7", "Plate8", "Plate9", "Plate10") +plates<- c("Plate1","Plate2","Plate3","Plate4","rrPlate1","rrPlate2") -Raw_plates <- c("Raw Data/20250602_SMARTX_H2S_Plate1.csv", - "Raw Data/20250602_SMARTX_H2S_Plate2.csv", - "Raw Data/20250602_SMARTX_H2S_Plate3.csv", - "Raw Data/20250603_SMARTX_H2S_Plate4.csv", - "Raw Data/20250603_SMARTX_H2S_Plate5.csv", - "Raw Data/20250603_SMARTX_H2S_Plate6.csv", - "Raw Data/20250603_SMARTX_H2S_Plate7.csv", - "Raw Data/20250603_SMARTX_H2S_Plate8.csv", - "Raw Data/20250603_SMARTX_H2S_Plate9.csv", - "Raw Data/20250603_SMARTX_H2S_Plate10.csv") +folder_path_rawdata <- paste0("Raw Data") +Raw_plates <- list.files(path = folder_path_rawdata, full.names = TRUE,pattern = "Plate") +head(Raw_plates) #Import Run Date for Each Plate for Std curve qaqc Run_dates <- tibble( - Plate = c("Plate1","Plate2","Plate3","Plate4","Plate5","Plate6","Plate7","Plate8","Plate9","Plate10"), - Run_Date = c("06/02/2025","06/02/2025","06/02/2025","06/03/2025","06/03/2025","06/03/2025","06/03/2025","06/03/2025","06/03/2025", "06/03/2025") + Plate = plates, + Run_Date = c("05/19/2026","05/19/2026","05/19/2026","05/20/2026","06/01/2026","06/01/2026") ) - Run_dates <- Run_dates %>% mutate(Run_Date = as.Date(Run_Date, format = "%m/%d/%Y")) - + Run_dates <- Run_dates %>% mutate(Run_Date = as.Date(Run_Date, tryFormats = c("%Y-%m-%d", "%m/%d/%Y", "%m/%d/%y"))) # Define the file path for QAQC log file - NO Need to change just check year -log_path <- "Processed Data/SMARTX_H2S_QAQC_2025.csv" +log_path <- "Processed Data/SMARTX_H2S_QAQC_2026.csv" # Define final path for data be sure to change year and month and run number -final_path <- "Processed Data/GCReW_SMARTX_Porewater_H2S_202505.csv" -rerun_path <- "Processed Data/GCReW_SMARTX_Porewater_H2S_202505_reruns.csv" +final_path <- "Processed Data/GCReW_GENX_Porewater_H2S_202605.csv" +rerun_path <- "Processed Data/GCReW_GENX_Porewater_H2S_202605_reruns.csv" ``` @@ -153,7 +145,7 @@ metadata <- raw_metadata %>% rename( Sample_ID = Sample.ID, ) %>% - select(-N_Treatment) + dplyr::select(-N_Treatment) ``` @@ -348,11 +340,11 @@ new_log_stds <- STD_run_date %>% dplyr::select(Plate, #read in log file and format log <- read.csv(log_path) -log_2 <- log %>% mutate(Run_Date = as.Date(as.character(Run_Date), format = "%Y-%m-%d"), Run = "Past Runs") +log_2 <- log %>% mutate(Run_Date = as.Date(as.character(Run_Date), tryFormats = c("%Y-%m-%d", "%m/%d/%Y")), Run = "Past Runs") log_3 <- log_2[, -c(1)] log_4 <- rbind(log_3, new_log_stds) -unique_log <- log_4 %>% distinct(.keep_all = TRUE) +unique_log <- log_4 %>% distinct(Plate,Curve,R2,Slope,Intercept,.keep_all = TRUE) #Calculate Mean and SD and calculate 2SD range for slope and intercept mean_slope <- mean(unique_log$Slope, na.rm = TRUE) @@ -393,7 +385,7 @@ ints_chk Slopes_chk -write.csv(unique_log, log_path) + #Get done of original runs Date_1 <-as.Date(new_log_stds$Run_Date[which(new_log_stds$Plate == "Plate1")]) @@ -424,19 +416,23 @@ stdcrv_tagged <- new_log_stds %>% mutate( #Calculate Combo Std Crv stdcrv_filtered <- stdcrv_tagged %>% filter(Date_Close == "Yes") - +stdcrv_filtered_no <- stdcrv_tagged %>% filter(Date_Close == "No") mean_slope_fin <- mean(stdcrv_filtered$Slope, na.rm = TRUE) - +mean_slope_no <- mean(stdcrv_filtered_no$Slope, na.rm = TRUE) mean_int_fin <- mean(stdcrv_filtered$Intercept, na.rm = TRUE) +mean_int_no <- mean(stdcrv_filtered_no$Intercept, na.rm = TRUE) #Attach Slope and Intercept to Plates -Std_crv_calc <- stdcrv_tagged %>% mutate(Slope_Calc = ifelse(Date_Close == "Yes", mean_slope_fin, Slope), Int_Calc = ifelse(Date_Close == "Yes", mean_int_fin, Intercept)) %>% dplyr::select(Plate, Slope_Calc, Int_Calc, Curve_RMVD, Slope_Flag, Int_Flag) %>% as.data.frame() +Std_crv_calc <- stdcrv_tagged %>% mutate(Slope_Calc = ifelse(Date_Close == "Yes", mean_slope_fin, mean_slope_no), Int_Calc = ifelse(Date_Close == "Yes", mean_int_fin, mean_int_no)) %>% dplyr::select(Plate, Slope_Calc, Int_Calc, Curve_RMVD, Slope_Flag, Int_Flag) %>% as.data.frame() std_curves <- Std_crv_calc %>% dplyr::select(Plate, Curve_RMVD) %>% filter(Curve_RMVD != "RMVD") %>% distinct() Curve_Flags <- Std_crv_calc %>% dplyr::select(Plate, Slope_Flag, Int_Flag) %>% distinct() Curve_Flags_forJoin <- Curve_Flags %>% mutate(Slope_Flag = ifelse(Slope_Flag %like% "Good", "", Slope_Flag), Int_Flag = ifelse(Int_Flag %like% "Good", "", Int_Flag)) + + +Std_crv_calc <-Std_crv_calc %>% distinct() ``` ## Return Flags For Standard Curve @@ -686,10 +682,10 @@ H2S_SPL_CV_fin <- H2S_SPL_cv_new %>% dplyr::select(Plate, #Filter samples and mark reruns H2S_Spl_pre_viz <- H2S_SPL_cv_new %>% mutate(IDs = toupper(IDs)) %>% - filter(grepl("^\\d{3}-", IDs)) %>% + filter(grepl("CH", IDs)) %>% filter(!str_detect(IDs, "DUP")) %>% filter(!str_detect(IDs, "SPIKE")) %>% - dplyr::select(Plate, IDs, Mean_Conc, Conc_SD, CV_Flag) %>% distinct(.keep_all = TRUE) %>% mutate(IDs = ifelse(Plate %like% "rr", paste0(IDs, "_RR"), IDs)) %>% mutate(ForPlot = ifelse(row_number() <= 80, "A", "B")) + dplyr::select(Plate, IDs, Mean_Conc, Conc_SD, CV_Flag) %>% distinct(.keep_all = TRUE) %>% mutate(IDs = ifelse(Plate %like% "rr", paste0(IDs, "_RR"), IDs)) #%>% mutate(ForPlot = ifelse(row_number() <= 80, "A", "B")) #Plot Samples before corrections H2S_Spl_Plot_Pre <- ggplot(H2S_Spl_pre_viz, aes(y = Mean_Conc, x = IDs, fill = CV_Flag)) + @@ -708,7 +704,7 @@ H2S_Spl_Plot_Pre <- ggplot(H2S_Spl_pre_viz, aes(y = Mean_Conc, x = IDs, fill = C position = position_dodge(.1) ) + theme_classic() + - facet_wrap(~ ForPlot ,, scale = "free_x", ncol = 1) + + #facet_wrap(~ ForPlot ,, scale = "free_x", ncol = 1) + theme(legend.position = "bottom", axis.text.x = element_text( angle = 90, vjust = 0.5, @@ -720,10 +716,10 @@ H2S_Spl_Plot_Pre <- ggplot(H2S_Spl_pre_viz, aes(y = Mean_Conc, x = IDs, fill = C H2S_Spl_Plot_Pre H2S_Spl_rmv_viz <- H2S_SPL_CV_fin %>% mutate(IDs = toupper(IDs)) %>% - filter(grepl("^\\d{3}-", IDs)) %>% + filter(grepl("CH", IDs)) %>% filter(!str_detect(IDs, "DUP")) %>% filter(!str_detect(IDs, "SPIKE")) %>% - dplyr::select(Plate, IDs, Mean_Conc, SD_Conc, CV_Flag, Conc_Flag) %>% distinct(.keep_all = TRUE) %>% mutate(IDs = ifelse(Plate %like% "rr", paste0(IDs, "_RR"), IDs)) %>% mutate(ForPlot = ifelse(row_number() <= 80, "A", "B")) + dplyr::select(Plate, IDs, Mean_Conc, SD_Conc, CV_Flag, Conc_Flag) %>% distinct(.keep_all = TRUE) %>% mutate(IDs = ifelse(Plate %like% "rr", paste0(IDs, "_RR"), IDs)) #%>% mutate(ForPlot = ifelse(row_number() <= 80, "A", "B")) #Plot samples after Corrections H2S_Spl_Plot_CV <- ggplot(H2S_Spl_rmv_viz, aes(y = Mean_Conc, x = IDs, fill = CV_Flag)) + @@ -742,7 +738,7 @@ H2S_Spl_Plot_CV <- ggplot(H2S_Spl_rmv_viz, aes(y = Mean_Conc, x = IDs, fill = CV position = position_dodge(.1) ) + theme_classic() + - facet_wrap(~ForPlot, scales = "free_x", ncol = 1) + +# facet_wrap(~ForPlot, scales = "free_x", ncol = 1) + theme(legend.position = "bottom", axis.text.x = element_text( angle = 90, vjust = 0.5, @@ -957,16 +953,16 @@ Spike_Flag <- ifelse(length_bad/length_all > 0.4, paste0(">40% Spikes Fail"), "" ## Merge samples with Metadata & check all samples are present ```{r check sample ids with metadata, echo=FALSE} #Get Samples Only -H2S_spls_md <- H2S_SPL_CV_fin %>% mutate(IDs = toupper(IDs)) %>% +H2S_spls_md <- H2S_SPL_CV_fin %>% # mutate(IDs = toupper(IDs)) %>% filter(grepl("^Ch\\d{1,2}-", IDs)) %>% - filter(!str_detect(IDs, "DUP")) %>% - filter(!str_detect(IDs, "SPIKE")) + filter(!str_detect(IDs, "Dup")) %>% + filter(!str_detect(IDs, "Spike")) #Check for reruns and replace -H2S_spl_rrn <- H2S_spls_md %>% - filter(Plate %like% "rr") %>% - dplyr::select(IDs, Mean_Conc, Conc_Flag) %>% - rename(RRN_Conc = Mean_Conc, Conc_Flag_rr = Conc_Flag) %>% +H2S_spl_rrn <- H2S_spls_md %>%group_by(IDs,Plate) %>% + filter(Plate %like% "rr") %>% ungroup() %>% + dplyr::select(IDs, Mean_Conc, Conc_Flag, Dilution) %>% + rename(RRN_Conc = Mean_Conc, Conc_Flag_rr = Conc_Flag, Dilution_rr = Dilution) %>% distinct(.keep_all = TRUE) RRN_IDs <- as.vector(H2S_spl_rrn$IDs) @@ -981,7 +977,8 @@ H2S_spl_rr_join <- full_join(H2S_spl_rrn,H2S_spl_og, by = join_by(IDs) ) Samples_Tagged <- H2S_spl_rr_join %>% mutate( Conc = ifelse(Rerun == "RRN", RRN_Conc, Mean_Conc), - Conc_Flag = ifelse(Rerun == "RRN", Conc_Flag_rr, Conc_Flag) + Conc_Flag = ifelse(Rerun == "RRN", Conc_Flag_rr, Conc_Flag), + Dilution = ifelse(Rerun == "RRN", Dilution_rr, Dilution) ) %>% dplyr::select(IDs, Conc, Conc_Flag, CV_Flag, Plate, Dilution, CV) %>% rename(Sample_ID = IDs) %>% ungroup() %>% group_by(Sample_ID) %>% mutate( Min_CV = ifelse(CV == min(CV), "KEEP", "RMV"), # get if CV is lowest of reruns Within_Range = "Within_Range" %in% Conc_Flag, #Get if any are within range @@ -1315,10 +1312,11 @@ viz_H2S_plot_2 cat("Visualize Data") ### Ammonia -H2S_forplot <- df_all_clean +H2S_forplot <- All_Clean_Data H2S_forplot$Depth_cm <- as.numeric(H2S_forplot$Depth_cm) +H2S_forplot <- H2S_forplot[order(H2S_forplot$Depth_cm), ] #group the data for plotting H2S_forplot <- H2S_forplot %>% @@ -1387,7 +1385,7 @@ viz_H2S_plot <- ggplot(data = H2S_forplot, aes( linewidth = 0.8), legend.key = element_rect("black") ) + - coord_flip(ylim = c(5.5,7.1)) + coord_flip() print(viz_H2S_plot) ``` @@ -1441,7 +1439,7 @@ viz_H2S_plot_2 <- ggplot(data = H2S_forplot, title = "GENX: Porewater H2S by Replicate") + scale_y_reverse(breaks = c(5, 20, 40, 80), limits = c(85, 0)) + - xlim(5.7, 7.1) + + xlim(5.7, 6500) + theme_classic() + theme( axis.text.x = element_text(angle = 0, hjust = 0.5), @@ -1457,256 +1455,12 @@ viz_H2S_plot_2 ``` -## Visualize Data -```{r Visualize Data C3, fig.height=10, echo=FALSE} -cat("Visualize Data") - -### Ammonia -H2S_forplot <- All_Clean_Data - -#C3 plots -H2S_forplot_C3 <- H2S_forplot %>% - filter(Nickname == "C3") - -H2S_forplot_C3$Depth_cm <- - as.numeric(H2S_forplot_C3$Depth_cm) - -#group the data for plotting -H2S_forplot_C3 <- H2S_forplot_C3 %>% - group_by(Depth_cm) %>% - mutate(row_num = factor(row_number())) %>% # create row_num as factor per group - ungroup() %>% - mutate(Treatment = ifelse(Temp_Treatment == 0, ifelse(CO2_Treatment == "Ambient", "0 C + aCO2", "0 C + eCO2"), ifelse(Temp_Treatment == 1.7, "1.7 C + aCO2", ifelse(Temp_Treatment == 3.4, "3.4 C + aCO2", ifelse(Temp_Treatment == 5.1, ifelse(CO2_Treatment == "Ambient", "5.1 C + aCO2", "5.1 C + eCO2"), NA))))) - -#create plot -viz_H2S_plot_C3 <- ggplot(data = H2S_forplot_C3, aes( - x = as.factor(Temp_Treatment), - y = H2S_Conc_uM, - fill = as.factor(Treatment), - color = as.factor(Treatment) -)) + - geom_bar(stat = "identity", position = position_dodge2(padding = 0.4, preserve = c("total", "single"), )) + - facet_grid(as.numeric(Depth_cm) ~ ., scales = "free_x") + - scale_fill_manual( - values = c( - "0 C + aCO2" = "blue", - "1.7 C + aCO2" = "green", - "3.4 C + aCO2" = "orange", - "5.1 C + aCO2" = "red", - "0 C + eCO2" = "white", - "5.1 C + eCO2" = "white" - ), - name = "Treatment:", - breaks = c("0 C + aCO2", "1.7 C + aCO2", "3.4 C + aCO2", "5.1 C + aCO2", "0 C + eCO2", "5.1 C + eCO2"), - labels = c("0 C + aCO2", "1.7 C + aCO2", "3.4 C + aCO2", "5.1 C + aCO2", "0 C + eCO2", "5.1 C + eCO2") - ) + - scale_color_manual( - values = c( - "0 C + aCO2" = "blue", - "1.7 C + aCO2" = "green", - "3.4 C + aCO2" = "orange", - "5.1 C + aCO2" = "red", - "0 C + eCO2" = "blue", - "5.1 C + eCO2" = "red" - ), - name = "Treatment:", - breaks = c("0 C + aCO2", "1.7 C + aCO2", "3.4 C + aCO2", "5.1 C + aCO2", "0 C + eCO2", "5.1 C + eCO2"), - labels = c("0 C + aCO2", "1.7 C + aCO2", "3.4 C + aCO2", "5.1 C + aCO2", "0 C + eCO2", "5.1 C + eCO2") - ) + - theme_classic() + - labs( - x = " ", - y = "H2S (uM)", - title = "C3: Porewater H2S", - fill = "CO2 Treatment", - color = "+Temp. (C)" - ) + - theme(legend.position = "right") + - scale_x_discrete(drop = TRUE) + - theme( - axis.text.x = element_text(angle = 0, hjust = 0.5), - panel.border = element_rect( - color = "black", - fill = NA, - linewidth = 0.8), - legend.key = element_rect("black") - ) + - coord_flip() -print(viz_H2S_plot_C3) - -``` -\newpage -```{r Visualize Data C4, fig.height=10, echo=FALSE} -#C4 plots -H2S_forplot_C4 <- H2S_forplot %>% - filter(Nickname == "C4") - -H2S_forplot_C4$Depth_cm <- - as.numeric(H2S_forplot_C4$Depth_cm) - -#group the data for plotting -H2S_forplot_C4 <- H2S_forplot_C4 %>% - group_by(Depth_cm) %>% - mutate(row_num = factor(row_number())) %>% # create row_num as factor per group - ungroup() - -viz_H2S_plot_C4 <- ggplot(data = H2S_forplot_C4, aes( - x = as.factor(Temp_Treatment), - y = H2S_Conc_uM, - fill = as.factor(Temp_Treatment) -)) + - geom_bar(stat = "identity", position = position_dodge2(padding = 0.25, preserve = "single"), ) + - facet_grid(as.numeric(Depth_cm) ~ ., scales = "free_x") + - facet_grid(Depth_cm ~ ., scales = "free_x") + - scale_fill_manual(values = c( - "0" = "blue", - "1.7" = "green", - "3.4" = "orange", - "5.1" = "red" - )) + - - theme_classic() + - labs(x = " ", - y = "H2S (uM)", - title = "C4: Porewater H2S", - fill = "+Temp. (C)") + - theme(legend.position = "right") + - scale_x_discrete(drop = TRUE) + - theme( - axis.text.x = element_text(angle = 0, hjust = 0.5), - panel.border = element_rect( - color = "black", - fill = NA, - linewidth = 0.8 - ), - legend.key = element_rect("black") - - ) + - coord_flip() -print(viz_H2S_plot_C4) - -``` -\newpage -```{r Visualize Data by Rep C3, fig.height=8.5, echo=FALSE} - -#get replicate value and treatment info -H2S_forplot_C3 <- H2S_forplot_C3 %>% - mutate(Replicate = str_sub(Plot, 2, 2)) %>% - mutate(Treatment1 = ifelse( - Temp_Treatment == 0, - ifelse(CO2_Treatment == "Ambient", "+ 0 C", "eCO2 + 0 C"), - ifelse( - Temp_Treatment == 1.7, - "+ 1.7 C", - ifelse( - Temp_Treatment == 3.4, - "+ 3.4 C", - ifelse( - Temp_Treatment == 5.1, - ifelse(CO2_Treatment == "Ambient", "+ 5.1 C", "eCO2 + 5.1 C"), - NA - ) - ) - ) - )) - -#ensure points are in correct order -H2S_forplot_C3 <- H2S_forplot_C3[order(H2S_forplot_C3$Depth_cm), ] - -#make plot -viz_H2S_plot_C3_2 <- ggplot(data = H2S_forplot_C3, - aes(x = H2S_Conc_uM, y = Depth_cm, color = Replicate)) + - geom_point(size = 3) + - geom_path(size = 1) + - scale_color_manual(values = c( - "1" = "#FFD500", - "2" = "#00D0FF", - "3" = "#FF0075" - )) + - facet_grid(factor( - Treatment1, - levels = c("eCO2 + 0 C", "+ 0 C", "+ 1.7 C", "+ 3.4 C", "+ 5.1 C", "eCO2 + 5.1 C") - ) ~ ., scales = "free_x") + - labs(x = "H2S (uM)", - y = "Depth (cm)", - title = "C3: Porewater H2S by Replicate") + - scale_y_reverse(breaks = c(10, 20, 40, 80, 120), - limits = c(125, 5)) + - theme_classic() + - theme( - axis.text.x = element_text(angle = 0, hjust = 0.5), - panel.border = element_rect( - color = "black", - fill = NA, - linewidth = 0.8 - ) - ) - -viz_H2S_plot_C3_2 - -``` -\newpage - -```{r Visualize Data by Rep C4, fig.height=5.7, echo=FALSE} - -#get replicate value and treatment info -H2S_forplot_C4 <- H2S_forplot_C4 %>% - mutate(Replicate = str_sub(Plot, 2, 2)) %>% - mutate(Treatment1 = ifelse( - Temp_Treatment == 0, - ifelse(CO2_Treatment == "Ambient", "+ 0 C", "eCO2 + 0 C"), - ifelse( - Temp_Treatment == 1.7, - "+ 1.7 C", - ifelse( - Temp_Treatment == 3.4, - "+ 3.4 C", - ifelse( - Temp_Treatment == 5.1, - ifelse(CO2_Treatment == "Ambient", "+ 5.1 C", "eCO2 + 5.1 C"), - NA - ) - ) - ) - )) -#make sure point are in correct order -H2S_forplot_C4 <- H2S_forplot_C4[order(H2S_forplot_C4$Depth_cm), ] - -#make plot -viz_H2S_plot_C4_2 <- ggplot(data = H2S_forplot_C4, - aes(x = H2S_Conc_uM, y = Depth_cm, color = Replicate)) + - geom_point(size = 3) + - geom_path(size = 1) + - scale_color_manual(values = c( - "4" = "#FFD500", - "5" = "#00D0FF", - "6" = "#FF0075" - )) + - facet_grid(factor(Treatment1, levels = c("+ 0 C", "+ 1.7 C", "+ 3.4 C", "+ 5.1 C")) ~ - ., scales = "free_x") + - labs(x = "H2S (uM)", - y = "Depth (cm)", - title = "C4: Porewater H2S by Replicate") + - scale_y_reverse(breaks = c(10, 20, 40, 80, 120), - limits = c(125, 5)) + - theme_classic() + - theme( - axis.text.x = element_text(angle = 0, hjust = 0.5), - panel.border = element_rect( - color = "black", - fill = NA, - linewidth = 0.8 - ) - ) - -viz_H2S_plot_C4_2 - -``` ##Export Data ```{r, echo=FALSE} +write.csv(unique_log, log_path) Rerun_Data <- All_Clean_Data %>% filter(H2S_Conc_Flag != "Within Range" | H2S_CV_Flag %like% "High") diff --git a/GENX (WIP)/Porewater/Sulfide/2026/Processed Data/GCReW_GENX_Porewater_H2S_202605.csv b/GENX (WIP)/Porewater/Sulfide/2026/Processed Data/GCReW_GENX_Porewater_H2S_202605.csv new file mode 100644 index 0000000..36ce146 --- /dev/null +++ b/GENX (WIP)/Porewater/Sulfide/2026/Processed Data/GCReW_GENX_Porewater_H2S_202605.csv @@ -0,0 +1,48 @@ +"","Site","Project","Year","Month","Community","Nickname","Plot","Depth_cm","CO2_Treatment","Temp_Treatment","H2S_Conc_uM","H2S_Conc_Flag","H2S_CV_Flag","H2S_Flags","Analysis_rundate","Run_notes" +"1","GCReW","GENX","2026","May","SCAM, SPPA, DISP","GENX","Ch1",20,"Ambient",0,1959.70149253731,"Within_Range","CV_Good","Spk_Bad Dup_Bad ",2026-05-20,"Ch1-80 not collected" +"2","GCReW","GENX","2026","May","SCAM, SPPA, DISP","GENX","Ch3",40,"Ambient",0.75,1341.36460554371,"Within_Range","CV_Good","Spk_Bad Dup_Bad ",2026-05-20,"Ch1-80 not collected" +"3","GCReW","GENX","2026","May","SCAM, SPPA, DISP","GENX","Ch4",80,"Ambient",1.5,5196.37526652452,"Within_Range","CV_High","Spk_Bad Dup_Bad ",2026-05-20,"Ch1-80 not collected" +"4","GCReW","GENX","2026","May","SCAM, SPPA, DISP","GENX","Ch1",40,"Ambient",0,3302.98507462687,"Within_Range","CV_Good","Spk_Bad Dup_Bad ",2026-05-20,"Ch1-80 not collected" +"5","GCReW","GENX","2026","May","SCAM, SPPA, DISP","GENX","Ch2",5,"Ambient",0,121.748400852878,"bdl","CV_High","Spk_Bad Dup_Bad ",2026-05-20,"Ch1-80 not collected" +"6","GCReW","GENX","2026","May","SCAM, SPPA, DISP","GENX","Ch5",20,"Ambient",2.25,994.52736318408,"Within_Range","CV_Good","Spk_Bad Dup_Bad ",2026-05-20,"Ch1-80 not collected" +"7","GCReW","GENX","2026","May","SCAM, SPPA, DISP","GENX","Ch2",20,"Ambient",0,1801.91897654584,"Within_Range","CV_Good","Spk_Bad Dup_Bad ",2026-05-20,"Ch1-80 not collected" +"8","GCReW","GENX","2026","May","SCAM, SPPA, DISP","GENX","Ch2",40,"Ambient",0,3402.48756218906,"Within_Range","CV_Good","Spk_Bad Dup_Bad ",2026-05-20,"Ch1-80 not collected" +"9","GCReW","GENX","2026","May","SCAM, SPPA, DISP","GENX","Ch3",80,"Ambient",0.75,3712.36673773987,"Within_Range","CV_Good","Spk_Bad Dup_Bad ",2026-05-20,"Ch1-80 not collected" +"10","GCReW","GENX","2026","May","SCAM, SPPA, DISP","GENX","Ch2",80,"Ambient",0,4585.14570007107,"Within_Range","CV_Good","Spk_Bad Dup_Bad ",2026-05-20,"Ch1-80 not collected" +"11","GCReW","GENX","2026","May","SCAM, SPPA, DISP","GENX","Ch4",5,"Ambient",1.5,1153.73134328358,"Within_Range","CV_Good","Spk_Bad Dup_Bad ",2026-05-20,"Ch1-80 not collected" +"12","GCReW","GENX","2026","May","SCAM, SPPA, DISP","GENX","Ch3",5,"Ambient",0.75,858.066808813078,"Within_Range","CV_Good","Spk_Bad Dup_Bad ",2026-05-20,"Ch1-80 not collected" +"13","GCReW","GENX","2026","May","SCAM, SPPA, DISP","GENX","Ch4",20,"Ambient",1.5,2501.27931769723,"Within_Range","CV_Good","Spk_Bad Dup_Bad ",2026-05-20,"Ch1-80 not collected" +"14","GCReW","GENX","2026","May","SCAM, SPPA, DISP","GENX","Ch1",5,"Ambient",0,424.520255863539,"Within_Range","CV_Good","Spk_Bad Dup_Bad ",2026-05-20,"Ch1-80 not collected" +"15","GCReW","GENX","2026","May","SCAM, SPPA, DISP","GENX","Ch3",20,"Ambient",0.75,1065.60056858564,"Within_Range","CV_Good","Spk_Bad Dup_Bad ",2026-05-20,"Ch1-80 not collected" +"16","GCReW","GENX","2026","May","SCAM, SPPA, DISP","GENX","Ch4",40,"Ambient",1.5,3196.37526652452,"Within_Range","CV_High","Spk_Bad Dup_Bad ",2026-05-20,"Ch1-80 not collected" +"17","GCReW","GENX","2026","May","SCAM, SPPA, DISP","GENX","Ch5",80,"Ambient",2.25,4929.14001421464,"Within_Range","CV_Good","Spk_Bad Dup_Bad ",2026-05-20,"Ch1-80 not collected" +"18","GCReW","GENX","2026","May","SCAM, SPPA, DISP","GENX","Ch7",80,"Ambient",3,177.185501066098,"Within_Range","CV_Good","Spk_Bad Dup_Bad ",2026-05-20,"Ch1-80 not collected" +"19","GCReW","GENX","2026","May","SCAM, SPPA, DISP","GENX","Ch9",20,"Ambient",3.75,383.297796730633,"Within_Range","CV_Good","Spk_Bad Dup_Bad ",2026-05-20,"Ch1-80 not collected" +"20","GCReW","GENX","2026","May","SCAM, SPPA, DISP","GENX","Ch6",20,"Ambient",2.25,778.464818763326,"Within_Range","CV_Good","Spk_Bad Dup_Bad ",2026-05-20,"Ch1-80 not collected" +"21","GCReW","GENX","2026","May","SCAM, SPPA, DISP","GENX","Ch9",40,"Ambient",3.75,1935.53660270078,"Within_Range","CV_Good","Spk_Bad Dup_Bad ",2026-05-20,"Ch1-80 not collected" +"22","GCReW","GENX","2026","May","SCAM, SPPA, DISP","GENX","Ch6",40,"Ambient",2.25,1951.17270788913,"Within_Range","CV_Good","Spk_Bad Dup_Bad ",2026-05-20,"Ch1-80 not collected" +"23","GCReW","GENX","2026","May","SCAM, SPPA, DISP","GENX","Ch6",80,"Ambient",2.25,5541.79104477612,"Within_Range","CV_Good","Spk_Bad Dup_Bad ",2026-05-20,"Ch1-80 not collected" +"24","GCReW","GENX","2026","May","SCAM, SPPA, DISP","GENX","Ch8",5,"Ambient",3.75,202.771855010661,"Within_Range","CV_High","Spk_Bad Dup_Bad ",2026-05-20,"Ch1-80 not collected" +"25","GCReW","GENX","2026","May","SCAM, SPPA, DISP","GENX","Ch7",5,"Ambient",3,108.955223880597,"Within_Range","CV_Good","Spk_Bad Dup_Bad ",2026-05-20,"Ch1-80 not collected" +"26","GCReW","GENX","2026","May","SCAM, SPPA, DISP","GENX","Ch8",20,"Ambient",3.75,2444.42075337598,"Within_Range","CV_Good","Spk_Bad Dup_Bad ",2026-05-20,"Ch1-80 not collected" +"27","GCReW","GENX","2026","May","SCAM, SPPA, DISP","GENX","Ch7",20,"Ambient",3,1770.64676616915,"Within_Range","CV_Good","Spk_Bad Dup_Bad ",2026-05-20,"Ch1-80 not collected" +"28","GCReW","GENX","2026","May","SCAM, SPPA, DISP","GENX","Ch8",40,"Ambient",3.75,6049.25373134328,"Within_Range","CV_Good","Spk_Bad Dup_Bad ",2026-05-20,"Ch1-80 not collected" +"29","GCReW","GENX","2026","May","SCAM, SPPA, DISP","GENX","Ch5",40,"Ambient",2.25,3439.44562899787,"Within_Range","CV_Good","Spk_Bad Dup_Bad ",2026-05-20,"Ch1-80 not collected" +"30","GCReW","GENX","2026","May","SCAM, SPPA, DISP","GENX","Ch7",40,"Ambient",3,2705.97014925373,"Within_Range","CV_Good","Spk_Bad Dup_Bad ",2026-05-20,"Ch1-80 not collected" +"31","GCReW","GENX","2026","May","SCAM, SPPA, DISP","GENX","Ch8",80,"Ambient",3.75,5691.0447761194,"Within_Range","CV_Good","Spk_Bad Dup_Bad ",2026-05-20,"Ch1-80 not collected" +"32","GCReW","GENX","2026","May","SCAM, SPPA, DISP","GENX","Ch10",5,"Ambient",4.5,258.208955223881,"Within_Range","CV_Good","Spk_Bad ",2026-05-20,"Ch1-80 not collected" +"33","GCReW","GENX","2026","May","SCAM, SPPA, DISP","GENX","Ch6",5,"Ambient",2.25,71.9495380241649,"Within_Range","CV_Good","Spk_Bad ",2026-05-20,"Ch1-80 not collected" +"34","GCReW","GENX","2026","May","SCAM, SPPA, DISP","GENX","Ch10",20,"Ambient",4.5,2504.12224591329,"Within_Range","CV_Good","Spk_Bad ",2026-05-20,"Ch1-80 not collected" +"35","GCReW","GENX","2026","May","SCAM, SPPA, DISP","GENX","Ch9",5,"Ambient",3.75,76.228144989339,"Within_Range","CV_Good","Spk_Bad ",2026-05-20,"Ch1-80 not collected" +"36","GCReW","GENX","2026","May","SCAM, SPPA, DISP","GENX","Ch10",40,"Ambient",4.5,4258.20895522388,"Within_Range","CV_Good","Spk_Bad ",2026-05-20,"Ch1-80 not collected" +"37","GCReW","GENX","2026","May","SCAM, SPPA, DISP","GENX","Ch10",80,"Ambient",4.5,4750.0355366027,"Within_Range","CV_Good","Spk_Bad ",2026-05-20,"Ch1-80 not collected" +"38","GCReW","GENX","2026","May","SCAM, SPPA, DISP","GENX","Ch11",5,"Ambient",5.25,70.5756929637526,"Within_Range","CV_High","Spk_Bad ",2026-05-20,"Ch1-80 not collected" +"39","GCReW","GENX","2026","May","SCAM, SPPA, DISP","GENX","Ch12",20,"Ambient",6,3673.98720682303,"Within_Range","CV_Good","Spk_Bad ",2026-05-20,"Ch1-80 not collected" +"40","GCReW","GENX","2026","May","SCAM, SPPA, DISP","GENX","Ch11",20,"Ambient",5.25,2441.57782515991,"Within_Range","CV_Good","Spk_Bad ",2026-05-20,"Ch1-80 not collected" +"41","GCReW","GENX","2026","May","SCAM, SPPA, DISP","GENX","Ch12",40,"Ambient",6,5315.77825159915,"Within_Range","CV_Good","Spk_Bad ",2026-05-20,"Ch1-80 not collected" +"42","GCReW","GENX","2026","May","SCAM, SPPA, DISP","GENX","Ch11",40,"Ambient",5.25,4212.72210376688,"Within_Range","CV_Good","Spk_Bad ",2026-05-20,"Ch1-80 not collected" +"43","GCReW","GENX","2026","May","SCAM, SPPA, DISP","GENX","Ch12",80,"Ambient",6,6032.19616204691,"Within_Range","CV_Good","Spk_Bad ",2026-05-20,"Ch1-80 not collected" +"44","GCReW","GENX","2026","May","SCAM, SPPA, DISP","GENX","Ch9",80,"Ambient",3.75,5156.57427149964,"Within_Range","CV_Good","Spk_Bad ",2026-05-20,"Ch1-80 not collected" +"45","GCReW","GENX","2026","May","SCAM, SPPA, DISP","GENX","Ch11",80,"Ambient",5.25,6020.82444918266,"Within_Range","CV_Good","Spk_Bad ",2026-05-20,"Ch1-80 not collected" +"46","GCReW","GENX","2026","May","SCAM, SPPA, DISP","GENX","Ch5",5,"Ambient",2.25,71.5799573560768,"Within_Range","CV_Good","Spk_Bad ",2026-05-20,"Ch1-80 not collected" +"47","GCReW","GENX","2026","May","SCAM, SPPA, DISP","GENX","Ch12",5,"Ambient",6,45.1975835110163,"Within_Range","CV_Good"," Std3Chk_Bad, Std5Chk_Bad Intercept_Bad",2026-05-20,"Ch1-80 not collected" diff --git a/GENX (WIP)/Porewater/Sulfide/2026/Processed Data/GCReW_GENX_Porewater_H2S_202605_reruns.csv b/GENX (WIP)/Porewater/Sulfide/2026/Processed Data/GCReW_GENX_Porewater_H2S_202605_reruns.csv new file mode 100644 index 0000000..1585187 --- /dev/null +++ b/GENX (WIP)/Porewater/Sulfide/2026/Processed Data/GCReW_GENX_Porewater_H2S_202605_reruns.csv @@ -0,0 +1,48 @@ +"","Site","Project","Year","Month","Community","Nickname","Plot","Depth_cm","CO2_Treatment","Temp_Treatment","H2S_Conc_uM","H2S_Conc_Flag","H2S_CV_Flag","H2S_Flags","Analysis_rundate","Run_notes" +"1","GCReW","GENX","2026","May","SCAM, SPPA, DISP","GENX","Ch4",80,"Ambient",1.5,6389.5652173913,"Within_Range","CV_Good","Spk_Bad ",2026-05-20,"Ch1-80 not collected" +"2","GCReW","GENX","2026","May","SCAM, SPPA, DISP","GENX","Ch4",40,"Ambient",1.5,3730.14492753623,"Within_Range","CV_Good","Spk_Bad ",2026-05-20,"Ch1-80 not collected" +"3","GCReW","GENX","2026","May","SCAM, SPPA, DISP","GENX","Ch8",5,"Ambient",3.75,367.971014492754,"Within_Range","CV_High","Spk_Bad ",2026-05-20,"Ch1-80 not collected" +"4","GCReW","GENX","2026","May","SCAM, SPPA, DISP","GENX","Ch2",5,"Ambient",0,101.127536231884,"Within_Range","CV_Good","Spk_Bad ",2026-05-20,"Ch1-80 not collected" +"5","GCReW","GENX","2026","May","SCAM, SPPA, DISP","GENX","Ch11",5,"Ambient",5.25,285.434782608696,"Within_Range","CV_High","Spk_Bad ",2026-05-20,"Ch1-80 not collected" +"6","GCReW","GENX","2026","May","SCAM, SPPA, DISP","GENX","Ch1",20,"Ambient",0,1959.70149253731,"Within_Range","CV_Good","Spk_Bad ",2026-05-20,"Ch1-80 not collected" +"7","GCReW","GENX","2026","May","SCAM, SPPA, DISP","GENX","Ch3",40,"Ambient",0.75,1341.36460554371,"Within_Range","CV_Good","Spk_Bad ",2026-05-20,"Ch1-80 not collected" +"8","GCReW","GENX","2026","May","SCAM, SPPA, DISP","GENX","Ch1",40,"Ambient",0,3302.98507462687,"Within_Range","CV_Good","Spk_Bad ",2026-05-20,"Ch1-80 not collected" +"9","GCReW","GENX","2026","May","SCAM, SPPA, DISP","GENX","Ch5",20,"Ambient",2.25,994.52736318408,"Within_Range","CV_Good","Spk_Bad ",2026-05-20,"Ch1-80 not collected" +"10","GCReW","GENX","2026","May","SCAM, SPPA, DISP","GENX","Ch2",20,"Ambient",0,1801.91897654584,"Within_Range","CV_Good","Spk_Bad ",2026-05-20,"Ch1-80 not collected" +"11","GCReW","GENX","2026","May","SCAM, SPPA, DISP","GENX","Ch2",40,"Ambient",0,3402.48756218906,"Within_Range","CV_Good","Spk_Bad ",2026-05-20,"Ch1-80 not collected" +"12","GCReW","GENX","2026","May","SCAM, SPPA, DISP","GENX","Ch3",80,"Ambient",0.75,3712.36673773987,"Within_Range","CV_Good","Spk_Bad ",2026-05-20,"Ch1-80 not collected" +"13","GCReW","GENX","2026","May","SCAM, SPPA, DISP","GENX","Ch2",80,"Ambient",0,4585.14570007107,"Within_Range","CV_Good","Spk_Bad ",2026-05-20,"Ch1-80 not collected" +"14","GCReW","GENX","2026","May","SCAM, SPPA, DISP","GENX","Ch4",5,"Ambient",1.5,1153.73134328358,"Within_Range","CV_Good","Spk_Bad ",2026-05-20,"Ch1-80 not collected" +"15","GCReW","GENX","2026","May","SCAM, SPPA, DISP","GENX","Ch3",5,"Ambient",0.75,808.315565031983,"Within_Range","CV_Good","Spk_Bad ",2026-05-20,"Ch1-80 not collected" +"16","GCReW","GENX","2026","May","SCAM, SPPA, DISP","GENX","Ch4",20,"Ambient",1.5,2501.27931769723,"Within_Range","CV_Good","Spk_Bad ",2026-05-20,"Ch1-80 not collected" +"17","GCReW","GENX","2026","May","SCAM, SPPA, DISP","GENX","Ch1",5,"Ambient",0,424.520255863539,"Within_Range","CV_Good","Spk_Bad ",2026-05-20,"Ch1-80 not collected" +"18","GCReW","GENX","2026","May","SCAM, SPPA, DISP","GENX","Ch3",20,"Ambient",0.75,1065.60056858564,"Within_Range","CV_Good","Spk_Bad ",2026-05-20,"Ch1-80 not collected" +"19","GCReW","GENX","2026","May","SCAM, SPPA, DISP","GENX","Ch5",80,"Ambient",2.25,4929.14001421464,"Within_Range","CV_Good","Spk_Bad ",2026-05-20,"Ch1-80 not collected" +"20","GCReW","GENX","2026","May","SCAM, SPPA, DISP","GENX","Ch7",80,"Ambient",3,177.185501066098,"Within_Range","CV_Good","Spk_Bad ",2026-05-20,"Ch1-80 not collected" +"21","GCReW","GENX","2026","May","SCAM, SPPA, DISP","GENX","Ch9",20,"Ambient",3.75,383.297796730633,"Within_Range","CV_Good","Spk_Bad ",2026-05-20,"Ch1-80 not collected" +"22","GCReW","GENX","2026","May","SCAM, SPPA, DISP","GENX","Ch6",20,"Ambient",2.25,778.464818763326,"Within_Range","CV_Good","Spk_Bad ",2026-05-20,"Ch1-80 not collected" +"23","GCReW","GENX","2026","May","SCAM, SPPA, DISP","GENX","Ch9",40,"Ambient",3.75,1935.53660270078,"Within_Range","CV_Good","Spk_Bad ",2026-05-20,"Ch1-80 not collected" +"24","GCReW","GENX","2026","May","SCAM, SPPA, DISP","GENX","Ch6",40,"Ambient",2.25,1951.17270788913,"Within_Range","CV_Good","Spk_Bad ",2026-05-20,"Ch1-80 not collected" +"25","GCReW","GENX","2026","May","SCAM, SPPA, DISP","GENX","Ch6",80,"Ambient",2.25,5541.79104477612,"Within_Range","CV_Good","Spk_Bad ",2026-05-20,"Ch1-80 not collected" +"26","GCReW","GENX","2026","May","SCAM, SPPA, DISP","GENX","Ch7",5,"Ambient",3,108.955223880597,"Within_Range","CV_Good","Spk_Bad ",2026-05-20,"Ch1-80 not collected" +"27","GCReW","GENX","2026","May","SCAM, SPPA, DISP","GENX","Ch8",20,"Ambient",3.75,2444.42075337598,"Within_Range","CV_Good","Spk_Bad ",2026-05-20,"Ch1-80 not collected" +"28","GCReW","GENX","2026","May","SCAM, SPPA, DISP","GENX","Ch7",20,"Ambient",3,1770.64676616915,"Within_Range","CV_Good","Spk_Bad ",2026-05-20,"Ch1-80 not collected" +"29","GCReW","GENX","2026","May","SCAM, SPPA, DISP","GENX","Ch8",40,"Ambient",3.75,6049.25373134328,"Within_Range","CV_Good","Spk_Bad ",2026-05-20,"Ch1-80 not collected" +"30","GCReW","GENX","2026","May","SCAM, SPPA, DISP","GENX","Ch5",40,"Ambient",2.25,3439.44562899787,"Within_Range","CV_Good","Spk_Bad ",2026-05-20,"Ch1-80 not collected" +"31","GCReW","GENX","2026","May","SCAM, SPPA, DISP","GENX","Ch7",40,"Ambient",3,2705.97014925373,"Within_Range","CV_Good","Spk_Bad ",2026-05-20,"Ch1-80 not collected" +"32","GCReW","GENX","2026","May","SCAM, SPPA, DISP","GENX","Ch8",80,"Ambient",3.75,5691.0447761194,"Within_Range","CV_Good","Spk_Bad ",2026-05-20,"Ch1-80 not collected" +"33","GCReW","GENX","2026","May","SCAM, SPPA, DISP","GENX","Ch10",5,"Ambient",4.5,258.208955223881,"Within_Range","CV_Good","Spk_Bad ",2026-05-20,"Ch1-80 not collected" +"34","GCReW","GENX","2026","May","SCAM, SPPA, DISP","GENX","Ch6",5,"Ambient",2.25,71.9495380241649,"Within_Range","CV_Good","Spk_Bad ",2026-05-20,"Ch1-80 not collected" +"35","GCReW","GENX","2026","May","SCAM, SPPA, DISP","GENX","Ch10",20,"Ambient",4.5,2504.12224591329,"Within_Range","CV_Good","Spk_Bad ",2026-05-20,"Ch1-80 not collected" +"36","GCReW","GENX","2026","May","SCAM, SPPA, DISP","GENX","Ch9",5,"Ambient",3.75,76.228144989339,"Within_Range","CV_Good","Spk_Bad ",2026-05-20,"Ch1-80 not collected" +"37","GCReW","GENX","2026","May","SCAM, SPPA, DISP","GENX","Ch10",40,"Ambient",4.5,4258.20895522388,"Within_Range","CV_Good","Spk_Bad ",2026-05-20,"Ch1-80 not collected" +"38","GCReW","GENX","2026","May","SCAM, SPPA, DISP","GENX","Ch10",80,"Ambient",4.5,4750.0355366027,"Within_Range","CV_Good","Spk_Bad ",2026-05-20,"Ch1-80 not collected" +"39","GCReW","GENX","2026","May","SCAM, SPPA, DISP","GENX","Ch12",20,"Ambient",6,3673.98720682303,"Within_Range","CV_Good","Spk_Bad ",2026-05-20,"Ch1-80 not collected" +"40","GCReW","GENX","2026","May","SCAM, SPPA, DISP","GENX","Ch11",20,"Ambient",5.25,2441.57782515991,"Within_Range","CV_Good","Spk_Bad ",2026-05-20,"Ch1-80 not collected" +"41","GCReW","GENX","2026","May","SCAM, SPPA, DISP","GENX","Ch12",40,"Ambient",6,5315.77825159915,"Within_Range","CV_Good","Spk_Bad ",2026-05-20,"Ch1-80 not collected" +"42","GCReW","GENX","2026","May","SCAM, SPPA, DISP","GENX","Ch11",40,"Ambient",5.25,4212.72210376688,"Within_Range","CV_Good","Spk_Bad ",2026-05-20,"Ch1-80 not collected" +"43","GCReW","GENX","2026","May","SCAM, SPPA, DISP","GENX","Ch12",80,"Ambient",6,6032.19616204691,"Within_Range","CV_Good","Spk_Bad ",2026-05-20,"Ch1-80 not collected" +"44","GCReW","GENX","2026","May","SCAM, SPPA, DISP","GENX","Ch9",80,"Ambient",3.75,5156.57427149964,"Within_Range","CV_Good","Spk_Bad ",2026-05-20,"Ch1-80 not collected" +"45","GCReW","GENX","2026","May","SCAM, SPPA, DISP","GENX","Ch11",80,"Ambient",5.25,6020.82444918266,"Within_Range","CV_Good","Spk_Bad ",2026-05-20,"Ch1-80 not collected" +"46","GCReW","GENX","2026","May","SCAM, SPPA, DISP","GENX","Ch5",5,"Ambient",2.25,71.5799573560768,"Within_Range","CV_Good","Spk_Bad ",2026-05-20,"Ch1-80 not collected" +"47","GCReW","GENX","2026","May","SCAM, SPPA, DISP","GENX","Ch12",5,"Ambient",6,45.1975835110163,"Within_Range","CV_Good"," Std3Chk_Bad, Std5Chk_Bad Intercept_Bad",2026-05-20,"Ch1-80 not collected" diff --git a/GENX (WIP)/Porewater/Sulfide/2026/Processed Data/SMARTX_H2S_QAQC_2025.csv b/GENX (WIP)/Porewater/Sulfide/2026/Processed Data/SMARTX_H2S_QAQC_2026.csv similarity index 96% rename from GENX (WIP)/Porewater/Sulfide/2026/Processed Data/SMARTX_H2S_QAQC_2025.csv rename to GENX (WIP)/Porewater/Sulfide/2026/Processed Data/SMARTX_H2S_QAQC_2026.csv index ee9884f..2879c83 100644 --- a/GENX (WIP)/Porewater/Sulfide/2026/Processed Data/SMARTX_H2S_QAQC_2025.csv +++ b/GENX (WIP)/Porewater/Sulfide/2026/Processed Data/SMARTX_H2S_QAQC_2026.csv @@ -254,13 +254,9 @@ "253","Plate7","H2S",0.9867,0.0098,0.1055,2025-09-22,"Past Runs" "254","Plate8","H2S",0.9935,0.0119,0.0702,2025-09-22,"Past Runs" "255","Plate9","H2S",0.9912,0.0109,0.1007,2025-09-22,"Past Runs" -"256","Plate1","H2S",0.9907,0.0124,0.0915,2025-06-02,"Current Runs" -"257","Plate2","H2S",0.9847,0.012,0.1032,2025-06-02,"Current Runs" -"258","Plate3","H2S",0.9905,0.0127,0.088,2025-06-02,"Current Runs" -"259","Plate4","H2S",0.9902,0.0111,0.0995,2025-06-03,"Current Runs" -"260","Plate5","H2S",0.9917,0.0122,0.0776,2025-06-03,"Current Runs" -"261","Plate6","H2S",0.99,0.0116,0.0878,2025-06-03,"Current Runs" -"262","Plate7","H2S",0.9919,0.0105,0.0895,2025-06-03,"Current Runs" -"263","Plate8","H2S",0.9905,0.0128,0.0925,2025-06-03,"Current Runs" -"264","Plate9","H2S",0.9862,0.012,0.0928,2025-06-03,"Current Runs" -"265","Plate10","H2S",0.982,0.011,0.1035,2025-06-03,"Current Runs" +"256","Plate1","H2S",0.99,0.0113,0.1063,2026-05-19,"Current Runs" +"257","Plate2","H2S",0.9896,0.0111,0.0739,2026-05-19,"Current Runs" +"258","Plate3","H2S",0.9937,0.0132,0.0924,2026-05-19,"Current Runs" +"259","Plate4","H2S",0.9726,0.0103,0.1306,2026-05-20,"Current Runs" +"260","rrPlate1","H2S",0.9866,0.0128,0.1203,2026-06-01,"Current Runs" +"261","rrPlate2","H2S",0.9922,0.0115,0.0987,2026-06-01,"Current Runs" diff --git a/GENX (WIP)/Porewater/Sulfide/2026/Raw Data/20260520_GENX_H2S_Plate4.csv b/GENX (WIP)/Porewater/Sulfide/2026/Raw Data/20260520_GENX_H2S_Plate4.csv new file mode 100644 index 0000000..6f83e51 --- /dev/null +++ b/GENX (WIP)/Porewater/Sulfide/2026/Raw Data/20260520_GENX_H2S_Plate4.csv @@ -0,0 +1,29 @@ +,1,2,3,4,5,6,7,8,9,10,11,12 +A,0.062,0.066,0.066,0.52,0.562,0.519,0.5,0.469,0.451,0.537,0.608,0.599 +B,0.175,0.128,0.143,0.586,0.451,0.513,0.068,0.06,0.064,0.662,0.619,0.593 +C,0.288,0.306,0.27,0.659,0.555,0.594,0.44,0.424,0.423,0.044,0.046,0.046 +D,0.458,0.456,0.448,0.545,0.574,0.592,0.526,0.488,0.5,0.51,0.538,0.579 +E,0.774,0.855,0.693,0.104,0.112,0.105,0.21,0.222,0.228,0.5,0.552,0.489 +F,1.366,1.191,1.078,0.314,0.294,0.297,0.289,0.254,0.265,0.064,0.062,0.061 +G,1.493,1.372,1.433,0.429,0.508,0.475,0.499,0.486,0.436,0.625,0.54,0.598 +H,0.218,0.242,0.191,0.333,0.3,0.313,0.436,0.433,0.483,0.926,0.802,0.839 +,,,,,,,,,,,, +,1,2,3,4,5,6,7,8,9,10,11,12 +A,Std 0,Std 0,Std 0,,,,,,,,, +B,Std 1,Std 1,Std 1,,,,ChkStd 0,ChkStd 0,ChkStd 0,Ch12-5,Ch12-5,Ch12-5 +C,Std 2,Std 2,Std 2,,,,,,,,, +D,Std 3,Std 3,Std 3,,,,ChkStd 3,ChkStd 3,ChkStd 3,,, +E,Std 4,Std 4,Std 4,,,,,,,,, +F,Std 5,Std 5,Std 5,,,,,,,ChkStd 0,ChkStd 0,ChkStd 0 +G,MC: 10ppt S5,MC: 10ppt S5,MC: 10ppt S5,,,,,,,,, +H,,,,,,,,,,ChkStd 4,ChkStd 4,ChkStd 4 +,,,,,,,,,,,, +,1,2,3,4,5,6,7,8,9,10,11,12 +A,1,1,1,,,,,,,,, +B,1,1,1,,,,1,1,1,1,1,1 +C,1,1,1,,,,,,,,, +D,1,1,1,,,,1,1,1,,, +E,1,1,1,,,,,,,,, +F,1,1,1,,,,,,,1,1,1 +G,1,1,1,,,,,,,,, +H,,,,,,,,,,1,1,1 diff --git a/GENX (WIP)/Porewater/Sulfide/2026/Raw Data/20260601_GENX_H2S_Rerun_Plate1.csv b/GENX (WIP)/Porewater/Sulfide/2026/Raw Data/20260601_GENX_H2S_Rerun_Plate1.csv new file mode 100644 index 0000000..ee5a8ab --- /dev/null +++ b/GENX (WIP)/Porewater/Sulfide/2026/Raw Data/20260601_GENX_H2S_Rerun_Plate1.csv @@ -0,0 +1,29 @@ +,1,2,3,4,5,6,7,8,9,10,11,12 +A,0.065,0.065,0.065,2.093,1.895,1.898,0.951,0.861,0.858,1.112,1.131,1.071 +B,0.131,0.14,0.179,0.691,0.822,0.845,0.066,0.065,0.062,0.647,0.718,0.614 +C,0.283,0.25,0.279,0.516,0.528,0.539,0.884,1.008,0.964,0.471,0.464,0.488 +D,0.483,0.506,0.444,0.181,0.181,0.188,0.457,0.483,0.462,1.431,1.6,1.491 +E,0.808,0.833,0.819,0.178,0.193,0.192,1.36,1.432,1.228,1.257,1.549,1.603 +F,1.401,1.397,1.294,0.412,0.507,0.502,1.695,1.816,1.775,0.064,0.062,0.068 +G,1.352,1.275,1.408,0.636,0.661,0.755,2.503,2.576,2.93,2.175,1.988,2.104 +H,1.219,1.282,1.284,0.624,0.616,0.529,2.227,1.986,1.706,0.777,0.814,0.785 +,,,,,,,,,,,, +,1,2,3,4,5,6,7,8,9,10,11,12 +A,Std 0,Std 0,Std 0,Ch11-5,Ch11-5,Ch11-5,P3-40,P3-40,P3-40,462-10,462-10,462-10 +B,Std 1,Std 1,Std 1,Ch4-80,Ch4-80,Ch4-80,ChkStd 0,ChkStd 0,ChkStd 0,442-120,442-120,442-120 +C,Std 2,Std 2,Std 2,Ch4-40,Ch4-40,Ch4-40,P3-40 Dup,P3-40 Dup,P3-40 Dup,321-20,321-20,321-20 +D,Std 3,Std 3,Std 3,Ch8-5,Ch8-5,Ch8-5,ChkStd 3,ChkStd 3,ChkStd 3, Ch2-5 Spike, Ch2-5 Spike, Ch2-5 Spike +E,Std 4,Std 4,Std 4,L18-20,L18-20,L18-20,P4-20,P4-20,P4-20, P4-20 Spike, P4-20 Spike, P4-20 Spike +F,Std 5,Std 5,Std 5,L11-40,L11-40,L11-40,P8-20,P8-20,P8-20,ChkStd 0,ChkStd 0,ChkStd 0 +G,MC: 10ppt S5,MC: 10ppt S5,MC: 10ppt S5,L13-40,L13-40,L13-40,331-10,331-10,331-10,461-10 Dup,461-10 Dup,461-10 Dup +H,Ch2-5,Ch2-5,Ch2-5,L16-80,L16-80,L16-80,461-10,461-10,461-10,ChkStd 4,ChkStd 4,ChkStd 4 +,,,,,,,,,,,, +,1,2,3,4,5,6,7,8,9,10,11,12 +A,1,1,1,1,1,1,1,1,1,1,1,1 +B,1,1,1,100,100,100,1,1,1,100,100,100 +C,1,1,1,100,100,100,1,1,1,100,100,100 +D,1,1,1,50,50,50,1,1,1,1,1,1 +E,1,1,1,1,1,1,1,1,1,1,1,1 +F,1,1,1,50,50,50,1,1,1,1,1,1 +G,1,1,1,50,50,50,1,1,1,100,100,100 +H,1,1,1,50,50,50,1,1,1,1,1,1 diff --git a/GENX (WIP)/Porewater/Sulfide/2026/Raw Data/20260601_GENX_H2S_Rerun_Plate2.csv b/GENX (WIP)/Porewater/Sulfide/2026/Raw Data/20260601_GENX_H2S_Rerun_Plate2.csv new file mode 100644 index 0000000..850274b --- /dev/null +++ b/GENX (WIP)/Porewater/Sulfide/2026/Raw Data/20260601_GENX_H2S_Rerun_Plate2.csv @@ -0,0 +1,29 @@ +,1,2,3,4,5,6,7,8,9,10,11,12 +A,0.066,0.065,0.061,0.393,0.431,0.415,0.421,0.494,0.473,0.045,0.045,0.046 +B,0.143,0.14,0.148,0.43,0.554,0.509,0.067,0.067,0.069,0.044,0.044,0.044 +C,0.261,0.255,0.237,0.497,0.476,0.565,0.488,0.511,0.525,0.044,0.044,0.046 +D,0.377,0.446,0.478,0.225,0.237,0.234,0.452,0.449,0.408,0.441,0.487,0.476 +E,0.804,0.814,0.861,0.511,0.482,0.516,0.262,0.224,0.241,0.482,0.493,0.548 +F,1.264,1.222,1.207,0.223,0.242,0.225,0.044,0.044,0.044,0.064,0.062,0.064 +G,1.261,1.319,1.343,0.169,0.143,0.14,0.044,0.045,0.044,0.044,0.044,0.044 +H,0.171,0.179,0.192,0.247,0.209,0.201,0.045,0.045,0.046,0.764,0.812,0.784 +,,,,,,,,,,,, +,1,2,3,4,5,6,7,8,9,10,11,12 +A,Std 0,Std 0,Std 0,323-20,323-20,323-20,331-10,331-10,331-10,,, +B,Std 1,Std 1,Std 1,323-80,323-80,323-80,ChkStd 0,ChkStd 0,ChkStd 0,,, +C,Std 2,Std 2,Std 2,613-80,613-80,613-80, 331-10 Dup, 331-10 Dup, 331-10 Dup,,, +D,Std 3,Std 3,Std 3,633-10,633-10,633-10,ChkStd 3,ChkStd 3,ChkStd 3,323-10 Spike,323-10 Spike,323-10 Spike +E,Std 4,Std 4,Std 4,633-40,633-40,633-40,461-10,461-10,461-10,461-10 Spike,461-10 Spike,461-10 Spike +F,Std 5,Std 5,Std 5,Ch11-5,Ch11-5,Ch11-5,,,,ChkStd 0,ChkStd 0,ChkStd 0 +G,MC: 10ppt S5,MC: 10ppt S5,MC: 10ppt S5,P4-20,P4-20,P4-20,,,,,, +H,323-10,323-10,323-10,P8-20,P8-20,P8-20,,,,ChkStd 4,ChkStd 4,ChkStd 4 +,,,,,,,,,,,, +,1,2,3,4,5,6,7,8,9,10,11,12 +A,1,1,1,100,100,100,25,25,25,,, +B,1,1,1,100,100,100,1,1,1,,, +C,1,1,1,100,100,100,25,25,25,,, +D,1,1,1,100,100,100,1,1,1,100,100,100 +E,1,1,1,100,100,100,25,25,25,25,25,25 +F,1,1,1,25,25,25,,,,1,1,1 +G,1,1,1,25,25,25,,,,,, +H,100,100,100,25,25,25,,,,1,1,1 diff --git a/GENX (WIP)/Porewater/Sulfide/2026/Raw Data/20260601_GENX_H2S_STD.csv b/GENX (WIP)/Porewater/Sulfide/2026/Raw Data/20260601_GENX_H2S_STD.csv new file mode 100644 index 0000000..8c5969f --- /dev/null +++ b/GENX (WIP)/Porewater/Sulfide/2026/Raw Data/20260601_GENX_H2S_STD.csv @@ -0,0 +1,29 @@ +,1,2,3,4,5,6,7,8,9,10,11,12 +A,0.063,0.063,0.072,0.047,0.046,0.047,0.045,0.046,0.046,0.045,0.044,0.045 +B,0.154,0.13,0.124,0.044,0.044,0.045,0.049,0.044,0.045,0.044,0.044,0.044 +C,0.261,0.251,0.228,0.044,0.045,0.045,0.044,0.044,0.044,0.045,0.045,0.046 +D,0.422,0.52,0.469,0.044,0.045,0.045,0.045,0.044,0.044,0.044,0.044,0.045 +E,0.671,0.631,0.672,0.044,0.044,0.045,0.045,0.044,0.044,0.047,0.045,0.045 +F,1.152,1.331,1.309,0.044,0.044,0.044,0.044,0.044,0.044,0.044,0.045,0.044 +G,1.283,1.178,1.293,0.044,0.045,0.045,0.045,0.045,0.044,0.044,0.044,0.044 +H,0.046,0.046,0.045,0.045,0.048,0.044,0.044,0.046,0.047,0.044,0.045,0.045 +,,,,,,,,,,,, +,1,2,3,4,5,6,7,8,9,10,11,12 +A,Std 0,Std 0,Std 0,,,,,,,,, +B,Std 1,Std 1,Std 1,,,,,,,,, +C,Std 2,Std 2,Std 2,,,,,,,,, +D,Std 3,Std 3,Std 3,,,,,,,,, +E,Std 4,Std 4,Std 4,,,,,,,,, +F,Std 5,Std 5,Std 5,,,,,,,,, +G,MC: 10ppt S5,MC: 10ppt S5,MC: 10ppt S5,,,,,,,,, +H,,,,,,,,,,,, +,,,,,,,,,,,, +,1,2,3,4,5,6,7,8,9,10,11,12 +A,1,1,1,,,,,,,,, +B,1,1,1,,,,,,,,, +C,1,1,1,,,,,,,,, +D,1,1,1,,,,,,,,, +E,1,1,1,,,,,,,,, +F,1,1,1,,,,,,,,, +G,1,1,1,,,,,,,,, +H,,,,,,,,,,,, diff --git a/GENX (WIP)/Porewater/Sulfide/2026/Ready for Review/GCReW_GENX_Porewater_H2S_202605.pdf b/GENX (WIP)/Porewater/Sulfide/2026/Ready for Review/GCReW_GENX_Porewater_H2S_202605.pdf new file mode 100644 index 0000000..01dbeb4 Binary files /dev/null and b/GENX (WIP)/Porewater/Sulfide/2026/Ready for Review/GCReW_GENX_Porewater_H2S_202605.pdf differ diff --git a/SMARTX/Porewater/Sulfide/2026/Datasheets/2026May_H2S_Datasheets.pdf b/SMARTX/Porewater/Sulfide/2026/Datasheets/2026May_H2S_Datasheets.pdf new file mode 100644 index 0000000..6823fec Binary files /dev/null and b/SMARTX/Porewater/Sulfide/2026/Datasheets/2026May_H2S_Datasheets.pdf differ diff --git a/SMARTX/Porewater/Sulfide/2026/Datasheets/2026May_H2S_Datasheets.xlsx b/SMARTX/Porewater/Sulfide/2026/Datasheets/2026May_H2S_Datasheets.xlsx new file mode 100644 index 0000000..5adc989 Binary files /dev/null and b/SMARTX/Porewater/Sulfide/2026/Datasheets/2026May_H2S_Datasheets.xlsx differ diff --git a/SMARTX/Porewater/Sulfide/2026/GCReW_SMARTX_Porewater_H2S_202605.Rmd b/SMARTX/Porewater/Sulfide/2026/GCReW_SMARTX_Porewater_H2S_202605.Rmd new file mode 100644 index 0000000..1095750 --- /dev/null +++ b/SMARTX/Porewater/Sulfide/2026/GCReW_SMARTX_Porewater_H2S_202605.Rmd @@ -0,0 +1,1425 @@ +--- +title: "SMARTX: Porewater Sulfide" +author: "May 2025 Samples" +date: "`r Sys.Date()`" +output: + pdf_document: + toc: false + number_sections: false +geometry: left=2cm,right=2cm,top=1cm,bottom=2cm +--- + + +## Code Set up +```{r setup, include=FALSE} + +library(dplyr) +library(broom) +library(ggplot2) +library(ggpubr) +library(stringr) +library(purrr) +library(tidyverse) +library(here) +library(data.table) +library(matrixStats) +library(gridExtra) +library(grid) +library(plater) +library(raster) +library(knitr) +library(readxl) +library(ggrepel) + +``` + +## run information +```{r Information to be changed} + +##Before or After Reruns (YES or NO) +After_Reruns = "YES" +#If NO will not write final data file + #And Will Write a Rerun File + +###things that need to be changed +sample_month = "May" +sample_year = "2026" +Run_Date = as.Date("05/19/2026", format = "%m/%d/%Y") +Run_by = "Melanie Giessner"#Instrument user +Script_run_by ="Melanie Giessner"#Code user + +Run_notes=""#any notes from run + +#Import Plate Data + +plates<- c("Plate1","Plate2","Plate3","Plate4","Plate5","Plate6","Plate7", "Plate8", "Plate9","rrPlate1","rrPlate2") + + +folder_path_rawdata <- paste0("Raw Data") +Raw_plates <- list.files(path = folder_path_rawdata, full.names = TRUE,pattern = "Plate") +head(Raw_plates) + + +#Import Run Date for Each Plate for Std curve qaqc +Run_dates <- tibble( + Plate = plates, + Run_Date = c("05/19/26","05/19/26","05/20/26","05/20/26","05/20/26","05/20/26","05/21/26","05/21/26", "05/21/2026","06/01/26","06/01/26") + ) + + Run_dates <- Run_dates %>% mutate(Run_Date = as.Date(Run_Date, tryFormats = c("%Y-%m-%d", "%m/%d/%y", "%m/%d/%Y"))) + + +# Define the file path for QAQC log file - NO Need to change just check year +log_path <- "Processed Data/SMARTX_H2S_QAQC_2026.csv" + +# Define final path for data be sure to change year and month and run number +final_path <- "Processed Data/GCReW_SMARTX_Porewater_H2S_202605.csv" +rerun_path <- "Processed Data/GCReW_SMARTX_Porewater_H2S_202605_reruns.csv" + + +``` + +```{r Set Up Code - constants and QAQC cutoffs, include=FALSE} + +#Flag cutoffs + r2_cutoff = 0.985 #this is the level below which we want to rerun or consider a curve + cv_flag_stds = 10 #this is the maximum cv allowed for standards + p_value_chkstds = 0.05 #the p-value for the t-test between check standards must be greater than this + p_value_MC = 0.05 #the p-value for the t-test between matrix checks and top std must be greater than this + cv_flag_sample = 10 #this is the maximum cv allowed for samples + dups_perc_diff = 15.5 #this is the maximum percent difference allowed between duplicates + high_recovery_cutoff = 120 #this is the maximum percent recovery of SO4 allowed in spiked samples + low_recovery_cutoff = 80 #this is the minimum percent recovery of SO4 allowed in spiked samples + +#Standard concentrations - Update if running different standard curve: +# standard units are in uM + standards <- tibble( + IDs = c("Std 0", "Std 1", "Std 2", "Std 3", "Std 4", "Std 5"), + Conc = c(0, 5.0, 12.5, 25.0, 50.0, 100.0) + ) #uM + + chk_standards <- tibble( + IDs = c("ChkStd 0", "ChkStd 3", "ChkStd 4"), + Conc = c(0, 25.0, 50.0) + ) #uM + + mtx_standards <- tibble( + IDs = c("MC: 10ppt S5"), + Conc = c(100) + ) #uM + +#Spike concentration calc + #spike for these samples was 50 uL of the 100uM standard + Con1 <- 1000000 #conversion factor value for spike volumes (uL -> L) + spk_std <- 100 # uM S2- standard used + spkvol <- 50 # uL volume of spike added + spk_Conc <- spk_std*(spkvol/Con1) # umoles of S2- added to each spiked sample + sample_vol <- 250 # the sample volume without the spike is 250 uL + samp_vol_a <- 300 # the sample volume + +#Top standard Concentration- Update if running different standard curve: + Top_STD = 100 + + +#Metadata file path +Raw_Metadata = here(".." , "GCReW", "GCReW_Project_Treatment_Metadata.csv") + +#Significant Digits +sigdigs <- 3 + +``` + + +##Read in metadata and create similar sample IDs for matching to samples +```{r pull in metadata for later, include=FALSE} + +#read in metadata + +raw_metadata <- read.csv(Raw_Metadata) +#clean up columns in metadata file: +#Pull out only SMARTX Rows +#Create a Sample_Name column to match the SEAL +metadata <- raw_metadata %>% + filter(grepl("SMARTX", Project, ignore.case = TRUE)) %>% + mutate(Sample_Name = Sample.ID) %>% + mutate(Month = sample_month) %>% + mutate(Year = sample_year) %>% + rename( + Sample_ID = Sample.ID, + ) %>% + dplyr::select(-N_Treatment) + +#Bring in the collection date and any field notes if relevant +#collection_metadata <- read.csv(Collection_Dates) +#then we will merge the collection date for SMARTX based on the project and the chambers + +``` + + +##Read in data +```{r read in plates,echo=FALSE,include=FALSE} + +#read in the csv files +dat<-read_plates( + files = Raw_plates,#list of all file paths + plate_names = plates , #list of plate names + well_ids_column = "Wells", # name to give column of well IDs (optional) + sep = "," # separator used in the csv file (optional) +) %>% + rename("Abs"=values, + "IDs"=values.2, + "Dilution"=values.3) +head(dat) + +``` + +##Remove High CV Stds +```{r, echo=FALSE} + +#filter for STDs +H2S_stds_raw <- dat %>% subset(IDs %like% "Std" | IDs %like% "Chk" | IDs %like% "MC") + +#Add in STD values +H2S_stds <- left_join(H2S_stds_raw, standards, by = "IDs") + +#Calculate CVs and add flags +H2S_STD_cv <- H2S_stds %>% group_by(Plate, IDs) %>% mutate(CV = cv(Abs)) %>% mutate(CV_Flag = ifelse(CV >= cv_flag_stds, "CV_High", "CV_Good")) %>% ungroup() + +#calculate new cv getting best cv from points if cv was high +H2S_STD_cv_new <- H2S_STD_cv %>% group_by(Plate, IDs) %>% + mutate(CV_New = map_dbl(row_number(), ~cv(Abs[-.x]))) %>% #Calculate CVs without 1 point + mutate(Removed = ifelse( #Choose Lowest CV if CV is high + CV_Flag == "CV_High", + ifelse( + CV_New == min(CV_New), + "RMVD", + "KEPT"), "CV_Good"), +CV2 = ifelse(CV_Flag == "CV_High", min(CV_New), CV), +Abs_rm = ifelse(Removed == "RMVD", NA, Abs)) %>% + mutate(Mean_Abs2 = mean(Abs_rm, na.rm = TRUE)) %>% + mutate(CV_Flag2 = ifelse(CV2 >= cv_flag_stds, "CV_High", "CV_Good")) %>% ungroup() + +#organize data +H2S_STD_CV_fin <- H2S_STD_cv_new %>% dplyr::select(Plate, + Wells, + Abs, + Removed, + IDs, + Dilution, + Conc, + Mean_Abs2, + CV2, + CV_Flag2) %>% + mutate(Mean_Abs = Mean_Abs2, CV_Flag = CV_Flag2, CV = CV2) %>% + dplyr::select(Plate, + Wells, Abs, + Removed, + IDs, + Dilution, + Conc, + Mean_Abs, + CV, + CV_Flag) + + +``` + + +##Check R2 & Remove Standards if Necessary +```{r, echo=FALSE} +split_data <- H2S_STD_CV_fin %>% filter(IDs %like% "Std") %>% filter(!IDs %like% "Chk") %>% dplyr::select(Plate, IDs, Conc, Mean_Abs, Abs, Removed, CV_Flag) %>% filter(!Removed == "RMVD") %>% #Split Data by Plate + distinct() %>% + group_by(Plate) %>% + group_split() + +#run regression and get coefficients by Run +Slope_H2S_raw_list <- map(split_data, ~ .x %>% mutate(Curve = "H2S", + R2 = summary(lm(Abs ~ Conc, data = .))$adj.r.squared , + Slope = coef(lm(Abs ~ Conc, data = .))[2], + Intercept = coef(lm(Abs ~ Conc, data = .))[1])) + + + Slope_H2S_raw <- bind_rows(Slope_H2S_raw_list) + + #check R2 and flag + Slope_H2S_Std_Crvs <- Slope_H2S_raw %>% dplyr::select(Plate, Curve, R2, Slope, Intercept) %>% distinct() %>% mutate(R2_Flag = ifelse(R2 >= r2_cutoff, "R2_Good", "R2_Bad")) + + #join standard curve CVs and regression values + R2_Check_Raw <- left_join(Slope_H2S_Std_Crvs, H2S_STD_CV_fin, by = "Plate") + + R2_Check <- R2_Check_Raw %>% + dplyr::select(Plate, + IDs, + Abs, + Removed, + Mean_Abs, + Conc, + R2, + Slope, + Intercept, + CV_Flag, + CV, + R2_Flag) %>% filter(IDs %like% "Std") %>% filter(!IDs %like% "Chk") %>% + distinct() + + #calculate concentrations from standard curve and separate removable points + + R2_Split <- R2_Check %>% mutate(RMVBL = ifelse(IDs %in% c("Std 0", "Std 1", "Std 5"), "No", "Yes")) %>% group_by(Plate) %>% dplyr::select(-Abs, -Removed) %>% distinct() %>% group_split() + + R2_New <- map( + R2_Split, + ~ .x %>% mutate( + Curve = "H2S", + R2_New = map_dbl(row_number(), ~ + summary(lm( + Mean_Abs[-.x] ~ Conc[-.x], data = pick(Mean_Abs, Conc) + ))$adj.r.squared) , + Slope_New = map_dbl(row_number(), ~ + coef(lm( + Mean_Abs[-.x] ~ Conc[-.x], data = pick(Mean_Abs, Conc) + ))[2]) , + Intercept_New = map_dbl(row_number(), ~ + coef(lm( + Mean_Abs[-.x] ~ Conc[-.x], data = pick(Mean_Abs, Conc) + ))[1]) + ) + ) %>% bind_rows() + + R2_Check_RMVBL <- R2_New %>% mutate(R2_New = round(R2_New, digits = 8), + CV = round(CV, digits = 8)) %>% group_by(Plate) %>% mutate(R2_New = ifelse(IDs %in% c("Std 0", "Std 1", "Std 5"), NA, R2_New)) %>% mutate(R2_RMV = ifelse( + R2_Flag == "R2_Bad", + ifelse(R2_New == max(R2_New, na.rm = TRUE), "RMVD", "KEPT"), + "R2_Good" + )) %>% mutate(R2_RMV_CV = ifelse( + R2_RMV == "R2_Good", + ifelse(CV_Flag == "CV_High", ifelse(CV == max(CV), "RMVD", "KEPT"), "KEPT"), + R2_RMV + )) %>% mutate(R2_RMVD = ifelse(is.na(R2_RMV_CV), "KEPT", R2_RMV_CV)) %>% dplyr::select(-R2_RMV, -R2_RMV_CV) + +R2_Removed_forPair <- R2_Check_RMVBL %>% dplyr::select(Plate, IDs, R2_RMVD) %>% distinct() + +H2S_STDs_Pair <- H2S_STD_CV_fin %>% filter(IDs %like% "Std") %>% filter(!IDs %like% "Chk") %>% dplyr::select(Plate, IDs, Conc, Mean_Abs, Abs, Removed, CV_Flag) %>% filter(!Removed == "RMVD") %>% distinct() %>% left_join(R2_Removed_forPair) + + + R2_Check_fin <- H2S_STDs_Pair %>% mutate(STD_ABS_rmv = ifelse(R2_RMVD == "RMVD", NA, Abs)) %>% group_by(Plate) %>% mutate(Points = ifelse("RMVD" %in% R2_RMVD, "Point_Removed", "ALL_KEPT")) %>% dplyr::select(Plate, IDs, Conc, STD_ABS_rmv, CV_Flag, Points) %>% ungroup() %>% na.omit() + + #separate plates for new regression + split_data_rmv <- R2_Check_fin %>% + distinct() %>% + group_by(Plate) %>% + group_split() + + #get new standard curve values + Slope_H2S_raw_list_rm <- map(split_data_rmv, ~ .x %>% mutate(Curve = "H2S", + R2 = summary(lm(STD_ABS_rmv ~ Conc, data = .))$adj.r.squared , + Slope = coef(lm(STD_ABS_rmv ~ Conc, data = .))[2], + Intercept = coef(lm(STD_ABS_rmv ~ Conc, data = .))[1])) + + Slope_H2S_raw_rm <- bind_rows(Slope_H2S_raw_list_rm) + + Slope_H2S_Std_Crvs_rm <- Slope_H2S_raw_rm %>% dplyr::select(Plate, Curve, R2, Slope, Intercept, CV_Flag, Points) %>% distinct() %>% mutate(R2_Flag = ifelse(R2 >= r2_cutoff, "R2_Good", "R2_Bad")) + + +``` + + +## Plot Standard Curves +```{r Plot all Standard Curves together, echo=FALSE} +##this is to see if there are any stds or plates that look off + +#Plot Std Crvs by plate +H2S_Curve <- ggplot(Slope_H2S_raw_rm, aes(STD_ABS_rmv, Conc, color = Plate, linetype = Points)) + geom_point(size = 3) + + geom_smooth(method = "lm", formula = "y ~ x", se = FALSE) + labs(title = "H2S Standard Curves", x = "Absorbance", y = "Concentration (uM)") + + theme_classic() +H2S_Curve + +#Add dates to plate and format data +STD_run_date <- left_join(Run_dates, Slope_H2S_Std_Crvs_rm, by = join_by(Plate)) +new_log_stds <- STD_run_date %>% dplyr::select(Plate, + Curve, + R2, + Slope, + Intercept, + Run_Date) %>% mutate(R2 = round(R2, digits = 4), Slope = round(Slope, digits = 4), Intercept = round(Intercept, digits = 4), ) %>% mutate(Run = "Current Runs") + + +#read in log file and format +log <- read.csv(log_path) +log_2 <- log %>% mutate(Run_Date = as.Date(as.character(Run_Date), tryFormats = c("%Y-%m-%d", "%m/%d/%y", "%m/%d/%Y")), Run = "Past Runs") +log_3 <- log_2[, -c(1)] +log_4 <- rbind(log_3, new_log_stds) + +unique_log <- log_4 %>% distinct(Plate,Curve,R2,Slope,Intercept,.keep_all = TRUE) %>% mutate(Run_Date = as.Date(as.character(Run_Date), tryFormats = c("%Y-%m-%d", "%m/%d/%y"))) + +#Calculate Mean and SD and calculate 2SD range for slope and intercept +mean_slope <- mean(unique_log$Slope, na.rm = TRUE) +sd_slope <- sd(unique_log$Slope, na.rm = TRUE) + +hi_2sd_slope <- mean_slope + 2*sd_slope + +lo_2sd_slope <- mean_slope - 2*sd_slope + +mean_int <- mean(unique_log$Intercept, na.rm = TRUE) +sd_int <- sd(unique_log$Intercept, na.rm = TRUE) + +hi_2sd_int <- mean_int + 2*sd_int + +lo_2sd_int <- mean_int - 2*sd_int + +#Plot Slope log +Slopes_chk <- ggplot(unique_log, aes(x = Run_Date, y = Slope, col = Run)) + + ylim(0.0045,0.018) + + scale_color_manual(values = c("Past Runs" = "grey27", "Current Runs" = "cyan3")) + + geom_abline(intercept = mean_slope - 2*sd_slope, slope = 0, linetype = "dashed", linewidth = 1.5, col = "red" )+ + geom_abline(intercept = mean_slope + 2*sd_slope, slope = 0, linetype = "dashed", linewidth = 1.5, col = "red" )+ + geom_point(size = 2) + + theme_classic()+ + ggtitle("Slope Log") + +#Plot Intercept log +ints_chk <- ggplot(unique_log, aes(x = Run_Date, y = Intercept, col = Run)) + + ylim(0.03, 0.15) + + scale_color_manual(values = c("Past Runs" = "grey27", "Current Runs" = "cyan3")) + + geom_abline(intercept = mean_int - 2*sd_int, slope = 0, linetype = "dashed", linewidth = 1.5, col = "red" )+ + geom_abline(intercept = mean_int + 2*sd_int, slope = 0, linetype = "dashed", linewidth = 1.5, col = "red" )+ + geom_point(size = 2) + + theme_classic()+ + ggtitle("Intercept Log") + +ints_chk + +Slopes_chk + + + +#Get done of original runs +Date_1 <-as.Date(new_log_stds$Run_Date[which(new_log_stds$Plate == "Plate1")]) + +#Check if Std Crvs are Within range and see if dates are close enough for combination +stdcrv_tagged <- new_log_stds %>% mutate( + In_Range_Slope = ifelse( + Slope >= hi_2sd_slope | + Slope <= lo_2sd_slope, + "Out of Range", + "In Range" + ), + In_Range_Int = ifelse( + Intercept >= hi_2sd_int | + Intercept <= lo_2sd_int, + "Out of Range", + "In Range" + ) +) %>% mutate( + Slope = ifelse(In_Range_Slope == "Out of Range", NA, Slope), + Intercept = ifelse(In_Range_Int == "Out of Range", NA, Intercept) +) %>% mutate(Date_Diff = abs(difftime(Date_1, Run_Date, units = "days"))) %>% mutate(Date_Close = ifelse(Date_Diff <= 2, "Yes", "No")) %>% mutate(Slope_Flag = ifelse(is.na(Slope), "Slope_Bad" , "Slope_Good"), Int_Flag = ifelse(is.na(Intercept), "Intercept_Bad" , "Intercept_Good")) %>% mutate( + Slope = ifelse(is.na(Intercept) | R2 <= r2_cutoff, NA, Slope), + Intercept = ifelse(is.na(Slope)| R2 <= r2_cutoff, NA, Intercept), + Curve_RMVD = ifelse(is.na(Slope) | + is.na(Intercept) | R2 <= r2_cutoff , "RMVD", "KEPT") +) + +#Calculate Combo Std Crv +stdcrv_filtered <- stdcrv_tagged %>% filter(Date_Close == "Yes") +stdcrv_filtered_no <- stdcrv_tagged %>% filter(Date_Close == "No") +mean_slope_fin <- mean(stdcrv_filtered$Slope, na.rm = TRUE) +mean_slope_no <- mean(stdcrv_filtered_no$Slope, na.rm = TRUE) +mean_int_fin <- mean(stdcrv_filtered$Intercept, na.rm = TRUE) +mean_int_no <- mean(stdcrv_filtered_no$Intercept, na.rm = TRUE) + +#Attach Slope and Intercept to Plates +Std_crv_calc <- stdcrv_tagged %>% mutate(Slope_Calc = ifelse(Date_Close == "Yes", mean_slope_fin, mean_slope_no), Int_Calc = ifelse(Date_Close == "Yes", mean_int_fin, mean_int_no)) %>% dplyr::select(Plate, Slope_Calc, Int_Calc, Curve_RMVD, Slope_Flag, Int_Flag) %>% as.data.frame() + +std_curves <- Std_crv_calc %>% dplyr::select(Plate, Curve_RMVD) %>% filter(Curve_RMVD != "RMVD") %>% distinct() + +Curve_Flags <- Std_crv_calc %>% dplyr::select(Plate, Slope_Flag, Int_Flag) %>% distinct() + +Curve_Flags_forJoin <- Curve_Flags %>% mutate(Slope_Flag = ifelse(Slope_Flag %like% "Good", "", Slope_Flag), Int_Flag = ifelse(Int_Flag %like% "Good", "", Int_Flag)) + + +Std_crv_calc <-Std_crv_calc %>% distinct() +``` + +## Return Flags For Standard Curve +```{r, echo=FALSE} + +STD_CRV_flags <- full_join(Slope_H2S_Std_Crvs_rm, Run_dates, by = join_by(Plate)) + +STD_CRV_flags_table1 <- STD_CRV_flags %>% dplyr::select(Plate, R2_Flag, CV_Flag) + +STD_CRV_flags_table2 <- Std_crv_calc %>% dplyr::select(Plate, Curve_RMVD) %>% mutate(Curve_RMVD = ifelse(Curve_RMVD == "RMVD", "REMOVED", Curve_RMVD)) + +knitr::kable(STD_CRV_flags_table1, format="markdown") + +knitr::kable(STD_CRV_flags_table2, format="markdown") + + +``` + +## Method Detection Limit +```{r, echo=FALSE} + +#get only lowest standard + STD_MDL_df <- H2S_STD_CV_fin %>% filter(IDs == "Std 1" + #, Removed != "RMVD" + ) %>% dplyr::select(Plate, Mean_Abs, IDs) %>% distinct() + + STD0_df <- H2S_STD_CV_fin %>% filter(IDs == "Std 0" + #, Removed != "RMVD" + ) %>% dplyr::select(Plate, Mean_Abs, IDs) %>% distinct() +#calculate the standard deviation of abs +stddev_mdl <- sd(STD_MDL_df$Mean_Abs) + +#Calculate Mean Std 0 +std0_mean <- mean(STD0_df$Mean_Abs) + +#calculate n +n <- length(STD_MDL_df$Mean_Abs) + +#Identify the proper Student's T for n-1 +StudentsT <-qt(.99,(n-1)) + +#Multiply Standard deviation by Student's T +STD_var <- (stddev_mdl*StudentsT) +MDL <- STD_var + std0_mean + +MDL_df <- as.data.frame(MDL) + +MDL_Plot <- ggplot() + + geom_bar(stat = 'identity', data = STD_MDL_df, aes(x = Plate, y = Mean_Abs, fill = IDs)) + + geom_bar(data = STD0_df, aes(x = Plate, y = Mean_Abs, fill = IDs), stat = 'identity') + + scale_fill_manual(name = "Standard:", values = c("Std 0" = "lightgreen", "Std 1" = "cornflowerblue")) + + geom_hline(yintercept = MDL, linetype = "dashed", linewidth = 1.5, color = "blue3") + + geom_label_repel(data = MDL_df, aes(x = 1.25, y = MDL + 0.015), label = paste0("MDL: ", signif(MDL, digits = sigdigs)), alpha = 0.7, color = "blue3") + + ggtitle(label = "H2S Minimum Detection Limit") + + labs(y = "Mean Absorbance") + + theme_classic() + +MDL_Plot +``` + +## Compare Check Standards to Standards +```{r, echo = FALSE} + +#subset datasets for comparison + +std0 <- subset(H2S_STD_CV_fin, IDs == "Std 0"& Plate %in% std_curves$Plate & !Removed == "RMVD") +std3 <- subset(H2S_STD_CV_fin, IDs == "Std 3"& Plate %in% std_curves$Plate & !Removed == "RMVD") +std4 <- subset(H2S_STD_CV_fin, IDs == "Std 4" & Plate %in% std_curves$Plate & !Removed == "RMVD") +std5 <- subset(H2S_STD_CV_fin, IDs == "Std 5" & Plate %in% std_curves$Plate & !Removed == "RMVD") + + +H2S_CHK_STD_CV_fin <- H2S_STD_CV_fin %>% filter(IDs %like% "ChkStd" | IDs %like% "ppt") +#Tag Check Standards and perform T Test +H2S_CHKs_a <- H2S_CHK_STD_CV_fin %>% + mutate(Std_ID = case_when( + IDs == "ChkStd 0" ~ paste0("Std 0"), + IDs == "ChkStd 3" ~ paste0("Std 3"), + IDs == "ChkStd 4" ~ paste0("Std 4"), + IDs %like% "S5" ~ paste0("Std 5") + ), + Chk_Abs = Abs, + Chk_Removed = Removed, + Chk_IDs = IDs, + Chk_Mean_Abs = Mean_Abs, + Chk_cv_flag = CV_Flag + ) %>% filter(!Chk_Removed == "RMVD") %>% + group_by(Std_ID,Plate) %>% + mutate( + Chk_pvalue = case_when( + Chk_IDs == "ChkStd 0" ~ t.test(std0$Abs, Chk_Abs,var.equal = T)$p.value[1], + Chk_IDs == "ChkStd 3" ~ t.test(std3$Abs, Chk_Abs,var.equal = T)$p.value[1], + Chk_IDs == "ChkStd 4" ~ t.test(std4$Abs, Chk_Abs,var.equal = T)$p.value[1], + Chk_IDs == "MC: 10ppt S5" ~ t.test(std5$Abs, Chk_Abs,var.equal = T)$p.value[1], + Chk_IDs == "MC: 20ppt S5" ~ t.test(std5$Abs, Chk_Abs,var.equal = T)$p.value[1] + ))%>% + ungroup() %>% + dplyr::select(Std_ID, Chk_IDs, Chk_pvalue, Chk_cv_flag, Chk_Mean_Abs, Plate) %>% distinct(.keep_all = TRUE) + +H2S_CHKs_1 <- H2S_CHKs_a %>% dplyr::select(-Chk_Mean_Abs) + +#Get Standard Values and set values for standards with no variance +H2S_STD_forCHK_a <- H2S_STD_CV_fin %>% filter(IDs %in% c("Std 0", "Std 3", "Std 4", "Std 5") ) %>% + mutate(Std_ID = IDs +) %>% filter(!Removed == "RMVD") %>% + dplyr::select(Plate, Std_ID, IDs, CV_Flag, Mean_Abs) %>% distinct(.keep_all = TRUE) + +H2S_STD_forCHK <- H2S_STD_forCHK_a %>% dplyr::select( -Mean_Abs) + +#join check standards with standards +Chk_Std_join <- full_join(H2S_CHKs_1, H2S_STD_forCHK, by = join_by(Std_ID, Plate)) + + +#flag data +Chk_Std_flags <- Chk_Std_join %>% mutate( + Chk_Flag_pv= ifelse( + Chk_pvalue > p_value_chkstds , + "Chk_Good", + "Chk_Bad" + ) + +) %>% mutate(CHK_Flag = paste0(gsub(" ", "", IDs), Chk_Flag_pv)) %>% + mutate(CHK_CV_Flag = paste0("Chk",gsub(" ", "", IDs), Chk_cv_flag)) + + #Organize Data for Plotting and Flagging +Chk_Flags <- Chk_Std_flags %>% group_by(Plate) %>% + mutate(Chk_Flag = ifelse(any(CHK_Flag %like% "Bad"), "Chk_Bad", "Chk_Good"), Chk_cv_flag = ifelse(any(CHK_CV_Flag %like% "High"), "Chk_CV_High", "Chk_CV_Good")) %>% + ungroup() %>% + mutate(CHK_CV_Flags = ifelse(CHK_CV_Flag %like% "High", paste0(gsub(" ", "", IDs), Chk_cv_flag), "Good")) %>% mutate(CHKs_Flag = ifelse(CHK_Flag %like% "Bad", CHK_Flag, "Good")) + +H2S_CHKs_plot <- H2S_CHKs_a %>% rename(IDs = Chk_IDs, Mean_Abs = Chk_Mean_Abs) %>% mutate(Type = "Check") %>% dplyr::select(-Chk_cv_flag,-Chk_pvalue) + +H2S_Std_chkplot <- H2S_STD_forCHK_a %>% dplyr::select(IDs, Mean_Abs, Std_ID, Plate) %>% mutate(Type = "Standard") + +Chk_flags_plot <- Chk_Flags %>% dplyr::select(Std_ID, Plate, CHKs_Flag, Chk_Flag_pv) %>% group_by(Std_ID,Plate) %>% distinct(.keep_all = TRUE) %>% mutate(Check_Flag = ifelse(Chk_Flag_pv %like% "Good", "Good", "Bad")) + +H2S_Chks_bind <- rbind(H2S_CHKs_plot, H2S_Std_chkplot) + +H2S_Chks_bind_1 <- left_join(H2S_Chks_bind, Chk_flags_plot, by = join_by(Std_ID,Plate)) + +H2S_Chks_plot_bind_a <- H2S_Chks_bind_1 %>% mutate(Plot_ID = ifelse(IDs %like% "Chk" | IDs %like% "MC", substr(IDs, 4, 8), IDs)) %>% mutate(Plot_ID = ifelse(Plot_ID %like% "10pp", "Matrix: 10ppt", Plot_ID )) +H2S_Chks_plot_bind <-H2S_Chks_plot_bind_a %>% filter(str_detect(Type, "Check")) %>% mutate(Plot_ID =as.factor(Plot_ID)) + +Check_Val <- H2S_Chks_plot_bind_a %>% filter(!str_detect(Plot_ID, "Check")) %>% group_by(Plot_ID) %>% mutate(Z = mean(Mean_Abs)) %>% dplyr::select(Plot_ID, Z) %>% distinct(.keep_all = TRUE) %>% filter(!Plot_ID %like% "10pp") %>% mutate(Plot_ID = ifelse(Plot_ID %like% "Std 5", "Matrix: 10ppt", Plot_ID )) %>% mutate(Plot_ID = as.factor(Plot_ID)) + +#Plot Check Standards +H2S_chk_plot <- ggplot(data = H2S_Chks_plot_bind, aes(x = Plate, y = Mean_Abs)) + + geom_bar(stat = 'identity', + position = position_dodge2(preserve = "single"), linewidth = 0.75, aes(fill = Check_Flag)) + + geom_hline(data = Check_Val, aes(yintercept = Z), linetype = "dashed", linewidth = 1, color = "darkblue") + + facet_wrap(.~Plot_ID) + + ylim(0, max(H2S_Chks_plot_bind$Mean_Abs) + 0.2) + + geom_label_repel(data = Check_Val, aes( x = "Plate1", y = Z + 0.25), label = "Mean Target Arbsorbance", alpha = 0.7, color = "darkblue") + + scale_fill_manual(values = c("Good" = "darkgreen", "Bad" = "darkred")) + + theme_classic() + labs(x = " ", y = "Absorbance", title = + "Check Stds: H2S with Confidence Interval") + + theme(legend.position = "bottom", axis.text.x = element_text( + angle = 90, + vjust = 0.5, + hjust = 1)) + + +H2S_chk_plot + +``` + +## Display Any Check Flags +```{r, echo=FALSE} +Chk_Flag_1 <- Chk_Flags %>% dplyr::select(Plate, CHKs_Flag) %>% filter(CHKs_Flag != "Good") + +CHK_CV_Flag_1 <- Chk_Flags %>% dplyr::select(Plate, CHK_CV_Flags) %>% filter(CHK_CV_Flags != "Good") + +knitr::kable(Chk_Flag_1, format="markdown") + +knitr::kable(CHK_CV_Flag_1, format="markdown") + +``` + + +##Calculate Sulfide Concentrations & Add Concentration Flags +```{r Calculate Sulfide Concentrations,echo=FALSE,include=FALSE} + +High_Std <- H2S_STD_CV_fin %>% filter(IDs == "Std 5") %>% mutate(Mean_Abs = round(Mean_Abs, digits = 4)) %>% ungroup() %>% dplyr::select(Plate, Mean_Abs) %>% distinct(.keep_all = TRUE) %>% rename(High_DL = Mean_Abs) + +#filter out stds and other experiments +raw_data <- dat %>% + filter(!str_detect(IDs, "Std")) %>% + filter(!str_detect(IDs, "MC")) + +#Calculate Concentrations and fix zeroes/negative values and flag conc + +joined_data <- right_join(Std_crv_calc, raw_data, by = join_by(Plate)) + +calc_data <- joined_data %>% mutate(Conc = ((Abs - Int_Calc) / Slope_Calc)*Dilution) %>% mutate(Conc = ifelse(Conc <= 0, 0, Conc)) + +dl_data <- right_join(High_Std, calc_data, by = join_by(Plate)) + +``` + +##Remove High CV Samples and Average +```{r, echo=FALSE} + +#Calculate CVs +H2S_SPL_cv <- dl_data %>% group_by(Plate, IDs) %>% mutate(Mean_Conc = mean(Conc)) %>% mutate(Conc_SD = sd(Conc)) %>% mutate(CV = cv(Conc)) %>% mutate(CV_Flag = ifelse(CV >= cv_flag_stds, "CV_High", "CV_Good")) %>% mutate(Mean_Abs = mean(Abs)) %>% mutate(Conc_Flag = ifelse(Mean_Abs < MDL, "bdl", ifelse(Mean_Abs > High_DL, "adl", "Within_Range"))) %>% ungroup() + +#calculate new cv getting best cv from points if cv was high +H2S_SPL_cv_new <- H2S_SPL_cv %>% group_by(Plate, IDs) %>% + mutate(CV_New = map_dbl(row_number(), ~cv(Conc[-.x]))) %>% #Calculate CVs without 1 point + mutate(Removed = ifelse( #Choose Lowest CV if CV is high + CV_Flag == "CV_High", + ifelse( + CV_New == min(CV_New), + "RMVD", + "KEPT"), "CV_Good"), +CV2 = ifelse(CV_Flag == "CV_High", min(CV_New), CV), +Conc_rm = ifelse(Removed == "RMVD", NA, Conc)) %>% + mutate(Mean_Conc2 = mean(Conc_rm, na.rm = TRUE)) %>% + mutate(CV_Flag2 = ifelse(CV2 >= cv_flag_sample, "CV_High", "CV_Good")) %>% + mutate(Conc_SD2 = sd(Conc_rm, na.rm = TRUE)) %>% ungroup() + +H2S_SPL_CV_fin <- H2S_SPL_cv_new %>% dplyr::select(Plate, + Wells, + Conc, + Removed, + IDs, + Dilution, + Conc, + Mean_Conc2, + Conc_SD2, + CV2, + CV_Flag2, + Conc_Flag) %>% + mutate(Mean_Conc = Mean_Conc2, CV_Flag = CV_Flag2, SD_Conc = Conc_SD2, CV = CV2) %>% + dplyr::select(Plate, Conc, + Removed, + IDs, + Dilution, + Mean_Conc, + SD_Conc, + CV, + CV_Flag, + Conc_Flag) + +``` + +## Plot Samples +```{r, echo=FALSE} + +#Filter samples and mark reruns +H2S_Spl_pre_viz <- H2S_SPL_cv_new %>% mutate(IDs = toupper(IDs)) %>% + filter(grepl("^\\d{3}-", IDs)) %>% + filter(!str_detect(IDs, "DUP")) %>% + filter(!str_detect(IDs, "SPIKE")) %>% + dplyr::select(Plate, IDs, Mean_Conc, Conc_SD, CV_Flag) %>% distinct(.keep_all = TRUE) %>% mutate(IDs = ifelse(Plate %like% "rr", paste0(IDs, "_RR"), IDs)) %>% mutate(ForPlot = ifelse(row_number() <= 80, "A", "B")) + +#Plot Samples before corrections +H2S_Spl_Plot_Pre <- ggplot(H2S_Spl_pre_viz, aes(y = Mean_Conc, x = IDs, fill = CV_Flag)) + + geom_bar(stat = 'identity', + position = position_dodge2(), + linewidth = 0.75, + col = "white") + + scale_fill_manual(values = c( + "CV_Good" = "green2", + "CV_High" = "pink2" + )) + + labs(y = "Sulfide (uM)", x = "Sample ID") + + geom_errorbar( + aes(ymin = Mean_Conc - Conc_SD, ymax = Mean_Conc + Conc_SD), + width = 0.3, + position = position_dodge(.1) + ) + + theme_classic() + + facet_wrap(~ ForPlot ,, scale = "free_x", ncol = 1) + + theme(legend.position = "bottom", axis.text.x = element_text( + angle = 90, + vjust = 0.5, + hjust = 1) + ) + + ggtitle("Sample triplicate means and sd dev before bad reps removed") + + +H2S_Spl_Plot_Pre + +H2S_Spl_rmv_viz <- H2S_SPL_CV_fin %>% mutate(IDs = toupper(IDs)) %>% + filter(grepl("^\\d{3}-", IDs)) %>% + filter(!str_detect(IDs, "DUP")) %>% + filter(!str_detect(IDs, "SPIKE")) %>% + dplyr::select(Plate, IDs, Mean_Conc, SD_Conc, CV_Flag, Conc_Flag) %>% distinct(.keep_all = TRUE) %>% mutate(IDs = ifelse(Plate %like% "rr", paste0(IDs, "_RR"), IDs)) %>% mutate(ForPlot = ifelse(row_number() <= 80, "A", "B")) + +#Plot samples after Corrections +H2S_Spl_Plot_CV <- ggplot(H2S_Spl_rmv_viz, aes(y = Mean_Conc, x = IDs, fill = CV_Flag)) + + geom_bar(aes(col = Conc_Flag), stat = 'identity', + position = position_dodge(), + linewidth = 0.75) + + scale_fill_manual(values = c( + "CV_Good" = "green2", + "CV_High" = "pink2" + )) + + scale_color_manual(values = c("Within_Range" = "darkgreen", "adl" = "red3", "bdl" = "blue3" )) + + labs(y = "Sulfide (uM)", x = "Sample ID") + + geom_errorbar( + aes(ymin = Mean_Conc - SD_Conc, ymax = Mean_Conc + SD_Conc), + width = 0.3, + position = position_dodge(.1) + ) + + theme_classic() + + facet_wrap(~ForPlot, scales = "free_x", ncol = 1) + + theme(legend.position = "bottom", axis.text.x = element_text( + angle = 90, + vjust = 0.5, + hjust = 1), + strip.text = element_blank(), + strip.background = element_blank() + ) + + ggtitle("Sample triplicate means and sd dev after bad reps removed") + + +H2S_Spl_Plot_CV + + + +``` + + +## Duplicate QAQC + +```{r,echo=FALSE} + +#pull out any rows that have "Dup" in the ID column and tag reruns +DUP_start <- H2S_SPL_CV_fin %>% mutate(Dup_ID = gsub(" ", "", substr(IDs, 1, 6)), + Dup = ifelse(IDs %like% "Dup", "Dup", "Org")) %>% mutate(Dup_ID = ifelse(Plate %like% "rr", paste0(Dup_ID, "_RR"), Dup_ID)) + +#separate dups from originals and tag for pairing + +dups_only <- DUP_start %>% filter(Dup == "Dup") %>% dplyr::select(Dup_ID, Mean_Conc, SD_Conc, Plate) %>% rename(Dup_Conc = Mean_Conc, Dup_SD = SD_Conc) %>% distinct(.keep_all = TRUE) + +no_dups <- DUP_start %>% filter(!Dup == "Dup") + +dup_spls_l <- dups_only %>% dplyr::select(Dup_ID) %>% distinct(.keep_all = TRUE) + +dup_spls <- no_dups %>% filter(Dup_ID %in% as.vector(dup_spls_l$Dup_ID)) %>% dplyr::select(Dup_ID, Mean_Conc, SD_Conc, Plate, IDs) %>% distinct(.keep_all = TRUE) + +dup_join <- full_join(dups_only, dup_spls, by = join_by(Dup_ID, Plate)) %>% na.omit() + +#Calculate Percent difference and Flag +dup_flags <- dup_join %>% + mutate(Diff_P = (abs(100 * (Mean_Conc - Dup_Conc) / mean(c(Mean_Conc, Dup_Conc))))) %>% + mutate(Dup_Flag = ifelse(Diff_P >= dups_perc_diff, "Dup_Bad", "Dup_Good")) + +#oraganize data for flagging and plotting +dup_flags_1 <- dup_flags %>% dplyr::select(Dup_ID, Dup_Flag, Diff_P, Plate) + +Dup_for_plot_1 <- DUP_start %>% dplyr::select(Plate, Mean_Conc, Dup_ID, IDs) %>% distinct(.keep_all = TRUE) %>% filter(Dup_ID %in% as.vector(dup_spls_l$Dup_ID)) %>% + left_join(dup_flags_1, by = join_by(Dup_ID, Plate)) %>% + mutate(Dup = ifelse(IDs %like% "Dup", "Duplicate", "Original")) %>% + dplyr::select(-IDs, -Mean_Conc, -Dup) %>% distinct(.keep_all = TRUE) %>% na.omit + +#plot Data +Dup_Plot <- ggplot(Dup_for_plot_1, + aes( + x = Plate, + y = Diff_P + )) + + geom_bar( + aes(fill = Dup_Flag), + stat = 'identity', + position = position_dodge2(preserve = "single"), + linewidth = 0.9 + ) + + geom_label_repel(data = as.data.frame(1), aes(x = "Plate1", y=17.5), label= "Percent Difference Cutoff", color = "red3", alpha = 0.7) + + geom_hline(aes(yintercept = dups_perc_diff), linetype = "dashed", linewidth = 1.5, color = "red3") + + labs(y = "Percent Difference", x = "Sample ID") + + scale_fill_manual(values = c( + "Dup_Good" = "darkgreen", + "Dup_Bad" = "darkred" + )) + + theme_classic()+ + theme(legend.position = "bottom") + + ggtitle("H2S Duplicates") + +Dup_Plot + + +``` + +## Display Dup Flags + +```{r, echo=FALSE} +Dup_Flag_1 <- dup_flags %>% group_by(Plate) %>% mutate(Dup_Flags = ifelse("Dup_Bad" %in% Dup_Flag, "Dup_Bad", "Dup_Good")) %>% dplyr::select(Plate, Dup_Flags) %>% rename(Dup_Flag = Dup_Flags) %>% distinct(.keep_all = TRUE) + +Dup_Flags_1 <-Dup_Flag_1 %>% mutate(Dup_Flags = paste0(Dup_Flag, "-", Plate)) + +Dup_Flags_2 <- Dup_Flags_1 %>% dplyr::select(Plate, Dup_Flag) %>% group_by(Plate) %>% mutate(Duplicate_Flag = ifelse("Dup_Bad" %in% Dup_Flag, "Dup_Bad", "")) %>% dplyr::select(Plate, Duplicate_Flag) %>% rename(Dup_Flag = Duplicate_Flag) %>% distinct(.keep_all = TRUE) + +Bad_Dups <- dup_flags %>% filter(str_detect(Dup_Flag, "Dup_Bad")) + +Bad_D_N <- length(Bad_Dups$Dup_Flag) + +Total_D_N <- length(dup_flags$Dup_Flag) + +ifelse(Bad_D_N/Total_D_N > 0.4, paste0("<60% of Dups Pass, Rerun"), paste0(">60% Dups Pass") ) + +Duplicate_Flag <- ifelse(Bad_D_N/Total_D_N > 0.4, paste0(" >40% Dups Fail"), "" ) + +knitr::kable(Dup_Flag_1, format="markdown") + + +``` + +## Spike QAQC +```{r, echo=FALSE} +#pull out any rows that have "Spk" in the ID column +SPK_start <- H2S_SPL_CV_fin %>% mutate(Spk_ID = gsub(" ", "", substr(IDs, 1, 6)), + Spk = ifelse(IDs %like% "Spike", "Spk", "Org")) %>% mutate(Spk_ID = ifelse(Plate %like% "rr", paste0(Spk_ID, "_RR"), Spk_ID)) +#separate spikes from originals +spks_only <- SPK_start %>% filter(Spk == "Spk") %>% dplyr::select(Spk_ID, Mean_Conc, SD_Conc, Dilution, Plate) %>% rename(Spk_Conc = Mean_Conc, + Spk_SD = SD_Conc, + Spk_Dilution = Dilution) %>% distinct(.keep_all = TRUE) + +no_spks <- SPK_start %>% filter(!Spk == "Spk") + +spls_l <- no_spks %>% dplyr::select(Spk_ID) %>% distinct(.keep_all = TRUE) + +spk_spls_l <- spks_only %>% dplyr::select(Spk_ID) %>% distinct(.keep_all = TRUE) + +spk_spls <- no_spks %>% filter(Spk_ID %in% as.vector(spk_spls_l$Spk_ID)) %>% dplyr::select(Spk_ID, Mean_Conc, SD_Conc, Plate, IDs, Dilution) %>% distinct(.keep_all = TRUE) + +SPK_only <- spks_only %>% filter(Spk_ID %in% as.vector(spls_l$Spk_ID)) + +spk_join <- full_join(SPK_only, spk_spls, by = join_by(Spk_ID, Plate)) + +#Calculate recovery and flag data +spk_flags <- spk_join %>% mutate( + Spl_mol = (sample_vol / Con1) * (Mean_Conc / Dilution), + Spk_mol = ((sample_vol + spkvol) / Con1) * (Spk_Conc / Spk_Dilution), + Spk_exp = Spl_mol + spk_Conc, + Spk_recovery = (Spk_mol/Spk_exp) * 100) %>% + mutate( + Spk_Flag = ifelse( + Spk_recovery >= high_recovery_cutoff | + Spk_recovery <= low_recovery_cutoff, + "Spk_Bad", + "Spk_Good" + ) + ) + +#organize data for flagging and plotting +spk_flags_1 <- spk_flags %>% dplyr::select(Spk_ID, Spk_Flag, Spk_recovery, Plate) %>% na.omit() + +Spk_for_plot_a <- SPK_start %>% dplyr::select(Plate, Mean_Conc, Spk_ID, IDs) %>% + distinct(.keep_all = TRUE) %>% + filter(Spk_ID %in% as.vector(spk_spls_l$Spk_ID)) %>% + left_join(spk_flags_1, by = join_by(Spk_ID, Plate)) %>% + mutate(Spk = ifelse(IDs %like% "Spike", "Spike", "Original")) %>% + filter(Spk_ID %in% as.vector(spls_l$Spk_ID)) + +Spk_for_plot_1 <- Spk_for_plot_a %>% dplyr::select(Plate, Spk_ID, Spk_recovery, Spk_Flag) %>% na.omit() %>% distinct(.keep_all = TRUE) + +#plot data +Spk_Plot <- ggplot(Spk_for_plot_1, + aes( + x = Plate, + y = Spk_recovery + )) + + geom_rect(aes(xmin=0, xmax=Inf, ymin=low_recovery_cutoff, ymax=high_recovery_cutoff), alpha = 0.25, fill ="palegreen") + + geom_bar( aes(fill = Spk_Flag), + stat = 'identity', + position = position_dodge2(preserve = "single"), + linewidth = 0.9 + ) + + geom_hline(aes(yintercept = high_recovery_cutoff), linetype = "dashed", color = "green3", linewidth = 1.5) + + geom_hline(aes(yintercept = low_recovery_cutoff), linetype = "dashed", color = "green3", linewidth = 1.5) + + geom_label_repel(data = as.data.frame(1),aes(x = "Plate1", y=high_recovery_cutoff - 7.5), label= "Acceptable Recovery Range", color = "darkgreen", alpha = 0.7) + + labs(y = "Spike Recovery (%)", x = "Plate") + + scale_fill_manual(values = c( + "Spk_Good" = "darkgreen", + "Spk_Bad" = "darkred" + )) + + theme_classic() + + theme(legend.position = "bottom") + + ggtitle("H2S Spikes") + +Spk_Plot + + +``` + +## Display Spike Flags +```{r, echo=FALSE} + +#Check if all Spikes are paired +ifelse(all(as.vector(spk_spls_l$Spk_ID) %in% as.vector(spls_l$Spk_ID)), paste0("Spikes Paired"), paste0("Spike Missing Pair")) + +#Format Data frame +Spk_Flag_1 <- spk_flags %>% dplyr::select(Plate, IDs, Spk_Flag) %>% na.omit() + +#Attach Plate to Flag +Spk_Flags_1 <-Spk_Flag_1 %>% group_by(Plate) %>% mutate(Spk_Flags_T = ifelse( "Spk_Bad" %in% Spk_Flag, paste0("Spk_Bad"), paste0("Spk_Good"))) %>% mutate(Spk_Flags = paste0(Spk_Flags_T, "-", Plate))%>% ungroup() +#If any Spikes in Plate are bad, then flag plate +Spk_Flags_2 <- Spk_Flags_1 %>% dplyr::select(Plate, Spk_Flag) %>% group_by(Plate) %>% mutate(Spike_Flag = ifelse("Spk_Bad" %in% Spk_Flag, "Spk_Bad", "")) %>% dplyr::select(Plate, Spike_Flag) %>% rename(Spk_Flag = Spike_Flag) %>% distinct(.keep_all = TRUE) + +Spk_disp <- Spk_Flags_1 %>% dplyr::select(Plate, Spk_Flags_T) %>% rename(Spike_Flag = Spk_Flags_T) %>% distinct(.keep_all = TRUE) %>% na.omit() + +knitr::kable(Spk_disp, format="markdown") + +bad <- Spk_Flag_1 %>% filter(Spk_Flag %like% "Bad") + +length_bad <- length(as.vector(bad$Spk_Flag)) + +length_all <- length(as.vector(Spk_Flag_1$Spk_Flag)) + +ifelse(length_bad/length_all > 0.4, paste0("<60% of Spikes Pass, Rerun"), paste0("Spikes Pass") ) + +Spike_Flag <- ifelse(length_bad/length_all > 0.4, paste0(">40% Spikes Fail"), "" ) + +``` + + +## Merge samples with Metadata & check all samples are present +```{r check sample ids with metadata, echo=FALSE} +#Get Samples Only +H2S_spls_md <- H2S_SPL_CV_fin %>% mutate(IDs = toupper(IDs)) %>% + filter(grepl("^\\d{3}-", IDs)) %>% + filter(!str_detect(IDs, "DUP")) %>% + filter(!str_detect(IDs, "SPIKE")) + +#Check for reruns and replace +H2S_spl_rrn <- H2S_spls_md %>% + filter(Plate %like% "rr") %>% + dplyr::select(IDs, Mean_Conc, Conc_Flag, Dilution) %>% + rename(RRN_Conc = Mean_Conc, Conc_Flag_rr = Conc_Flag, Dilution_rr = Dilution) %>% + distinct(.keep_all = TRUE) + +RRN_IDs <- as.vector(H2S_spl_rrn$IDs) + +H2S_spl_og <- H2S_spls_md %>% + filter(!Plate %like% "rr") %>% + dplyr::select(IDs, Mean_Conc, Conc_Flag, Plate, CV_Flag, Dilution, CV) %>% + distinct(.keep_all = TRUE) %>% + mutate(Rerun = ifelse(IDs %in% RRN_IDs, "RRN", "Org")) + +H2S_spl_rr_join <- full_join(H2S_spl_rrn,H2S_spl_og, by = join_by(IDs) ) + +Samples_Tagged <- H2S_spl_rr_join %>% mutate( + Conc = ifelse(Rerun == "RRN", RRN_Conc, Mean_Conc), + Conc_Flag = ifelse(Rerun == "RRN", Conc_Flag_rr, Conc_Flag), + Dilution = ifelse(Rerun == "RRN", Dilution_rr, Dilution) +) %>% dplyr::select(IDs, Conc, Conc_Flag, CV_Flag, Plate, Dilution, CV) %>% rename(Sample_ID = IDs) %>% ungroup() %>% group_by(Sample_ID) %>% mutate( + Min_CV = ifelse(CV == min(CV), "KEEP", "RMV"), # get if CV is lowest of reruns + Within_Range = "Within_Range" %in% Conc_Flag, #Get if any are within range + BDL = "bdl" %in% Conc_Flag, #get if any are below detection limit + Max_Dil = max(Dilution), #get maximum dilution of reruns + Min_Dil = min(Dilution),#get minimum dilution of reruns + All_Good = all(Conc_Flag == "Within_Range") & all(CV_Flag == "CV_Good"), #get if all are within range and good cv + CV_Check = CV == min(CV[which(Dilution == Max_Dil)]), #Get if CV is lowest of highest dilution for reruns + Number = length(Conc) #get number of times ran +) %>% ungroup() %>% + mutate(Remove = ifelse(Number == 1, #check if sample was reran + "KEEP", + ifelse(All_Good, #check if multiple samples meet all criteria + ifelse(Min_CV == "KEEP", #Keep only lowest CV + "KEEP1", + "RMV1"), + ifelse(Conc_Flag == "Within_Range" & CV_Flag == "CV_Good", #If only one sample meets all criteria keep that one + "KEEP2", ifelse(Conc_Flag == "Within_Range", "KEEP2a", + ifelse(!(Within_Range) & BDL, #Check if none are within range but are under detection limit + ifelse(Dilution == Min_Dil, #keep lowest dilution + "KEEP3", + "RMV3"), + ifelse(!(Within_Range) & CV_Check, #if all are above detection limit keep lowest CV of highest dilution + "KEEP4", + "RMV4") + ) + ) + )))) + +Samples <- Samples_Tagged %>% filter(Remove %like% "KEEP") + +#check to see if all samples are present in the metadata +all_present <- all(metadata$Sample_Name %in% Samples$Sample_ID) + +if (all_present) { + message("All sample IDs are present in data") +} else { + message("Some sample IDs are missing from data.") + + # Optional: Which ones are missing? + missing_ids <- setdiff(metadata$Sample_Name, Samples$Sample_ID) + print(missing_ids) +} + + +#merge metadata with sample run data +merged_data <- metadata %>% + mutate(Sample_ID = paste0("\\b", Sample_ID, "\\b")) %>% + fuzzyjoin::regex_left_join(Samples, ., by = c(Sample_ID = "Sample_Name")) + +#might want to include a flag or something to see that all the samples are included? + +``` + + +##Add Flags +```{r, echo=FALSE} + +#Get only bad flags for each plate and check +Chk_Flags_All <- Chk_Flags %>% dplyr::select(Plate, CHKs_Flag) %>% filter(CHKs_Flag %like% "Bad") %>% na.omit() %>% distinct(.keep_all = TRUE) %>% group_by(Plate) %>% + summarise( + CHKSTD_Flags = paste(CHKs_Flag, collapse = ", "), + .groups = 'drop' # Drops the grouping structure after summarizing + ) + + +STD_Flags_All <- STD_CRV_flags %>% dplyr::select(Plate, R2_Flag, CV_Flag) %>% mutate(STDCV_Flags = paste0("STD", CV_Flag)) %>% dplyr::select(-CV_Flag) %>% mutate( + R2_Flag = ifelse(R2_Flag %like% "Good", NA, R2_Flag), + STDCV_Flags = ifelse(STDCV_Flags %like% "Good", NA, STDCV_Flags) +) %>% na.omit() + +Flags_Int <- tibble(Plate = c(plates)) + +#Join Flags + +Flags_Joined_1 <-left_join(Flags_Int, Dup_Flags_2, by = join_by(Plate)) + +Flags_Joined_2 <- left_join(Flags_Joined_1, Spk_Flags_2, by = join_by(Plate)) + +Flags_Joined_3 <- left_join(Flags_Joined_2, Chk_Flags_All, by = join_by(Plate)) + +Flags_Joined_4 <- left_join(Flags_Joined_3, STD_Flags_All, by = join_by(Plate)) + +Flags_Joined <- left_join(Flags_Joined_4, Curve_Flags_forJoin, by = join_by(Plate)) + + +Flags_Joined[Flags_Joined == "NA"] <- NA + +#Merge Flags into one column +Flags <- Flags_Joined %>% replace(is.na(.), "") %>% mutate( + H2S_Flags = paste0( + Spk_Flag, + " ", + Dup_Flag, + " ", + CHKSTD_Flags, + " ", + R2_Flag, + " ", + STDCV_Flags, + " ", + Slope_Flag, + " ", + Int_Flag + ) +) %>% dplyr::select(Plate, H2S_Flags) + +#Add Flags to data +flagged_data <- left_join(merged_data, Flags, by = join_by(Plate)) + + +df_all_clean <- flagged_data %>% dplyr::select(-Plate) + +``` + +##Organize Data +```{r, echo=FALSE} +#check results +#head(Samples) + +#pull out what we need + +df_all_clean_cols <- df_all_clean %>% + dplyr::select( + Site, + Project, + Year, + Month, + Community, + Nickname, + Plot, + Depth_cm, + CO2_Treatment, + Temp_Treatment, + Conc, + Conc_Flag, + CV_Flag, + H2S_Flags + ) + +final_data_labeled <- df_all_clean_cols %>% + mutate( + Run_notes = Run_notes,# new column with notes about the run + Analysis_rundate = Run_Date) + +#rename columns +org_labeled_fin_data <- final_data_labeled %>% + rename( + H2S_Conc_uM = Conc, + H2S_Conc_Flag = Conc_Flag, + H2S_CV_Flag = CV_Flag + ) + +#Order Columns for Final Data Frame +All_Clean_Data <- org_labeled_fin_data %>% + dplyr::select( + Site, + Project, + Year, + Month, + Community, + Nickname, + Plot, + Depth_cm, + CO2_Treatment, + Temp_Treatment, + H2S_Conc_uM, + H2S_Conc_Flag, + H2S_CV_Flag, + H2S_Flags, + Analysis_rundate, + Run_notes + ) +#head(Samples1) + +``` + + +## Visualize Data +```{r Visualize Data C3, fig.height=10, echo=FALSE} +cat("Visualize Data") + +### Ammonia +H2S_forplot <- All_Clean_Data + +#C3 plots +H2S_forplot_C3 <- H2S_forplot %>% + filter(Nickname == "C3") + +H2S_forplot_C3$Depth_cm <- + as.numeric(H2S_forplot_C3$Depth_cm) + +#group the data for plotting +H2S_forplot_C3 <- H2S_forplot_C3 %>% + group_by(Depth_cm) %>% + mutate(row_num = factor(row_number())) %>% # create row_num as factor per group + ungroup() %>% + mutate(Treatment = ifelse(Temp_Treatment == 0, ifelse(CO2_Treatment == "Ambient", "0 C + aCO2", "0 C + eCO2"), ifelse(Temp_Treatment == 1.7, "1.7 C + aCO2", ifelse(Temp_Treatment == 3.4, "3.4 C + aCO2", ifelse(Temp_Treatment == 5.1, ifelse(CO2_Treatment == "Ambient", "5.1 C + aCO2", "5.1 C + eCO2"), NA))))) + +#create plot +viz_H2S_plot_C3 <- ggplot(data = H2S_forplot_C3, aes( + x = as.factor(Temp_Treatment), + y = H2S_Conc_uM, + fill = as.factor(Treatment), + color = as.factor(Treatment) +)) + + geom_bar(stat = "identity", position = position_dodge2(padding = 0.4, preserve = c("total", "single"), )) + + facet_grid(as.numeric(Depth_cm) ~ ., scales = "free_x") + + scale_fill_manual( + values = c( + "0 C + aCO2" = "blue", + "1.7 C + aCO2" = "green", + "3.4 C + aCO2" = "orange", + "5.1 C + aCO2" = "red", + "0 C + eCO2" = "white", + "5.1 C + eCO2" = "white" + ), + name = "Treatment:", + breaks = c("0 C + aCO2", "1.7 C + aCO2", "3.4 C + aCO2", "5.1 C + aCO2", "0 C + eCO2", "5.1 C + eCO2"), + labels = c("0 C + aCO2", "1.7 C + aCO2", "3.4 C + aCO2", "5.1 C + aCO2", "0 C + eCO2", "5.1 C + eCO2") + ) + + scale_color_manual( + values = c( + "0 C + aCO2" = "blue", + "1.7 C + aCO2" = "green", + "3.4 C + aCO2" = "orange", + "5.1 C + aCO2" = "red", + "0 C + eCO2" = "blue", + "5.1 C + eCO2" = "red" + ), + name = "Treatment:", + breaks = c("0 C + aCO2", "1.7 C + aCO2", "3.4 C + aCO2", "5.1 C + aCO2", "0 C + eCO2", "5.1 C + eCO2"), + labels = c("0 C + aCO2", "1.7 C + aCO2", "3.4 C + aCO2", "5.1 C + aCO2", "0 C + eCO2", "5.1 C + eCO2") + ) + + theme_classic() + + labs( + x = " ", + y = "H2S (uM)", + title = "C3: Porewater H2S", + fill = "CO2 Treatment", + color = "+Temp. (C)" + ) + + theme(legend.position = "right") + + scale_x_discrete(drop = TRUE) + + theme( + axis.text.x = element_text(angle = 0, hjust = 0.5), + panel.border = element_rect( + color = "black", + fill = NA, + linewidth = 0.8), + legend.key = element_rect("black") + ) + + coord_flip() +print(viz_H2S_plot_C3) + +``` +\newpage +```{r Visualize Data C4, fig.height=10, echo=FALSE} +#C4 plots +H2S_forplot_C4 <- H2S_forplot %>% + filter(Nickname == "C4") + +H2S_forplot_C4$Depth_cm <- + as.numeric(H2S_forplot_C4$Depth_cm) + +#group the data for plotting +H2S_forplot_C4 <- H2S_forplot_C4 %>% + group_by(Depth_cm) %>% + mutate(row_num = factor(row_number())) %>% # create row_num as factor per group + ungroup() + +viz_H2S_plot_C4 <- ggplot(data = H2S_forplot_C4, aes( + x = as.factor(Temp_Treatment), + y = H2S_Conc_uM, + fill = as.factor(Temp_Treatment) +)) + + geom_bar(stat = "identity", position = position_dodge2(padding = 0.25, preserve = "single"), ) + + facet_grid(as.numeric(Depth_cm) ~ ., scales = "free_x") + + facet_grid(Depth_cm ~ ., scales = "free_x") + + scale_fill_manual(values = c( + "0" = "blue", + "1.7" = "green", + "3.4" = "orange", + "5.1" = "red" + )) + + + theme_classic() + + labs(x = " ", + y = "H2S (uM)", + title = "C4: Porewater H2S", + fill = "+Temp. (C)") + + theme(legend.position = "right") + + scale_x_discrete(drop = TRUE) + + theme( + axis.text.x = element_text(angle = 0, hjust = 0.5), + panel.border = element_rect( + color = "black", + fill = NA, + linewidth = 0.8 + ), + legend.key = element_rect("black") + + ) + + coord_flip() +print(viz_H2S_plot_C4) + +``` +\newpage +```{r Visualize Data by Rep C3, fig.height=8.5, echo=FALSE} + +#get replicate value and treatment info +H2S_forplot_C3 <- H2S_forplot_C3 %>% + mutate(Replicate = str_sub(Plot, 2, 2)) %>% + mutate(Treatment1 = ifelse( + Temp_Treatment == 0, + ifelse(CO2_Treatment == "Ambient", "+ 0 C", "eCO2 + 0 C"), + ifelse( + Temp_Treatment == 1.7, + "+ 1.7 C", + ifelse( + Temp_Treatment == 3.4, + "+ 3.4 C", + ifelse( + Temp_Treatment == 5.1, + ifelse(CO2_Treatment == "Ambient", "+ 5.1 C", "eCO2 + 5.1 C"), + NA + ) + ) + ) + )) + +#ensure points are in correct order +H2S_forplot_C3 <- H2S_forplot_C3[order(H2S_forplot_C3$Depth_cm), ] + +#make plot +viz_H2S_plot_C3_2 <- ggplot(data = H2S_forplot_C3, + aes(x = H2S_Conc_uM, y = Depth_cm, color = Replicate)) + + geom_point(size = 3) + + geom_path(size = 1) + + scale_color_manual(values = c( + "1" = "#FFD500", + "2" = "#00D0FF", + "3" = "#FF0075" + )) + + facet_grid(factor( + Treatment1, + levels = c("eCO2 + 0 C", "+ 0 C", "+ 1.7 C", "+ 3.4 C", "+ 5.1 C", "eCO2 + 5.1 C") + ) ~ ., scales = "free_x") + + labs(x = "H2S (uM)", + y = "Depth (cm)", + title = "C3: Porewater H2S by Replicate") + + scale_y_reverse(breaks = c(10, 20, 40, 80, 120), + limits = c(125, 5)) + + theme_classic() + + theme( + axis.text.x = element_text(angle = 0, hjust = 0.5), + panel.border = element_rect( + color = "black", + fill = NA, + linewidth = 0.8 + ) + ) + +viz_H2S_plot_C3_2 + +``` +\newpage + +```{r Visualize Data by Rep C4, fig.height=5.7, echo=FALSE} + +#get replicate value and treatment info +H2S_forplot_C4 <- H2S_forplot_C4 %>% + mutate(Replicate = str_sub(Plot, 2, 2)) %>% + mutate(Treatment1 = ifelse( + Temp_Treatment == 0, + ifelse(CO2_Treatment == "Ambient", "+ 0 C", "eCO2 + 0 C"), + ifelse( + Temp_Treatment == 1.7, + "+ 1.7 C", + ifelse( + Temp_Treatment == 3.4, + "+ 3.4 C", + ifelse( + Temp_Treatment == 5.1, + ifelse(CO2_Treatment == "Ambient", "+ 5.1 C", "eCO2 + 5.1 C"), + NA + ) + ) + ) + )) + +#make sure point are in correct order +H2S_forplot_C4 <- H2S_forplot_C4[order(H2S_forplot_C4$Depth_cm), ] + +#make plot +viz_H2S_plot_C4_2 <- ggplot(data = H2S_forplot_C4, + aes(x = H2S_Conc_uM, y = Depth_cm, color = Replicate)) + + geom_point(size = 3) + + geom_path(size = 1) + + scale_color_manual(values = c( + "4" = "#FFD500", + "5" = "#00D0FF", + "6" = "#FF0075" + )) + + facet_grid(factor(Treatment1, levels = c("+ 0 C", "+ 1.7 C", "+ 3.4 C", "+ 5.1 C")) ~ + ., scales = "free_x") + + labs(x = "H2S (uM)", + y = "Depth (cm)", + title = "C4: Porewater H2S by Replicate") + + scale_y_reverse(breaks = c(10, 20, 40, 80, 120), + limits = c(125, 5)) + + theme_classic() + + theme( + axis.text.x = element_text(angle = 0, hjust = 0.5), + panel.border = element_rect( + color = "black", + fill = NA, + linewidth = 0.8 + ) + ) + +viz_H2S_plot_C4_2 + +``` + + +##Export Data +```{r, echo=FALSE} +write.csv(unique_log, log_path) + Rerun_Data <- All_Clean_Data %>% filter(H2S_Conc_Flag != "Within Range" | H2S_CV_Flag %like% "High") + +if(After_Reruns == "YES"){ + write.csv(All_Clean_Data, final_path)} else { + write.csv(Rerun_Data, rerun_path) } +#end +``` + + +### END \ No newline at end of file diff --git a/SMARTX/Porewater/Sulfide/2026/GCReW_SMARTX_Porewater_H2S_Template.Rmd b/SMARTX/Porewater/Sulfide/2026/GCReW_SMARTX_Porewater_H2S_Template.Rmd new file mode 100644 index 0000000..6cbe2dc --- /dev/null +++ b/SMARTX/Porewater/Sulfide/2026/GCReW_SMARTX_Porewater_H2S_Template.Rmd @@ -0,0 +1,1420 @@ +--- +title: "SMARTX: Porewater Sulfide" +author: "May 2025 Samples" +date: "`r Sys.Date()`" +output: + pdf_document: + toc: false + number_sections: false +geometry: left=2cm,right=2cm,top=1cm,bottom=2cm +--- + + +## Code Set up +```{r setup, include=FALSE} + +library(dplyr) +library(broom) +library(ggplot2) +library(ggpubr) +library(stringr) +library(purrr) +library(tidyverse) +library(here) +library(data.table) +library(matrixStats) +library(gridExtra) +library(grid) +library(plater) +library(raster) +library(knitr) +library(readxl) +library(ggrepel) + +``` + +## run information +```{r Information to be changed} + +##Before or After Reruns (YES or NO) +After_Reruns = "YES" +#If NO will not write final data file + #And Will Write a Rerun File + +###things that need to be changed +sample_month = "May" +sample_year = "2026" +Run_Date = as.Date("05/19/2026", format = "%m/%d/%Y") +Run_by = "Melanie Giessner"#Instrument user +Script_run_by ="Melanie Giessner"#Code user + +Run_notes=""#any notes from run + +#Import Plate Data + +plates<- c("Plate1","Plate2","Plate3","Plate4","Plate5","Plate6","Plate7", "Plate8", "Plate9") + + +folder_path_rawdata <- paste0("Raw Data") +Raw_plates <- list.files(path = folder_path_rawdata, full.names = TRUE,pattern = "Plate") +head(Raw_plates) + + +#Import Run Date for Each Plate for Std curve qaqc +Run_dates <- tibble( + Plate = plates, + Run_Date = c("05/19/26","05/19/26","05/20/26","05/20/26","05/20/26","05/20/26","05/21/26","05/21/26", "05/21/26") + ) + + Run_dates <- Run_dates %>% mutate(Run_Date = as.Date(Run_Date, format = "%m/%d/%y")) + + +# Define the file path for QAQC log file - NO Need to change just check year +log_path <- "Processed Data/SMARTX_H2S_QAQC_2026.csv" + +# Define final path for data be sure to change year and month and run number +final_path <- "Processed Data/GCReW_SMARTX_Porewater_H2S_202605.csv" +rerun_path <- "Processed Data/GCReW_SMARTX_Porewater_H2S_202605_reruns.csv" + + +``` + +```{r Set Up Code - constants and QAQC cutoffs, include=FALSE} + +#Flag cutoffs + r2_cutoff = 0.985 #this is the level below which we want to rerun or consider a curve + cv_flag_stds = 10 #this is the maximum cv allowed for standards + p_value_chkstds = 0.05 #the p-value for the t-test between check standards must be greater than this + p_value_MC = 0.05 #the p-value for the t-test between matrix checks and top std must be greater than this + cv_flag_sample = 10 #this is the maximum cv allowed for samples + dups_perc_diff = 15.5 #this is the maximum percent difference allowed between duplicates + high_recovery_cutoff = 120 #this is the maximum percent recovery of SO4 allowed in spiked samples + low_recovery_cutoff = 80 #this is the minimum percent recovery of SO4 allowed in spiked samples + +#Standard concentrations - Update if running different standard curve: +# standard units are in uM + standards <- tibble( + IDs = c("Std 0", "Std 1", "Std 2", "Std 3", "Std 4", "Std 5"), + Conc = c(0, 5.0, 12.5, 25.0, 50.0, 100.0) + ) #uM + + chk_standards <- tibble( + IDs = c("ChkStd 0", "ChkStd 3", "ChkStd 4"), + Conc = c(0, 25.0, 50.0) + ) #uM + + mtx_standards <- tibble( + IDs = c("MC: 10ppt S5"), + Conc = c(100) + ) #uM + +#Spike concentration calc + #spike for these samples was 50 uL of the 100uM standard + Con1 <- 1000000 #conversion factor value for spike volumes (uL -> L) + spk_std <- 100 # uM S2- standard used + spkvol <- 50 # uL volume of spike added + spk_Conc <- spk_std*(spkvol/Con1) # umoles of S2- added to each spiked sample + sample_vol <- 250 # the sample volume without the spike is 250 uL + samp_vol_a <- 300 # the sample volume + +#Top standard Concentration- Update if running different standard curve: + Top_STD = 100 + + +#Metadata file path +Raw_Metadata = here(".." , "GCReW", "GCReW_Project_Treatment_Metadata.csv") + +#Significant Digits +sigdigs <- 3 + +``` + + +##Read in metadata and create similar sample IDs for matching to samples +```{r pull in metadata for later, include=FALSE} + +#read in metadata + +raw_metadata <- read.csv(Raw_Metadata) +#clean up columns in metadata file: +#Pull out only SMARTX Rows +#Create a Sample_Name column to match the SEAL +metadata <- raw_metadata %>% + filter(grepl("SMARTX", Project, ignore.case = TRUE)) %>% + mutate(Sample_Name = Sample.ID) %>% + mutate(Month = sample_month) %>% + mutate(Year = sample_year) %>% + rename( + Sample_ID = Sample.ID, + ) %>% + dplyr::select(-N_Treatment) + +#Bring in the collection date and any field notes if relevant +#collection_metadata <- read.csv(Collection_Dates) +#then we will merge the collection date for SMARTX based on the project and the chambers + +``` + + +##Read in data +```{r read in plates,echo=FALSE,include=FALSE} + +#read in the csv files +dat<-read_plates( + files = Raw_plates,#list of all file paths + plate_names = plates , #list of plate names + well_ids_column = "Wells", # name to give column of well IDs (optional) + sep = "," # separator used in the csv file (optional) +) %>% + rename("Abs"=values, + "IDs"=values.2, + "Dilution"=values.3) +head(dat) + +``` + +##Remove High CV Stds +```{r, echo=FALSE} + +#filter for STDs +H2S_stds_raw <- dat %>% subset(IDs %like% "Std" | IDs %like% "Chk" | IDs %like% "MC") + +#Add in STD values +H2S_stds <- left_join(H2S_stds_raw, standards, by = "IDs") + +#Calculate CVs and add flags +H2S_STD_cv <- H2S_stds %>% group_by(Plate, IDs) %>% mutate(CV = cv(Abs)) %>% mutate(CV_Flag = ifelse(CV >= cv_flag_stds, "CV_High", "CV_Good")) %>% ungroup() + +#calculate new cv getting best cv from points if cv was high +H2S_STD_cv_new <- H2S_STD_cv %>% group_by(Plate, IDs) %>% + mutate(CV_New = map_dbl(row_number(), ~cv(Abs[-.x]))) %>% #Calculate CVs without 1 point + mutate(Removed = ifelse( #Choose Lowest CV if CV is high + CV_Flag == "CV_High", + ifelse( + CV_New == min(CV_New), + "RMVD", + "KEPT"), "CV_Good"), +CV2 = ifelse(CV_Flag == "CV_High", min(CV_New), CV), +Abs_rm = ifelse(Removed == "RMVD", NA, Abs)) %>% + mutate(Mean_Abs2 = mean(Abs_rm, na.rm = TRUE)) %>% + mutate(CV_Flag2 = ifelse(CV2 >= cv_flag_stds, "CV_High", "CV_Good")) %>% ungroup() + +#organize data +H2S_STD_CV_fin <- H2S_STD_cv_new %>% dplyr::select(Plate, + Wells, + Abs, + Removed, + IDs, + Dilution, + Conc, + Mean_Abs2, + CV2, + CV_Flag2) %>% + mutate(Mean_Abs = Mean_Abs2, CV_Flag = CV_Flag2, CV = CV2) %>% + dplyr::select(Plate, + Wells, Abs, + Removed, + IDs, + Dilution, + Conc, + Mean_Abs, + CV, + CV_Flag) + + +``` + + +##Check R2 & Remove Standards if Necessary +```{r, echo=FALSE} +split_data <- H2S_STD_CV_fin %>% filter(IDs %like% "Std") %>% filter(!IDs %like% "Chk") %>% dplyr::select(Plate, IDs, Conc, Mean_Abs, Abs, Removed, CV_Flag) %>% filter(!Removed == "RMVD") %>% #Split Data by Plate + distinct() %>% + group_by(Plate) %>% + group_split() + +#run regression and get coefficients by Run +Slope_H2S_raw_list <- map(split_data, ~ .x %>% mutate(Curve = "H2S", + R2 = summary(lm(Abs ~ Conc, data = .))$adj.r.squared , + Slope = coef(lm(Abs ~ Conc, data = .))[2], + Intercept = coef(lm(Abs ~ Conc, data = .))[1])) + + + Slope_H2S_raw <- bind_rows(Slope_H2S_raw_list) + + #check R2 and flag + Slope_H2S_Std_Crvs <- Slope_H2S_raw %>% dplyr::select(Plate, Curve, R2, Slope, Intercept) %>% distinct() %>% mutate(R2_Flag = ifelse(R2 >= r2_cutoff, "R2_Good", "R2_Bad")) + + #join standard curve CVs and regression values + R2_Check_Raw <- left_join(Slope_H2S_Std_Crvs, H2S_STD_CV_fin, by = "Plate") + + R2_Check <- R2_Check_Raw %>% + dplyr::select(Plate, + IDs, + Abs, + Removed, + Mean_Abs, + Conc, + R2, + Slope, + Intercept, + CV_Flag, + CV, + R2_Flag) %>% filter(IDs %like% "Std") %>% filter(!IDs %like% "Chk") %>% + distinct() + + #calculate concentrations from standard curve and separate removable points + + R2_Split <- R2_Check %>% mutate(RMVBL = ifelse(IDs %in% c("Std 0", "Std 1", "Std 5"), "No", "Yes")) %>% group_by(Plate) %>% dplyr::select(-Abs, -Removed) %>% distinct() %>% group_split() + + R2_New <- map( + R2_Split, + ~ .x %>% mutate( + Curve = "H2S", + R2_New = map_dbl(row_number(), ~ + summary(lm( + Mean_Abs[-.x] ~ Conc[-.x], data = pick(Mean_Abs, Conc) + ))$adj.r.squared) , + Slope_New = map_dbl(row_number(), ~ + coef(lm( + Mean_Abs[-.x] ~ Conc[-.x], data = pick(Mean_Abs, Conc) + ))[2]) , + Intercept_New = map_dbl(row_number(), ~ + coef(lm( + Mean_Abs[-.x] ~ Conc[-.x], data = pick(Mean_Abs, Conc) + ))[1]) + ) + ) %>% bind_rows() + + R2_Check_RMVBL <- R2_New %>% mutate(R2_New = round(R2_New, digits = 8), + CV = round(CV, digits = 8)) %>% group_by(Plate) %>% mutate(R2_New = ifelse(IDs %in% c("Std 0", "Std 1", "Std 5"), NA, R2_New)) %>% mutate(R2_RMV = ifelse( + R2_Flag == "R2_Bad", + ifelse(R2_New == max(R2_New, na.rm = TRUE), "RMVD", "KEPT"), + "R2_Good" + )) %>% mutate(R2_RMV_CV = ifelse( + R2_RMV == "R2_Good", + ifelse(CV_Flag == "CV_High", ifelse(CV == max(CV), "RMVD", "KEPT"), "KEPT"), + R2_RMV + )) %>% mutate(R2_RMVD = ifelse(is.na(R2_RMV_CV), "KEPT", R2_RMV_CV)) %>% dplyr::select(-R2_RMV, -R2_RMV_CV) + +R2_Removed_forPair <- R2_Check_RMVBL %>% dplyr::select(Plate, IDs, R2_RMVD) %>% distinct() + +H2S_STDs_Pair <- H2S_STD_CV_fin %>% filter(IDs %like% "Std") %>% filter(!IDs %like% "Chk") %>% dplyr::select(Plate, IDs, Conc, Mean_Abs, Abs, Removed, CV_Flag) %>% filter(!Removed == "RMVD") %>% distinct() %>% left_join(R2_Removed_forPair) + + + R2_Check_fin <- H2S_STDs_Pair %>% mutate(STD_ABS_rmv = ifelse(R2_RMVD == "RMVD", NA, Abs)) %>% group_by(Plate) %>% mutate(Points = ifelse("RMVD" %in% R2_RMVD, "Point_Removed", "ALL_KEPT")) %>% dplyr::select(Plate, IDs, Conc, STD_ABS_rmv, CV_Flag, Points) %>% ungroup() %>% na.omit() + + #separate plates for new regression + split_data_rmv <- R2_Check_fin %>% + distinct() %>% + group_by(Plate) %>% + group_split() + + #get new standard curve values + Slope_H2S_raw_list_rm <- map(split_data_rmv, ~ .x %>% mutate(Curve = "H2S", + R2 = summary(lm(STD_ABS_rmv ~ Conc, data = .))$adj.r.squared , + Slope = coef(lm(STD_ABS_rmv ~ Conc, data = .))[2], + Intercept = coef(lm(STD_ABS_rmv ~ Conc, data = .))[1])) + + Slope_H2S_raw_rm <- bind_rows(Slope_H2S_raw_list_rm) + + Slope_H2S_Std_Crvs_rm <- Slope_H2S_raw_rm %>% dplyr::select(Plate, Curve, R2, Slope, Intercept, CV_Flag, Points) %>% distinct() %>% mutate(R2_Flag = ifelse(R2 >= r2_cutoff, "R2_Good", "R2_Bad")) + + +``` + + +## Plot Standard Curves +```{r Plot all Standard Curves together, echo=FALSE} +##this is to see if there are any stds or plates that look off + +#Plot Std Crvs by plate +H2S_Curve <- ggplot(Slope_H2S_raw_rm, aes(STD_ABS_rmv, Conc, color = Plate, linetype = Points)) + geom_point(size = 3) + + geom_smooth(method = "lm", formula = "y ~ x", se = FALSE) + labs(title = "H2S Standard Curves", x = "Absorbance", y = "Concentration (uM)") + + theme_classic() +H2S_Curve + +#Add dates to plate and format data +STD_run_date <- left_join(Run_dates, Slope_H2S_Std_Crvs_rm, by = join_by(Plate)) +new_log_stds <- STD_run_date %>% dplyr::select(Plate, + Curve, + R2, + Slope, + Intercept, + Run_Date) %>% mutate(R2 = round(R2, digits = 4), Slope = round(Slope, digits = 4), Intercept = round(Intercept, digits = 4), ) %>% mutate(Run = "Current Runs") + + +#read in log file and format +log <- read.csv(log_path) +log_2 <- log %>% mutate(Run_Date = as.Date(as.character(Run_Date), tryFormats = c("%Y-%m-%d", "%m/%d/%y")), Run = "Past Runs") +log_3 <- log_2[, -c(1)] +log_4 <- rbind(log_3, new_log_stds) + +unique_log <- log_4 %>% distinct(Plate,Curve,R2,Slope,Intercept,.keep_all = TRUE) %>% mutate(Run_Date = as.Date(as.character(Run_Date), tryFormats = c("%Y-%m-%d", "%m/%d/%y"))) + +#Calculate Mean and SD and calculate 2SD range for slope and intercept +mean_slope <- mean(unique_log$Slope, na.rm = TRUE) +sd_slope <- sd(unique_log$Slope, na.rm = TRUE) + +hi_2sd_slope <- mean_slope + 2*sd_slope + +lo_2sd_slope <- mean_slope - 2*sd_slope + +mean_int <- mean(unique_log$Intercept, na.rm = TRUE) +sd_int <- sd(unique_log$Intercept, na.rm = TRUE) + +hi_2sd_int <- mean_int + 2*sd_int + +lo_2sd_int <- mean_int - 2*sd_int + +#Plot Slope log +Slopes_chk <- ggplot(unique_log, aes(x = Run_Date, y = Slope, col = Run)) + + ylim(0.0045,0.018) + + scale_color_manual(values = c("Past Runs" = "grey27", "Current Runs" = "cyan3")) + + geom_abline(intercept = mean_slope - 2*sd_slope, slope = 0, linetype = "dashed", linewidth = 1.5, col = "red" )+ + geom_abline(intercept = mean_slope + 2*sd_slope, slope = 0, linetype = "dashed", linewidth = 1.5, col = "red" )+ + geom_point(size = 2) + + theme_classic()+ + ggtitle("Slope Log") + +#Plot Intercept log +ints_chk <- ggplot(unique_log, aes(x = Run_Date, y = Intercept, col = Run)) + + ylim(0.03, 0.15) + + scale_color_manual(values = c("Past Runs" = "grey27", "Current Runs" = "cyan3")) + + geom_abline(intercept = mean_int - 2*sd_int, slope = 0, linetype = "dashed", linewidth = 1.5, col = "red" )+ + geom_abline(intercept = mean_int + 2*sd_int, slope = 0, linetype = "dashed", linewidth = 1.5, col = "red" )+ + geom_point(size = 2) + + theme_classic()+ + ggtitle("Intercept Log") + +ints_chk + +Slopes_chk + + + +#Get done of original runs +Date_1 <-as.Date(new_log_stds$Run_Date[which(new_log_stds$Plate == "Plate1")]) + +#Check if Std Crvs are Within range and see if dates are close enough for combination +stdcrv_tagged <- new_log_stds %>% mutate( + In_Range_Slope = ifelse( + Slope >= hi_2sd_slope | + Slope <= lo_2sd_slope, + "Out of Range", + "In Range" + ), + In_Range_Int = ifelse( + Intercept >= hi_2sd_int | + Intercept <= lo_2sd_int, + "Out of Range", + "In Range" + ) +) %>% mutate( + Slope = ifelse(In_Range_Slope == "Out of Range", NA, Slope), + Intercept = ifelse(In_Range_Int == "Out of Range", NA, Intercept) +) %>% mutate(Date_Diff = abs(difftime(Date_1, Run_Date, units = "days"))) %>% mutate(Date_Close = ifelse(Date_Diff <= 2, "Yes", "No")) %>% mutate(Slope_Flag = ifelse(is.na(Slope), "Slope_Bad" , "Slope_Good"), Int_Flag = ifelse(is.na(Intercept), "Intercept_Bad" , "Intercept_Good")) %>% mutate( + Slope = ifelse(is.na(Intercept) | R2 <= r2_cutoff, NA, Slope), + Intercept = ifelse(is.na(Slope)| R2 <= r2_cutoff, NA, Intercept), + Curve_RMVD = ifelse(is.na(Slope) | + is.na(Intercept) | R2 <= r2_cutoff , "RMVD", "KEPT") +) + +#Calculate Combo Std Crv +stdcrv_filtered <- stdcrv_tagged %>% filter(Date_Close == "Yes") + +mean_slope_fin <- mean(stdcrv_filtered$Slope, na.rm = TRUE) + +mean_int_fin <- mean(stdcrv_filtered$Intercept, na.rm = TRUE) + +#Attach Slope and Intercept to Plates +Std_crv_calc <- stdcrv_tagged %>% mutate(Slope_Calc = ifelse(Date_Close == "Yes", mean_slope_fin, Slope), Int_Calc = ifelse(Date_Close == "Yes", mean_int_fin, Intercept)) %>% dplyr::select(Plate, Slope_Calc, Int_Calc, Curve_RMVD, Slope_Flag, Int_Flag) %>% as.data.frame() %>% distinct() + +std_curves <- Std_crv_calc %>% dplyr::select(Plate, Curve_RMVD) %>% filter(Curve_RMVD != "RMVD") %>% distinct() + +Curve_Flags <- Std_crv_calc %>% dplyr::select(Plate, Slope_Flag, Int_Flag) %>% distinct() + +Curve_Flags_forJoin <- Curve_Flags %>% mutate(Slope_Flag = ifelse(Slope_Flag %like% "Good", "", Slope_Flag), Int_Flag = ifelse(Int_Flag %like% "Good", "", Int_Flag)) +``` + +## Return Flags For Standard Curve +```{r, echo=FALSE} + +STD_CRV_flags <- full_join(Slope_H2S_Std_Crvs_rm, Run_dates, by = join_by(Plate)) + +STD_CRV_flags_table1 <- STD_CRV_flags %>% dplyr::select(Plate, R2_Flag, CV_Flag) + +STD_CRV_flags_table2 <- Std_crv_calc %>% dplyr::select(Plate, Curve_RMVD) %>% mutate(Curve_RMVD = ifelse(Curve_RMVD == "RMVD", "REMOVED", Curve_RMVD)) + +knitr::kable(STD_CRV_flags_table1, format="markdown") + +knitr::kable(STD_CRV_flags_table2, format="markdown") + + +``` + +## Method Detection Limit +```{r, echo=FALSE} + +#get only lowest standard + STD_MDL_df <- H2S_STD_CV_fin %>% filter(IDs == "Std 1" + #, Removed != "RMVD" + ) %>% dplyr::select(Plate, Mean_Abs, IDs) %>% distinct() + + STD0_df <- H2S_STD_CV_fin %>% filter(IDs == "Std 0" + #, Removed != "RMVD" + ) %>% dplyr::select(Plate, Mean_Abs, IDs) %>% distinct() +#calculate the standard deviation of abs +stddev_mdl <- sd(STD_MDL_df$Mean_Abs) + +#Calculate Mean Std 0 +std0_mean <- mean(STD0_df$Mean_Abs) + +#calculate n +n <- length(STD_MDL_df$Mean_Abs) + +#Identify the proper Student's T for n-1 +StudentsT <-qt(.99,(n-1)) + +#Multiply Standard deviation by Student's T +STD_var <- (stddev_mdl*StudentsT) +MDL <- STD_var + std0_mean + +MDL_df <- as.data.frame(MDL) + +MDL_Plot <- ggplot() + + geom_bar(stat = 'identity', data = STD_MDL_df, aes(x = Plate, y = Mean_Abs, fill = IDs)) + + geom_bar(data = STD0_df, aes(x = Plate, y = Mean_Abs, fill = IDs), stat = 'identity') + + scale_fill_manual(name = "Standard:", values = c("Std 0" = "lightgreen", "Std 1" = "cornflowerblue")) + + geom_hline(yintercept = MDL, linetype = "dashed", linewidth = 1.5, color = "blue3") + + geom_label_repel(data = MDL_df, aes(x = 1.25, y = MDL + 0.015), label = paste0("MDL: ", signif(MDL, digits = sigdigs)), alpha = 0.7, color = "blue3") + + ggtitle(label = "H2S Minimum Detection Limit") + + labs(y = "Mean Absorbance") + + theme_classic() + +MDL_Plot +``` + +## Compare Check Standards to Standards +```{r, echo = FALSE} + +#subset datasets for comparison + +std0 <- subset(H2S_STD_CV_fin, IDs == "Std 0"& Plate %in% std_curves$Plate & !Removed == "RMVD") +std3 <- subset(H2S_STD_CV_fin, IDs == "Std 3"& Plate %in% std_curves$Plate & !Removed == "RMVD") +std4 <- subset(H2S_STD_CV_fin, IDs == "Std 4" & Plate %in% std_curves$Plate & !Removed == "RMVD") +std5 <- subset(H2S_STD_CV_fin, IDs == "Std 5" & Plate %in% std_curves$Plate & !Removed == "RMVD") + + +H2S_CHK_STD_CV_fin <- H2S_STD_CV_fin %>% filter(IDs %like% "ChkStd" | IDs %like% "ppt") +#Tag Check Standards and perform T Test +H2S_CHKs_a <- H2S_CHK_STD_CV_fin %>% + mutate(Std_ID = case_when( + IDs == "ChkStd 0" ~ paste0("Std 0"), + IDs == "ChkStd 3" ~ paste0("Std 3"), + IDs == "ChkStd 4" ~ paste0("Std 4"), + IDs %like% "S5" ~ paste0("Std 5") + ), + Chk_Abs = Abs, + Chk_Removed = Removed, + Chk_IDs = IDs, + Chk_Mean_Abs = Mean_Abs, + Chk_cv_flag = CV_Flag + ) %>% filter(!Chk_Removed == "RMVD") %>% + group_by(Std_ID,Plate) %>% + mutate( + Chk_pvalue = case_when( + Chk_IDs == "ChkStd 0" ~ t.test(std0$Abs, Chk_Abs,var.equal = T)$p.value[1], + Chk_IDs == "ChkStd 3" ~ t.test(std3$Abs, Chk_Abs,var.equal = T)$p.value[1], + Chk_IDs == "ChkStd 4" ~ t.test(std4$Abs, Chk_Abs,var.equal = T)$p.value[1], + Chk_IDs == "MC: 10ppt S5" ~ t.test(std5$Abs, Chk_Abs,var.equal = T)$p.value[1], + Chk_IDs == "MC: 20ppt S5" ~ t.test(std5$Abs, Chk_Abs,var.equal = T)$p.value[1] + ))%>% + ungroup() %>% + dplyr::select(Std_ID, Chk_IDs, Chk_pvalue, Chk_cv_flag, Chk_Mean_Abs, Plate) %>% distinct(.keep_all = TRUE) + +H2S_CHKs_1 <- H2S_CHKs_a %>% dplyr::select(-Chk_Mean_Abs) + +#Get Standard Values and set values for standards with no variance +H2S_STD_forCHK_a <- H2S_STD_CV_fin %>% filter(IDs %in% c("Std 0", "Std 3", "Std 4", "Std 5") ) %>% + mutate(Std_ID = IDs +) %>% filter(!Removed == "RMVD") %>% + dplyr::select(Plate, Std_ID, IDs, CV_Flag, Mean_Abs) %>% distinct(.keep_all = TRUE) + +H2S_STD_forCHK <- H2S_STD_forCHK_a %>% dplyr::select( -Mean_Abs) + +#join check standards with standards +Chk_Std_join <- full_join(H2S_CHKs_1, H2S_STD_forCHK, by = join_by(Std_ID, Plate)) + + +#flag data +Chk_Std_flags <- Chk_Std_join %>% mutate( + Chk_Flag_pv= ifelse( + Chk_pvalue > p_value_chkstds , + "Chk_Good", + "Chk_Bad" + ) + +) %>% mutate(CHK_Flag = paste0(gsub(" ", "", IDs), Chk_Flag_pv)) %>% + mutate(CHK_CV_Flag = paste0("Chk",gsub(" ", "", IDs), Chk_cv_flag)) + + #Organize Data for Plotting and Flagging +Chk_Flags <- Chk_Std_flags %>% group_by(Plate) %>% + mutate(Chk_Flag = ifelse(any(CHK_Flag %like% "Bad"), "Chk_Bad", "Chk_Good"), Chk_cv_flag = ifelse(any(CHK_CV_Flag %like% "High"), "Chk_CV_High", "Chk_CV_Good")) %>% + ungroup() %>% + mutate(CHK_CV_Flags = ifelse(CHK_CV_Flag %like% "High", paste0(gsub(" ", "", IDs), Chk_cv_flag), "Good")) %>% mutate(CHKs_Flag = ifelse(CHK_Flag %like% "Bad", CHK_Flag, "Good")) + +H2S_CHKs_plot <- H2S_CHKs_a %>% rename(IDs = Chk_IDs, Mean_Abs = Chk_Mean_Abs) %>% mutate(Type = "Check") %>% dplyr::select(-Chk_cv_flag,-Chk_pvalue) + +H2S_Std_chkplot <- H2S_STD_forCHK_a %>% dplyr::select(IDs, Mean_Abs, Std_ID, Plate) %>% mutate(Type = "Standard") + +Chk_flags_plot <- Chk_Flags %>% dplyr::select(Std_ID, Plate, CHKs_Flag, Chk_Flag_pv) %>% group_by(Std_ID,Plate) %>% distinct(.keep_all = TRUE) %>% mutate(Check_Flag = ifelse(Chk_Flag_pv %like% "Good", "Good", "Bad")) + +H2S_Chks_bind <- rbind(H2S_CHKs_plot, H2S_Std_chkplot) + +H2S_Chks_bind_1 <- left_join(H2S_Chks_bind, Chk_flags_plot, by = join_by(Std_ID,Plate)) + +H2S_Chks_plot_bind_a <- H2S_Chks_bind_1 %>% mutate(Plot_ID = ifelse(IDs %like% "Chk" | IDs %like% "MC", substr(IDs, 4, 8), IDs)) %>% mutate(Plot_ID = ifelse(Plot_ID %like% "10pp", "Matrix: 10ppt", Plot_ID )) +H2S_Chks_plot_bind <-H2S_Chks_plot_bind_a %>% filter(str_detect(Type, "Check")) %>% mutate(Plot_ID =as.factor(Plot_ID)) + +Check_Val <- H2S_Chks_plot_bind_a %>% filter(!str_detect(Plot_ID, "Check")) %>% group_by(Plot_ID) %>% mutate(Z = mean(Mean_Abs)) %>% dplyr::select(Plot_ID, Z) %>% distinct(.keep_all = TRUE) %>% filter(!Plot_ID %like% "10pp") %>% mutate(Plot_ID = ifelse(Plot_ID %like% "Std 5", "Matrix: 10ppt", Plot_ID )) %>% mutate(Plot_ID = as.factor(Plot_ID)) + +#Plot Check Standards +H2S_chk_plot <- ggplot(data = H2S_Chks_plot_bind, aes(x = Plate, y = Mean_Abs)) + + geom_bar(stat = 'identity', + position = position_dodge2(preserve = "single"), linewidth = 0.75, aes(fill = Check_Flag)) + + geom_hline(data = Check_Val, aes(yintercept = Z), linetype = "dashed", linewidth = 1, color = "darkblue") + + facet_wrap(.~Plot_ID) + + ylim(0, max(H2S_Chks_plot_bind$Mean_Abs) + 0.2) + + geom_label_repel(data = Check_Val, aes( x = "Plate1", y = Z + 0.25), label = "Mean Target Arbsorbance", alpha = 0.7, color = "darkblue") + + scale_fill_manual(values = c("Good" = "darkgreen", "Bad" = "darkred")) + + theme_classic() + labs(x = " ", y = "Absorbance", title = + "Check Stds: H2S with Confidence Interval") + + theme(legend.position = "bottom", axis.text.x = element_text( + angle = 90, + vjust = 0.5, + hjust = 1)) + + +H2S_chk_plot + +``` + +## Display Any Check Flags +```{r, echo=FALSE} +Chk_Flag_1 <- Chk_Flags %>% dplyr::select(Plate, CHKs_Flag) %>% filter(CHKs_Flag != "Good") + +CHK_CV_Flag_1 <- Chk_Flags %>% dplyr::select(Plate, CHK_CV_Flags) %>% filter(CHK_CV_Flags != "Good") + +knitr::kable(Chk_Flag_1, format="markdown") + +knitr::kable(CHK_CV_Flag_1, format="markdown") + +``` + + +##Calculate Sulfide Concentrations & Add Concentration Flags +```{r Calculate Sulfide Concentrations,echo=FALSE,include=FALSE} + +High_Std <- H2S_STD_CV_fin %>% filter(IDs == "Std 5") %>% mutate(Mean_Abs = round(Mean_Abs, digits = 4)) %>% ungroup() %>% dplyr::select(Plate, Mean_Abs) %>% distinct(.keep_all = TRUE) %>% rename(High_DL = Mean_Abs) + +#filter out stds and other experiments +raw_data <- dat %>% + filter(!str_detect(IDs, "Std")) %>% + filter(!str_detect(IDs, "MC")) + +#Calculate Concentrations and fix zeroes/negative values and flag conc + +joined_data <- right_join(Std_crv_calc, raw_data, by = join_by(Plate)) + +calc_data <- joined_data %>% mutate(Conc = ((Abs - Int_Calc) / Slope_Calc)*Dilution) %>% mutate(Conc = ifelse(Conc <= 0, 0, Conc)) + +dl_data <- right_join(High_Std, calc_data, by = join_by(Plate)) + +``` + +##Remove High CV Samples and Average +```{r, echo=FALSE} + +#Calculate CVs +H2S_SPL_cv <- dl_data %>% group_by(Plate, IDs) %>% mutate(Mean_Conc = mean(Conc)) %>% mutate(Conc_SD = sd(Conc)) %>% mutate(CV = cv(Conc)) %>% mutate(CV_Flag = ifelse(CV >= cv_flag_stds, "CV_High", "CV_Good")) %>% mutate(Mean_Abs = mean(Abs)) %>% mutate(Conc_Flag = ifelse(Mean_Abs < MDL, "bdl", ifelse(Mean_Abs > High_DL, "adl", "Within_Range"))) %>% ungroup() + +#calculate new cv getting best cv from points if cv was high +H2S_SPL_cv_new <- H2S_SPL_cv %>% group_by(Plate, IDs) %>% + mutate(CV_New = map_dbl(row_number(), ~cv(Conc[-.x]))) %>% #Calculate CVs without 1 point + mutate(Removed = ifelse( #Choose Lowest CV if CV is high + CV_Flag == "CV_High", + ifelse( + CV_New == min(CV_New), + "RMVD", + "KEPT"), "CV_Good"), +CV2 = ifelse(CV_Flag == "CV_High", min(CV_New), CV), +Conc_rm = ifelse(Removed == "RMVD", NA, Conc)) %>% + mutate(Mean_Conc2 = mean(Conc_rm, na.rm = TRUE)) %>% + mutate(CV_Flag2 = ifelse(CV2 >= cv_flag_sample, "CV_High", "CV_Good")) %>% + mutate(Conc_SD2 = sd(Conc_rm, na.rm = TRUE)) %>% ungroup() + +H2S_SPL_CV_fin <- H2S_SPL_cv_new %>% dplyr::select(Plate, + Wells, + Conc, + Removed, + IDs, + Dilution, + Conc, + Mean_Conc2, + Conc_SD2, + CV2, + CV_Flag2, + Conc_Flag) %>% + mutate(Mean_Conc = Mean_Conc2, CV_Flag = CV_Flag2, SD_Conc = Conc_SD2, CV = CV2) %>% + dplyr::select(Plate, Conc, + Removed, + IDs, + Dilution, + Mean_Conc, + SD_Conc, + CV, + CV_Flag, + Conc_Flag) + +``` + +## Plot Samples +```{r, echo=FALSE} + +#Filter samples and mark reruns +H2S_Spl_pre_viz <- H2S_SPL_cv_new %>% mutate(IDs = toupper(IDs)) %>% + filter(grepl("^\\d{3}-", IDs)) %>% + filter(!str_detect(IDs, "DUP")) %>% + filter(!str_detect(IDs, "SPIKE")) %>% + dplyr::select(Plate, IDs, Mean_Conc, Conc_SD, CV_Flag) %>% distinct(.keep_all = TRUE) %>% mutate(IDs = ifelse(Plate %like% "rr", paste0(IDs, "_RR"), IDs)) %>% mutate(ForPlot = ifelse(row_number() <= 80, "A", "B")) + +#Plot Samples before corrections +H2S_Spl_Plot_Pre <- ggplot(H2S_Spl_pre_viz, aes(y = Mean_Conc, x = IDs, fill = CV_Flag)) + + geom_bar(stat = 'identity', + position = position_dodge2(), + linewidth = 0.75, + col = "white") + + scale_fill_manual(values = c( + "CV_Good" = "green2", + "CV_High" = "pink2" + )) + + labs(y = "Sulfide (uM)", x = "Sample ID") + + geom_errorbar( + aes(ymin = Mean_Conc - Conc_SD, ymax = Mean_Conc + Conc_SD), + width = 0.3, + position = position_dodge(.1) + ) + + theme_classic() + + facet_wrap(~ ForPlot ,, scale = "free_x", ncol = 1) + + theme(legend.position = "bottom", axis.text.x = element_text( + angle = 90, + vjust = 0.5, + hjust = 1) + ) + + ggtitle("Sample triplicate means and sd dev before bad reps removed") + + +H2S_Spl_Plot_Pre + +H2S_Spl_rmv_viz <- H2S_SPL_CV_fin %>% mutate(IDs = toupper(IDs)) %>% + filter(grepl("^\\d{3}-", IDs)) %>% + filter(!str_detect(IDs, "DUP")) %>% + filter(!str_detect(IDs, "SPIKE")) %>% + dplyr::select(Plate, IDs, Mean_Conc, SD_Conc, CV_Flag, Conc_Flag) %>% distinct(.keep_all = TRUE) %>% mutate(IDs = ifelse(Plate %like% "rr", paste0(IDs, "_RR"), IDs)) %>% mutate(ForPlot = ifelse(row_number() <= 80, "A", "B")) + +#Plot samples after Corrections +H2S_Spl_Plot_CV <- ggplot(H2S_Spl_rmv_viz, aes(y = Mean_Conc, x = IDs, fill = CV_Flag)) + + geom_bar(aes(col = Conc_Flag), stat = 'identity', + position = position_dodge(), + linewidth = 0.75) + + scale_fill_manual(values = c( + "CV_Good" = "green2", + "CV_High" = "pink2" + )) + + scale_color_manual(values = c("Within_Range" = "darkgreen", "adl" = "red3", "bdl" = "blue3" )) + + labs(y = "Sulfide (uM)", x = "Sample ID") + + geom_errorbar( + aes(ymin = Mean_Conc - SD_Conc, ymax = Mean_Conc + SD_Conc), + width = 0.3, + position = position_dodge(.1) + ) + + theme_classic() + + facet_wrap(~ForPlot, scales = "free_x", ncol = 1) + + theme(legend.position = "bottom", axis.text.x = element_text( + angle = 90, + vjust = 0.5, + hjust = 1), + strip.text = element_blank(), + strip.background = element_blank() + ) + + ggtitle("Sample triplicate means and sd dev after bad reps removed") + + +H2S_Spl_Plot_CV + + + +``` + + +## Duplicate QAQC + +```{r,echo=FALSE} + +#pull out any rows that have "Dup" in the ID column and tag reruns +DUP_start <- H2S_SPL_CV_fin %>% mutate(Dup_ID = gsub(" ", "", substr(IDs, 1, 6)), + Dup = ifelse(IDs %like% "Dup", "Dup", "Org")) %>% mutate(Dup_ID = ifelse(Plate %like% "rr", paste0(Dup_ID, "_RR"), Dup_ID)) + +#separate dups from originals and tag for pairing + +dups_only <- DUP_start %>% filter(Dup == "Dup") %>% dplyr::select(Dup_ID, Mean_Conc, SD_Conc, Plate) %>% rename(Dup_Conc = Mean_Conc, Dup_SD = SD_Conc) %>% distinct(.keep_all = TRUE) + +no_dups <- DUP_start %>% filter(!Dup == "Dup") + +dup_spls_l <- dups_only %>% dplyr::select(Dup_ID) %>% distinct(.keep_all = TRUE) + +dup_spls <- no_dups %>% filter(Dup_ID %in% as.vector(dup_spls_l$Dup_ID)) %>% dplyr::select(Dup_ID, Mean_Conc, SD_Conc, Plate, IDs) %>% distinct(.keep_all = TRUE) + +dup_join <- full_join(dups_only, dup_spls, by = join_by(Dup_ID, Plate)) %>% na.omit() + +#Calculate Percent difference and Flag +dup_flags <- dup_join %>% + mutate(Diff_P = (abs(100 * (Mean_Conc - Dup_Conc) / mean(c(Mean_Conc, Dup_Conc))))) %>% + mutate(Dup_Flag = ifelse(Diff_P >= dups_perc_diff, "Dup_Bad", "Dup_Good")) + +#oraganize data for flagging and plotting +dup_flags_1 <- dup_flags %>% dplyr::select(Dup_ID, Dup_Flag, Diff_P, Plate) + +Dup_for_plot_1 <- DUP_start %>% dplyr::select(Plate, Mean_Conc, Dup_ID, IDs) %>% distinct(.keep_all = TRUE) %>% filter(Dup_ID %in% as.vector(dup_spls_l$Dup_ID)) %>% + left_join(dup_flags_1, by = join_by(Dup_ID, Plate)) %>% + mutate(Dup = ifelse(IDs %like% "Dup", "Duplicate", "Original")) %>% + dplyr::select(-IDs, -Mean_Conc, -Dup) %>% distinct(.keep_all = TRUE) %>% na.omit + +#plot Data +Dup_Plot <- ggplot(Dup_for_plot_1, + aes( + x = Plate, + y = Diff_P + )) + + geom_bar( + aes(fill = Dup_Flag), + stat = 'identity', + position = position_dodge2(preserve = "single"), + linewidth = 0.9 + ) + + geom_label_repel(data = as.data.frame(1), aes(x = "Plate1", y=17.5), label= "Percent Difference Cutoff", color = "red3", alpha = 0.7) + + geom_hline(aes(yintercept = dups_perc_diff), linetype = "dashed", linewidth = 1.5, color = "red3") + + labs(y = "Percent Difference", x = "Sample ID") + + scale_fill_manual(values = c( + "Dup_Good" = "darkgreen", + "Dup_Bad" = "darkred" + )) + + theme_classic()+ + theme(legend.position = "bottom") + + ggtitle("H2S Duplicates") + +Dup_Plot + + +``` + +## Display Dup Flags + +```{r, echo=FALSE} +Dup_Flag_1 <- dup_flags %>% group_by(Plate) %>% mutate(Dup_Flags = ifelse("Dup_Bad" %in% Dup_Flag, "Dup_Bad", "Dup_Good")) %>% dplyr::select(Plate, Dup_Flags) %>% rename(Dup_Flag = Dup_Flags) %>% distinct(.keep_all = TRUE) + +Dup_Flags_1 <-Dup_Flag_1 %>% mutate(Dup_Flags = paste0(Dup_Flag, "-", Plate)) + +Dup_Flags_2 <- Dup_Flags_1 %>% dplyr::select(Plate, Dup_Flag) %>% group_by(Plate) %>% mutate(Duplicate_Flag = ifelse("Dup_Bad" %in% Dup_Flag, "Dup_Bad", "")) %>% dplyr::select(Plate, Duplicate_Flag) %>% rename(Dup_Flag = Duplicate_Flag) %>% distinct(.keep_all = TRUE) + +Bad_Dups <- dup_flags %>% filter(str_detect(Dup_Flag, "Dup_Bad")) + +Bad_D_N <- length(Bad_Dups$Dup_Flag) + +Total_D_N <- length(dup_flags$Dup_Flag) + +ifelse(Bad_D_N/Total_D_N > 0.4, paste0("<60% of Dups Pass, Rerun"), paste0(">60% Dups Pass") ) + +Duplicate_Flag <- ifelse(Bad_D_N/Total_D_N > 0.4, paste0(" >40% Dups Fail"), "" ) + +knitr::kable(Dup_Flag_1, format="markdown") + + +``` + +## Spike QAQC +```{r, echo=FALSE} +#pull out any rows that have "Spk" in the ID column +SPK_start <- H2S_SPL_CV_fin %>% mutate(Spk_ID = gsub(" ", "", substr(IDs, 1, 6)), + Spk = ifelse(IDs %like% "Spike", "Spk", "Org")) %>% mutate(Spk_ID = ifelse(Plate %like% "rr", paste0(Spk_ID, "_RR"), Spk_ID)) +#separate spikes from originals +spks_only <- SPK_start %>% filter(Spk == "Spk") %>% dplyr::select(Spk_ID, Mean_Conc, SD_Conc, Dilution, Plate) %>% rename(Spk_Conc = Mean_Conc, + Spk_SD = SD_Conc, + Spk_Dilution = Dilution) %>% distinct(.keep_all = TRUE) + +no_spks <- SPK_start %>% filter(!Spk == "Spk") + +spls_l <- no_spks %>% dplyr::select(Spk_ID) %>% distinct(.keep_all = TRUE) + +spk_spls_l <- spks_only %>% dplyr::select(Spk_ID) %>% distinct(.keep_all = TRUE) + +spk_spls <- no_spks %>% filter(Spk_ID %in% as.vector(spk_spls_l$Spk_ID)) %>% dplyr::select(Spk_ID, Mean_Conc, SD_Conc, Plate, IDs, Dilution) %>% distinct(.keep_all = TRUE) + +SPK_only <- spks_only %>% filter(Spk_ID %in% as.vector(spls_l$Spk_ID)) + +spk_join <- full_join(SPK_only, spk_spls, by = join_by(Spk_ID, Plate)) + +#Calculate recovery and flag data +spk_flags <- spk_join %>% mutate( + Spl_mol = (sample_vol / Con1) * (Mean_Conc / Dilution), + Spk_mol = ((sample_vol + spkvol) / Con1) * (Spk_Conc / Spk_Dilution), + Spk_exp = Spl_mol + spk_Conc, + Spk_recovery = (Spk_mol/Spk_exp) * 100) %>% + mutate( + Spk_Flag = ifelse( + Spk_recovery >= high_recovery_cutoff | + Spk_recovery <= low_recovery_cutoff, + "Spk_Bad", + "Spk_Good" + ) + ) + +#organize data for flagging and plotting +spk_flags_1 <- spk_flags %>% dplyr::select(Spk_ID, Spk_Flag, Spk_recovery, Plate) %>% na.omit() + +Spk_for_plot_a <- SPK_start %>% dplyr::select(Plate, Mean_Conc, Spk_ID, IDs) %>% + distinct(.keep_all = TRUE) %>% + filter(Spk_ID %in% as.vector(spk_spls_l$Spk_ID)) %>% + left_join(spk_flags_1, by = join_by(Spk_ID, Plate)) %>% + mutate(Spk = ifelse(IDs %like% "Spike", "Spike", "Original")) %>% + filter(Spk_ID %in% as.vector(spls_l$Spk_ID)) + +Spk_for_plot_1 <- Spk_for_plot_a %>% dplyr::select(Plate, Spk_ID, Spk_recovery, Spk_Flag) %>% na.omit() %>% distinct(.keep_all = TRUE) + +#plot data +Spk_Plot <- ggplot(Spk_for_plot_1, + aes( + x = Plate, + y = Spk_recovery + )) + + geom_rect(aes(xmin=0, xmax=Inf, ymin=low_recovery_cutoff, ymax=high_recovery_cutoff), alpha = 0.25, fill ="palegreen") + + geom_bar( aes(fill = Spk_Flag), + stat = 'identity', + position = position_dodge2(preserve = "single"), + linewidth = 0.9 + ) + + geom_hline(aes(yintercept = high_recovery_cutoff), linetype = "dashed", color = "green3", linewidth = 1.5) + + geom_hline(aes(yintercept = low_recovery_cutoff), linetype = "dashed", color = "green3", linewidth = 1.5) + + geom_label_repel(data = as.data.frame(1),aes(x = "Plate1", y=high_recovery_cutoff - 7.5), label= "Acceptable Recovery Range", color = "darkgreen", alpha = 0.7) + + labs(y = "Spike Recovery (%)", x = "Plate") + + scale_fill_manual(values = c( + "Spk_Good" = "darkgreen", + "Spk_Bad" = "darkred" + )) + + theme_classic() + + theme(legend.position = "bottom") + + ggtitle("H2S Spikes") + +Spk_Plot + + +``` + +## Display Spike Flags +```{r, echo=FALSE} + +#Check if all Spikes are paired +ifelse(all(as.vector(spk_spls_l$Spk_ID) %in% as.vector(spls_l$Spk_ID)), paste0("Spikes Paired"), paste0("Spike Missing Pair")) + +#Format Data frame +Spk_Flag_1 <- spk_flags %>% dplyr::select(Plate, IDs, Spk_Flag) %>% na.omit() + +#Attach Plate to Flag +Spk_Flags_1 <-Spk_Flag_1 %>% group_by(Plate) %>% mutate(Spk_Flags_T = ifelse( "Spk_Bad" %in% Spk_Flag, paste0("Spk_Bad"), paste0("Spk_Good"))) %>% mutate(Spk_Flags = paste0(Spk_Flags_T, "-", Plate))%>% ungroup() +#If any Spikes in Plate are bad, then flag plate +Spk_Flags_2 <- Spk_Flags_1 %>% dplyr::select(Plate, Spk_Flag) %>% group_by(Plate) %>% mutate(Spike_Flag = ifelse("Spk_Bad" %in% Spk_Flag, "Spk_Bad", "")) %>% dplyr::select(Plate, Spike_Flag) %>% rename(Spk_Flag = Spike_Flag) %>% distinct(.keep_all = TRUE) + +Spk_disp <- Spk_Flags_1 %>% dplyr::select(Plate, Spk_Flags_T) %>% rename(Spike_Flag = Spk_Flags_T) %>% distinct(.keep_all = TRUE) %>% na.omit() + +knitr::kable(Spk_disp, format="markdown") + +bad <- Spk_Flag_1 %>% filter(Spk_Flag %like% "Bad") + +length_bad <- length(as.vector(bad$Spk_Flag)) + +length_all <- length(as.vector(Spk_Flag_1$Spk_Flag)) + +ifelse(length_bad/length_all > 0.4, paste0("<60% of Spikes Pass, Rerun"), paste0("Spikes Pass") ) + +Spike_Flag <- ifelse(length_bad/length_all > 0.4, paste0(">40% Spikes Fail"), "" ) + +``` + + +## Merge samples with Metadata & check all samples are present +```{r check sample ids with metadata, echo=FALSE} +#Get Samples Only +H2S_spls_md <- H2S_SPL_CV_fin %>% mutate(IDs = toupper(IDs)) %>% + filter(grepl("^\\d{3}-", IDs)) %>% + filter(!str_detect(IDs, "DUP")) %>% + filter(!str_detect(IDs, "SPIKE")) + +#Check for reruns and replace +H2S_spl_rrn <- H2S_spls_md %>% + filter(Plate %like% "rr") %>% + dplyr::select(IDs, Mean_Conc, Conc_Flag) %>% + rename(RRN_Conc = Mean_Conc, Conc_Flag_rr = Conc_Flag) %>% + distinct(.keep_all = TRUE) + +RRN_IDs <- as.vector(H2S_spl_rrn$IDs) + +H2S_spl_og <- H2S_spls_md %>% + filter(!Plate %like% "rr") %>% + dplyr::select(IDs, Mean_Conc, Conc_Flag, Plate, CV_Flag, Dilution, CV) %>% + distinct(.keep_all = TRUE) %>% + mutate(Rerun = ifelse(IDs %in% RRN_IDs, "RRN", "Org")) + +H2S_spl_rr_join <- full_join(H2S_spl_rrn,H2S_spl_og, by = join_by(IDs) ) + +Samples_Tagged <- H2S_spl_rr_join %>% mutate( + Conc = ifelse(Rerun == "RRN", RRN_Conc, Mean_Conc), + Conc_Flag = ifelse(Rerun == "RRN", Conc_Flag_rr, Conc_Flag) +) %>% dplyr::select(IDs, Conc, Conc_Flag, CV_Flag, Plate, Dilution, CV) %>% rename(Sample_ID = IDs) %>% ungroup() %>% group_by(Sample_ID) %>% mutate( + Min_CV = ifelse(CV == min(CV), "KEEP", "RMV"), # get if CV is lowest of reruns + Within_Range = "Within_Range" %in% Conc_Flag, #Get if any are within range + BDL = "bdl" %in% Conc_Flag, #get if any are below detection limit + Max_Dil = max(Dilution), #get maximum dilution of reruns + Min_Dil = min(Dilution),#get minimum dilution of reruns + All_Good = all(Conc_Flag == "Within_Range") & all(CV_Flag == "CV_Good"), #get if all are within range and good cv + CV_Check = CV == min(CV[which(Dilution == Max_Dil)]), #Get if CV is lowest of highest dilution for reruns + Number = length(Conc) #get number of times ran +) %>% ungroup() %>% + mutate(Remove = ifelse(Number == 1, #check if sample was reran + "KEEP", + ifelse(All_Good, #check if multiple samples meet all criteria + ifelse(Min_CV == "KEEP", #Keep only lowest CV + "KEEP1", + "RMV1"), + ifelse(Conc_Flag == "Within_Range" & CV_Flag == "CV_Good", #If only one sample meets all criteria keep that one + "KEEP2", ifelse(Conc_Flag == "Within_Range", "KEEP2a", + ifelse(!(Within_Range) & BDL, #Check if none are within range but are under detection limit + ifelse(Dilution == Min_Dil, #keep lowest dilution + "KEEP3", + "RMV3"), + ifelse(!(Within_Range) & CV_Check, #if all are above detection limit keep lowest CV of highest dilution + "KEEP4", + "RMV4") + ) + ) + )))) + +Samples <- Samples_Tagged %>% filter(Remove %like% "KEEP") + +#check to see if all samples are present in the metadata +all_present <- all(metadata$Sample_Name %in% Samples$Sample_ID) + +if (all_present) { + message("All sample IDs are present in data") +} else { + message("Some sample IDs are missing from data.") + + # Optional: Which ones are missing? + missing_ids <- setdiff(metadata$Sample_Name, Samples$Sample_ID) + print(missing_ids) +} + + +#merge metadata with sample run data +merged_data <- metadata %>% + mutate(Sample_ID = paste0("\\b", Sample_ID, "\\b")) %>% + fuzzyjoin::regex_left_join(Samples, ., by = c(Sample_ID = "Sample_Name")) + +#might want to include a flag or something to see that all the samples are included? + +``` + + +##Add Flags +```{r, echo=FALSE} + +#Get only bad flags for each plate and check +Chk_Flags_All <- Chk_Flags %>% dplyr::select(Plate, CHKs_Flag) %>% filter(CHKs_Flag %like% "Bad") %>% na.omit() %>% distinct(.keep_all = TRUE) %>% group_by(Plate) %>% + summarise( + CHKSTD_Flags = paste(CHKs_Flag, collapse = ", "), + .groups = 'drop' # Drops the grouping structure after summarizing + ) + + +STD_Flags_All <- STD_CRV_flags %>% dplyr::select(Plate, R2_Flag, CV_Flag) %>% mutate(STDCV_Flags = paste0("STD", CV_Flag)) %>% dplyr::select(-CV_Flag) %>% mutate( + R2_Flag = ifelse(R2_Flag %like% "Good", NA, R2_Flag), + STDCV_Flags = ifelse(STDCV_Flags %like% "Good", NA, STDCV_Flags) +) %>% na.omit() + +Flags_Int <- tibble(Plate = c(plates)) + +#Join Flags + +Flags_Joined_1 <-left_join(Flags_Int, Dup_Flags_2, by = join_by(Plate)) + +Flags_Joined_2 <- left_join(Flags_Joined_1, Spk_Flags_2, by = join_by(Plate)) + +Flags_Joined_3 <- left_join(Flags_Joined_2, Chk_Flags_All, by = join_by(Plate)) + +Flags_Joined_4 <- left_join(Flags_Joined_3, STD_Flags_All, by = join_by(Plate)) + +Flags_Joined <- left_join(Flags_Joined_4, Curve_Flags_forJoin, by = join_by(Plate)) + + +Flags_Joined[Flags_Joined == "NA"] <- NA + +#Merge Flags into one column +Flags <- Flags_Joined %>% replace(is.na(.), "") %>% mutate( + H2S_Flags = paste0( + Spk_Flag, + " ", + Dup_Flag, + " ", + CHKSTD_Flags, + " ", + R2_Flag, + " ", + STDCV_Flags, + " ", + Slope_Flag, + " ", + Int_Flag + ) +) %>% dplyr::select(Plate, H2S_Flags) + +#Add Flags to data +flagged_data <- left_join(merged_data, Flags, by = join_by(Plate)) + + +df_all_clean <- flagged_data %>% dplyr::select(-Plate) + +``` + +##Organize Data +```{r, echo=FALSE} +#check results +#head(Samples) + +#pull out what we need + +df_all_clean_cols <- df_all_clean %>% + dplyr::select( + Site, + Project, + Year, + Month, + Community, + Nickname, + Plot, + Depth_cm, + CO2_Treatment, + Temp_Treatment, + Conc, + Conc_Flag, + CV_Flag, + H2S_Flags + ) + +final_data_labeled <- df_all_clean_cols %>% + mutate( + Run_notes = Run_notes,# new column with notes about the run + Analysis_rundate = Run_Date) + +#rename columns +org_labeled_fin_data <- final_data_labeled %>% + rename( + H2S_Conc_uM = Conc, + H2S_Conc_Flag = Conc_Flag, + H2S_CV_Flag = CV_Flag + ) + +#Order Columns for Final Data Frame +All_Clean_Data <- org_labeled_fin_data %>% + dplyr::select( + Site, + Project, + Year, + Month, + Community, + Nickname, + Plot, + Depth_cm, + CO2_Treatment, + Temp_Treatment, + H2S_Conc_uM, + H2S_Conc_Flag, + H2S_CV_Flag, + H2S_Flags, + Analysis_rundate, + Run_notes + ) +#head(Samples1) + +``` + + +## Visualize Data +```{r Visualize Data C3, fig.height=10, echo=FALSE} +cat("Visualize Data") + +### Ammonia +H2S_forplot <- All_Clean_Data + +#C3 plots +H2S_forplot_C3 <- H2S_forplot %>% + filter(Nickname == "C3") + +H2S_forplot_C3$Depth_cm <- + as.numeric(H2S_forplot_C3$Depth_cm) + +#group the data for plotting +H2S_forplot_C3 <- H2S_forplot_C3 %>% + group_by(Depth_cm) %>% + mutate(row_num = factor(row_number())) %>% # create row_num as factor per group + ungroup() %>% + mutate(Treatment = ifelse(Temp_Treatment == 0, ifelse(CO2_Treatment == "Ambient", "0 C + aCO2", "0 C + eCO2"), ifelse(Temp_Treatment == 1.7, "1.7 C + aCO2", ifelse(Temp_Treatment == 3.4, "3.4 C + aCO2", ifelse(Temp_Treatment == 5.1, ifelse(CO2_Treatment == "Ambient", "5.1 C + aCO2", "5.1 C + eCO2"), NA))))) + +#create plot +viz_H2S_plot_C3 <- ggplot(data = H2S_forplot_C3, aes( + x = as.factor(Temp_Treatment), + y = H2S_Conc_uM, + fill = as.factor(Treatment), + color = as.factor(Treatment) +)) + + geom_bar(stat = "identity", position = position_dodge2(padding = 0.4, preserve = c("total", "single"), )) + + facet_grid(as.numeric(Depth_cm) ~ ., scales = "free_x") + + scale_fill_manual( + values = c( + "0 C + aCO2" = "blue", + "1.7 C + aCO2" = "green", + "3.4 C + aCO2" = "orange", + "5.1 C + aCO2" = "red", + "0 C + eCO2" = "white", + "5.1 C + eCO2" = "white" + ), + name = "Treatment:", + breaks = c("0 C + aCO2", "1.7 C + aCO2", "3.4 C + aCO2", "5.1 C + aCO2", "0 C + eCO2", "5.1 C + eCO2"), + labels = c("0 C + aCO2", "1.7 C + aCO2", "3.4 C + aCO2", "5.1 C + aCO2", "0 C + eCO2", "5.1 C + eCO2") + ) + + scale_color_manual( + values = c( + "0 C + aCO2" = "blue", + "1.7 C + aCO2" = "green", + "3.4 C + aCO2" = "orange", + "5.1 C + aCO2" = "red", + "0 C + eCO2" = "blue", + "5.1 C + eCO2" = "red" + ), + name = "Treatment:", + breaks = c("0 C + aCO2", "1.7 C + aCO2", "3.4 C + aCO2", "5.1 C + aCO2", "0 C + eCO2", "5.1 C + eCO2"), + labels = c("0 C + aCO2", "1.7 C + aCO2", "3.4 C + aCO2", "5.1 C + aCO2", "0 C + eCO2", "5.1 C + eCO2") + ) + + theme_classic() + + labs( + x = " ", + y = "H2S (uM)", + title = "C3: Porewater H2S", + fill = "CO2 Treatment", + color = "+Temp. (C)" + ) + + theme(legend.position = "right") + + scale_x_discrete(drop = TRUE) + + theme( + axis.text.x = element_text(angle = 0, hjust = 0.5), + panel.border = element_rect( + color = "black", + fill = NA, + linewidth = 0.8), + legend.key = element_rect("black") + ) + + coord_flip() +print(viz_H2S_plot_C3) + +``` +\newpage +```{r Visualize Data C4, fig.height=10, echo=FALSE} +#C4 plots +H2S_forplot_C4 <- H2S_forplot %>% + filter(Nickname == "C4") + +H2S_forplot_C4$Depth_cm <- + as.numeric(H2S_forplot_C4$Depth_cm) + +#group the data for plotting +H2S_forplot_C4 <- H2S_forplot_C4 %>% + group_by(Depth_cm) %>% + mutate(row_num = factor(row_number())) %>% # create row_num as factor per group + ungroup() + +viz_H2S_plot_C4 <- ggplot(data = H2S_forplot_C4, aes( + x = as.factor(Temp_Treatment), + y = H2S_Conc_uM, + fill = as.factor(Temp_Treatment) +)) + + geom_bar(stat = "identity", position = position_dodge2(padding = 0.25, preserve = "single"), ) + + facet_grid(as.numeric(Depth_cm) ~ ., scales = "free_x") + + facet_grid(Depth_cm ~ ., scales = "free_x") + + scale_fill_manual(values = c( + "0" = "blue", + "1.7" = "green", + "3.4" = "orange", + "5.1" = "red" + )) + + + theme_classic() + + labs(x = " ", + y = "H2S (uM)", + title = "C4: Porewater H2S", + fill = "+Temp. (C)") + + theme(legend.position = "right") + + scale_x_discrete(drop = TRUE) + + theme( + axis.text.x = element_text(angle = 0, hjust = 0.5), + panel.border = element_rect( + color = "black", + fill = NA, + linewidth = 0.8 + ), + legend.key = element_rect("black") + + ) + + coord_flip() +print(viz_H2S_plot_C4) + +``` +\newpage +```{r Visualize Data by Rep C3, fig.height=8.5, echo=FALSE} + +#get replicate value and treatment info +H2S_forplot_C3 <- H2S_forplot_C3 %>% + mutate(Replicate = str_sub(Plot, 2, 2)) %>% + mutate(Treatment1 = ifelse( + Temp_Treatment == 0, + ifelse(CO2_Treatment == "Ambient", "+ 0 C", "eCO2 + 0 C"), + ifelse( + Temp_Treatment == 1.7, + "+ 1.7 C", + ifelse( + Temp_Treatment == 3.4, + "+ 3.4 C", + ifelse( + Temp_Treatment == 5.1, + ifelse(CO2_Treatment == "Ambient", "+ 5.1 C", "eCO2 + 5.1 C"), + NA + ) + ) + ) + )) + +#ensure points are in correct order +H2S_forplot_C3 <- H2S_forplot_C3[order(H2S_forplot_C3$Depth_cm), ] + +#make plot +viz_H2S_plot_C3_2 <- ggplot(data = H2S_forplot_C3, + aes(x = H2S_Conc_uM, y = Depth_cm, color = Replicate)) + + geom_point(size = 3) + + geom_path(size = 1) + + scale_color_manual(values = c( + "1" = "#FFD500", + "2" = "#00D0FF", + "3" = "#FF0075" + )) + + facet_grid(factor( + Treatment1, + levels = c("eCO2 + 0 C", "+ 0 C", "+ 1.7 C", "+ 3.4 C", "+ 5.1 C", "eCO2 + 5.1 C") + ) ~ ., scales = "free_x") + + labs(x = "H2S (uM)", + y = "Depth (cm)", + title = "C3: Porewater H2S by Replicate") + + scale_y_reverse(breaks = c(10, 20, 40, 80, 120), + limits = c(125, 5)) + + theme_classic() + + theme( + axis.text.x = element_text(angle = 0, hjust = 0.5), + panel.border = element_rect( + color = "black", + fill = NA, + linewidth = 0.8 + ) + ) + +viz_H2S_plot_C3_2 + +``` +\newpage + +```{r Visualize Data by Rep C4, fig.height=5.7, echo=FALSE} + +#get replicate value and treatment info +H2S_forplot_C4 <- H2S_forplot_C4 %>% + mutate(Replicate = str_sub(Plot, 2, 2)) %>% + mutate(Treatment1 = ifelse( + Temp_Treatment == 0, + ifelse(CO2_Treatment == "Ambient", "+ 0 C", "eCO2 + 0 C"), + ifelse( + Temp_Treatment == 1.7, + "+ 1.7 C", + ifelse( + Temp_Treatment == 3.4, + "+ 3.4 C", + ifelse( + Temp_Treatment == 5.1, + ifelse(CO2_Treatment == "Ambient", "+ 5.1 C", "eCO2 + 5.1 C"), + NA + ) + ) + ) + )) + +#make sure point are in correct order +H2S_forplot_C4 <- H2S_forplot_C4[order(H2S_forplot_C4$Depth_cm), ] + +#make plot +viz_H2S_plot_C4_2 <- ggplot(data = H2S_forplot_C4, + aes(x = H2S_Conc_uM, y = Depth_cm, color = Replicate)) + + geom_point(size = 3) + + geom_path(size = 1) + + scale_color_manual(values = c( + "4" = "#FFD500", + "5" = "#00D0FF", + "6" = "#FF0075" + )) + + facet_grid(factor(Treatment1, levels = c("+ 0 C", "+ 1.7 C", "+ 3.4 C", "+ 5.1 C")) ~ + ., scales = "free_x") + + labs(x = "H2S (uM)", + y = "Depth (cm)", + title = "C4: Porewater H2S by Replicate") + + scale_y_reverse(breaks = c(10, 20, 40, 80, 120), + limits = c(125, 5)) + + theme_classic() + + theme( + axis.text.x = element_text(angle = 0, hjust = 0.5), + panel.border = element_rect( + color = "black", + fill = NA, + linewidth = 0.8 + ) + ) + +viz_H2S_plot_C4_2 + +``` + + +##Export Data +```{r, echo=FALSE} +write.csv(unique_log, log_path) + Rerun_Data <- All_Clean_Data %>% filter(H2S_Conc_Flag != "Within Range" | H2S_CV_Flag %like% "High") + +if(After_Reruns == "YES"){ + write.csv(All_Clean_Data, final_path)} else { + write.csv(Rerun_Data, rerun_path) } +#end +``` + + +### END \ No newline at end of file diff --git a/SMARTX/Porewater/Sulfide/2026/Processed Data/GCReW_SMARTX_Porewater_H2S_202605.csv b/SMARTX/Porewater/Sulfide/2026/Processed Data/GCReW_SMARTX_Porewater_H2S_202605.csv new file mode 100644 index 0000000..a3eddcd --- /dev/null +++ b/SMARTX/Porewater/Sulfide/2026/Processed Data/GCReW_SMARTX_Porewater_H2S_202605.csv @@ -0,0 +1,151 @@ +"","Site","Project","Year","Month","Community","Nickname","Plot","Depth_cm","CO2_Treatment","Temp_Treatment","H2S_Conc_uM","H2S_Conc_Flag","H2S_CV_Flag","H2S_Flags","Analysis_rundate","Run_notes" +"1","GCReW","SMARTX","2026","May","SPPA, DISP","C4","462",10,"Ambient",3.4,87.4753623188406,"Within_Range","CV_Good","Spk_Bad ",2026-05-19,"" +"2","GCReW","SMARTX","2026","May","SPPA, DISP","C4","442",120,"Ambient",3.4,4877.97101449275,"Within_Range","CV_High","Spk_Bad Std5Chk_Bad ",2026-05-19,"" +"3","GCReW","SMARTX","2026","May","SCAM","C3","321",20,"Ambient",1.7,3266.3768115942,"Within_Range","CV_High","Spk_Bad Std5Chk_Bad ",2026-05-19,"" +"4","GCReW","SMARTX","2026","May","SCAM","C3","323",20,"Ambient",5.1,2733.04347826087,"Within_Range","CV_High","Spk_Bad Std5Chk_Bad Slope_Bad ",2026-05-19,"" +"5","GCReW","SMARTX","2026","May","SCAM","C3","331",10,"Ambient",1.7,836.521739130435,"Within_Range","CV_High","Spk_Bad Std5Chk_Bad ",2026-05-19,"" +"6","GCReW","SMARTX","2026","May","SCAM","C3","323",80,"Ambient",5.1,3763.47826086957,"Within_Range","CV_High","Spk_Bad Std5Chk_Bad Slope_Bad ",2026-05-19,"" +"7","GCReW","SMARTX","2026","May","SCAM","C3","613",80,"Elevated",5.1,3372.17391304348,"Within_Range","CV_High","Spk_Bad Std5Chk_Bad, Std4Chk_Bad Intercept_Bad",2026-05-19,"" +"8","GCReW","SMARTX","2026","May","SCAM","C3","633",10,"Elevated",5.1,1159.13043478261,"Within_Range","CV_High","Spk_Bad Std3Chk_Bad, Std5Chk_Bad Intercept_Bad",2026-05-19,"" +"9","GCReW","SMARTX","2026","May","SCAM","C3","633",40,"Elevated",5.1,3515.65217391304,"Within_Range","CV_High","Spk_Bad Std3Chk_Bad, Std5Chk_Bad Intercept_Bad",2026-05-19,"" +"10","GCReW","SMARTX","2026","May","SPPA, DISP","C4","461",10,"Ambient",1.7,290.869565217391,"Within_Range","CV_High","Spk_Bad ",2026-05-19,"" +"11","GCReW","SMARTX","2026","May","SCAM","C3","323",10,"Ambient",5.1,663.478260869565,"Within_Range","CV_High","Spk_Bad Std5Chk_Bad ",2026-05-19,"" +"12","GCReW","SMARTX","2026","May","SCAM","C3","610",20,"Elevated",0,991.322314049587,"Within_Range","CV_Good","Spk_Bad Dup_Bad Std3Chk_Bad ",2026-05-19,"" +"13","GCReW","SMARTX","2026","May","SCAM","C3","310",120,"Ambient",0,2688.29201101928,"Within_Range","CV_Good","Spk_Bad Dup_Bad Std3Chk_Bad ",2026-05-19,"" +"14","GCReW","SMARTX","2026","May","SCAM","C3","311",120,"Ambient",1.7,4330.1652892562,"Within_Range","CV_Good","Spk_Bad Dup_Bad Std3Chk_Bad ",2026-05-19,"" +"15","GCReW","SMARTX","2026","May","SCAM","C3","610",40,"Elevated",0,1313.63636363636,"Within_Range","CV_Good","Spk_Bad Dup_Bad Std3Chk_Bad ",2026-05-19,"" +"16","GCReW","SMARTX","2026","May","SCAM","C3","312",10,"Ambient",3.4,1079.47658402204,"Within_Range","CV_Good","Spk_Bad Dup_Bad Std3Chk_Bad ",2026-05-19,"" +"17","GCReW","SMARTX","2026","May","SCAM","C3","610",80,"Elevated",0,1754.40771349862,"Within_Range","CV_Good","Spk_Bad Dup_Bad Std3Chk_Bad ",2026-05-19,"" +"18","GCReW","SMARTX","2026","May","SCAM","C3","312",20,"Ambient",3.4,3253.0303030303,"Within_Range","CV_Good","Spk_Bad Dup_Bad Std3Chk_Bad ",2026-05-19,"" +"19","GCReW","SMARTX","2026","May","SCAM","C3","610",120,"Elevated",0,1784.71074380165,"Within_Range","CV_Good","Spk_Bad Dup_Bad Std3Chk_Bad ",2026-05-19,"" +"20","GCReW","SMARTX","2026","May","SCAM","C3","310",10,"Ambient",0,648.347107438017,"Within_Range","CV_Good","Spk_Bad Dup_Bad Std3Chk_Bad ",2026-05-19,"" +"21","GCReW","SMARTX","2026","May","SCAM","C3","311",10,"Ambient",1.7,1129.06336088154,"Within_Range","CV_Good","Spk_Bad Dup_Bad Std3Chk_Bad ",2026-05-19,"" +"22","GCReW","SMARTX","2026","May","SCAM","C3","310",20,"Ambient",0,1086.36363636364,"Within_Range","CV_Good","Spk_Bad Dup_Bad Std3Chk_Bad ",2026-05-19,"" +"23","GCReW","SMARTX","2026","May","SCAM","C3","311",20,"Ambient",1.7,2153.8567493113,"Within_Range","CV_Good","Spk_Bad Dup_Bad Std3Chk_Bad ",2026-05-19,"" +"24","GCReW","SMARTX","2026","May","SCAM","C3","310",40,"Ambient",0,1945.86776859504,"Within_Range","CV_Good","Spk_Bad Dup_Bad Std3Chk_Bad ",2026-05-19,"" +"25","GCReW","SMARTX","2026","May","SCAM","C3","311",40,"Ambient",1.7,2831.54269972452,"Within_Range","CV_Good","Spk_Bad Dup_Bad Std3Chk_Bad ",2026-05-19,"" +"26","GCReW","SMARTX","2026","May","SCAM","C3","610",10,"Elevated",0,465.151515151515,"bdl","CV_Good","Spk_Bad Dup_Bad Std3Chk_Bad ",2026-05-19,"" +"27","GCReW","SMARTX","2026","May","SCAM","C3","310",80,"Ambient",0,1768.18181818182,"Within_Range","CV_Good","Spk_Bad Dup_Bad Std3Chk_Bad ",2026-05-19,"" +"28","GCReW","SMARTX","2026","May","SCAM","C3","311",80,"Ambient",1.7,4545.04132231405,"Within_Range","CV_Good","Spk_Bad Dup_Bad Std3Chk_Bad ",2026-05-19,"" +"29","GCReW","SMARTX","2026","May","SCAM","C3","312",80,"Ambient",3.4,4478.92561983471,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad, Std4Chk_Bad Intercept_Bad",2026-05-19,"" +"30","GCReW","SMARTX","2026","May","SCAM","C3","613",20,"Elevated",5.1,2765.42699724518,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad, Std4Chk_Bad Intercept_Bad",2026-05-19,"" +"31","GCReW","SMARTX","2026","May","SCAM","C3","620",20,"Elevated",0,1826.03305785124,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad, Std4Chk_Bad Intercept_Bad",2026-05-19,"" +"32","GCReW","SMARTX","2026","May","SCAM","C3","312",120,"Ambient",3.4,2798.48484848485,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad, Std4Chk_Bad Intercept_Bad",2026-05-19,"" +"33","GCReW","SMARTX","2026","May","SCAM","C3","620",40,"Elevated",0,2770.93663911846,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad, Std4Chk_Bad Intercept_Bad",2026-05-19,"" +"34","GCReW","SMARTX","2026","May","SCAM","C3","313",10,"Ambient",5.1,1578.09917355372,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad, Std4Chk_Bad Intercept_Bad",2026-05-19,"" +"35","GCReW","SMARTX","2026","May","SCAM","C3","620",80,"Elevated",0,1776.44628099174,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad, Std4Chk_Bad Intercept_Bad",2026-05-19,"" +"36","GCReW","SMARTX","2026","May","SCAM","C3","313",20,"Ambient",5.1,2883.88429752066,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad, Std4Chk_Bad Intercept_Bad",2026-05-19,"" +"37","GCReW","SMARTX","2026","May","SCAM","C3","313",40,"Ambient",5.1,3297.10743801653,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad, Std4Chk_Bad Intercept_Bad",2026-05-19,"" +"38","GCReW","SMARTX","2026","May","SCAM","C3","613",40,"Elevated",5.1,3412.80991735537,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad, Std4Chk_Bad Intercept_Bad",2026-05-19,"" +"39","GCReW","SMARTX","2026","May","SCAM","C3","313",80,"Ambient",5.1,2443.1129476584,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad, Std4Chk_Bad Intercept_Bad",2026-05-19,"" +"40","GCReW","SMARTX","2026","May","SCAM","C3","313",120,"Ambient",5.1,2586.36363636364,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad, Std4Chk_Bad Intercept_Bad",2026-05-19,"" +"41","GCReW","SMARTX","2026","May","SCAM","C3","613",120,"Elevated",5.1,2421.07438016529,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad, Std4Chk_Bad Intercept_Bad",2026-05-19,"" +"42","GCReW","SMARTX","2026","May","SCAM","C3","312",40,"Ambient",3.4,3024.38016528926,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad, Std4Chk_Bad Intercept_Bad",2026-05-19,"" +"43","GCReW","SMARTX","2026","May","SCAM","C3","613",10,"Elevated",5.1,1291.59779614325,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad, Std4Chk_Bad Intercept_Bad",2026-05-19,"" +"44","GCReW","SMARTX","2026","May","SCAM","C3","620",10,"Elevated",0,861.845730027548,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad, Std4Chk_Bad Intercept_Bad",2026-05-19,"" +"45","GCReW","SMARTX","2026","May","SCAM","C3","320",10,"Ambient",0,834.297520661157,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad ",2026-05-19,"" +"46","GCReW","SMARTX","2026","May","SCAM","C3","321",80,"Ambient",1.7,4247.52066115702,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad ",2026-05-19,"" +"47","GCReW","SMARTX","2026","May","SCAM","C3","322",80,"Ambient",3.4,3415.56473829201,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad ",2026-05-19,"" +"48","GCReW","SMARTX","2026","May","SCAM","C3","320",20,"Ambient",0,1268.18181818182,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad ",2026-05-19,"" +"49","GCReW","SMARTX","2026","May","SCAM","C3","322",120,"Ambient",3.4,5073.96694214876,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad ",2026-05-19,"" +"50","GCReW","SMARTX","2026","May","SCAM","C3","320",40,"Ambient",0,1706.19834710744,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad ",2026-05-19,"" +"51","GCReW","SMARTX","2026","May","SCAM","C3","320",80,"Ambient",0,3045.04132231405,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad ",2026-05-19,"" +"52","GCReW","SMARTX","2026","May","SCAM","C3","320",120,"Ambient",0,1549.17355371901,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad ",2026-05-19,"" +"53","GCReW","SMARTX","2026","May","SCAM","C3","321",120,"Ambient",1.7,3186.91460055096,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad ",2026-05-19,"" +"54","GCReW","SMARTX","2026","May","SCAM","C3","321",10,"Ambient",1.7,1218.59504132231,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad ",2026-05-19,"" +"55","GCReW","SMARTX","2026","May","SCAM","C3","322",10,"Ambient",3.4,838.429752066116,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad ",2026-05-19,"" +"56","GCReW","SMARTX","2026","May","SCAM","C3","322",20,"Ambient",3.4,1759.9173553719,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad ",2026-05-19,"" +"57","GCReW","SMARTX","2026","May","SCAM","C3","620",120,"Elevated",0,1792.97520661157,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad ",2026-05-19,"" +"58","GCReW","SMARTX","2026","May","SCAM","C3","321",40,"Ambient",1.7,2930.71625344353,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad ",2026-05-19,"" +"59","GCReW","SMARTX","2026","May","SCAM","C3","322",40,"Ambient",3.4,4156.61157024793,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad ",2026-05-19,"" +"60","GCReW","SMARTX","2026","May","SCAM","C3","323",40,"Ambient",5.1,3558.81542699725,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad Slope_Bad ",2026-05-19,"" +"61","GCReW","SMARTX","2026","May","SCAM","C3","630",10,"Elevated",0,393.526170798898,"bdl","CV_Good","Spk_Bad Std5Chk_Bad Slope_Bad ",2026-05-19,"" +"62","GCReW","SMARTX","2026","May","SCAM","C3","330",10,"Ambient",0,309.504132231405,"bdl","CV_Good","Spk_Bad Std5Chk_Bad Slope_Bad ",2026-05-19,"" +"63","GCReW","SMARTX","2026","May","SCAM","C3","330",20,"Ambient",0,1781.95592286501,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad Slope_Bad ",2026-05-19,"" +"64","GCReW","SMARTX","2026","May","SCAM","C3","323",120,"Ambient",5.1,3134.57300275482,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad Slope_Bad ",2026-05-19,"" +"65","GCReW","SMARTX","2026","May","SCAM","C3","330",40,"Ambient",0,1970.66115702479,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad Slope_Bad ",2026-05-19,"" +"66","GCReW","SMARTX","2026","May","SCAM","C3","623",10,"Elevated",5.1,597.382920110193,"bdl","CV_Good","Spk_Bad Std5Chk_Bad Slope_Bad ",2026-05-19,"" +"67","GCReW","SMARTX","2026","May","SCAM","C3","623",20,"Elevated",5.1,1352.20385674931,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad Slope_Bad ",2026-05-19,"" +"68","GCReW","SMARTX","2026","May","SCAM","C3","630",20,"Elevated",0,1007.85123966942,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad Slope_Bad ",2026-05-19,"" +"69","GCReW","SMARTX","2026","May","SCAM","C3","623",40,"Elevated",5.1,1660.74380165289,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad Slope_Bad ",2026-05-19,"" +"70","GCReW","SMARTX","2026","May","SCAM","C3","630",40,"Elevated",0,3443.1129476584,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad Slope_Bad ",2026-05-19,"" +"71","GCReW","SMARTX","2026","May","SCAM","C3","623",80,"Elevated",5.1,3929.33884297521,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad Slope_Bad ",2026-05-19,"" +"72","GCReW","SMARTX","2026","May","SCAM","C3","630",80,"Elevated",0,1669.00826446281,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad Slope_Bad ",2026-05-19,"" +"73","GCReW","SMARTX","2026","May","SCAM","C3","623",120,"Elevated",5.1,3613.91184573003,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad Slope_Bad ",2026-05-19,"" +"74","GCReW","SMARTX","2026","May","SCAM","C3","630",120,"Elevated",0,613.911845730028,"bdl","CV_Good","Spk_Bad Std5Chk_Bad Slope_Bad ",2026-05-19,"" +"75","GCReW","SMARTX","2026","May","SCAM","C3","330",120,"Ambient",0,3365.97796143251,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad ",2026-05-19,"" +"76","GCReW","SMARTX","2026","May","SCAM","C3","332",40,"Ambient",3.4,6330.1652892562,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad ",2026-05-19,"" +"77","GCReW","SMARTX","2026","May","SCAM","C3","333",40,"Ambient",5.1,3983.05785123967,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad ",2026-05-19,"" +"78","GCReW","SMARTX","2026","May","SCAM","C3","333",80,"Ambient",5.1,3820.52341597796,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad ",2026-05-19,"" +"79","GCReW","SMARTX","2026","May","SCAM","C3","331",20,"Ambient",1.7,2462.39669421488,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad ",2026-05-19,"" +"80","GCReW","SMARTX","2026","May","SCAM","C3","333",120,"Ambient",5.1,3564.32506887052,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad ",2026-05-19,"" +"81","GCReW","SMARTX","2026","May","SCAM","C3","331",40,"Ambient",1.7,4276.44628099174,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad ",2026-05-19,"" +"82","GCReW","SMARTX","2026","May","SCAM","C3","331",80,"Ambient",1.7,4483.05785123967,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad ",2026-05-19,"" +"83","GCReW","SMARTX","2026","May","SCAM","C3","332",80,"Ambient",3.4,5029.88980716253,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad ",2026-05-19,"" +"84","GCReW","SMARTX","2026","May","SCAM","C3","331",120,"Ambient",1.7,5247.52066115703,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad ",2026-05-19,"" +"85","GCReW","SMARTX","2026","May","SCAM","C3","332",120,"Ambient",3.4,6253.0303030303,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad ",2026-05-19,"" +"86","GCReW","SMARTX","2026","May","SCAM","C3","332",10,"Ambient",3.4,1437.60330578512,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad ",2026-05-19,"" +"87","GCReW","SMARTX","2026","May","SCAM","C3","333",10,"Ambient",5.1,2169.00826446281,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad ",2026-05-19,"" +"88","GCReW","SMARTX","2026","May","SCAM","C3","330",80,"Ambient",0,2916.94214876033,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad ",2026-05-19,"" +"89","GCReW","SMARTX","2026","May","SCAM","C3","332",20,"Ambient",3.4,2768.18181818182,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad ",2026-05-19,"" +"90","GCReW","SMARTX","2026","May","SCAM","C3","333",20,"Ambient",5.1,3892.14876033058,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad ",2026-05-19,"" +"91","GCReW","SMARTX","2026","May","SCAM","C3","633",20,"Elevated",5.1,3674.51790633609,"Within_Range","CV_Good","Spk_Bad Std3Chk_Bad, Std5Chk_Bad Intercept_Bad",2026-05-19,"" +"92","GCReW","SMARTX","2026","May","SPPA, DISP","C4","440",120,"Ambient",0,3175.89531680441,"Within_Range","CV_Good","Spk_Bad Std3Chk_Bad, Std5Chk_Bad Intercept_Bad",2026-05-19,"" +"93","GCReW","SMARTX","2026","May","SPPA, DISP","C4","441",120,"Ambient",1.7,4068.45730027548,"Within_Range","CV_Good","Spk_Bad Std3Chk_Bad, Std5Chk_Bad Intercept_Bad",2026-05-19,"" +"94","GCReW","SMARTX","2026","May","SCAM","C3","633",80,"Elevated",5.1,4011.98347107438,"Within_Range","CV_Good","Spk_Bad Std3Chk_Bad, Std5Chk_Bad Intercept_Bad",2026-05-19,"" +"95","GCReW","SMARTX","2026","May","SCAM","C3","633",120,"Elevated",5.1,3977.54820936639,"Within_Range","CV_Good","Spk_Bad Std3Chk_Bad, Std5Chk_Bad Intercept_Bad",2026-05-19,"" +"96","GCReW","SMARTX","2026","May","SPPA, DISP","C4","440",10,"Ambient",0,127.685950413223,"bdl","CV_Good","Spk_Bad Std3Chk_Bad, Std5Chk_Bad Intercept_Bad",2026-05-19,"" +"97","GCReW","SMARTX","2026","May","SPPA, DISP","C4","441",10,"Ambient",1.7,1082.23140495868,"Within_Range","CV_Good","Spk_Bad Std3Chk_Bad, Std5Chk_Bad Intercept_Bad",2026-05-19,"" +"98","GCReW","SMARTX","2026","May","SPPA, DISP","C4","440",20,"Ambient",0,1757.16253443526,"Within_Range","CV_Good","Spk_Bad Std3Chk_Bad, Std5Chk_Bad Intercept_Bad",2026-05-19,"" +"99","GCReW","SMARTX","2026","May","SPPA, DISP","C4","441",20,"Ambient",1.7,1489.94490358127,"Within_Range","CV_Good","Spk_Bad Std3Chk_Bad, Std5Chk_Bad Intercept_Bad",2026-05-19,"" +"100","GCReW","SMARTX","2026","May","SPPA, DISP","C4","440",40,"Ambient",0,3326.03305785124,"Within_Range","CV_Good","Spk_Bad Std3Chk_Bad, Std5Chk_Bad Intercept_Bad",2026-05-19,"" +"101","GCReW","SMARTX","2026","May","SPPA, DISP","C4","441",40,"Ambient",1.7,3178.65013774105,"Within_Range","CV_Good","Spk_Bad Std3Chk_Bad, Std5Chk_Bad Intercept_Bad",2026-05-19,"" +"102","GCReW","SMARTX","2026","May","SPPA, DISP","C4","440",80,"Ambient",0,1870.11019283747,"Within_Range","CV_Good","Spk_Bad Std3Chk_Bad, Std5Chk_Bad Intercept_Bad",2026-05-19,"" +"103","GCReW","SMARTX","2026","May","SPPA, DISP","C4","441",80,"Ambient",1.7,2988.56749311295,"Within_Range","CV_Good","Spk_Bad Std3Chk_Bad, Std5Chk_Bad Intercept_Bad",2026-05-19,"" +"104","GCReW","SMARTX","2026","May","SPPA, DISP","C4","442",20,"Ambient",3.4,937.603305785124,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad ",2026-05-19,"" +"105","GCReW","SMARTX","2026","May","SPPA, DISP","C4","443",120,"Ambient",5.1,4156.61157024793,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad ",2026-05-19,"" +"106","GCReW","SMARTX","2026","May","SPPA, DISP","C4","450",120,"Ambient",0,3930.71625344353,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad ",2026-05-19,"" +"107","GCReW","SMARTX","2026","May","SPPA, DISP","C4","442",40,"Ambient",3.4,2988.56749311295,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad ",2026-05-19,"" +"108","GCReW","SMARTX","2026","May","SPPA, DISP","C4","451",10,"Ambient",1.7,652.479338842975,"bdl","CV_Good","Spk_Bad Std5Chk_Bad ",2026-05-19,"" +"109","GCReW","SMARTX","2026","May","SPPA, DISP","C4","442",80,"Ambient",3.4,5094.62809917355,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad ",2026-05-19,"" +"110","GCReW","SMARTX","2026","May","SPPA, DISP","C4","451",20,"Ambient",1.7,1425.20661157025,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad ",2026-05-19,"" +"111","GCReW","SMARTX","2026","May","SPPA, DISP","C4","443",10,"Ambient",5.1,1536.77685950413,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad ",2026-05-19,"" +"112","GCReW","SMARTX","2026","May","SPPA, DISP","C4","450",10,"Ambient",0,195.179063360882,"bdl","CV_Good","Spk_Bad Std5Chk_Bad ",2026-05-19,"" +"113","GCReW","SMARTX","2026","May","SPPA, DISP","C4","443",20,"Ambient",5.1,2963.7741046832,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad ",2026-05-19,"" +"114","GCReW","SMARTX","2026","May","SPPA, DISP","C4","450",20,"Ambient",0,478.925619834711,"bdl","CV_Good","Spk_Bad Std5Chk_Bad ",2026-05-19,"" +"115","GCReW","SMARTX","2026","May","SPPA, DISP","C4","443",40,"Ambient",5.1,4211.70798898072,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad ",2026-05-19,"" +"116","GCReW","SMARTX","2026","May","SPPA, DISP","C4","450",40,"Ambient",0,2867.35537190083,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad ",2026-05-19,"" +"117","GCReW","SMARTX","2026","May","SPPA, DISP","C4","442",10,"Ambient",3.4,558.815426997245,"bdl","CV_Good","Spk_Bad Std5Chk_Bad ",2026-05-19,"" +"118","GCReW","SMARTX","2026","May","SPPA, DISP","C4","443",80,"Ambient",5.1,3613.91184573003,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad ",2026-05-19,"" +"119","GCReW","SMARTX","2026","May","SPPA, DISP","C4","450",80,"Ambient",0,3622.17630853995,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad ",2026-05-19,"" +"120","GCReW","SMARTX","2026","May","SPPA, DISP","C4","451",80,"Ambient",1.7,4225.48209366391,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad ",2026-05-19,"" +"121","GCReW","SMARTX","2026","May","SPPA, DISP","C4","453",20,"Ambient",5.1,2129.06336088154,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad ",2026-05-19,"" +"122","GCReW","SMARTX","2026","May","SPPA, DISP","C4","460",20,"Ambient",0,1346.69421487603,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad ",2026-05-19,"" +"123","GCReW","SMARTX","2026","May","SPPA, DISP","C4","451",120,"Ambient",1.7,4622.17630853995,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad ",2026-05-19,"" +"124","GCReW","SMARTX","2026","May","SPPA, DISP","C4","460",40,"Ambient",0,3043.66391184573,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad ",2026-05-19,"" +"125","GCReW","SMARTX","2026","May","SPPA, DISP","C4","452",10,"Ambient",3.4,288.842975206612,"bdl","CV_Good","Spk_Bad Std5Chk_Bad ",2026-05-19,"" +"126","GCReW","SMARTX","2026","May","SPPA, DISP","C4","460",80,"Ambient",0,4343.93939393939,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad ",2026-05-19,"" +"127","GCReW","SMARTX","2026","May","SPPA, DISP","C4","452",20,"Ambient",3.4,988.567493112948,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad ",2026-05-19,"" +"128","GCReW","SMARTX","2026","May","SPPA, DISP","C4","452",40,"Ambient",3.4,3507.85123966942,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad ",2026-05-19,"" +"129","GCReW","SMARTX","2026","May","SPPA, DISP","C4","453",40,"Ambient",5.1,3156.61157024793,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad ",2026-05-19,"" +"130","GCReW","SMARTX","2026","May","SPPA, DISP","C4","452",80,"Ambient",3.4,4815.01377410468,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad ",2026-05-19,"" +"131","GCReW","SMARTX","2026","May","SPPA, DISP","C4","453",80,"Ambient",5.1,2925.20661157025,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad ",2026-05-19,"" +"132","GCReW","SMARTX","2026","May","SPPA, DISP","C4","452",120,"Ambient",3.4,4572.58953168044,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad ",2026-05-19,"" +"133","GCReW","SMARTX","2026","May","SPPA, DISP","C4","453",120,"Ambient",5.1,2399.03581267218,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad ",2026-05-19,"" +"134","GCReW","SMARTX","2026","May","SPPA, DISP","C4","451",40,"Ambient",1.7,3649.72451790634,"Within_Range","CV_Good","Spk_Bad Std5Chk_Bad ",2026-05-19,"" +"135","GCReW","SMARTX","2026","May","SPPA, DISP","C4","460",10,"Ambient",0,297.107438016529,"bdl","CV_Good","Spk_Bad Std5Chk_Bad ",2026-05-19,"" +"136","GCReW","SMARTX","2026","May","SPPA, DISP","C4","462",80,"Ambient",3.4,3698.26086956522,"Within_Range","CV_Good","Spk_Bad ",2026-05-19,"" +"137","GCReW","SMARTX","2026","May","SPPA, DISP","C4","463",80,"Ambient",5.1,4422.89855072464,"Within_Range","CV_Good","Spk_Bad ",2026-05-19,"" +"138","GCReW","SMARTX","2026","May","SPPA, DISP","C4","461",20,"Ambient",1.7,1193.91304347826,"Within_Range","CV_Good","Spk_Bad ",2026-05-19,"" +"139","GCReW","SMARTX","2026","May","SPPA, DISP","C4","463",120,"Ambient",5.1,3254.78260869565,"Within_Range","CV_Good","Spk_Bad ",2026-05-19,"" +"140","GCReW","SMARTX","2026","May","SPPA, DISP","C4","461",40,"Ambient",1.7,1824.34782608696,"Within_Range","CV_Good","Spk_Bad ",2026-05-19,"" +"141","GCReW","SMARTX","2026","May","SPPA, DISP","C4","453",10,"Ambient",5.1,4059.13043478261,"Within_Range","CV_Good","Spk_Bad ",2026-05-19,"" +"142","GCReW","SMARTX","2026","May","SPPA, DISP","C4","461",80,"Ambient",1.7,2883.76811594203,"Within_Range","CV_Good","Spk_Bad ",2026-05-19,"" +"143","GCReW","SMARTX","2026","May","SPPA, DISP","C4","461",120,"Ambient",1.7,1198.26086956522,"Within_Range","CV_Good","Spk_Bad ",2026-05-19,"" +"144","GCReW","SMARTX","2026","May","SPPA, DISP","C4","462",120,"Ambient",3.4,4385.21739130435,"Within_Range","CV_Good","Spk_Bad ",2026-05-19,"" +"145","GCReW","SMARTX","2026","May","SPPA, DISP","C4","463",10,"Ambient",5.1,620,"Within_Range","CV_Good","Spk_Bad ",2026-05-19,"" +"146","GCReW","SMARTX","2026","May","SPPA, DISP","C4","462",20,"Ambient",3.4,1220,"Within_Range","CV_Good","Spk_Bad ",2026-05-19,"" +"147","GCReW","SMARTX","2026","May","SPPA, DISP","C4","463",20,"Ambient",5.1,2675.07246376812,"Within_Range","CV_Good","Spk_Bad ",2026-05-19,"" +"148","GCReW","SMARTX","2026","May","SPPA, DISP","C4","460",120,"Ambient",0,3372.17391304348,"Within_Range","CV_Good","Spk_Bad ",2026-05-19,"" +"149","GCReW","SMARTX","2026","May","SPPA, DISP","C4","462",40,"Ambient",3.4,4028.69565217391,"Within_Range","CV_Good","Spk_Bad ",2026-05-19,"" +"150","GCReW","SMARTX","2026","May","SPPA, DISP","C4","463",40,"Ambient",5.1,3857.68115942029,"Within_Range","CV_Good","Spk_Bad ",2026-05-19,"" diff --git a/SMARTX/Porewater/Sulfide/2026/Processed Data/SMARTX_H2S_QAQC_2026.csv b/SMARTX/Porewater/Sulfide/2026/Processed Data/SMARTX_H2S_QAQC_2026.csv new file mode 100644 index 0000000..ea698db --- /dev/null +++ b/SMARTX/Porewater/Sulfide/2026/Processed Data/SMARTX_H2S_QAQC_2026.csv @@ -0,0 +1,267 @@ +"","Plate","Curve","R2","Slope","Intercept","Run_Date","Run" +"1",NA,"H2S",0.991219025,0.01093912,0.100689277,2025-09-22,"Past Runs" +"2",NA,"H2S",0.993877242,0.011939201,0.06915697,2025-09-22,"Past Runs" +"3",NA,"H2S",0.993801685,0.00988706,0.089656986,2025-09-22,"Past Runs" +"4",NA,"H2S",0.98902287,0.011446925,0.096027164,2025-09-19,"Past Runs" +"5",NA,"H2S",0.994548336,0.011899625,0.083277661,2025-09-19,"Past Runs" +"6",NA,"H2S",0.992796039,0.009941877,0.087862342,2025-09-19,"Past Runs" +"7",NA,"H2S",0.997865585,0.011856306,0.066974671,2025-09-19,"Past Runs" +"8",NA,"H2S",0.986077314,0.012606847,0.075308108,2025-09-19,"Past Runs" +"9",NA,"H2S",0.992846269,0.01106119,0.083271756,2025-09-19,"Past Runs" +"10",NA,"H2S",0.989586556,0.012257337,0.086131432,2025-09-18,"Past Runs" +"11",NA,"H2S",0.994028851,0.011363046,0.089013852,2025-09-18,"Past Runs" +"12",NA,"H2S",0.986483002,0.012786783,0.079924043,2025-09-18,"Past Runs" +"13",NA,"H2S",0.987456283,0.010471189,0.097437793,2025-09-18,"Past Runs" +"14",NA,"H2S",0.990170085,0.011201815,0.080205858,2025-09-18,"Past Runs" +"15",NA,"H2S",0.994921447,0.011747968,0.0821679,2025-09-18,"Past Runs" +"16",NA,"H2S",0.988565262,0.011839841,0.069910825,2025-07-16,"Past Runs" +"17",NA,"H2S",0.991619504,0.011745192,0.081514125,2025-07-16,"Past Runs" +"18",NA,"H2S",0.990299632,0.011051745,0.072271651,2025-07-16,"Past Runs" +"19",NA,"H2S",0.991820501,0.011030978,0.107305831,2025-07-16,"Past Runs" +"20",NA,"H2S",0.987843267,0.011940853,0.084781412,2025-07-16,"Past Runs" +"21",NA,"H2S",0.992091938,0.011957557,0.080297784,2025-07-16,"Past Runs" +"22",NA,"H2S",0.991711318,0.011277024,0.093205964,2025-07-16,"Past Runs" +"23",NA,"H2S",0.990221806,0.012007601,0.081764155,2025-07-15,"Past Runs" +"24",NA,"H2S",0.985259661,0.010168475,0.104301957,2025-07-15,"Past Runs" +"25",NA,"H2S",0.988492907,0.011813071,0.068994131,2025-07-16,"Past Runs" +"26",NA,"H2S",0.994149685,0.013418056,0.072423824,2025-07-15,"Past Runs" +"27",NA,"H2S",0.991748191,0.011735538,0.088628605,2025-07-15,"Past Runs" +"28",NA,"H2S",0.989333168,0.012411661,0.088435965,2025-07-15,"Past Runs" +"29",NA,"H2S",0.992931678,0.011946484,0.10370681,2025-07-14,"Past Runs" +"30",NA,"H2S",0.99409875,0.011778654,0.091418456,2025-07-14,"Past Runs" +"31",NA,"H2S",0.988158507,0.010797151,0.091271836,2025-07-14,"Past Runs" +"32",NA,"H2S",0.992095456,0.010752828,0.104719179,2025-07-14,"Past Runs" +"33",NA,"H2S",0.99451618,0.011110069,0.090558393,2025-07-14,"Past Runs" +"34",NA,"H2S",0.992226742,0.012274256,0.095585343,2025-08-27,"Past Runs" +"35",NA,"H2S",0.989946431,0.01162827,0.097001612,2025-08-27,"Past Runs" +"36",NA,"H2S",0.988459596,0.011593871,0.102538661,2025-08-27,"Past Runs" +"37",NA,"H2S",0.984009845,0.01077442,0.094690475,2025-08-08,"Past Runs" +"38",NA,"H2S",0.991998684,0.012003707,0.087888803,2025-08-08,"Past Runs" +"39",NA,"H2S",0.988472937,0.013654087,0.080747996,2025-08-08,"Past Runs" +"40",NA,"H2S",0.989644138,0.011187528,0.100376401,2025-08-08,"Past Runs" +"41",NA,"H2S",0.991253241,0.01240335,0.091781398,2025-07-28,"Past Runs" +"42",NA,"H2S",0.985302046,0.010983613,0.096511057,2025-07-28,"Past Runs" +"43",NA,"H2S",0.989746609,0.012199156,0.083958107,2025-07-28,"Past Runs" +"44",NA,"H2S",0.983978644,0.01257192,0.082066064,2025-07-28,"Past Runs" +"45",NA,"H2S",0.985041184,0.013253135,0.095890286,2025-06-23,"Past Runs" +"46",NA,"H2S",0.988479922,0.012770225,0.097515258,2025-06-23,"Past Runs" +"47",NA,"H2S",0.986622245,0.014490479,0.088550945,2025-06-23,"Past Runs" +"48",NA,"H2S",0.98593674,0.012464999,0.101324152,2025-06-23,"Past Runs" +"49",NA,"H2S",0.992217588,0.011106834,0.087410369,2025-06-03,"Past Runs" +"50",NA,"H2S",0.994571071,0.01266079,0.086043319,2025-06-03,"Past Runs" +"51",NA,"H2S",0.987008654,0.01202734,0.088509886,2025-06-03,"Past Runs" +"52",NA,"H2S",0.991890557,0.010510502,0.089450704,2025-06-03,"Past Runs" +"53",NA,"H2S",0.990808319,0.011660482,0.083892866,2025-06-03,"Past Runs" +"54",NA,"H2S",0.99195308,0.012188907,0.076050353,2025-06-03,"Past Runs" +"55",NA,"H2S",0.990300427,0.011117767,0.095151906,2025-06-03,"Past Runs" +"56",NA,"H2S",0.990287741,0.012773563,0.085475942,2025-06-02,"Past Runs" +"57",NA,"H2S",0.985219853,0.012034496,0.101191716,2025-06-02,"Past Runs" +"58",NA,"H2S",0.990742934,0.012442945,0.09150939,2025-06-02,"Past Runs" +"59",NA,"H2S",0.988190426,0.012914305,0.098581692,2025-06-02,"Past Runs" +"60",NA,"H2S",0.989470668,0.01309737,0.091276263,2025-06-02,"Past Runs" +"61",NA,"H2S",0.985446517,0.012512003,0.101529112,2025-06-02,"Past Runs" +"62",NA,"H2S",0.989516031,0.009990116,0.090615023,2025-05-29,"Past Runs" +"63",NA,"H2S",0.989050067,0.009114036,0.092492755,2025-05-29,"Past Runs" +"64",NA,"H2S",0.992170999,0.009329021,0.090250992,2025-05-27,"Past Runs" +"65",NA,"H2S",0.991744664,0.009917044,0.078245698,2025-05-27,"Past Runs" +"66",NA,"H2S",0.994352551,0.009616728,0.087789906,2025-05-27,"Past Runs" +"67",NA,"H2S",0.985006054,0.009610255,0.07704108,2025-05-27,"Past Runs" +"68",NA,"H2S",0.993274803,0.009359273,0.090591475,2025-05-27,"Past Runs" +"69",NA,"H2S",0.986045229,0.011531354,0.077709532,2024-11-18,"Past Runs" +"70",NA,"H2S",0.986196268,0.011480984,0.07703203,2024-11-18,"Past Runs" +"71",NA,"H2S",0.985787929,0.009948554,0.091199531,2024-11-18,"Past Runs" +"72",NA,"H2S",0.988947878,0.010495862,0.093284593,2024-11-18,"Past Runs" +"73",NA,"H2S",0.988264781,0.010127226,0.080001514,2024-10-28,"Past Runs" +"74",NA,"H2S",0.988125768,0.009325271,0.097513836,2024-10-28,"Past Runs" +"75",NA,"H2S",0.99758753,0.011945752,0.067197191,2024-10-28,"Past Runs" +"76",NA,"H2S",0.993078174,0.009645972,0.08151815,2024-10-07,"Past Runs" +"77",NA,"H2S",0.986071127,0.009987862,0.086021444,2024-10-04,"Past Runs" +"78",NA,"H2S",0.986143404,0.009891411,0.079796142,2024-10-04,"Past Runs" +"79",NA,"H2S",0.99164056,0.009670319,0.086201323,2024-10-03,"Past Runs" +"80",NA,"H2S",0.992085737,0.009733216,0.067611651,2024-10-03,"Past Runs" +"81",NA,"H2S",0.992009962,0.01118999,0.069642654,2024-10-03,"Past Runs" +"82",NA,"H2S",0.985288821,0.010925627,0.071179528,2024-10-03,"Past Runs" +"83",NA,"H2S",0.995390082,0.011330148,0.070037534,2024-10-03,"Past Runs" +"84",NA,"H2S",0.994790512,0.009796019,0.071794375,2024-10-01,"Past Runs" +"85",NA,"H2S",0.989580278,0.010755502,0.087527355,2024-10-01,"Past Runs" +"86",NA,"H2S",0.990511071,0.009855933,0.084838618,2024-10-01,"Past Runs" +"87",NA,"H2S",0.992652978,0.009918529,0.082342296,2024-10-01,"Past Runs" +"88",NA,"H2S",0.986832476,0.010348222,0.095254617,2024-09-23,"Past Runs" +"89",NA,"H2S",0.993120795,0.012220049,0.075212346,2024-09-23,"Past Runs" +"90",NA,"H2S",0.997632416,0.009657487,0.072204384,2024-09-25,"Past Runs" +"91",NA,"H2S",0.988833662,0.010418036,0.079942507,2024-09-24,"Past Runs" +"92",NA,"H2S",0.989425359,0.010908767,0.079669724,2024-09-24,"Past Runs" +"93",NA,"H2S",0.9939478,0.011206242,0.073020732,2024-09-24,"Past Runs" +"94",NA,"H2S",0.992036143,0.010398233,0.086327041,2024-09-24,"Past Runs" +"95",NA,"H2S",0.986162946,0.010280929,0.083188885,2024-09-24,"Past Runs" +"96",NA,"H2S",0.987800455,0.011372072,0.073224086,2024-09-23,"Past Runs" +"97",NA,"H2S",0.997485183,0.011409313,0.06519985,2024-09-23,"Past Runs" +"98",NA,"H2S",0.989099616,0.009735423,0.086474227,2024-09-19,"Past Runs" +"99",NA,"H2S",0.985472997,0.010406102,0.081660091,2024-09-19,"Past Runs" +"100",NA,"H2S",0.985753501,0.011560614,0.084016281,2024-09-19,"Past Runs" +"101",NA,"H2S",0.997161027,0.011775527,0.069868502,2024-09-18,"Past Runs" +"102",NA,"H2S",0.989061589,0.010749066,0.094634117,2024-09-18,"Past Runs" +"103",NA,"H2S",0.988308897,0.010324402,0.093490431,2024-09-18,"Past Runs" +"104",NA,"H2S",0.988282091,0.011748716,0.090496556,2024-09-18,"Past Runs" +"105",NA,"H2S",0.990611188,0.011004901,0.08215848,2024-09-09,"Past Runs" +"106",NA,"H2S",0.992687363,0.011700541,0.077148047,2024-08-30,"Past Runs" +"107",NA,"H2S",0.988249032,0.010524088,0.096531712,2024-09-03,"Past Runs" +"108",NA,"H2S",0.988532329,0.010996494,0.084496543,2024-09-03,"Past Runs" +"109",NA,"H2S",0.989712544,0.011101339,0.099050983,2024-09-03,"Past Runs" +"110",NA,"H2S",0.986439831,0.010996091,0.08776573,2024-08-30,"Past Runs" +"111",NA,"H2S",0.989313189,0.010457844,0.084754346,2024-08-30,"Past Runs" +"112",NA,"H2S",0.990177739,0.010268758,0.087174996,2024-08-30,"Past Runs" +"113",NA,"H2S",0.985866463,0.010585417,0.09737672,2024-08-30,"Past Runs" +"114",NA,"H2S",0.99044815,0.011181375,0.077015013,2024-08-30,"Past Runs" +"115",NA,"H2S",0.99053911,0.011535354,0.07384657,2024-08-29,"Past Runs" +"116",NA,"H2S",0.985015156,0.009782729,0.093669731,2024-08-29,"Past Runs" +"117",NA,"H2S",0.990100963,0.011025989,0.095480695,2024-08-29,"Past Runs" +"118",NA,"H2S",0.986738056,0.011094002,0.090055999,2024-08-29,"Past Runs" +"119",NA,"H2S",0.994093709,0.010473948,0.080691929,2024-08-29,"Past Runs" +"120",NA,"H2S",0.986192277,0.011543972,0.085092199,2024-08-07,"Past Runs" +"121",NA,"H2S",0.989960946,0.010741325,0.089432284,2024-08-07,"Past Runs" +"122",NA,"H2S",0.986951933,0.011912043,0.085700427,2024-08-07,"Past Runs" +"123",NA,"H2S",0.991998444,0.010555363,0.079000944,2024-08-07,"Past Runs" +"124",NA,"H2S",0.985536677,0.011846101,0.081424587,2024-07-29,"Past Runs" +"125",NA,"H2S",0.989595015,0.01224124,0.098524648,2024-07-29,"Past Runs" +"126",NA,"H2S",0.986188356,0.010118538,0.089341935,2024-07-25,"Past Runs" +"127",NA,"H2S",0.992411811,0.012549456,0.078491188,2024-07-25,"Past Runs" +"128",NA,"H2S",0.986593659,0.012390759,0.091396714,2024-07-25,"Past Runs" +"129",NA,"H2S",0.987105229,0.011378377,0.09863995,2024-07-25,"Past Runs" +"130",NA,"H2S",0.985994152,0.011415216,0.08057319,2024-07-25,"Past Runs" +"131",NA,"H2S",0.990738705,0.011295641,0.084048401,2024-07-31,"Past Runs" +"132",NA,"H2S",0.987136133,0.011450047,0.079739708,2024-07-29,"Past Runs" +"133",NA,"H2S",0.99126783,0.013018999,0.08407446,2024-07-29,"Past Runs" +"134",NA,"H2S",0.991454138,0.01254834,0.090174827,2024-07-29,"Past Runs" +"135",NA,"H2S",0.99018676,0.010771473,0.09900375,2024-07-24,"Past Runs" +"136",NA,"H2S",0.984822062,0.011740029,0.096632577,2024-07-24,"Past Runs" +"137",NA,"H2S",0.993424378,0.012468772,0.07384182,2024-07-19,"Past Runs" +"138",NA,"H2S",0.989184664,0.01069962,0.08457192,2024-07-19,"Past Runs" +"139",NA,"H2S",0.989831855,0.011217555,0.074495287,2024-07-19,"Past Runs" +"140",NA,"H2S",0.988637133,0.011247898,0.09116868,2024-07-19,"Past Runs" +"141",NA,"H2S",0.990494512,0.012004154,0.08805378,2024-07-19,"Past Runs" +"142",NA,"H2S",0.988124802,0.011667535,0.091833244,2024-07-19,"Past Runs" +"143",NA,"H2S",0.990863942,0.010234964,0.079436097,2024-07-18,"Past Runs" +"144",NA,"H2S",0.983817166,0.010882717,0.094621893,2024-07-18,"Past Runs" +"145",NA,"H2S",0.990198017,0.011687802,0.081889383,2024-07-18,"Past Runs" +"146",NA,"H2S",0.987899965,0.01159855,0.091733041,2024-07-18,"Past Runs" +"147",NA,"H2S",0.989060685,0.011495464,0.099538763,2024-07-18,"Past Runs" +"148",NA,"H2S",0.986916133,0.009342433,0.095298628,2024-07-18,"Past Runs" +"149",NA,"H2S",0.984427464,0.011641613,0.092097982,2024-07-19,"Past Runs" +"150",NA,"H2S",0.990912834,0.010479158,0.086080607,2024-07-19,"Past Runs" +"151",NA,"H2S",0.987412326,0.010983562,0.094991681,2024-07-18,"Past Runs" +"152",NA,"H2S",0.986465804,0.011418341,0.090477665,2024-07-18,"Past Runs" +"153",NA,"H2S",0.987068169,0.011199063,0.089853992,2024-07-18,"Past Runs" +"154",NA,"H2S",0.989037854,0.011295078,0.081699567,2024-07-17,"Past Runs" +"155",NA,"H2S",0.992083054,0.012185227,0.07626707,2024-07-17,"Past Runs" +"156",NA,"H2S",0.992139993,0.011646417,0.077884912,2024-07-17,"Past Runs" +"157",NA,"H2S",0.993165626,0.012227159,0.072878643,2024-07-17,"Past Runs" +"158",NA,"H2S",0.991179678,0.010917098,0.077263615,2024-07-17,"Past Runs" +"159",NA,"H2S",0.994482296,0.010706488,0.074416857,2024-07-17,"Past Runs" +"160",NA,"H2S",0.993221658,0.011432212,0.085152764,2024-07-15,"Past Runs" +"161",NA,"H2S",0.991012311,0.012163061,0.075124953,2024-07-05,"Past Runs" +"162",NA,"H2S",0.985644961,0.012042341,0.087343444,2024-07-05,"Past Runs" +"163",NA,"H2S",0.990282541,0.011631377,0.089041685,2024-07-05,"Past Runs" +"164",NA,"H2S",0.987824676,0.011559837,0.066632483,2024-07-05,"Past Runs" +"165",NA,"H2S",0.987863383,0.012339206,0.093894911,2024-07-03,"Past Runs" +"166",NA,"H2S",0.994315831,0.012786291,0.087233216,2024-07-03,"Past Runs" +"167",NA,"H2S",0.988339045,0.011649182,0.091537982,2024-07-03,"Past Runs" +"168",NA,"H2S",0.988950697,0.014678212,0.09163757,2023-11-14,"Past Runs" +"169",NA,"H2S",0.990040026,0.012259376,0.107676904,2023-11-14,"Past Runs" +"170",NA,"H2S",0.992010649,0.010954084,0.079408389,2024-05-29,"Past Runs" +"171",NA,"H2S",0.989206107,0.010763348,0.088663974,2024-05-29,"Past Runs" +"172",NA,"H2S",0.990869031,0.010939769,0.092318935,2024-05-29,"Past Runs" +"173",NA,"H2S",0.985767699,0.010729643,0.084530357,2024-05-29,"Past Runs" +"174",NA,"H2S",0.990353193,0.011621645,0.084002879,2024-05-28,"Past Runs" +"175",NA,"H2S",0.987684582,0.01183304,0.076585822,2024-05-28,"Past Runs" +"176",NA,"H2S",0.990127271,0.010373918,0.082859368,2024-05-28,"Past Runs" +"177",NA,"H2S",0.992091943,0.011632631,0.078949694,2024-05-28,"Past Runs" +"178",NA,"H2S",0.991295752,0.011015224,0.083816625,2024-05-23,"Past Runs" +"179",NA,"H2S",0.987251905,0.011995579,0.078461365,2024-05-23,"Past Runs" +"180",NA,"H2S",0.991135851,0.011944649,0.090053389,2024-05-23,"Past Runs" +"181",NA,"H2S",0.987847657,0.013334201,0.076212686,2024-05-22,"Past Runs" +"182",NA,"H2S",0.98858924,0.010019939,0.074402064,2024-05-22,"Past Runs" +"183",NA,"H2S",0.992678091,0.012147509,0.085708498,2024-05-22,"Past Runs" +"184",NA,"H2S",0.993578596,0.012248114,0.078688178,2024-05-22,"Past Runs" +"185",NA,"H2S",0.992362286,0.01333791,0.069302726,2024-05-21,"Past Runs" +"186",NA,"H2S",0.989216329,0.012520477,0.080249778,2024-05-21,"Past Runs" +"187",NA,"H2S",0.986391164,0.012989122,0.080584704,2024-05-21,"Past Runs" +"188","Plate1","H2S",0.9936,0.0095,0.0909,2025-05-27,"Past Runs" +"189","Plate2","H2S",0.9942,0.009,0.0831,2025-05-27,"Past Runs" +"190","Plate3","H2S",0.9939,0.0095,0.0892,2025-05-27,"Past Runs" +"191","Plate4","H2S",0.9985,0.0101,0.0762,2025-05-27,"Past Runs" +"192","Plate5","H2S",0.9972,0.0096,0.0866,2025-05-27,"Past Runs" +"193","Plate6","H2S",0.9985,0.0101,0.0762,2025-05-27,"Past Runs" +"194","Plate7","H2S",0.9985,0.0101,0.0762,2025-05-27,"Past Runs" +"195","Plate_rr","H2S",0.9906,0.0131,0.0934,2025-06-02,"Past Runs" +"196","Plate1","H2S",0.9801,0.0114,0.1116,2025-07-14,"Past Runs" +"197","Plate2","H2S",0.9881,0.0107,0.1167,2025-07-14,"Past Runs" +"198","Plate3","H2S",0.9796,0.0113,0.1195,2025-07-14,"Past Runs" +"199","Plate4","H2S",0.9888,0.0115,0.1123,2025-07-14,"Past Runs" +"200","Plate5","H2S",0.9961,0.012,0.1021,2025-07-14,"Past Runs" +"201","Plate6","H2S",0.9961,0.012,0.1021,2025-07-14,"Past Runs" +"202","Plate7","H2S",0.994,0.0128,0.0806,2025-07-15,"Past Runs" +"203","Plate8","H2S",0.9928,0.0115,0.0903,2025-07-15,"Past Runs" +"204","Plate9","H2S",0.9974,0.0117,0.0896,2025-07-15,"Past Runs" +"205","Plate10","H2S",0.9962,0.0134,0.0672,2025-07-15,"Past Runs" +"206","Plate_rr","H2S",0.9994,0.0124,0.0564,2025-07-16,"Past Runs" +"207","Plate1","H2S",0.9778,0.0111,0.1128,2025-07-14,"Past Runs" +"208","Plate2","H2S",0.9911,0.0107,0.1158,2025-07-14,"Past Runs" +"209","Plate3","H2S",0.9638,0.0107,0.1265,2025-07-14,"Past Runs" +"210","Plate4","H2S",0.9929,0.0119,0.1013,2025-07-14,"Past Runs" +"211","Plate5","H2S",0.9919,0.0114,0.1145,2025-07-14,"Past Runs" +"212","Plate6","H2S",0.9919,0.0114,0.1145,2025-07-14,"Past Runs" +"213","Plate7","H2S",0.9917,0.0124,0.0852,2025-07-15,"Past Runs" +"214","Plate8","H2S",0.9961,0.012,0.0817,2025-07-15,"Past Runs" +"215","Plate9","H2S",0.9934,0.0118,0.0934,2025-07-15,"Past Runs" +"216","Plate10","H2S",0.9953,0.0134,0.0704,2025-07-15,"Past Runs" +"217","Plate_rr","H2S",0.9952,0.0119,0.0733,2025-07-16,"Past Runs" +"218","Plate1","H2S",0.9851,0.0127,0.1017,2025-06-02,"Past Runs" +"219","Plate2","H2S",0.9911,0.012,0.103,2025-06-02,"Past Runs" +"220","Plate3","H2S",0.9934,0.0127,0.0862,2025-06-02,"Past Runs" +"221","Plate4","H2S",0.9912,0.0111,0.0949,2025-06-03,"Past Runs" +"222","Plate5","H2S",0.9955,0.0122,0.0761,2025-06-03,"Past Runs" +"223","Plate6","H2S",0.9934,0.0117,0.0839,2025-06-03,"Past Runs" +"224","Plate7","H2S",0.9908,0.0105,0.0895,2025-06-03,"Past Runs" +"225","Plate8","H2S",0.9919,0.0129,0.0966,2025-06-03,"Past Runs" +"226","Plate9","H2S",0.9873,0.012,0.1022,2025-06-03,"Past Runs" +"227","Plate10","H2S",0.9748,0.0111,0.1063,2025-06-03,"Past Runs" +"228","Plate1","H2S",0.9907,0.0124,0.0915,2025-06-02,"Past Runs" +"229","Plate2","H2S",0.9847,0.012,0.1032,2025-06-02,"Past Runs" +"230","Plate3","H2S",0.9905,0.0127,0.088,2025-06-02,"Past Runs" +"231","Plate4","H2S",0.9902,0.0111,0.0995,2025-06-03,"Past Runs" +"232","Plate5","H2S",0.9917,0.0122,0.0776,2025-06-03,"Past Runs" +"233","Plate6","H2S",0.99,0.0116,0.0878,2025-06-03,"Past Runs" +"234","Plate7","H2S",0.9919,0.0105,0.0895,2025-06-03,"Past Runs" +"235","Plate8","H2S",0.9905,0.0128,0.0925,2025-06-03,"Past Runs" +"236","Plate9","H2S",0.9862,0.012,0.0928,2025-06-03,"Past Runs" +"237","Plate10","H2S",0.982,0.011,0.1035,2025-06-03,"Past Runs" +"238","Plate1","H2S",0.9899,0.012,0.0847,2025-07-15,"Past Runs" +"239","Plate2","H2S",0.9853,0.0102,0.1043,2025-07-15,"Past Runs" +"240","Plate3","H2S",0.9912,0.0112,0.0972,2025-07-16,"Past Runs" +"241","Plate4","H2S",0.9918,0.0119,0.0833,2025-07-16,"Past Runs" +"242","Plate5","H2S",0.9878,0.0119,0.0848,2025-07-16,"Past Runs" +"243","Plate6","H2S",0.9924,0.0108,0.1249,2025-07-16,"Past Runs" +"244","Plate7","H2S",0.9813,0.011,0.0921,2025-07-16,"Past Runs" +"245","Plate8","H2S",0.9916,0.0117,0.0815,2025-07-16,"Past Runs" +"246","Plate9","H2S",0.9885,0.0118,0.069,2025-07-16,"Past Runs" +"247","Plate1","H2S",0.9861,0.0126,0.0753,2025-09-19,"Past Runs" +"248","Plate2","H2S",0.9979,0.0119,0.067,2025-09-19,"Past Runs" +"249","Plate3","H2S",0.9928,0.0099,0.0879,2025-09-19,"Past Runs" +"250","Plate4","H2S",0.9861,0.0126,0.0753,2025-09-19,"Past Runs" +"251","Plate5","H2S",0.9865,0.0113,0.0814,2025-09-19,"Past Runs" +"252","Plate6","H2S",0.989,0.0114,0.096,2025-09-19,"Past Runs" +"253","Plate7","H2S",0.9867,0.0098,0.1055,2025-09-22,"Past Runs" +"254","Plate8","H2S",0.9935,0.0119,0.0702,2025-09-22,"Past Runs" +"255","Plate9","H2S",0.9912,0.0109,0.1007,2025-09-22,"Past Runs" +"256","Plate1","H2S",0.9873,0.0117,0.0838,2026-05-19,"Current Runs" +"257","Plate2","H2S",0.9818,0.01,0.1263,2026-05-19,"Current Runs" +"258","Plate3","H2S",0.9833,0.0123,0.0984,2026-05-20,"Current Runs" +"259","Plate4","H2S",0.9972,0.0137,0.0769,2026-05-20,"Current Runs" +"260","Plate5","H2S",0.9915,0.0119,0.1059,2026-05-20,"Current Runs" +"261","Plate6","H2S",0.9726,0.0103,0.1306,2026-05-20,"Current Runs" +"262","Plate7","H2S",0.989,0.0125,0.08,2026-05-21,"Current Runs" +"263","Plate8","H2S",0.9867,0.0123,0.0865,2026-05-21,"Current Runs" +"264","Plate9","H2S",0.9669,0.0099,0.1115,2020-05-21,"Current Runs" +"265","rrPlate1","H2S",0.9866,0.0128,0.1203,2026-06-01,"Current Runs" +"266","rrPlate2","H2S",0.9922,0.0115,0.0987,2026-06-01,"Current Runs" diff --git a/SMARTX/Porewater/Sulfide/2026/Raw Data/20260519_SMARTX_H2S_Plate1.csv b/SMARTX/Porewater/Sulfide/2026/Raw Data/20260519_SMARTX_H2S_Plate1.csv new file mode 100644 index 0000000..4add05a --- /dev/null +++ b/SMARTX/Porewater/Sulfide/2026/Raw Data/20260519_SMARTX_H2S_Plate1.csv @@ -0,0 +1,29 @@ +,1,2,3,4,5,6,7,8,9,10,11,12 +A,0.066,0.064,0.06,0.214,0.234,0.204,0.381,0.418,0.444,0.604,0.806,0.622 +B,0.147,0.12,0.135,0.252,0.242,0.25,0.069,0.066,0.062,0.207,0.226,0.226 +C,0.214,0.218,0.248,0.284,0.3,0.32,0.397,0.445,0.445,0.486,0.454,0.508 +D,0.447,0.352,0.398,0.295,0.303,0.317,0.366,0.342,0.385,0.503,0.41,0.606 +E,0.715,0.643,0.816,0.194,0.171,0.164,0.22,0.232,0.225,0.44,0.548,0.527 +F,1.142,1.357,1.249,0.213,0.228,0.249,0.353,0.369,0.327,0.063,0.061,0.063 +G,1.208,1.253,1.322,0.331,0.318,0.284,0.421,0.41,0.449,0.436,0.414,0.478 +H,0.148,0.149,0.139,0.314,0.371,0.292,0.652,0.626,0.513,0.633,0.723,0.821 +,,,,,,,,,,,, +,1,2,3,4,5,6,7,8,9,10,11,12 +A,Std 0,Std 0,Std 0,610-20,610-20,610-20,310-120,310-120,310-120,311-120,311-120,311-120 +B,Std 1,Std 1,Std 1,610-40,610-40,610-40,ChkStd 0,ChkStd 0,ChkStd 0,312-10,312-10,312-10 +C,Std 2,Std 2,Std 2,610-80,610-80,610-80,310-120 Dup,310-120 Dup,310-120 Dup,312-20,312-20,312-20 +D,Std 3,Std 3,Std 3,610-120,610-120,610-120,ChkStd 3,ChkStd 3,ChkStd 3,610-10 Spike,610-10 Spike,610-10 Spike +E,Std 4,Std 4,Std 4,310-10,310-10,310-10,311-10,311-10,311-10,311-10 Spike,311-10 Spike,311-10 Spike +F,Std 5,Std 5,Std 5,310-20,310-20,310-20,311-20,311-20,311-20,ChkStd 0,ChkStd 0,ChkStd 0 +G,MC: 10ppt S5,MC: 10ppt S5,MC: 10ppt S5,310-40,310-40,310-40,312-20 Dup,311-40,311-40,311-40,312-20 Dup,312-20 Dup +H,610-10,610-10,610-10,310-80,310-80,310-80,311-80,311-80,311-80,ChkStd 4,ChkStd 4,ChkStd 4 +,,,,,,,,,,,, +,1,2,3,4,5,6,7,8,9,10,11,12 +A,1,1,1,100,100,100,100,100,100,100,100,100 +B,1,1,1,100,100,100,1,1,1,100,100,100 +C,1,1,1,100,100,100,100,100,100,100,100,100 +D,1,1,1,100,100,100,1,1,1,100,100,100 +E,1,1,1,100,100,100,100,100,100,100,100,100 +F,1,1,1,100,100,100,100,100,100,1,1,1 +G,1,1,1,100,100,100,100,100,100,100,100,100 +H,100,100,100,100,100,100,100,100,100,1,1,1 diff --git a/SMARTX/Porewater/Sulfide/2026/Raw Data/20260519_SMARTX_H2S_Plate2.csv b/SMARTX/Porewater/Sulfide/2026/Raw Data/20260519_SMARTX_H2S_Plate2.csv new file mode 100644 index 0000000..c86fabc --- /dev/null +++ b/SMARTX/Porewater/Sulfide/2026/Raw Data/20260519_SMARTX_H2S_Plate2.csv @@ -0,0 +1,29 @@ +,1,2,3,4,5,6,7,8,9,10,11,12 +A,0.062,0.065,0.065,0.614,0.486,0.648,0.434,0.439,0.398,0.261,0.301,0.319 +B,0.239,0.268,0.128,0.415,0.411,0.457,0.067,0.064,0.066,0.418,0.452,0.403 +C,0.24,0.313,0.246,0.265,0.29,0.285,0.453,0.455,0.375,0.306,0.302,0.385 +D,0.396,0.349,0.38,0.374,0.459,0.417,0.394,0.423,0.414,0.735,0.716,0.755 +E,0.832,0.734,0.728,0.471,0.487,0.506,0.476,0.507,0.523,0.724,0.861,0.676 +F,1.348,1.104,1.153,0.413,0.362,0.379,0.794,0.668,0.569,0.068,0.063,0.065 +G,1.325,1.299,1.402,0.517,0.398,0.406,0.373,0.382,0.391,0.282,0.287,0.336 +H,0.583,0.465,0.445,0.24,0.251,0.245,0.192,0.197,0.191,0.658,0.638,0.72 +,,,,,,,,,,,, +,1,2,3,4,5,6,7,8,9,10,11,12 +A,Std 0,Std 0,Std 0,312-80,312-80,312-80,613-20,613-20,613-20,620-20,620-20,620-20 +B,Std 1,Std 1,Std 1,312-120,312-120,312-120,ChkStd 0,ChkStd 0,ChkStd 0,620-40,620-40,620-40 +C,Std 2,Std 2,Std 2,313-10,313-10,313-10,613-20 Dup,613-20 Dup,613-20 Dup,620-80,620-80,620-80 +D,Std 3,Std 3,Std 3,313-20,313-20,313-20,ChkStd 3,ChkStd 3,ChkStd 3,312-40 Spike,312-40 Spike,312-40 Spike +E,Std 4,Std 4,Std 4,313-40,313-40,313-40,613-40,613-40,613-40,613-40 Spike,613-40 Spike,613-40 Spike +F,Std 5,Std 5,Std 5,313-80,313-80,313-80,613-80,613-80,613-80,ChkStd 0,ChkStd 0,ChkStd 0 +G,MC: 10ppt S5,MC: 10ppt S5,MC: 10ppt S5,313-120,313-120,313-120,613-120,613-120,613-120,620-80 Dup,620-80 Dup,620-80 Dup +H,312-40,312-40,312-40,613-10,613-10,613-10,620-10,620-10,620-10,ChkStd 4,ChkStd 4,ChkStd 4 +,,,,,,,,,,,, +,1,2,3,4,5,6,7,8,9,10,11,12 +A,1,1,1,100,100,100,100,100,100,100,100,100 +B,1,1,1,100,100,100,1,1,1,100,100,100 +C,1,1,1,100,100,100,100,100,100,100,100,100 +D,1,1,1,100,100,100,1,1,1,100,100,100 +E,1,1,1,100,100,100,100,100,100,100,100,100 +F,1,1,1,100,100,100,100,100,100,1,1,1 +G,1,1,1,100,100,100,100,100,100,100,100,100 +H,100,100,100,100,100,100,100,100,100,1,1,1 diff --git a/SMARTX/Porewater/Sulfide/2026/Raw Data/20260519_SMARTX_H2S_STD.csv b/SMARTX/Porewater/Sulfide/2026/Raw Data/20260519_SMARTX_H2S_STD.csv new file mode 100644 index 0000000..e524b79 --- /dev/null +++ b/SMARTX/Porewater/Sulfide/2026/Raw Data/20260519_SMARTX_H2S_STD.csv @@ -0,0 +1,29 @@ +,1,2,3,4,5,6,7,8,9,10,11,12, +A,0.066,0.067,0.066,0.046,0.045,0.045,0.046,0.045,0.045,0.046,0.046,0.045, +B,0.124,0.128,0.134,0.045,0.044,0.045,0.046,0.044,0.044,0.044,0.044,0.044, +C,0.28,0.232,0.249,0.045,0.045,0.045,0.044,0.045,0.044,0.044,0.044,0.047, +D,0.409,0.724,0.435,0.044,0.045,0.045,0.044,0.044,0.044,0.044,0.044,0.044, +E,0.665,0.608,0.6,0.044,0.045,0.045,0.044,0.045,0.045,0.045,0.044,0.044, +F,1.351,1.156,1.186,0.044,0.044,0.044,0.044,0.044,0.044,0.044,0.045,0.044, +G,1.327,1.166,0.981,0.044,0.044,0.044,0.044,0.046,0.044,0.044,0.044,0.045, +H,0.045,0.044,0.046,0.045,0.045,0.044,0.045,0.045,0.046,0.044,0.045,0.046, +,,,,,,,,,,,,, +,1,2,3,4,5,6,7,8,9,10,11,12, +A,Std 0,Std 0,Std 0,,,,,,,,,, +B,Std 1,Std 1,Std 1,,,,,,,,,, +C,Std 2,Std 2,Std 2,,,,,,,,,, +D,Std 3,Std 3,Std 3,,,,,,,,,, +E,Std 4,Std 4,Std 4,,,,,,,,,, +F,Std 5,Std 5,Std 5,,,,,,,,,, +G,MC: 10ppt S5,MC: 10ppt S5,MC: 10ppt S5,,,,,,,,,, +H,,,,,,,,,,,,, +,,,,,,,,,,,,, +,1,2,3,4,5,6,7,8,9,10,11,12, +A,1,1,1,,,,,,,,,, +B,1,1,1,,,,,,,,,, +C,1,1,1,,,,,,,,,, +D,1,1,1,,,,,,,,,, +E,1,1,1,,,,,,,,,, +F,1,1,1,,,,,,,,,, +G,1,1,1,,,,,,,,,, +H,,,,,,,,,,,,, diff --git a/SMARTX/Porewater/Sulfide/2026/Raw Data/20260520_SMARTX_H2S_Plate3.csv b/SMARTX/Porewater/Sulfide/2026/Raw Data/20260520_SMARTX_H2S_Plate3.csv new file mode 100644 index 0000000..d235d65 --- /dev/null +++ b/SMARTX/Porewater/Sulfide/2026/Raw Data/20260520_SMARTX_H2S_Plate3.csv @@ -0,0 +1,29 @@ +,1,2,3,4,5,6,7,8,9,10,11,12 +A,0.064,0.064,0.06,0.182,0.199,0.189,0.641,0.571,0.597,0.51,0.484,0.513 +B,0.131,0.125,0.127,0.245,0.284,0.24,0.062,0.062,0.068,0.697,0.724,0.688 +C,0.343,0.262,0.254,0.287,0.377,0.304,0.585,0.587,0.628,0.164,0.196,0.227 +D,0.544,0.403,0.478,0.572,0.483,0.432,0.473,0.465,0.464,0.6,0.673,0.645 +E,0.899,0.863,0.77,0.319,0.287,0.266,0.454,0.465,0.505,0.727,0.734,0.767 +F,1.226,1.39,1.333,0.194,0.24,0.233,0.165,0.184,0.197,0.063,0.067,0.062 +G,1.408,1.348,1.427,0.385,0.437,0.495,0.303,0.3,0.303,0.185,0.172,0.18 +H,0.294,0.367,0.318,0.455,0.468,0.408,0.452,0.564,0.62,0.851,0.746,0.829 +,,,,,,,,,,,, +,1,2,3,4,5,6,7,8,9,10,11,12 +A,Std 0,Std 0,Std 0,320-10,320-10,320-10,321-80,321-80,321-80,322-80,322-80,322-80 +B,Std 1,Std 1,Std 1,320-20,320-20,320-20,ChkStd 0,ChkStd 0,ChkStd 0,322-120,322-120,322-120 +C,Std 2,Std 2,Std 2,320-40,320-40,320-40,321-80 Dup,321-80 Dup,321-80 Dup,323-10,323-10,323-10 +D,Std 3,Std 3,Std 3,320-80,320-80,320-80,ChkStd 3,ChkStd 3,ChkStd 3,620-120 Spike,620-120 Spike,620-120 Spike +E,Std 4,Std 4,Std 4,320-120,320-120,320-120,321-120,321-120,321-120,321-120 Spike,321-120 Spike,321-120 Spike +F,Std 5,Std 5,Std 5,321-10,321-10,321-10,322-10,322-10,322-10,ChkStd 0,ChkStd 0,ChkStd 0 +G,MC: 10ppt S5,MC: 10ppt S5,MC: 10ppt S5,321-20,321-20,321-20,322-20,322-20,322-20,323-10 Dup,323-10 Dup,323-10 Dup +H,620-120,620-120,620-120,321-40,321-40,321-40,322-40,322-40,322-40,ChkStd 4,ChkStd 4,ChkStd 4 +,,,,,,,,,,,, +,1,2,3,4,5,6,7,8,9,10,11,12 +A,1,1,1,100,100,100,100,100,100,100,100,100 +B,1,1,1,100,100,100,1,1,1,100,100,100 +C,1,1,1,100,100,100,100,100,100,100,100,100 +D,1,1,1,100,100,100,1,1,1,100,100,100 +E,1,1,1,100,100,100,100,100,100,100,100,100 +F,1,1,1,100,100,100,100,100,100,1,1,1 +G,1,1,1,100,100,100,100,100,100,100,100,100 +H,100,100,100,100,100,100,100,100,100,1,1,1 diff --git a/SMARTX/Porewater/Sulfide/2026/Raw Data/20260520_SMARTX_H2S_Plate4.csv b/SMARTX/Porewater/Sulfide/2026/Raw Data/20260520_SMARTX_H2S_Plate4.csv new file mode 100644 index 0000000..189d862 --- /dev/null +++ b/SMARTX/Porewater/Sulfide/2026/Raw Data/20260520_SMARTX_H2S_Plate4.csv @@ -0,0 +1,29 @@ +,1,2,3,4,5,6,7,8,9,10,11,12 +A,0.056,0.061,0.065,0.525,0.55,0.484,0.141,0.137,0.132,0.125,0.119,0.128 +B,0.186,0.132,0.142,0.467,0.649,0.559,0.063,0.062,0.061,0.311,0.304,0.299 +C,0.261,0.299,0.268,0.433,0.492,0.48,0.121,0.139,0.152,0.318,0.369,0.337 +D,0.412,0.53,0.412,0.162,0.156,0.166,0.443,0.385,0.547,0.738,0.685,0.781 +E,0.96,0.779,0.925,0.238,0.256,0.264,0.209,0.19,0.213,0.543,0.613,0.511 +F,1.411,1.484,1.106,0.291,0.278,0.301,0.505,0.54,0.472,0.065,0.061,0.062 +G,1.356,1.355,1.376,0.472,0.56,0.569,0.285,0.286,0.302,0.324,0.39,0.294 +H,0.459,0.409,0.353,0.508,0.497,0.574,0.164,0.161,0.165,0.66,0.774,0.791 +,,,,,,,,,,,, +,1,2,3,4,5,6,7,8,9,10,11,12 +A,Std 0,Std 0,Std 0,323-40,323-40,323-40,630-10,630-10,630-10,330-10,330-10,330-10 +B,Std 1,Std 1,Std 1,323-80,323-80,323-80,ChkStd 0,ChkStd 0,ChkStd 0,330-20,330-20,330-20 +C,Std 2,Std 2,Std 2,323-120,323-120,323-120,630-10 Dup,630-10 Dup,630-10 Dup,330-40,330-40,330-40 +D,Std 3,Std 3,Std 3,623-10,623-10,623-10,ChkStd 3,ChkStd 3,ChkStd 3,323-20 Spike,323-20 Spike,323-20 Spike +E,Std 4,Std 4,Std 4,623-20,623-20,623-20,630-20,630-20,630-20,630-20 Spike,630-20 Spike,630-20 Spike +F,Std 5,Std 5,Std 5,623-40,623-40,623-40,630-40,630-40,630-40,ChkStd 0,ChkStd 0,ChkStd 0 +G,MC: 10ppt S5,MC: 10ppt S5,MC: 10ppt S5,623-80,623-80,623-80,630-80,630-80,630-80,330-40 Dup,330-40 Dup,330-40 Dup +H,323-20,323-20,323-20,623-120,623-120,623-120,630-120,630-120,630-120,ChkStd 4,ChkStd 4,ChkStd 4 +,,,,,,,,,,,, +,1,2,3,4,5,6,7,8,9,10,11,12 +A,1,1,1,100,100,100,100,100,100,100,100,100 +B,1,1,1,100,100,100,1,1,1,100,100,100 +C,1,1,1,100,100,100,100,100,100,100,100,100 +D,1,1,1,100,100,100,1,1,1,100,100,100 +E,1,1,1,100,100,100,100,100,100,100,100,100 +F,1,1,1,100,100,100,100,100,100,1,1,1 +G,1,1,1,100,100,100,100,100,100,100,100,100 +H,100,100,100,100,100,100,100,100,100,1,1,1 diff --git a/SMARTX/Porewater/Sulfide/2026/Raw Data/20260520_SMARTX_H2S_Plate5.csv b/SMARTX/Porewater/Sulfide/2026/Raw Data/20260520_SMARTX_H2S_Plate5.csv new file mode 100644 index 0000000..794d5a1 --- /dev/null +++ b/SMARTX/Porewater/Sulfide/2026/Raw Data/20260520_SMARTX_H2S_Plate5.csv @@ -0,0 +1,29 @@ +,1,2,3,4,5,6,7,8,9,10,11,12 +A,0.06,0.063,0.063,0.517,0.471,0.501,0.889,0.838,0.838,0.617,0.574,0.522 +B,0.132,0.149,0.256,0.135,0.173,0.15,0.065,0.061,0.063,0.537,0.592,0.525 +C,0.27,0.268,0.27,0.415,0.379,0.367,0.892,0.801,0.685,0.486,0.556,0.519 +D,0.472,0.388,0.482,0.589,0.624,0.476,0.385,0.417,0.546,0.722,0.729,0.667 +E,0.85,0.864,0.854,0.62,0.643,0.47,0.695,0.697,0.701,0.889,0.908,0.911 +F,1.324,1.257,1.266,0.706,0.555,0.742,0.927,0.809,0.801,0.066,0.063,0.057 +G,1.427,1.546,1.45,0.273,0.256,0.26,0.269,0.356,0.347,0.552,0.599,0.51 +H,0.457,0.463,0.406,0.456,0.411,0.405,0.469,0.58,0.54,0.77,0.701,0.677 +,,,,,,,,,,,, +,1,2,3,4,5,6,7,8,9,10,11,12 +A,Std 0,Std 0,Std 0,330-120,330-120,330-120,332-40,332-40,332-40,333-40,333-40,333-40 +B,Std 1,Std 1,Std 1,331-10,331-10,331-10,ChkStd 0,ChkStd 0,ChkStd 0,333-80,333-80,333-80 +C,Std 2,Std 2,Std 2,331-20,331-20,331-20,332-40 Dup,332-40 Dup,332-40 Dup,333-120,333-120,333-120 +D,Std 3,Std 3,Std 3,331-40,331-40,331-40,ChkStd 3,ChkStd 3,ChkStd 3,330-80 Spike,330-80 Spike,330-80 Spike +E,Std 4,Std 4,Std 4,331-80,331-80,331-80,332-80,332-80,332-80,332-80 Spike,332-80 Spike,332-80 Spike +F,Std 5,Std 5,Std 5,331-120,331-120,331-120,332-120,332-120,332-120,ChkStd 0,ChkStd 0,ChkStd 0 +G,MC: 10ppt S5,MC: 10ppt S5,MC: 10ppt S5,332-10,332-10,332-10,333-10,333-10,333-10,333-120 Dup,333-120 Dup,333-120 Dup +H,330-80,330-80,330-80,332-20,332-20,332-20,333-20,333-20,333-20,ChkStd 4,ChkStd 4,ChkStd 4 +,,,,,,,,,,,, +,1,2,3,4,5,6,7,8,9,10,11,12 +A,1,1,1,100,100,100,100,100,100,100,100,100 +B,1,1,1,100,100,100,1,1,1,100,100,100 +C,1,1,1,100,100,100,100,100,100,100,100,100 +D,1,1,1,100,100,100,1,1,1,100,100,100 +E,1,1,1,100,100,100,100,100,100,100,100,100 +F,1,1,1,100,100,100,100,100,100,1,1,1 +G,1,1,1,100,100,100,100,100,100,100,100,100 +H,100,100,100,100,100,100,100,100,100,1,1,1 diff --git a/SMARTX/Porewater/Sulfide/2026/Raw Data/20260520_SMARTX_H2S_Plate6.csv b/SMARTX/Porewater/Sulfide/2026/Raw Data/20260520_SMARTX_H2S_Plate6.csv new file mode 100644 index 0000000..2acbb4a --- /dev/null +++ b/SMARTX/Porewater/Sulfide/2026/Raw Data/20260520_SMARTX_H2S_Plate6.csv @@ -0,0 +1,29 @@ +,1,2,3,4,5,6,7,8,9,10,11,12 +A,0.062,0.066,0.066,0.52,0.562,0.519,0.5,0.469,0.451,0.537,0.608,0.599 +B,0.175,0.128,0.143,0.586,0.451,0.513,0.068,0.06,0.064,0.662,0.619,0.593 +C,0.288,0.306,0.27,0.659,0.555,0.594,0.44,0.424,0.423,0.044,0.046,0.046 +D,0.458,0.456,0.448,0.545,0.574,0.592,0.526,0.488,0.5,0.51,0.538,0.579 +E,0.774,0.855,0.693,0.104,0.112,0.105,0.21,0.222,0.228,0.5,0.552,0.489 +F,1.366,1.191,1.078,0.314,0.294,0.297,0.289,0.254,0.265,0.064,0.062,0.061 +G,1.493,1.372,1.433,0.429,0.508,0.475,0.499,0.486,0.436,0.625,0.54,0.598 +H,0.218,0.242,0.191,0.333,0.3,0.313,0.436,0.433,0.483,0.926,0.802,0.839 +,,,,,,,,,,,, +,1,2,3,4,5,6,7,8,9,10,11,12 +A,Std 0,Std 0,Std 0,633-20,633-20,633-20,440-120,440-120,440-120,441-120,441-120,441-120 +B,Std 1,Std 1,Std 1,633-40,633-40,633-40,ChkStd 0,ChkStd 0,ChkStd 0,,, +C,Std 2,Std 2,Std 2,633-80,633-80,633-80,440-120 Dup,440-120 Dup,440-120 Dup,,, +D,Std 3,Std 3,Std 3,633-120,633-120,633-120,ChkStd 3,ChkStd 3,ChkStd 3,633-10 Spike,633-10 Spike,633-10 Spike +E,Std 4,Std 4,Std 4,440-10,440-10,440-10,441-10,441-10,441-10,441-10 Spike,441-10 Spike,441-10 Spike +F,Std 5,Std 5,Std 5,440-20,440-20,440-20,441-20,441-20,441-20,ChkStd 0,ChkStd 0,ChkStd 0 +G,MC: 10ppt S5,MC: 10ppt S5,MC: 10ppt S5,440-40,440-40,440-40,441-40,441-40,441-40,441-120 Dup,441-120 Dup,441-120 Dup +H,633-10,633-10,633-10,440-80,440-80,440-80,441-80,441-80,441-80,ChkStd 4,ChkStd 4,ChkStd 4 +,,,,,,,,,,,, +,1,2,3,4,5,6,7,8,9,10,11,12 +A,1,1,1,100,100,100,100,100,100,100,100,100 +B,1,1,1,100,100,100,1,1,1,1,1,1 +C,1,1,1,100,100,100,100,100,100,,, +D,1,1,1,100,100,100,1,1,1,100,100,100 +E,1,1,1,100,100,100,100,100,100,100,100,100 +F,1,1,1,100,100,100,100,100,100,1,1,1 +G,1,1,1,100,100,100,100,100,100,100,100,100 +H,100,100,100,100,100,100,100,100,100,1,1,1 diff --git a/SMARTX/Porewater/Sulfide/2026/Raw Data/20260520_SMARTX_H2S_STD.csv b/SMARTX/Porewater/Sulfide/2026/Raw Data/20260520_SMARTX_H2S_STD.csv new file mode 100644 index 0000000..0384051 --- /dev/null +++ b/SMARTX/Porewater/Sulfide/2026/Raw Data/20260520_SMARTX_H2S_STD.csv @@ -0,0 +1,29 @@ +,1,2,3,4,5,6,7,8,9,10,11,12 +A,0.066,0.064,0.066,0.046,0.045,0.045,0.046,0.045,0.045,0.045,0.046,0.045 +B,0.134,0.136,0.185,0.044,0.044,0.045,0.046,0.044,0.045,0.045,0.045,0.044 +C,0.263,0.251,0.244,0.045,0.045,0.045,0.044,0.044,0.048,0.045,0.045,0.046 +D,0.534,0.393,0.476,0.045,0.045,0.045,0.045,0.045,0.045,0.045,0.045,0.046 +E,0.711,0.644,0.672,0.044,0.045,0.045,0.045,0.044,0.044,0.045,0.044,0.044 +F,1.502,1.335,1.182,0.044,0.044,0.044,0.045,0.044,0.045,0.045,0.045,0.044 +G,1.334,1.426,1.174,0.045,0.045,0.045,0.045,0.045,0.044,0.044,0.044,0.045 +H,0.045,0.044,0.045,0.045,0.044,0.045,0.045,0.045,0.046,0.044,0.045,0.046 +,,,,,,,,,,,, +,1,2,3,4,5,6,7,8,9,10,11,12 +A,Std 0,Std 0,Std 0,,,,,,,,, +B,Std 1,Std 1,Std 1,,,,,,,,, +C,Std 2,Std 2,Std 2,,,,,,,,, +D,Std 3,Std 3,Std 3,,,,,,,,, +E,Std 4,Std 4,Std 4,,,,,,,,, +F,Std 5,Std 5,Std 5,,,,,,,,, +G,MC: 10ppt S5,MC: 10ppt S5,MC: 10ppt S5,,,,,,,,, +H,,,,,,,,,,,, +,,,,,,,,,,,, +,1,2,3,4,5,6,7,8,9,10,11,12 +A,1,1,1,,,,,,,,, +B,1,1,1,,,,,,,,, +C,1,1,1,,,,,,,,, +D,1,1,1,,,,,,,,, +E,1,1,1,,,,,,,,, +F,1,1,1,,,,,,,,, +G,1,1,1,,,,,,,,, +H,,,,,,,,,,,, diff --git a/SMARTX/Porewater/Sulfide/2026/Raw Data/20260521_SMARTX_H2S_Plate7.csv b/SMARTX/Porewater/Sulfide/2026/Raw Data/20260521_SMARTX_H2S_Plate7.csv new file mode 100644 index 0000000..b12e35b --- /dev/null +++ b/SMARTX/Porewater/Sulfide/2026/Raw Data/20260521_SMARTX_H2S_Plate7.csv @@ -0,0 +1,29 @@ +,1,2,3,4,5,6,7,8,9,10,11,12 +A,0.068,0.061,0.064,0.228,0.197,0.208,0.648,0.557,0.571,0.564,0.576,0.554 +B,0.119,0.145,0.134,0.432,0.463,0.457,0.07,0.065,0.063,0.167,0.142,0.169 +C,0.226,0.301,0.222,0.593,0.693,0.718,0.56,0.647,0.514,0.256,0.267,0.299 +D,0.466,0.407,0.373,0.745,0.575,0.653,0.394,0.527,0.428,0.446,0.483,0.477 +E,0.86,0.651,0.754,0.231,0.265,0.285,0.112,0.112,0.114,0.407,0.496,0.438 +F,1.272,1.333,1.293,0.448,0.445,0.45,0.146,0.146,0.149,0.064,0.067,0.064 +G,1.349,1.419,1.41,0.553,0.598,0.645,0.449,0.439,0.42,0.271,0.281,0.291 +H,0.151,0.162,0.157,0.527,0.52,0.532,0.492,0.543,0.547,0.703,0.899,0.807 +,,,,,,,,,,,, +,1,2,3,4,5,6,7,8,9,10,11,12 +A,Std 0,Std 0,Std 0,442-20,442-20,442-20,443-120,443-120,443-120,450-120,450-120,450-120 +B,Std 1,Std 1,Std 1,442-40,442-40,442-40,ChkStd 0,ChkStd 0,ChkStd 0,451-10,451-10,451-10 +C,Std 2,Std 2,Std 2,442-80,442-80,442-80,443-120 Dup,443-120 Dup,443-120 Dup,451-20,451-20,451-20 +D,Std 3,Std 3,Std 3,442-120,442-120,442-120,ChkStd 3,ChkStd 3,ChkStd 3,442-10 Spike,442-10 Spike,442-10 Spike +E,Std 4,Std 4,Std 4,443-10,443-10,443-10,450-10,450-10,450-10,450-10 Spike,450-10 Spike,450-10 Spike +F,Std 5,Std 5,Std 5,443-20,443-20,443-20,450-20,450-20,450-20,ChkStd 0,ChkStd 0,ChkStd 0 +G,MC: 10ppt S5,MC: 10ppt S5,MC: 10ppt S5,443-40,443-40,443-40,450-40,450-40,450-40,451-20 Dup,451-20 Dup,451-20 Dup +H,442-10,442-10,442-10,443-80,443-80,443-80,450-80,450-80,450-80,ChkStd 4,ChkStd 4,ChkStd 4 +,,,,,,,,,,,, +,1,2,3,4,5,6,7,8,9,10,11,12 +A,1,1,1,100,100,100,100,100,100,100,100,100 +B,1,1,1,100,100,100,1,1,1,100,100,100 +C,1,1,1,100,100,100,100,100,100,100,100,100 +D,1,1,1,100,100,100,1,1,1,100,100,100 +E,1,1,1,100,100,100,100,100,100,100,100,100 +F,1,1,1,100,100,100,100,100,100,1,1,1 +G,1,1,1,100,100,100,100,100,100,100,100,100 +H,100,100,100,100,100,100,100,100,100,1,1,1 diff --git a/SMARTX/Porewater/Sulfide/2026/Raw Data/20260521_SMARTX_H2S_Plate8.csv b/SMARTX/Porewater/Sulfide/2026/Raw Data/20260521_SMARTX_H2S_Plate8.csv new file mode 100644 index 0000000..03abb06 --- /dev/null +++ b/SMARTX/Porewater/Sulfide/2026/Raw Data/20260521_SMARTX_H2S_Plate8.csv @@ -0,0 +1,29 @@ +,1,2,3,4,5,6,7,8,9,10,11,12 +A,0.066,0.068,0.064,0.625,0.61,0.566,0.352,0.327,0.361,0.255,0.263,0.238 +B,0.14,0.13,0.118,0.627,0.68,0.638,0.068,0.066,0.067,0.477,0.424,0.471 +C,0.226,0.212,0.245,0.125,0.126,0.121,0.349,0.307,0.347,0.646,0.592,0.606 +D,0.444,0.385,0.441,0.196,0.211,0.219,0.436,0.455,0.464,0.87,0.717,0.849 +E,0.81,0.759,0.628,0.422,0.529,0.498,0.43,0.496,0.487,0.659,0.694,0.705 +F,1.304,1.065,1.234,0.693,0.703,0.619,0.404,0.473,0.452,0.063,0.063,0.062 +G,1.308,1.396,1.323,0.6,0.678,0.649,0.392,0.352,0.394,0.669,0.554,0.589 +H,0.53,0.515,0.547,0.075,0.089,0.096,0.125,0.125,0.134,0.792,0.762,0.709 +,,,,,,,,,,,, +,1,2,3,4,5,6,7,8,9,10,11,12 +A,Std 0,Std 0,Std 0,451-80,451-80,451-80,453-20,453-20,453-20,460-20,460-20,460-20 +B,Std 1,Std 1,Std 1,451-120,451-120,451-120,ChkStd 0,ChkStd 0,ChkStd 0,460-40,460-40,460-40 +C,Std 2,Std 2,Std 2,452-10,452-10,452-10,453-20 Dup,453-20 Dup,453-20 Dup,460-80,460-80,460-80 +D,Std 3,Std 3,Std 3,452-20,452-20,452-20,ChkStd 3,ChkStd 3,ChkStd 3,451-40 Spike,451-40 Spike,451-40 Spike +E,Std 4,Std 4,Std 4,452-40,452-40,452-40,453-40,453-40,453-40,453-40 Spike,453-40 Spike,453-40 Spike +F,Std 5,Std 5,Std 5,452-80,452-80,452-80,453-80,453-80,453-80,ChkStd 0,ChkStd 0,ChkStd 0 +G,MC: 10ppt S5,MC: 10ppt S5,MC: 10ppt S5,452-120,452-120,452-120,453-120,453-120,453-120,460-80 Dup,460-80 Dup,460-80 Dup +H,451-40,451-40,451-40,453-10,453-10,453-10,460-10,460-10,460-10,ChkStd 4,ChkStd 4,ChkStd 4 +,,,,,,,,,,,, +,1,2,3,4,5,6,7,8,9,10,11,12 +A,1,1,1,100,100,100,100,100,100,100,100,100 +B,1,1,1,100,100,100,1,1,1,100,100,100 +C,1,1,1,100,100,100,100,100,100,100,100,100 +D,1,1,1,100,100,100,1,1,1,100,100,100 +E,1,1,1,100,100,100,100,100,100,100,100,100 +F,1,1,1,100,100,100,100,100,100,1,1,1 +G,1,1,1,100,100,100,100,100,100,100,100,100 +H,100,100,100,100,100,100,100,100,100,1,1,1 diff --git a/SMARTX/Porewater/Sulfide/2026/Raw Data/20260521_SMARTX_H2S_Plate9.csv b/SMARTX/Porewater/Sulfide/2026/Raw Data/20260521_SMARTX_H2S_Plate9.csv new file mode 100644 index 0000000..20ee176 --- /dev/null +++ b/SMARTX/Porewater/Sulfide/2026/Raw Data/20260521_SMARTX_H2S_Plate9.csv @@ -0,0 +1,29 @@ +,1,2,3,4,5,6,7,8,9,10,11,12 +A,0.066,0.063,0.065,0.1,0.105,0.102,0.512,0.536,0.659,0.608,0.652,0.562 +B,0.122,0.134,0.111,0.234,0.213,0.238,0.067,0.065,0.066,0.476,0.46,0.483 +C,0.292,0.26,0.282,0.303,0.314,0.353,0.604,0.548,0.561,0.547,0.756,0.584 +D,0.438,0.462,0.364,0.426,0.442,0.423,0.425,0.401,0.42,0.78,0.772,0.787 +E,0.778,0.741,0.671,0.244,0.229,0.209,0.581,0.523,0.625,0.89,0.901,0.8 +F,1.295,1.004,1.139,0.077,0.075,0.09,0.174,0.171,0.165,0.065,0.064,0.064 +G,1.296,1.257,1.17,0.247,0.243,0.227,0.387,0.41,0.422,0.522,0.546,0.471 +H,0.579,0.513,0.46,0.548,0.576,0.473,0.568,0.549,0.51,0.747,0.792,0.809 +,,,,,,,,,,,, +,1,2,3,4,5,6,7,8,9,10,11,12 +A,Std 0,Std 0,Std 0,461-10,461-10,461-10,462-80,462-80,462-80,463-80,463-80,463-80 +B,Std 1,Std 1,Std 1,461-20,461-20,461-20,ChkStd 0,ChkStd 0,ChkStd 0,463-120,463-120,463-120 +C,Std 2,Std 2,Std 2,461-40,461-40,461-40,462-80 Dup,462-80 Dup,462-80 Dup,453-10,453-10,453-10 +D,Std 3,Std 3,Std 3,461-80,461-80,461-80,ChkStd 3,ChkStd 3,ChkStd 3,460-120 Spike,460-120 Spike,460-120 Spike +E,Std 4,Std 4,Std 4,461-120,461-120,461-120,462-120,462-120,462-120,462-120 Spike,462-120 Spike,462-120 Spike +F,Std 5,Std 5,Std 5,462-10,462-10,462-10,463-10,463-10,463-10,ChkStd 0,ChkStd 0,ChkStd 0 +G,MC: 10ppt S5,MC: 10ppt S5,MC: 10ppt S5,462-20,462-20,462-20,463-20,463-20,463-20,463-120 Dup,463-120 Dup,463-120 Dup +H,460-120,460-120,460-120,462-40,462-40,462-40,463-40,463-40,463-40,ChkStd 4,ChkStd 4,ChkStd 4 +,,,,,,,,,,,, +,1,2,3,4,5,6,7,8,9,10,11,12 +A,1,1,1,100,100,100,100,100,100,100,100,100 +B,1,1,1,100,100,100,1,1,1,100,100,100 +C,1,1,1,100,100,100,100,100,100,100,100,100 +D,1,1,1,100,100,100,1,1,1,100,100,100 +E,1,1,1,100,100,100,100,100,100,100,100,100 +F,1,1,1,100,100,100,100,100,100,1,1,1 +G,1,1,1,100,100,100,100,100,100,100,100,100 +H,100,100,100,100,100,100,100,100,100,1,1,1 diff --git a/SMARTX/Porewater/Sulfide/2026/Raw Data/20260521_SMARTX_H2S_STD.csv b/SMARTX/Porewater/Sulfide/2026/Raw Data/20260521_SMARTX_H2S_STD.csv new file mode 100644 index 0000000..6aa9121 --- /dev/null +++ b/SMARTX/Porewater/Sulfide/2026/Raw Data/20260521_SMARTX_H2S_STD.csv @@ -0,0 +1,29 @@ +,1,2,3,4,5,6,7,8,9,10,11,12 +A,0.066,0.068,0.064,0.049,0.045,0.045,0.046,0.045,0.045,0.045,0.046,0.045 +B,0.128,0.13,0.126,0.044,0.046,0.045,0.046,0.044,0.045,0.045,0.044,0.045 +C,0.235,0.239,0.263,0.045,0.044,0.045,0.044,0.044,0.044,0.045,0.045,0.046 +D,0.383,0.367,0.415,0.044,0.045,0.045,0.044,0.044,0.044,0.045,0.045,0.044 +E,0.728,0.705,0.743,0.045,0.044,0.044,0.045,0.044,0.044,0.045,0.045,0.045 +F,1.259,1.409,1.112,0.047,0.045,0.045,0.044,0.044,0.045,0.045,0.045,0.045 +G,1.478,1.454,1.245,0.045,0.045,0.044,0.045,0.045,0.044,0.044,0.044,0.045 +H,0.045,0.045,0.045,0.045,0.045,0.044,0.045,0.045,0.046,0.044,0.045,0.046 +,,,,,,,,,,,, +,1,2,3,4,5,6,7,8,9,10,11,12 +A,Std 0,Std 0,Std 0,,,,,,,,, +B,Std 1,Std 1,Std 1,,,,,,,,, +C,Std 2,Std 2,Std 2,,,,,,,,, +D,Std 3,Std 3,Std 3,,,,,,,,, +E,Std 4,Std 4,Std 4,,,,,,,,, +F,Std 5,Std 5,Std 5,,,,,,,,, +G,MC: 10ppt S5,MC: 10ppt S5,MC: 10ppt S5,,,,,,,,, +H,,,,,,,,,,,, +,,,,,,,,,,,, +,1,2,3,4,5,6,7,8,9,10,11,12 +A,1,1,1,,,,,,,,, +B,1,1,1,,,,,,,,, +C,1,1,1,,,,,,,,, +D,1,1,1,,,,,,,,, +E,1,1,1,,,,,,,,, +F,1,1,1,,,,,,,,, +G,1,1,1,,,,,,,,, +H,,,,,,,,,,,, diff --git a/SMARTX/Porewater/Sulfide/2026/Raw Data/20260601_SMARTX_H2S_Rerun_Plate1.csv b/SMARTX/Porewater/Sulfide/2026/Raw Data/20260601_SMARTX_H2S_Rerun_Plate1.csv new file mode 100644 index 0000000..ee5a8ab --- /dev/null +++ b/SMARTX/Porewater/Sulfide/2026/Raw Data/20260601_SMARTX_H2S_Rerun_Plate1.csv @@ -0,0 +1,29 @@ +,1,2,3,4,5,6,7,8,9,10,11,12 +A,0.065,0.065,0.065,2.093,1.895,1.898,0.951,0.861,0.858,1.112,1.131,1.071 +B,0.131,0.14,0.179,0.691,0.822,0.845,0.066,0.065,0.062,0.647,0.718,0.614 +C,0.283,0.25,0.279,0.516,0.528,0.539,0.884,1.008,0.964,0.471,0.464,0.488 +D,0.483,0.506,0.444,0.181,0.181,0.188,0.457,0.483,0.462,1.431,1.6,1.491 +E,0.808,0.833,0.819,0.178,0.193,0.192,1.36,1.432,1.228,1.257,1.549,1.603 +F,1.401,1.397,1.294,0.412,0.507,0.502,1.695,1.816,1.775,0.064,0.062,0.068 +G,1.352,1.275,1.408,0.636,0.661,0.755,2.503,2.576,2.93,2.175,1.988,2.104 +H,1.219,1.282,1.284,0.624,0.616,0.529,2.227,1.986,1.706,0.777,0.814,0.785 +,,,,,,,,,,,, +,1,2,3,4,5,6,7,8,9,10,11,12 +A,Std 0,Std 0,Std 0,Ch11-5,Ch11-5,Ch11-5,P3-40,P3-40,P3-40,462-10,462-10,462-10 +B,Std 1,Std 1,Std 1,Ch4-80,Ch4-80,Ch4-80,ChkStd 0,ChkStd 0,ChkStd 0,442-120,442-120,442-120 +C,Std 2,Std 2,Std 2,Ch4-40,Ch4-40,Ch4-40,P3-40 Dup,P3-40 Dup,P3-40 Dup,321-20,321-20,321-20 +D,Std 3,Std 3,Std 3,Ch8-5,Ch8-5,Ch8-5,ChkStd 3,ChkStd 3,ChkStd 3, Ch2-5 Spike, Ch2-5 Spike, Ch2-5 Spike +E,Std 4,Std 4,Std 4,L18-20,L18-20,L18-20,P4-20,P4-20,P4-20, P4-20 Spike, P4-20 Spike, P4-20 Spike +F,Std 5,Std 5,Std 5,L11-40,L11-40,L11-40,P8-20,P8-20,P8-20,ChkStd 0,ChkStd 0,ChkStd 0 +G,MC: 10ppt S5,MC: 10ppt S5,MC: 10ppt S5,L13-40,L13-40,L13-40,331-10,331-10,331-10,461-10 Dup,461-10 Dup,461-10 Dup +H,Ch2-5,Ch2-5,Ch2-5,L16-80,L16-80,L16-80,461-10,461-10,461-10,ChkStd 4,ChkStd 4,ChkStd 4 +,,,,,,,,,,,, +,1,2,3,4,5,6,7,8,9,10,11,12 +A,1,1,1,1,1,1,1,1,1,1,1,1 +B,1,1,1,100,100,100,1,1,1,100,100,100 +C,1,1,1,100,100,100,1,1,1,100,100,100 +D,1,1,1,50,50,50,1,1,1,1,1,1 +E,1,1,1,1,1,1,1,1,1,1,1,1 +F,1,1,1,50,50,50,1,1,1,1,1,1 +G,1,1,1,50,50,50,1,1,1,100,100,100 +H,1,1,1,50,50,50,1,1,1,1,1,1 diff --git a/SMARTX/Porewater/Sulfide/2026/Raw Data/20260601_SMARTX_H2S_Rerun_Plate2.csv b/SMARTX/Porewater/Sulfide/2026/Raw Data/20260601_SMARTX_H2S_Rerun_Plate2.csv new file mode 100644 index 0000000..850274b --- /dev/null +++ b/SMARTX/Porewater/Sulfide/2026/Raw Data/20260601_SMARTX_H2S_Rerun_Plate2.csv @@ -0,0 +1,29 @@ +,1,2,3,4,5,6,7,8,9,10,11,12 +A,0.066,0.065,0.061,0.393,0.431,0.415,0.421,0.494,0.473,0.045,0.045,0.046 +B,0.143,0.14,0.148,0.43,0.554,0.509,0.067,0.067,0.069,0.044,0.044,0.044 +C,0.261,0.255,0.237,0.497,0.476,0.565,0.488,0.511,0.525,0.044,0.044,0.046 +D,0.377,0.446,0.478,0.225,0.237,0.234,0.452,0.449,0.408,0.441,0.487,0.476 +E,0.804,0.814,0.861,0.511,0.482,0.516,0.262,0.224,0.241,0.482,0.493,0.548 +F,1.264,1.222,1.207,0.223,0.242,0.225,0.044,0.044,0.044,0.064,0.062,0.064 +G,1.261,1.319,1.343,0.169,0.143,0.14,0.044,0.045,0.044,0.044,0.044,0.044 +H,0.171,0.179,0.192,0.247,0.209,0.201,0.045,0.045,0.046,0.764,0.812,0.784 +,,,,,,,,,,,, +,1,2,3,4,5,6,7,8,9,10,11,12 +A,Std 0,Std 0,Std 0,323-20,323-20,323-20,331-10,331-10,331-10,,, +B,Std 1,Std 1,Std 1,323-80,323-80,323-80,ChkStd 0,ChkStd 0,ChkStd 0,,, +C,Std 2,Std 2,Std 2,613-80,613-80,613-80, 331-10 Dup, 331-10 Dup, 331-10 Dup,,, +D,Std 3,Std 3,Std 3,633-10,633-10,633-10,ChkStd 3,ChkStd 3,ChkStd 3,323-10 Spike,323-10 Spike,323-10 Spike +E,Std 4,Std 4,Std 4,633-40,633-40,633-40,461-10,461-10,461-10,461-10 Spike,461-10 Spike,461-10 Spike +F,Std 5,Std 5,Std 5,Ch11-5,Ch11-5,Ch11-5,,,,ChkStd 0,ChkStd 0,ChkStd 0 +G,MC: 10ppt S5,MC: 10ppt S5,MC: 10ppt S5,P4-20,P4-20,P4-20,,,,,, +H,323-10,323-10,323-10,P8-20,P8-20,P8-20,,,,ChkStd 4,ChkStd 4,ChkStd 4 +,,,,,,,,,,,, +,1,2,3,4,5,6,7,8,9,10,11,12 +A,1,1,1,100,100,100,25,25,25,,, +B,1,1,1,100,100,100,1,1,1,,, +C,1,1,1,100,100,100,25,25,25,,, +D,1,1,1,100,100,100,1,1,1,100,100,100 +E,1,1,1,100,100,100,25,25,25,25,25,25 +F,1,1,1,25,25,25,,,,1,1,1 +G,1,1,1,25,25,25,,,,,, +H,100,100,100,25,25,25,,,,1,1,1 diff --git a/SMARTX/Porewater/Sulfide/2026/Raw Data/20260601_SMARTX_H2S_STD.csv b/SMARTX/Porewater/Sulfide/2026/Raw Data/20260601_SMARTX_H2S_STD.csv new file mode 100644 index 0000000..8c5969f --- /dev/null +++ b/SMARTX/Porewater/Sulfide/2026/Raw Data/20260601_SMARTX_H2S_STD.csv @@ -0,0 +1,29 @@ +,1,2,3,4,5,6,7,8,9,10,11,12 +A,0.063,0.063,0.072,0.047,0.046,0.047,0.045,0.046,0.046,0.045,0.044,0.045 +B,0.154,0.13,0.124,0.044,0.044,0.045,0.049,0.044,0.045,0.044,0.044,0.044 +C,0.261,0.251,0.228,0.044,0.045,0.045,0.044,0.044,0.044,0.045,0.045,0.046 +D,0.422,0.52,0.469,0.044,0.045,0.045,0.045,0.044,0.044,0.044,0.044,0.045 +E,0.671,0.631,0.672,0.044,0.044,0.045,0.045,0.044,0.044,0.047,0.045,0.045 +F,1.152,1.331,1.309,0.044,0.044,0.044,0.044,0.044,0.044,0.044,0.045,0.044 +G,1.283,1.178,1.293,0.044,0.045,0.045,0.045,0.045,0.044,0.044,0.044,0.044 +H,0.046,0.046,0.045,0.045,0.048,0.044,0.044,0.046,0.047,0.044,0.045,0.045 +,,,,,,,,,,,, +,1,2,3,4,5,6,7,8,9,10,11,12 +A,Std 0,Std 0,Std 0,,,,,,,,, +B,Std 1,Std 1,Std 1,,,,,,,,, +C,Std 2,Std 2,Std 2,,,,,,,,, +D,Std 3,Std 3,Std 3,,,,,,,,, +E,Std 4,Std 4,Std 4,,,,,,,,, +F,Std 5,Std 5,Std 5,,,,,,,,, +G,MC: 10ppt S5,MC: 10ppt S5,MC: 10ppt S5,,,,,,,,, +H,,,,,,,,,,,, +,,,,,,,,,,,, +,1,2,3,4,5,6,7,8,9,10,11,12 +A,1,1,1,,,,,,,,, +B,1,1,1,,,,,,,,, +C,1,1,1,,,,,,,,, +D,1,1,1,,,,,,,,, +E,1,1,1,,,,,,,,, +F,1,1,1,,,,,,,,, +G,1,1,1,,,,,,,,, +H,,,,,,,,,,,, diff --git a/SMARTX/Porewater/Sulfide/2026/Ready for Review/GCReW_SMARTX_Porewater_H2S_202605.pdf b/SMARTX/Porewater/Sulfide/2026/Ready for Review/GCReW_SMARTX_Porewater_H2S_202605.pdf new file mode 100644 index 0000000..ea82ab9 Binary files /dev/null and b/SMARTX/Porewater/Sulfide/2026/Ready for Review/GCReW_SMARTX_Porewater_H2S_202605.pdf differ