Skip to content

Commit 2e65279

Browse files
committed
added some java source files and completed smooth winds page
Added the source files used to compile the DGEN and SmoothWinds jar files. Added source files used to conduct experiments for both. Added a new page 'Smooth Winds' for building accurate local genealogies. Documentation soon to follow.
1 parent 342a429 commit 2e65279

14 files changed

+10122
-26
lines changed

R/r_makeFigsSmoothWinds.R

+150-10
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
library(ggpubr)
2+
library(Hmisc)
3+
library(gdata)
24

35
figsPath = "/Users/leo/rice/tmp/"
4-
paperPath = "/Users/leo/rice/res/papers/RECOMB2016/svn/ISBRA19-Leo/draft1/figs/"
6+
paperPath = "/Users/leo/rice/res/papers/RECOMB2016/svn/WABI19-Leo/lipics-v2019-authors/figs/"
57

68

79

@@ -19,7 +21,7 @@ myPlot <- ggerrorplot(values, x = "Method", y = "Time", xlab = "Method Used", yl
1921

2022
myPlot <- ggpar(myPlot, x.text.angle = 90) #angles x labels
2123

22-
ggsave(filename=paste(paperPath,"fig_mosq6tax_time.pdf",sep=""), plot=myPlot, width=8,height=8)
24+
ggsave(filename=paste(paperPath,"fig_mosq_6tax_time.pdf",sep=""), plot=myPlot, width=8,height=8)
2325

2426

2527

@@ -71,6 +73,118 @@ ggsave(filename=paste(paperPath,"fig_mosq6tax_accuracy.pdf",sep=""), plot=myPlot
7173

7274

7375

76+
###
77+
# Fig - primates 11tax accuracy
78+
###
79+
80+
fileToRead = paste(figsPath,"final_primates_11tax_20x/FinalResults/r_all",sep="")
81+
values = read.csv(fileToRead, header=TRUE)
82+
83+
#do a lil renaming
84+
#values[1:21,]
85+
values [,1] = gsub("-CNTRD", "", values[,1])
86+
values [,1] = gsub("LessMem", "", values[,1])
87+
88+
#sort em by mean
89+
means = aggregate(values[, 2], list(values$Method), mean)
90+
meansOrdered = means[order(means$x),]
91+
meansOrderedNames = meansOrdered[,1]
92+
list(meansOrderedNames)
93+
meanOrderedNames = fct_inorder(rev(meansOrderedNames)) #rev does reverse order (so currently best is on top, without rev its on bottom)
94+
95+
#meanOrderedNames <- fct_inorder(meanOrderedNames, ordered = TRUE)
96+
97+
meanOrderedNames <- factor(meanOrderedNames, fct_inorder(meanOrderedNames))
98+
#meanOrderedNames
99+
values$Method <- factor(values$Method, meanOrderedNames)
100+
#values$Method #WORKS?
101+
102+
#command line with saving?
103+
myPlot <- ggerrorplot(values, x = "Method", y = "Accuracy", xlab = "Method Used", ylab = "Symmetric Difference",
104+
desc_stat = "mean_sd", color = "black",
105+
add = "jitter", add.params = list(color = "darkgray"),font.x = c(24, "bold", "black"),font.y = c(24, "bold", "black"),font.tickslab = c(18,"bold", "black")
106+
)
107+
myPlot <- ggpar(myPlot, x.text.angle = 90) #angles x labels
108+
# THIS IS AN OPTION ALSO
109+
myPlot <- myPlot + coord_flip()
110+
ggsave(filename=paste(paperPath,"fig_primates_11tax_accuracy.pdf",sep=""), plot=myPlot, width=12,height=8)
111+
112+
113+
114+
115+
116+
117+
###
118+
# Fig - generate ALL ACCURACY FIGS (since the naming conventions are easy and they are all the same)
119+
###
120+
121+
myFunctionMakePlot <- function(inputFile,outputFile) {
122+
123+
fileToRead = paste(figsPath,inputFile,sep="")
124+
values = read.csv(fileToRead, header=TRUE)
125+
126+
#do a lil renaming
127+
values [,1] = gsub("-CNTRD", "", values[,1])
128+
values [,1] = gsub("LessMem", "", values[,1])
129+
130+
#sort em by mean
131+
means = aggregate(values[, 2], list(values$Method), mean)
132+
meansOrdered = means[order(means$x),]
133+
meansOrderedNames = meansOrdered[,1]
134+
meanOrderedNames = fct_inorder(rev(meansOrderedNames)) #rev does reverse order (so currently best is on top, without rev its on bottom)
135+
136+
#meanOrderedNames <- factor(meanOrderedNames, fct_inorder(meanOrderedNames))
137+
values$Method <- factor(values$Method, meanOrderedNames)
138+
#values$Method #WORKS?
139+
140+
#command line with saving?
141+
myPlot <- ggerrorplot(values, x = "Method", y = "Accuracy", xlab = "Method Used", ylab = "Symmetric Difference",
142+
desc_stat = "mean_sd", color = "black",
143+
add = "jitter", add.params = list(color = "darkgray"),font.x = c(24, "bold", "black"),font.y = c(24, "bold", "black"),font.tickslab = c(18,"bold", "black")
144+
)
145+
myPlot <- ggpar(myPlot, x.text.angle = 90) #angles x labels
146+
# THIS IS AN OPTION ALSO (flips it)
147+
myPlot <- myPlot + coord_flip()
148+
ggsave(filename=paste(paperPath,outputFile,sep=""), plot=myPlot, width=12,height=8)
149+
}
150+
151+
myFunctionMakePlot("final_butterfly_8tax_20x/FinalResults/r_all","fig_butterfly_8tax_accuracy.pdf")
152+
myFunctionMakePlot("final_butterfly_12tax_20x/FinalResults/r_all","fig_butterfly_12tax_accuracy.pdf")
153+
myFunctionMakePlot("final_bird_8tax_20x/FinalResults/r_all","fig_bird_8tax_accuracy.pdf")
154+
myFunctionMakePlot("final_bird_12tax_20x/FinalResults/r_all","fig_bird_12tax_accuracy.pdf")
155+
myFunctionMakePlot("final_mosq_12tax_20x/FinalResults/r_all","fig_mosq_12tax_accuracy.pdf")
156+
myFunctionMakePlot("final_mosq_18tax_20x/FinalResults/r_all","fig_mosq_18tax_accuracy.pdf")
157+
myFunctionMakePlot("final_bird_4tax_20x/FinalResults/r_all","fig_bird_4tax_accuracy.pdf")
158+
myFunctionMakePlot("final_butterfly_4tax_20x/FinalResults/r_all","fig_butterfly_4tax_accuracy.pdf")
159+
myFunctionMakePlot("final_mosq_6tax_20x/FinalResults/r_all","fig_mosq_6tax_accuracy.pdf")
160+
myFunctionMakePlot("final_primates_11tax_20x/FinalResults/r_all","fig_primates_11tax_accuracy.pdf")
161+
myFunctionMakePlot("final_humans_4tax_20x/FinalResults/r_all","fig_humans_4tax_accuracy.pdf")
162+
163+
164+
###
165+
# GENERATE ALL TIMING FIGS
166+
###
167+
myFunctionMakeTimingPlot <- function(inputFile,outputFile) {
168+
169+
fileToRead = paste(figsPath,inputFile,sep="")
170+
values = read.csv(fileToRead, header=TRUE)
171+
172+
#command line with saving?
173+
myPlot <- ggerrorplot(values, x = "Method", y = "Time", xlab = "Method Used", ylab = "Time (s)",
174+
desc_stat = "mean_sd", color = "black",
175+
add = "jitter", add.params = list(color = "darkgray"),font.x = c(24, "bold", "black"),font.y = c(24, "bold", "black"),font.tickslab = c(14,"bold", "black")
176+
)
177+
178+
myPlot <- ggpar(myPlot, x.text.angle = 90) #angles x labels
179+
180+
ggsave(filename=paste(paperPath,outputFile,sep=""), plot=myPlot, width=8,height=8)
181+
}
182+
183+
myFunctionMakeTimingPlot("final_mosq_6tax_20x/FinalTimings/r_all","fig_mosq_6tax_time.pdf")
184+
myFunctionMakeTimingPlot("final_mosq_12tax_20x/FinalTimings/r_all","fig_mosq_12tax_time.pdf")
185+
myFunctionMakeTimingPlot("final_mosq_18tax_20x/FinalTimings/r_all","fig_mosq_18tax_time.pdf")
186+
myFunctionMakeTimingPlot("final_bird_4tax_20x/FinalTimings/r_all","fig_bird_4tax_time.pdf")
187+
74188

75189

76190

@@ -94,14 +208,40 @@ dat <- data.frame(x = factor(rep(c("Controls", "Cases"), each = n),
94208
Outcome = c(controls, cases))
95209
#One option is simply to show the data points, which you can do like this:
96210

97-
dat %>% ggplot(aes(x, Outcome)) +
98-
geom_jitter(width = 0.05)
211+
dat %>% ggplot(aes(x, Outcome)) +
212+
geom_jitter(width = 0.05)
99213

100-
myPlot <- ggplot(dat,aes(x, Outcome)) +
101-
geom_jitter(width = 0.05)
102-
103-
myPlot + theme(axis.text.x = element_text(angle = 90, hjust = 1))
214+
myPlot <- ggplot(dat,aes(x, Outcome)) +
215+
geom_jitter(width = 0.05)
216+
217+
myPlot + theme(axis.text.x = element_text(angle = 90, hjust = 1))
104218

105-
#maybe i just go with this
106-
myPlot + coord_flip()
219+
#maybe i just go with this
220+
myPlot + coord_flip()
221+
222+
223+
####
224+
# TESTING ORDER BY MEANS OF CATEGORIES
225+
###
226+
227+
zz <- "chrom start
228+
chr2 39482
229+
chr1 203918
230+
chr1 198282
231+
chrX 7839028
232+
chr17 3874"
233+
Data <- read.table(text=zz, header = TRUE)
234+
235+
#library(Hmisc)
236+
#library(gdata)
237+
238+
Data$chrom <- reorder.factor(Data$chrom , levels = c("chr1","chr2", "chr17", "chrX"))
239+
240+
Data[order(Data$chrom), ]
241+
242+
#### MAKING A FUNCTION
243+
mysummary <- function(x,y) {
244+
cat(x)
245+
cat(y)
246+
}
107247

0 commit comments

Comments
 (0)