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
ee8463c6
Commit
ee8463c6
authored
2 years ago
by
Le, Mia
Browse files
Options
Downloads
Patches
Plain Diff
edited plot visuals for seed_var
parent
509dabe8
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
cami_src/cami.py
+12
-9
12 additions, 9 deletions
cami_src/cami.py
cami_src/cami_suite.py
+6
-4
6 additions, 4 deletions
cami_src/cami_suite.py
with
18 additions
and
13 deletions
cami_src/cami.py
+
12
−
9
View file @
ee8463c6
...
@@ -295,9 +295,12 @@ def main(ppi_network, seeds, tools, tool_weights, consensus, evaluate,
...
@@ -295,9 +295,12 @@ def main(ppi_network, seeds, tools, tool_weights, consensus, evaluate,
#PLOT
#PLOT
# Create a figure instance
# Create a figure instance
plt
.
figure
(
figsize
=
(
48
,
12
))
fig
,
axs
=
plt
.
subplots
(
2
,
1
,
figsize
=
(
20
,
15
))
plt
.
subplots_adjust
(
left
=
0.2
)
ax1
=
axs
[
0
]
ax5
=
axs
[
1
]
# Extract Figure and Axes instance
# Extract Figure and Axes instance
ax1
=
plt
.
subplot
(
1
,
2
,
1
,
label
=
'
ax1
'
)
# Create a plot
# Create a plot
violins1
=
ax1
.
violinplot
(
redisc_rates
,
showmeans
=
True
,
showextrema
=
True
)
violins1
=
ax1
.
violinplot
(
redisc_rates
,
showmeans
=
True
,
showextrema
=
True
)
...
@@ -313,7 +316,8 @@ def main(ppi_network, seeds, tools, tool_weights, consensus, evaluate,
...
@@ -313,7 +316,8 @@ def main(ppi_network, seeds, tools, tool_weights, consensus, evaluate,
ax1
.
set_xticklabels
(
tool_labels
)
ax1
.
set_xticklabels
(
tool_labels
)
ax1
.
tick_params
(
axis
=
'
x
'
,
labelsize
=
11
)
ax1
.
tick_params
(
axis
=
'
x
'
,
labelsize
=
11
)
ax1
.
set_ylabel
(
'
Rediscovery rate (<rediscovered seeds>/<removed seeds>)
'
,
wrap
=
True
)
ax1
.
set_ylabel
(
'
Rediscovery rate (<rediscovered seeds>/<removed seeds>)
'
,
wrap
=
True
,
fontsize
=
14
)
# ax4 = plt.subplot(1,3,2, label='ax4')
# ax4 = plt.subplot(1,3,2, label='ax4')
# 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)
...
@@ -329,7 +333,6 @@ def main(ppi_network, seeds, tools, tool_weights, consensus, evaluate,
...
@@ -329,7 +333,6 @@ def main(ppi_network, seeds, tools, tool_weights, consensus, evaluate,
# ax4.set_ylabel('Sensitivity (TP/TP + FN)', wrap=True)
# ax4.set_ylabel('Sensitivity (TP/TP + FN)', wrap=True)
ax5
=
plt
.
subplot
(
1
,
2
,
2
)
violins3
=
ax5
.
violinplot
([
module_size_dict
[
tool
]
for
tool
in
tools
],
showmeans
=
True
,
showextrema
=
True
)
violins3
=
ax5
.
violinplot
([
module_size_dict
[
tool
]
for
tool
in
tools
],
showmeans
=
True
,
showextrema
=
True
)
# Add title
# Add title
for
violinpart
in
list
(
violins3
.
keys
())[
2
:]:
for
violinpart
in
list
(
violins3
.
keys
())[
2
:]:
...
@@ -342,10 +345,10 @@ def main(ppi_network, seeds, tools, tool_weights, consensus, evaluate,
...
@@ -342,10 +345,10 @@ def main(ppi_network, seeds, tools, tool_weights, consensus, evaluate,
ax5
.
set_xticks
(
list
(
range
(
1
,
len
(
tools
)
+
1
)))
ax5
.
set_xticks
(
list
(
range
(
1
,
len
(
tools
)
+
1
)))
ax5
.
set_xticklabels
(
tool_labels
)
ax5
.
set_xticklabels
(
tool_labels
)
ax5
.
set_ylabel
(
'
(<rediscovered seeds>/<module size>)
'
)
ax5
.
set_ylabel
(
'
(<rediscovered seeds>/<module size>)
'
,
fontsize
=
14
)
ax5
.
tick_params
(
axis
=
'
x
'
,
labelsize
=
11
)
ax5
.
tick_params
(
axis
=
'
x
'
,
labelsize
=
11
)
plt
.
tight_layout
plt
.
tight_layout
()
plt
.
savefig
(
f
'
{
output_dir
}
/00_
{
identifier
}
_seed_variation_result.png
'
)
fig
.
savefig
(
f
'
{
output_dir
}
/00_
{
identifier
}
_seed_variation_result.png
'
,
bbox_inches
=
"
tight
"
)
print
(
f
'
Violin plot saved under: 00_
{
identifier
}
_seed_variation_result.png
'
)
print
(
f
'
Violin plot saved under: 00_
{
identifier
}
_seed_variation_result.png
'
)
...
...
This diff is collapsed.
Click to expand it.
cami_src/cami_suite.py
+
6
−
4
View file @
ee8463c6
...
@@ -184,6 +184,7 @@ class cami():
...
@@ -184,6 +184,7 @@ class cami():
inputparams
=
tool
.
prepare_input
()
inputparams
=
tool
.
prepare_input
()
print
(
f
'
running
{
tool
.
name
}
...
'
)
print
(
f
'
running
{
tool
.
name
}
...
'
)
preds
=
set
(
tool
.
run_algorithm
(
inputparams
))
preds
=
set
(
tool
.
run_algorithm
(
inputparams
))
if
self
.
debug
:
print
(
f
'
{
tool
.
name
}
predicted
{
len
(
preds
)
}
active vertices (seeds not excluded):
'
)
print
(
f
'
{
tool
.
name
}
predicted
{
len
(
preds
)
}
active vertices (seeds not excluded):
'
)
print
(
preds
)
print
(
preds
)
return
preds
return
preds
...
@@ -361,7 +362,7 @@ class cami():
...
@@ -361,7 +362,7 @@ class cami():
for
vertex
in
cami_vlist
:
for
vertex
in
cami_vlist
:
print
(
f
'
{
gene_name_map
[
vertex
]
}
\t
{
cami_scores
[
vertex
]
}
\t
{
codes2tools
[
vertex
]
}
'
)
print
(
f
'
{
gene_name_map
[
vertex
]
}
\t
{
cami_scores
[
vertex
]
}
\t
{
codes2tools
[
vertex
]
}
'
)
else
:
else
:
print
(
f
'
With the
{
len
(
seed_genes
)
}
seed genes CAMI (
{
cami_method_name
}
) proposes
{
len
(
seed_genes
)
}
to add to the Active Module
'
)
print
(
f
'
With the
{
len
(
seed_genes
)
}
seed genes CAMI (
{
cami_method_name
}
) proposes
{
len
(
cami_vlist
)
}
to add to the Active Module
'
)
# for visualization with nvenn
# for visualization with nvenn
self
.
result_gene_sets
[
cami_method_name
]
=
cami_genes
self
.
result_gene_sets
[
cami_method_name
]
=
cami_genes
...
@@ -450,7 +451,7 @@ class cami():
...
@@ -450,7 +451,7 @@ class cami():
degradome_sets
=
{
tool
:
self
.
result_gene_sets
[
tool
]
degradome_sets
=
{
tool
:
self
.
result_gene_sets
[
tool
]
for
tool
in
self
.
result_gene_sets
for
tool
in
self
.
result_gene_sets
if
len
(
self
.
result_gene_sets
[
tool
])
>
0
}
if
len
(
self
.
result_gene_sets
[
tool
])
>
0
}
url
=
degradome
.
send_request
(
degradome_sets
,
{
self
.
ppi_vertex2gene
[
seed
]
for
seed
in
self
.
seed_lst
}
)
url
=
degradome
.
send_request
(
degradome_sets
)
with
open
(
f
'
{
self
.
output_dir
}
/venn_link_
{
self
.
uid
}
.txt
'
,
'
w
'
)
as
f
:
with
open
(
f
'
{
self
.
output_dir
}
/venn_link_
{
self
.
uid
}
.txt
'
,
'
w
'
)
as
f
:
f
.
write
(
url
)
f
.
write
(
url
)
return
url
return
url
...
@@ -463,6 +464,7 @@ class cami():
...
@@ -463,6 +464,7 @@ class cami():
# webbrowser.open(url)
# webbrowser.open(url)
else
:
else
:
print
(
'
Cannot use degradome to create venn diagrams of 6 or more tools
'
)
print
(
'
Cannot use degradome to create venn diagrams of 6 or more tools
'
)
return
None
def
download_diagram
(
self
,
url
):
def
download_diagram
(
self
,
url
):
venn_name
=
f
'
{
self
.
output_dir
}
/vdiagram_
{
self
.
uid
}
'
venn_name
=
f
'
{
self
.
output_dir
}
/vdiagram_
{
self
.
uid
}
'
...
...
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