#This is just some practice attempts at making histograms of the various states that ebFRET identifies in a given Hidden Markov Model. library(ggplot2) library(hrbrthemes) library(dplyr) library(tidyr) library(viridis) library(ggridges) #Load in the Full Report Trace outputs from ebFRET TypeAll_traces_2states_ebFRET <- read.table("F:/Conditions/1uMeEF2;15mMMg2+(WT)/Compiled/Saved_Data/T1_to_T2_Synchronized_secondAttempt/ebFRET_Results/1e15Mg_2states.dat", quote="\"", comment.char="") TypeAll_traces_3states_ebFRET <- read.table("F:/Conditions/1uMeEF2;15mMMg2+(WT)/Compiled/Saved_Data/T1_to_T2_Synchronized_secondAttempt/ebFRET_Results/1e15Mg_3states.dat", quote="\"", comment.char="") TypeAll_traces_4states_ebFRET <- read.table("F:/Conditions/1uMeEF2;15mMMg2+(WT)/Compiled/Saved_Data/T1_to_T2_Synchronized_secondAttempt/ebFRET_Results/1e15Mg_4states.dat", quote="\"", comment.char="") #Name the columns for each dataframe colnames(TypeAll_traces_2states_ebFRET) <- c("Trace", "Donor", "Acceptor", "FRET", "Viterbi_State", "Viterbi_Mean") colnames(TypeAll_traces_3states_ebFRET) <- c("Trace", "Donor", "Acceptor", "FRET", "Viterbi_State", "Viterbi_Mean") colnames(TypeAll_traces_4states_ebFRET) <- c("Trace", "Donor", "Acceptor", "FRET", "Viterbi_State", "Viterbi_Mean") #Use dplyr to filter out a particular state for each state in the 2-state HMM State1_2HMM <- filter(TypeAll_traces_2states_ebFRET, Viterbi_State == 1) State2_2HMM <- filter(TypeAll_traces_2states_ebFRET, Viterbi_State == 2) #Use dplyr to filter out a particular state for each state in the 3-state HMM State1_3HMM <- filter(TypeAll_traces_3states_ebFRET, Viterbi_State == 1) State2_3HMM <- filter(TypeAll_traces_3states_ebFRET, Viterbi_State == 2) State3_3HMM <- filter(TypeAll_traces_3states_ebFRET, Viterbi_State == 3) #Use dplyr to filter out a particular state for each state in the 4-state HMM State1_4HMM <- filter(TypeAll_traces_4states_ebFRET, Viterbi_State == 1) State2_4HMM <- filter(TypeAll_traces_4states_ebFRET, Viterbi_State == 2) State3_4HMM <- filter(TypeAll_traces_4states_ebFRET, Viterbi_State == 3) State4_4HMM <- filter(TypeAll_traces_4states_ebFRET, Viterbi_State == 4) #Use dplyr to select the Viterbi_Mean values for each state in the 2-state HMM FRET_State1_2HMM <- select(State1_2HMM, Viterbi_Mean) FRET_State2_2HMM <- select(State2_2HMM, Viterbi_Mean) #Use dplyr to select the Viterbi_Mean values for each state in the 3-state HMM FRET_State1_3HMM <- select(State1_3HMM, Viterbi_Mean) FRET_State2_3HMM <- select(State2_3HMM, Viterbi_Mean) FRET_State3_3HMM <- select(State3_3HMM, Viterbi_Mean) #Use dplyr to select the Viterbi_Mean values for each state in the 4-state HMM FRET_State1_4HMM <- select(State1_4HMM, Viterbi_Mean) FRET_State2_4HMM <- select(State2_4HMM, Viterbi_Mean) FRET_State3_4HMM <- select(State3_4HMM, Viterbi_Mean) FRET_State4_4HMM <- select(State4_4HMM, Viterbi_Mean) #Faceted for each state in the 2-state HMM ggplot(TypeAll_traces_2states_ebFRET, aes(x=Viterbi_Mean))+ geom_histogram(color="black", fill="white")+ facet_grid(Viterbi_State ~ .) #Faceted for each state in the 3-state HMM ggplot(TypeAll_traces_3states_ebFRET, aes(x=Viterbi_Mean))+ geom_histogram(color="black", fill="white")+ facet_grid(Viterbi_State ~ .) #Faceted for each state in the 4-state HMM ggplot(TypeAll_traces_4states_ebFRET, aes(x=Viterbi_Mean))+ geom_histogram(color="black", fill="white")+ facet_grid(Viterbi_State ~ .)