-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplot_support_frequencies.Rmd
More file actions
124 lines (105 loc) · 3.81 KB
/
Copy pathplot_support_frequencies.Rmd
File metadata and controls
124 lines (105 loc) · 3.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
---
title: "plot bootstraps"
author: "laura dijkhuizen"
date: "04/08/2020"
output: pdf_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
This is a late afternoon inquiry to see if plotting distributions of support values in trees is somewhat insightfull perhaps.
# create simple tab files with bootstrap values
```{bash}
for t in analyses/*_trees/*/*.treefile
do out=$(echo $t | sed 's/.treefile/.bootstraptab/')
if [ ! -f $out ]
then egrep -o ')[0-9./]+' $t | tr -d ')' | tr '/' '\t' > $out
fi
done
```
### optionally, inspect your files for troubleshooting etc.
```{bash}
#for t in analyses/*_trees/*/*.bootstraptab
#do head $t
#done
```
# Read all tab files
```{r pressure, echo=FALSE}
library(data.table)
files <- list.files(path = "analyses",recursive = TRUE,pattern = '*.bootstraptab',full.names = TRUE)
tabs <- lapply(X = files,FUN = fread, sep = '\t')
```
### now simplify these names a bit
`
Note that the `echo = FALSE` parameter was added to the code chunk to prevent printing of the R code that generated the plot.
```{r}
metatabs <- strsplit(x = files,split = '/')
rm(combitab)
combitab <- data.table()
for (i in 1:length(tabs)) {
temp <- tabs[[i]]
if (dim(temp)[2] == 1) {
names(temp) <- 'nonparametricBootstrap'
temp$SHaLRT <- NA
temp$UFBootstrap <- NA
}
if (length(names(temp)) == 2) {
names(temp) <- c('SHaLRT','UFBootstrap')
temp$nonparametricBootstrap <- NA
}
temp$dataset <- factor(metatabs[[i]][2])
temp$alignment <- as.character(metatabs[[i]][3])
temp$iqtree <- factor(metatabs[[i]][4])
combitab <- rbind(combitab,temp,fill=T)
rm(temp)
}
combitab$nonparametricBootstrap <- as.numeric(combitab$nonparametricBootstrap)
combitab$SHaLRT <- as.numeric(combitab$SHaLRT)
combitab$UFBootstrap <- as.numeric(combitab$UFBootstrap)
summary(combitab)
rm(metatab,tabs,i,files
)
```
### melt dataframe to long format
```{r}
combitab <- melt(combitab,variable.name = 'bootstrapstrategy',id.vars = c('dataset','alignment','iqtree'),value.name = 'bootstrapvalue')
```
#plot
```{r,fig.height=10,fig.width=15,fig.dim='cm'}
library(ggplot2)
attach(combitab)
plot <- ggplot(data=combitab,mapping = aes(x=bootstrapvalue,col=bootstrapstrategy))
plot <- plot + geom_freqpoly()
plot <- plot + theme_classic()
plot <- plot + facet_grid(dataset~alignment)
plot <- plot + theme(legend.position = 'bottom')
plot
rm(plot)
```
```{r,fig.height=10,fig.width=15,fig.dim='cm'}
library(ggplot2)
attach(combitab)
plot <- ggplot(data=combitab,mapping = aes(x=bootstrapvalue,col=alignment))
plot <- plot + geom_freqpoly()
plot <- plot + theme_classic()
plot <- plot + facet_grid(dataset~bootstrapstrategy)
plot <- plot + theme(legend.position = 'bottom')
plot
rm(plot)
```
```{r,fig.height=15,fig.width=15,fig.dim='cm'}
library(ggplot2)
attach(combitab)
plot <- ggplot(data=combitab,mapping = aes(x=bootstrapvalue,y=alignment,col=alignment))
plot <- plot + geom_boxplot()
#plot <- plot + theme_classic()
plot <- plot + facet_grid(dataset~bootstrapstrategy)
plot <- plot + theme(legend.position = 'bottom')
plot
rm(plot)
```
All and all, plotting support values like this is not very insighfull.
I'm quite surprised by how similar support distributions are for the different aligning strategies actually.
Still one make some funny observations. For example the optimal trimming percentage (very naïve interpretation of optimal) differs for the different alignment strategies, but not for the two quick bootstrap methods.
Perhaps the bootstrap is artificially high for leniently trimmed alignments.
It seems that the UF bootstrap correlates better with the nonparemetric bootstrap, at least, if you're trying to pick an alignment strategy and use this naïve method of optimising support in your tree (which you shouldn't, at least not without inspecting the trees and the alignments as well.).