Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
HIDDEN
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
sPlot
HIDDEN
Commits
bb7f73f5
Commit
bb7f73f5
authored
5 years ago
by
Francesco Sabatini
Browse files
Options
Downloads
Patches
Plain Diff
Relaxed round - fixed
parent
681d56e7
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
01b_MesobromionCluster.R
+23
-24
23 additions, 24 deletions
01b_MesobromionCluster.R
session.R
+7
-5
7 additions, 5 deletions
session.R
with
30 additions
and
29 deletions
01b_MesobromionCluster.R
+
23
−
24
View file @
bb7f73f5
...
@@ -116,6 +116,7 @@ Mesobromion <- function(species.path, traits.path, output, myfunction="get.corXY
...
@@ -116,6 +116,7 @@ Mesobromion <- function(species.path, traits.path, output, myfunction="get.corXY
if
(
combinations
==
"sequential"
){
if
(
combinations
==
"sequential"
){
if
(
!
is.na
(
start.round
)){
if
(
!
is.na
(
start.round
)){
print
(
paste
(
"Load data from previous round="
,
start.round
-1
))
print
(
paste
(
"Load data from previous round="
,
start.round
-1
))
load
(
file
=
paste
(
output
,
"_round_"
,
start.round
-1
,
".RData"
,
sep
=
""
))
load
(
file
=
paste
(
output
,
"_round_"
,
start.round
-1
,
".RData"
,
sep
=
""
))
...
@@ -127,23 +128,37 @@ Mesobromion <- function(species.path, traits.path, output, myfunction="get.corXY
...
@@ -127,23 +128,37 @@ Mesobromion <- function(species.path, traits.path, output, myfunction="get.corXY
allcomb.t
<-
lapply
(
1
:
ncol
(
traits
),
function
(
x
){
return
(
x
)})
allcomb.t
<-
lapply
(
1
:
ncol
(
traits
),
function
(
x
){
return
(
x
)})
nall
<-
length
(
allcomb.t
)
nall
<-
length
(
allcomb.t
)
}
else
{
}
else
{
best.row
<-
corXY.ci
%>%
if
(
nround
>=
relax.round
){
filter
(
Trait.comb
==
best
)
best
<-
corXY.ci
%>%
upper
<-
best.row
$
q975
filter
(
ntraits
==
(
nround
-1
))
%>%
lower
<-
best.row
$
q025
arrange
(
desc
(
Coef.obs
))
%>%
slice
(
1
)
%>%
pull
(
Trait.comb
)
new.best.row
<-
corXY.ci
%>%
filter
(
Trait.comb
==
best
)
upper
<-
new.best.row
$
q975
lower
<-
new.best.row
$
q025
print
(
paste
(
"Assumptions relaxed - new best at round="
,
nround
,
"is trait combination"
,
best
))
}
else
{
best.row
<-
corXY.ci
%>%
filter
(
Trait.comb
==
best
)
upper
<-
best.row
$
q975
lower
<-
best.row
$
q025
}
best.split
<-
as.numeric
(
unlist
(
strsplit
(
best
,
"_"
)))
best.split
<-
as.numeric
(
unlist
(
strsplit
(
best
,
"_"
)))
max.inter.t
<-
nround
-
length
(
best.split
)
max.inter.t
i
<-
nround
-
length
(
best.split
)
#n.traits <- ncol(traits)
#n.traits <- ncol(traits)
list.traits
<-
as.numeric
(
traits.sign.alone
)
list.traits
<-
as.numeric
(
traits.sign.alone
)
list.traits
<-
list.traits
[
-
which
(
list.traits
%in%
best.split
)]
## list of remaining traits without best
list.traits
<-
list.traits
[
-
which
(
list.traits
%in%
best.split
)]
## list of remaining traits without best
if
(
length
(
list.traits
)
<
max.inter.t
)
{
if
(
length
(
list.traits
)
<
max.inter.t
i
)
{
save
(
corXY.output
,
file
=
paste
(
output
,
".RData"
,
sep
=
""
))
save
(
corXY.output
,
file
=
paste
(
output
,
".RData"
,
sep
=
""
))
if
(
ncores
>
1
)
{
stopCluster
(
cl
)}
if
(
ncores
>
1
)
{
stopCluster
(
cl
)}
stop
(
"Tested all combo of significant traits"
)
stop
(
"Tested all combo of significant traits"
)
}
}
allcomb.t
<-
NULL
allcomb.t
<-
NULL
#for(n.inter in 1:max.inter.t){
#for(n.inter in 1:max.inter.t){
allcomb.t
<-
c
(
allcomb.t
,
combn
(
list.traits
,
max.inter.t
,
simplify
=
F
))
allcomb.t
<-
c
(
allcomb.t
,
combn
(
list.traits
,
max.inter.t
i
,
simplify
=
F
))
#}
#}
#add best to all combo
#add best to all combo
allcomb.t
<-
lapply
(
allcomb.t
,
function
(
x
){
return
(
c
(
best.split
,
x
))})
allcomb.t
<-
lapply
(
allcomb.t
,
function
(
x
){
return
(
c
(
best.split
,
x
))})
...
@@ -196,7 +211,7 @@ Mesobromion <- function(species.path, traits.path, output, myfunction="get.corXY
...
@@ -196,7 +211,7 @@ Mesobromion <- function(species.path, traits.path, output, myfunction="get.corXY
print
(
paste
(
"new best at nround="
,
nround
,
"is trait combination"
,
best
))
print
(
paste
(
"new best at nround="
,
nround
,
"is trait combination"
,
best
))
}
}
if
(
nround
>
1
&
nround
<
relax.round
){
if
(
nround
>
1
){
better
<-
corXY.ci
%>%
better
<-
corXY.ci
%>%
filter
(
ntraits
==
nround
)
%>%
filter
(
ntraits
==
nround
)
%>%
filter
(
q025
>
upper
)
%>%
filter
(
q025
>
upper
)
%>%
...
@@ -219,22 +234,6 @@ Mesobromion <- function(species.path, traits.path, output, myfunction="get.corXY
...
@@ -219,22 +234,6 @@ Mesobromion <- function(species.path, traits.path, output, myfunction="get.corXY
print
(
paste
(
"new best at round="
,
nround
,
"is trait combination"
,
best
))
print
(
paste
(
"new best at round="
,
nround
,
"is trait combination"
,
best
))
}
else
{
print
(
paste
(
"no new best at round="
,
nround
))}
}
else
{
print
(
paste
(
"no new best at round="
,
nround
))}
}
}
if
(
nround
>
1
&
nround
>
relax.round
){
better
<-
corXY.ci
%>%
filter
(
ntraits
==
nround
)
%>%
arrange
(
desc
(
Coef.obs
))
%>%
slice
(
1
)
%>%
pull
(
Trait.comb
)
new.best.row
<-
corXY.ci
%>%
filter
(
Trait.comb
==
better
)
upper
<-
new.best.row
$
q975
lower
<-
new.best.row
$
q025
best
<-
better
print
(
paste
(
"Assumptions relaxed - new best at round="
,
nround
,
"is trait combination"
,
best
))
}
print
(
paste
(
"save intermediate results at round"
,
nround
))
print
(
paste
(
"save intermediate results at round"
,
nround
))
save
(
corXY.output
,
best
,
traits.sign.alone
,
corXY.ci
,
file
=
paste
(
output
,
"_round_"
,
nround
,
".RData"
,
sep
=
""
))
save
(
corXY.output
,
best
,
traits.sign.alone
,
corXY.ci
,
file
=
paste
(
output
,
"_round_"
,
nround
,
".RData"
,
sep
=
""
))
}
}
...
...
This diff is collapsed.
Click to expand it.
session.R
+
7
−
5
View file @
bb7f73f5
species.path
<-
"_data/Mesobromion/species.out.10perc.txt"
species.path
<-
"_data/Mesobromion/species.out.10perc.txt"
traits.path
<-
"_data/Mesobromion/traits.out.10perc.txt"
traits.path
<-
"_data/Mesobromion/traits.out.10perc.txt"
output
<-
"
test99
"
output
<-
"
_derived/Mesobromion/HIDDEN
"
myfunction
<-
"get.corXY.bootstrap"
myfunction
<-
"get.corXY.bootstrap"
max.inter.t
<-
3
max.inter.t
<-
7
chunk.i
<-
NA
chunk.i
<-
NA
nperm
<-
2
0
nperm
<-
2
ncores
<-
1
ncores
<-
1
chunkn
<-
3
*
ncores
chunkn
<-
3
*
ncores
combinations
<-
"sequential"
combinations
<-
"sequential"
start.round
<-
4
start.round
<-
6
relax.round
<-
6
source
(
"01b_MesobromionCluster.R"
)
source
(
"01b_MesobromionCluster.R"
)
#Mesobromion(species.path, traits.path, output, myfunction, max.inter.t, chunkn, chunk.i, nperm)
#Mesobromion(species.path, traits.path, output, myfunction, max.inter.t, chunkn, chunk.i, nperm)
Mesobromion
(
species.path
,
traits.path
,
output
,
myfunction
,
combinations
,
start.round
,
max.inter.t
,
Mesobromion
(
species.path
,
traits.path
,
output
,
myfunction
,
combinations
,
start.round
,
relax.round
,
max.inter.t
,
chunkn
,
chunk.i
,
nperm
,
ncores
)
chunkn
,
chunk.i
,
nperm
,
ncores
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment