<-dir('data/spectra/emission', full.names = TRUE)
+ files
+<-read.table(files[1], sep='\t')
+ spectra$sample <- 1
+ spectra
+for(i in seq_along(files)[-1]){
+<-read.table(files[i], sep='\t')
+ spectra.tmp $sample <- i
+ spectra.tmp<- rbind(spectra, spectra.tmp)
+ spectra
+ }
+$fluor <- NA
+ spectra
+$fluor[spectra$sample %in% seq(9,17)] <- 594
+ spectra$fluor[!(spectra$sample %in% seq(9,17))] <- 488
+ spectra
+$status <- NA
+ spectra
+<-c('fluor', 'quench', 'fluor',
+ status'quench', 'quench', 'unquench',
+ 'unquench', 'unquench', 'unquench',
+ 'fluor', 'fluor', 'fluor',
+ 'quench', 'quench', 'quench',
+ 'unquench', 'unquench', 'unquench')
+ <-1
+ kfor(i in unique(spectra$sample)){
+
+
+ $status[spectra$sample==i]<-status[i]
+ spectra
+
+ }
+
+library(dplyr)
+
+
+Attaching package: 'dplyr'
+
+
+The following objects are masked from 'package:stats':
+
+ filter, lag
+
+
+The following objects are masked from 'package:base':
+
+ intersect, setdiff, setequal, union
+<- spectra %>%
+ specgroup_by(fluor, status, V3) %>%
+ summarise(emission=mean(V4))
+
+`summarise()` has grouped output by 'fluor', 'status'. You can override using
+the `.groups` argument.
+$emission[spec$fluor == 488]<-spec$emission[spec$fluor == 488]/max(spec$emission[spec$fluor == 488 & spec$status == 'fluor'])
+ spec$emission[spec$fluor == 594]<-spec$emission[spec$fluor == 594]/max(spec$emission[spec$fluor == 594 & spec$status == 'fluor'])
+ spec
+$emission <- spec$emission - mean(spec$emission[1:50])
+ spec
+
+<- function(cname)
+ col2hex
+ {<- col2rgb(cname)
+ colMat rgb(
+ red=colMat[1,]/255,
+ green=colMat[2,]/255,
+ blue=colMat[3,]/255
+
+ )
+ }
+<- spec[-which(spec$status == 'unquench'),]
+ spec
+quartz(width = 130.1729/20, height = 83.8626/20)
+par(yaxs='i', xaxs='i', mar=c(4,4,1,1))
+plot(0,0, type='n', xlim=c(450,750), ylim=c(0,1), ylab='Emission', xlab="Wavelength (nm)", las=1, axes=F)
+axis(2, las=1, at=c(0,0.5,1))
+
+<- c('green3', 'green4', 'red', 'red4')
+ color <- unique( paste(spec$fluor, spec$status) )
+ unique_samples names(spec)<-c("fluor" , "status" , "wavelength" , "emission")
+
+<- numeric()
+ peak.max # Loop through each unique sample and create a polygon plot
+for (sample_name in unique_samples) {
+# Subset the data for the current sample
+ <- spec[paste(spec$fluor, spec$status) == sample_name, ]
+ sample_data
+ # Create a polygon plot for the current sample
+ polygon(c(sample_data$wavelength,
+ $wavelength[nrow(sample_data)],
+ sample_data$wavelength[1],
+ sample_data$wavelength[1]),
+ sample_data
+ c(sample_data$emission, 0, 0, sample_data$emission[1]),
+ col = paste0( col2hex( color[match(sample_name, unique_samples)] ), '70' ),
+ border = color[match(sample_name, unique_samples)], lwd=2, xpd=F )
+
+ # Add a legend for sample names
+ legend("topright", legend = unique_samples, fill = color)
+
+ <- c(peak.max, sample_data$wavelength[which.max(sample_data$emission)] )
+ peak.max
+ }
+axis(1, at=seq(300,800,by=50))
+
+
+