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
5da128cc
Commit
5da128cc
authored
2 years ago
by
Le, Mia
Browse files
Options
Downloads
Patches
Plain Diff
added functional relevance to seed_var result table
parent
18bb85c2
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
cami_src/cami_suite.py
+29
-21
29 additions, 21 deletions
cami_src/cami_suite.py
cami_src/evaluation_scripts/seed_variation_script.py
+11
-0
11 additions, 0 deletions
cami_src/evaluation_scripts/seed_variation_script.py
with
40 additions
and
21 deletions
cami_src/cami_suite.py
+
29
−
21
View file @
5da128cc
...
@@ -239,27 +239,35 @@ class cami():
...
@@ -239,27 +239,35 @@ class cami():
prefix
=
f
'
{
result_set
}
_
{
self
.
uid
}
'
,
prefix
=
f
'
{
result_set
}
_
{
self
.
uid
}
'
,
file_type
=
'
png
'
)
file_type
=
'
png
'
)
sub_validation_results
=
biodigest
.
single_validation
.
single_validation
(
with
open
(
os
.
path
.
join
(
self
.
tmp_dir
,
f
'
{
result_set
}
_
{
self
.
uid
}
_relevance_scores.tsv
'
),
'
w
'
)
as
f
:
tar
=
set
(
self
.
result_module_sets
[
result_set
]),
rel_score_name
=
list
(
set_validation_results
[
'
input_values
'
][
'
values
'
].
keys
())[
0
]
tar_id
=
'
entrez
'
,
f
.
write
(
f
'
value
\t
{
rel_score_name
}
\n
'
)
mode
=
'
subnetwork-set
'
,
val_res_dct
=
set_validation_results
[
'
input_values
'
][
'
values
'
][
rel_score_name
]
distance
=
'
jaccard
'
,
for
val
in
val_res_dct
:
network_data
=
{
"
network_file
"
:
ppi_graph_file
,
f
.
write
(
f
'
{
val
}
\t
{
val_res_dct
[
val
]
}
\n
'
)
"
prop_name
"
:
"
name
"
,
"
id_type
"
:
"
entrez
"
},
# sub_validation_results = biodigest.single_validation.single_validation(
ref
=
set
(
seed_gene_lst
),
# tar=set(self.result_module_sets[result_set]),
ref_id
=
'
entrez
'
# tar_id='entrez',
)
# mode='subnetwork-set',
if
sub_validation_results
[
'
status
'
]
==
'
ok
'
:
# distance='jaccard',
biodigest
.
single_validation
.
save_results
(
sub_validation_results
,
f
'
{
result_set
}
_
{
self
.
uid
}
'
,
# network_data={"network_file":ppi_graph_file,
self
.
output_dir
)
# "prop_name":"name",
biodigest
.
evaluation
.
d_utils
.
plotting_utils
.
create_plots
(
results
=
sub_validation_results
,
# "id_type":"entrez"},
mode
=
'
subnetwork-set
'
,
# ref=set(seed_gene_lst),
tar
=
set
(
self
.
result_module_sets
[
result_set
]),
# ref_id='entrez'
tar_id
=
'
entrez
'
,
# )
out_dir
=
self
.
output_dir
,
# if sub_validation_results['status'] == 'ok':
prefix
=
f
'
{
result_set
}
_
{
self
.
uid
}
'
,
# biodigest.single_validation.save_results(sub_validation_results, f'{result_set}_{self.uid}',
file_type
=
'
png
'
)
# self.output_dir)
# biodigest.evaluation.d_utils.plotting_utils.create_plots(results=sub_validation_results,
# mode='subnetwork-set',
# tar=set(self.result_module_sets[result_set]),
# tar_id='entrez',
# out_dir=self.output_dir,
# prefix=f'{result_set}_{self.uid}',
# file_type='png')
def
run_threaded_tool
(
self
,
tool
,
pred_sets
):
def
run_threaded_tool
(
self
,
tool
,
pred_sets
):
"""
run a tool in one thread and save the results into a dictionary pred_sets
"""
run a tool in one thread and save the results into a dictionary pred_sets
...
...
This diff is collapsed.
Click to expand it.
cami_src/evaluation_scripts/seed_variation_script.py
+
11
−
0
View file @
5da128cc
...
@@ -51,6 +51,11 @@ def make_seedvariation(cami, n_iterations, removal_frac=0.2, vis=False, plot=Tru
...
@@ -51,6 +51,11 @@ def make_seedvariation(cami, n_iterations, removal_frac=0.2, vis=False, plot=Tru
res_table
.
write
(
f
'
\t
{
tool
}
_rdr_ks_pvalue
'
)
res_table
.
write
(
f
'
\t
{
tool
}
_rdr_ks_pvalue
'
)
for
tool
in
prediction_tools
:
for
tool
in
prediction_tools
:
res_table
.
write
(
f
'
\t
{
tool
}
_msr_ks_pvalue
'
)
res_table
.
write
(
f
'
\t
{
tool
}
_msr_ks_pvalue
'
)
with
open
(
os
.
path
.
join
(
cami
.
tmp_dir
,
f
'
{
used_tools
[
0
]
}
_
{
cami
.
uid
}
_relevance_scores.tsv)
'
),
'
r
'
)
as
f
:
for
line
in
f
:
val_name
=
line
.
split
(
'
\t
'
)[
0
]
redisc_table
.
write
(
f
'
\t
{
val_name
}
'
)
res_table
.
write
(
'
\n
'
)
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)}
...
@@ -135,6 +140,12 @@ def make_seedvariation(cami, n_iterations, removal_frac=0.2, vis=False, plot=Tru
...
@@ -135,6 +140,12 @@ def make_seedvariation(cami, n_iterations, removal_frac=0.2, vis=False, plot=Tru
for
pred_tool
in
prediction_tools
:
for
pred_tool
in
prediction_tools
:
p_val
=
kolmogorov_smirnoff
.
calculate_ks_p_value
(
list
(
module_size_dict
[
tool
]),
p_val
=
kolmogorov_smirnoff
.
calculate_ks_p_value
(
list
(
module_size_dict
[
tool
]),
list
(
module_size_dict
[
pred_tool
]))
list
(
module_size_dict
[
pred_tool
]))
res_table
.
write
(
f
'
\t
{
p_val
}
'
)
with
open
(
os
.
path
.
join
(
cami
.
tmp_dir
,
f
'
{
tool
}
_
{
cami
.
uid
}
_relevance_scores.tsv)
'
),
'
r
'
)
as
f
:
for
line
in
f
:
rel_score
=
line
.
split
(
'
\t
'
)[
1
].
strip
()
res_table
.
write
(
f
'
\t
{
rel_score
}
'
)
res_table
.
write
(
'
\n
'
)
res_table
.
write
(
'
\n
'
)
print
(
f
'
Result tables are saved in the following locations:
'
)
print
(
f
'
Result tables are saved in the following locations:
'
)
...
...
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