Skip to content

Commit

Permalink
using the same ylim in the barplots across mafs
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffersonfparil committed Apr 17, 2024
1 parent c6daaf7 commit b11162c
Show file tree
Hide file tree
Showing 9 changed files with 1,365 additions and 1,353 deletions.
270 changes: 135 additions & 135 deletions res/cocksfoot-Concordance.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
274 changes: 137 additions & 137 deletions res/cocksfoot-Concordance_high_confidence_data.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
292 changes: 146 additions & 146 deletions res/cocksfoot-Mean_absolute_error.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
292 changes: 146 additions & 146 deletions res/cocksfoot-Mean_absolute_error_high_confidence_data.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
364 changes: 182 additions & 182 deletions res/grape-Concordance.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
690 changes: 345 additions & 345 deletions res/grape-Mean_absolute_error.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 10 additions & 5 deletions res/perf_plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,16 @@ plot_metrics = function(df, dataset, vec_2_metrics=c("mae_frequencies", "concord
9,10,11,12
), byrow=TRUE, ncol=4))
par(mar=c(5,5,5,1))
### Defile ylim
eval(parse(text=paste0("agg_mu = aggregate(", metric, " ~ algorithm + maf + missing_rate, data=df, FUN=mean, na.rm=TRUE)")))
eval(parse(text=paste0("agg_sd = aggregate(", metric, " ~ algorithm + maf + missing_rate, data=df, FUN=function(x){3*sd(x,na.rm=TRUE)})")))
eval(parse(text=paste0("mat_mu = matrix(agg_mu$", metric, ", nrow=length(unique(agg_mu$algorithm)), byrow=FALSE)")))
y = eval(parse(text=paste0("agg_sd$", metric)))
if (grepl("concordance", metric) == TRUE) {
y_lim = c(0, 1.00+max(c(0.01, max(y, na.rm=TRUE))))
} else {
y_lim = c(0, max(mat_mu, na.rm=TRUE)+max(c(0.01, max(y, na.rm=TRUE))))
}
for (maf in vec_maf) {
# maf = vec_maf[1]
subdf = df[df$maf == maf, ]
Expand All @@ -102,11 +112,6 @@ plot_metrics = function(df, dataset, vec_2_metrics=c("mae_frequencies", "concord
mat_sd = mat_sd[idx_sort, ]
### Barplot
par(xpd=TRUE) ### xpd=TRUE allows us to place the legend outside the plot area
if (grepl("concordance", metric) == TRUE) {
y_lim = c(0, 1.00+max(c(0.01, max(agg_sd[,3], na.rm=TRUE))))
} else {
y_lim = c(0, max(mat_mu, na.rm=TRUE)+max(c(0.01, max(agg_sd[,3], na.rm=TRUE))))
}
bplot = barplot(mat_mu, beside=TRUE, col=vec_colours, ylim=y_lim, border=NA, main=paste0("maf = ", maf), xlab="Sparsity (missing/total)", ylab=metric_label, las=1)
if (maf==min(vec_maf)) {
legend("topleft", inset=c(-0.001, -0.5), legend=vec_algorithm, fill=vec_colours, bty="n", horiz=TRUE)
Expand Down
244 changes: 122 additions & 122 deletions res/soybean-Concordance.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
277 changes: 142 additions & 135 deletions res/soybean-Mean_absolute_error.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit b11162c

Please sign in to comment.