####################################################################################################################################################################### # This program is meant to take the .csv files created by the Click1_Click2_Cut.R program and format them for use in ebFRET. ####################################################################################################################################################################### #Create a variable that contains the full names (full paths) for each text file in your directory of interest. path = r"(C:\Users\clark\Desktop\Documents for Thesis and Manuscript\Analysis_9.9.2022\Lifetime_of_Initial_Sampling_Event_CognateNoTig)" setwd(path) files <- list.files(path, pattern="*.csv", full.names=TRUE, recursive=FALSE) b <- 1 new_file_name <- "ebFRET_formatted_traces_NearCognate_25nMTC_5uMeEF2_CoInjection_SecondaryEvents_T1_to_T2_CKH_Filtered_Traces.txt" for (i in files){ # read the file, specify the correct separator data <- read.csv(i, header = FALSE, sep = ",") #Add a new column to each file that specifies the ID for the file ID_row <- b formatted_table <- cbind(ID_row, data) colnames(formatted_table) <- NULL #Save the formatted files to one file where each formatted trace appended to the last trace in the file. write.table(formatted_table, new_file_name, row.names = FALSE, col.names = FALSE, append = TRUE) #Iterate b so that the next trace has a unique identifier. b = b + 1 }