Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
cami
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Chow Castro, Marcos
cami
Commits
37715e1e
Commit
37715e1e
authored
2 years ago
by
Le, Mia
Browse files
Options
Downloads
Patches
Plain Diff
edited seed_variation
parent
e7bbe4f9
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
cami_src/evaluation_scripts/seed_variation_script.py
+18
-5
18 additions, 5 deletions
cami_src/evaluation_scripts/seed_variation_script.py
cami_src/seed_variationconf
+2
-2
2 additions, 2 deletions
cami_src/seed_variationconf
with
20 additions
and
7 deletions
cami_src/evaluation_scripts/seed_variation_script.py
+
18
−
5
View file @
37715e1e
...
@@ -6,6 +6,7 @@ import random
...
@@ -6,6 +6,7 @@ import random
from
cami_suite
import
cami
from
cami_suite
import
cami
import
utils.comparison_matrix
as
comparison_matrix
import
utils.comparison_matrix
as
comparison_matrix
import
numpy
as
np
import
numpy
as
np
from
utils
import
kolmogorov_smirnoff
def
predict_and_make_consensus
(
cami
,
vis
=
False
):
def
predict_and_make_consensus
(
cami
,
vis
=
False
):
result_sets
=
cami
.
make_predictions
()
result_sets
=
cami
.
make_predictions
()
...
@@ -16,7 +17,7 @@ def predict_and_make_consensus(cami, vis=False):
...
@@ -16,7 +17,7 @@ def predict_and_make_consensus(cami, vis=False):
if
vis
:
if
vis
:
cami
.
use_nvenn
(
download
=
True
)
cami
.
use_nvenn
(
download
=
True
)
def
make_seedvariation
(
cami
,
n_iterations
,
removal_frac
=
0.2
,
vis
=
False
,
plot
=
Fals
e
):
def
make_seedvariation
(
cami
,
n_iterations
,
removal_frac
=
0.2
,
vis
=
False
,
plot
=
Tru
e
):
identifier
=
cami
.
uid
identifier
=
cami
.
uid
base_seeds
=
cami
.
origin_seed_lst
base_seeds
=
cami
.
origin_seed_lst
original_seeds
=
[
cami
.
ppi_vertex2gene
[
seed
]
for
seed
in
base_seeds
]
original_seeds
=
[
cami
.
ppi_vertex2gene
[
seed
]
for
seed
in
base_seeds
]
...
@@ -26,6 +27,7 @@ def make_seedvariation(cami, n_iterations, removal_frac=0.2, vis=False, plot=Fal
...
@@ -26,6 +27,7 @@ def make_seedvariation(cami, n_iterations, removal_frac=0.2, vis=False, plot=Fal
removal_frac
=
removal_frac
removal_frac
=
removal_frac
nof_iterations
=
int
(
n_iterations
)
nof_iterations
=
int
(
n_iterations
)
used_tools
=
list
(
cami
.
result_gene_sets
.
keys
())
used_tools
=
list
(
cami
.
result_gene_sets
.
keys
())
prediction_tools
=
cami
.
prediction_tools
nof_seeds
=
len
(
base_seeds
)
nof_seeds
=
len
(
base_seeds
)
nof_removals
=
max
([
int
(
nof_seeds
*
removal_frac
),
1
])
nof_removals
=
max
([
int
(
nof_seeds
*
removal_frac
),
1
])
...
@@ -44,8 +46,12 @@ def make_seedvariation(cami, n_iterations, removal_frac=0.2, vis=False, plot=Fal
...
@@ -44,8 +46,12 @@ def make_seedvariation(cami, n_iterations, removal_frac=0.2, vis=False, plot=Fal
for
tool
in
used_tools
:
for
tool
in
used_tools
:
redisc_table
.
write
(
f
'
\t
{
tool
}
'
)
redisc_table
.
write
(
f
'
\t
{
tool
}
'
)
redisc_table
.
write
(
'
\n
'
)
redisc_table
.
write
(
'
\n
'
)
res_table
.
write
(
'
tool
\t
rdr
\t
rdr_std
\t
sensitivity
\t
sensitivity_std
\t
precision
\t
precision_std
\n
'
)
res_table
.
write
(
'
tool
\t
rdr
\t
rdr_std
\t
sensitivity
\t
sensitivity_std
\t
precision
\t
precision_std
'
)
for
tool
in
prediction_tools
:
res_table
.
write
(
f
'
\t
{
tool
}
_rdr_ks_pvalue
'
)
for
tool
in
prediction_tools
:
res_table
.
write
(
f
'
\t
{
tool
}
_msr_ks_pvalue
'
)
res_table
.
write
(
'
\n
'
)
# result dictionaries of the form {tool:list(value for each iteration)}
# result dictionaries of the form {tool:list(value for each iteration)}
tp_rate_dict
=
{
k
:
list
()
for
k
in
used_tools
}
tp_rate_dict
=
{
k
:
list
()
for
k
in
used_tools
}
...
@@ -121,7 +127,15 @@ def make_seedvariation(cami, n_iterations, removal_frac=0.2, vis=False, plot=Fal
...
@@ -121,7 +127,15 @@ def make_seedvariation(cami, n_iterations, removal_frac=0.2, vis=False, plot=Fal
res_table
.
write
(
f
'
{
np
.
mean
(
tp_rate_dict
[
tool
])
}
\t
'
)
res_table
.
write
(
f
'
{
np
.
mean
(
tp_rate_dict
[
tool
])
}
\t
'
)
res_table
.
write
(
f
'
{
np
.
std
(
tp_rate_dict
[
tool
])
}
\t
'
)
res_table
.
write
(
f
'
{
np
.
std
(
tp_rate_dict
[
tool
])
}
\t
'
)
res_table
.
write
(
f
'
{
np
.
mean
(
module_size_dict
[
tool
])
}
\t
'
)
res_table
.
write
(
f
'
{
np
.
mean
(
module_size_dict
[
tool
])
}
\t
'
)
res_table
.
write
(
f
'
{
np
.
std
(
module_size_dict
[
tool
])
}
\n
'
)
res_table
.
write
(
f
'
{
np
.
std
(
module_size_dict
[
tool
])
}
'
)
for
pred_tool
in
prediction_tools
:
p_val
=
kolmogorov_smirnoff
.
calculate_ks_p_value
(
list
(
redisc_rate_dict
[
tool
]),
list
(
redisc_rate_dict
[
pred_tool
]))
res_table
.
write
(
f
'
\t
{
p_val
}
'
)
for
pred_tool
in
prediction_tools
:
p_val
=
kolmogorov_smirnoff
.
calculate_ks_p_value
(
list
(
module_size_dict
[
tool
]),
list
(
module_size_dict
[
pred_tool
]))
res_table
.
write
(
'
\n
'
)
print
(
f
'
Result tables are saved in the following locations:
'
)
print
(
f
'
Result tables are saved in the following locations:
'
)
...
@@ -175,7 +189,6 @@ def make_seedvariation(cami, n_iterations, removal_frac=0.2, vis=False, plot=Fal
...
@@ -175,7 +189,6 @@ def make_seedvariation(cami, n_iterations, removal_frac=0.2, vis=False, plot=Fal
ax1
.
set_ylabel
(
'
Rediscovery rate (<rediscovered seeds>/<removed seeds>)
'
,
wrap
=
True
,
fontsize
=
14
)
ax1
.
set_ylabel
(
'
Rediscovery rate (<rediscovered seeds>/<removed seeds>)
'
,
wrap
=
True
,
fontsize
=
14
)
violins2
=
ax4
.
violinplot
([
tp_rate_dict
[
tool
]
for
tool
in
tools
],
showmeans
=
True
,
showextrema
=
True
)
violins2
=
ax4
.
violinplot
([
tp_rate_dict
[
tool
]
for
tool
in
tools
],
showmeans
=
True
,
showextrema
=
True
)
for
violinpart
in
list
(
violins2
.
keys
())[
2
:]:
for
violinpart
in
list
(
violins2
.
keys
())[
2
:]:
violins2
[
violinpart
].
set_color
(
'
k
'
)
violins2
[
violinpart
].
set_color
(
'
k
'
)
...
...
This diff is collapsed.
Click to expand it.
cami_src/seed_variationconf
+
2
−
2
View file @
37715e1e
...
@@ -12,10 +12,10 @@ visualization_flag = False
...
@@ -12,10 +12,10 @@ visualization_flag = False
output_name = 'modules.out'
output_name = 'modules.out'
para = 1
para = 1
c = 'false'
c = 'false'
toolweight
:
1
toolweight
=
1
[diamond]
[diamond]
alpha
:
1
alpha
=
1
pred_factor : 3
pred_factor : 3
max_preds : 200
max_preds : 200
p_value_cutoff : 1e-05
p_value_cutoff : 1e-05
...
...
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