Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Guillaume Perréal
easy16S
Commits
95e9346c
Commit
95e9346c
authored
Sep 25, 2018
by
Midoux Cedric
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of gitlab-ssh.irstea.fr:cedric.midoux/easy16S
Conflicts: perf.R
parents
f5d0ad73
b0f10e89
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
10 deletions
+17
-10
perf.R
perf.R
+17
-10
No files found.
perf.R
View file @
95e9346c
library
(
microbenchmark
)
mb
<-
microbenchmark
(
"clear"
=
{
rm
(
list
=
ls
())
lapply
(
paste
(
'package:'
,
names
(
sessionInfo
()
$
otherPkgs
),
sep
=
""
),
detach
,
character.only
=
TRUE
,
unload
=
TRUE
)
},
"load packages"
=
{
library
(
shinydashboard
)
library
(
glue
)
...
...
@@ -14,23 +18,23 @@ mb <- microbenchmark(
"barplot"
=
{
p
<-
plot_bar
(
physeq
=
data
,
fill
=
"Phylum"
,
x
=
"Description"
,
title
=
"OTU abundance barplot"
)
p
<-
p
+
facet_grid
(
". ~ EnvType"
,
scales
=
"free_x"
)
plot
(
p
)
#
plot(p)
},
"filtered plot"
=
{
p
<-
plot_composition
(
physeq
=
data
,
taxaRank1
=
"Kingdom"
,
taxaSet1
=
"Bacteria"
,
taxaRank2
=
"Phylum"
,
numberOfTaxa
=
10
,
fill
=
"Phylum"
,
x
=
"Description"
)
p
<-
p
+
facet_grid
(
". ~ EnvType"
,
scales
=
"free_x"
)
plot
(
p
)
#
plot(p)
},
"heatmap"
=
{
p
<-
plot_heatmap
(
prune_taxa
(
names
(
sort
(
taxa_sums
(
data
),
decreasing
=
TRUE
)[
1
:
250
]),
data
),
distance
=
"bray"
,
method
=
"NMDS"
,
low
=
"yellow"
,
high
=
"red"
,
na.value
=
"white"
,
sample.order
=
"Description"
,
title
=
"Taxa heatmap by samples"
)
p
<-
p
+
facet_grid
(
". ~ EnvType"
,
scales
=
"free_x"
)
plot
(
p
)
#
plot(p)
},
"alpha"
=
{
p
<-
plot_richness
(
physeq
=
data
,
measures
=
c
(
"Observed"
,
"Chao1"
,
"ACE"
,
"Shannon"
,
"Simpson"
,
"InvSimpson"
,
"Fisher"
),
x
=
"EnvType"
,
color
=
"EnvType"
,
shape
=
"FoodType"
,
title
=
"Alpha diversity graphics"
)
p
<-
p
+
geom_boxplot
()
p
<-
p
+
geom_point
()
plot
(
p
)
#
plot(p)
},
"beta"
=
{
beta
<-
melt
(
as
(
distance
(
data
,
method
=
"bray"
),
"matrix"
))
...
...
@@ -46,29 +50,32 @@ mb <- microbenchmark(
p1
<-
p1
+
geom_tile
()
p1
<-
p1
+
ggtitle
(
"Beta diversity heatmap"
)
p1
<-
p1
+
theme
(
axis.text.x
=
element_text
(
angle
=
90
,
hjust
=
1
,
color
=
tipColor
),
axis.text.y
=
element_text
(
color
=
tipColor
),
axis.title.x
=
element_blank
(),
axis.title.y
=
element_blank
())
plot
(
p1
+
scale_fill_gradient2
())
#
plot(p1 + scale_fill_gradient2())
},
"rarefaction"
=
{
p
<-
ggrare
(
physeq
=
data
,
step
=
100
,
se
=
FALSE
,
color
=
"EnvType"
,
label
=
"Description"
)
p
<-
p
+
facet_grid
(
". ~ FoodType"
)
p
<-
p
+
geom_vline
(
xintercept
=
min
(
sample_sums
(
data
)),
color
=
"gray60"
)
p
<-
p
+
ggtitle
(
"Rarefaction curves"
)
plot
(
p
)
#
plot(p)
},
"acp"
=
{
p
<-
plot_samples
(
physeq
=
data
,
ordination
=
ordinate
(
data
,
method
=
"MDS"
,
distance
=
"unifrac"
),
axes
=
c
(
1
,
2
),
color
=
"EnvType"
,
shape
=
"FoodType"
,
replicate
=
"EnvType"
,
label
=
"Description"
,
title
=
"Samples ordination graphic"
)
p
<-
p
+
stat_ellipse
(
aes_string
(
group
=
"EnvType"
))
plot
(
p
+
theme_bw
())
#
plot(p + theme_bw())
},
"tree"
=
{
p
<-
plot_tree
(
physeq
=
prune_taxa
(
names
(
sort
(
taxa_sums
(
data
),
decreasing
=
TRUE
)[
1
:
20
]),
data
),
method
=
"sampledodge"
,
color
=
"EnvType"
,
size
=
"abundance"
,
label.tips
=
"taxa_names"
,
sizebase
=
5
,
ladderize
=
"left"
,
plot.margin
=
0
,
title
=
"Phylogenetic tree"
)
plot
(
p
)
#
plot(p)
},
"clustering"
=
{
p
<-
plot_clust
(
physeq
=
data
,
dist
=
"unifrac"
,
method
=
"ward.D2"
,
color
=
"EnvType"
)
plot
(
p
)
#
plot(p)
},
times
=
100
,
unit
=
's'
,
order
=
'
inorder
'
,
warmup
=
0
)
times
=
100
,
unit
=
"s"
,
control
=
list
(
order
=
"
inorder
"
)
)
mb
autoplot
(
mb
)
save
(
mb
,
file
=
"benchmark.RData"
)
ggsave
(
"benchmark.png"
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment