Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Beatrice Tan
CNAprioritization
Commits
f17dcbd8
Commit
f17dcbd8
authored
Feb 07, 2018
by
Beatrice Tan
Browse files
Updated reports.
parent
b6e501b7
Changes
2
Show whitespace changes
Inline
Side-by-side
scripts/ReportSizes.py
View file @
f17dcbd8
...
@@ -20,11 +20,11 @@ def make_report(size_gistic, size_rubic_gains, size_rubic_losses, census_genes,
...
@@ -20,11 +20,11 @@ def make_report(size_gistic, size_rubic_gains, size_rubic_losses, census_genes,
for
tool
in
'GISTIC'
,
'RUBIC'
:
for
tool
in
'GISTIC'
,
'RUBIC'
:
size_file
=
(
size_rubic_gains
[
i
],
size_rubic_losses
[
i
])
if
tool
==
'RUBIC'
else
size_gistic
[
i
]
size_file
=
(
size_rubic_gains
[
i
],
size_rubic_losses
[
i
])
if
tool
==
'RUBIC'
else
size_gistic
[
i
]
parsed_results
=
parse_regions
(
size_file
,
known_genes
,
census_genes
,
tool
)
parsed_results
=
parse_regions
(
size_file
,
known_genes
,
census_genes
,
tool
)
if
tool
not
in
all_results
.
keys
():
#
if tool not in all_results.keys():
all_results
[
tool
]
=
{}
#
all_results[tool] = {}
all_results
[
tool
][
size
]
=
[
parsed_results
]
#
all_results[tool][size] = [parsed_results]
else
:
#
else:
all_results
[
tool
][
size
]
=
all_results
[
tool
][
size
]
+
[
parsed_results
]
#
all_results[tool][size] = all_results[tool][size] + [parsed_results]
stats_results
=
get_stats
(
parsed_results
,
size
)
stats_results
=
get_stats
(
parsed_results
,
size
)
for
stat_list
in
stats_results
[
0
],
stats_results
[
1
]:
for
stat_list
in
stats_results
[
0
],
stats_results
[
1
]:
converted_stats
=
[
tool
]
+
stat_list
[
0
:
2
]
converted_stats
=
[
tool
]
+
stat_list
[
0
:
2
]
...
@@ -33,7 +33,7 @@ def make_report(size_gistic, size_rubic_gains, size_rubic_losses, census_genes,
...
@@ -33,7 +33,7 @@ def make_report(size_gistic, size_rubic_gains, size_rubic_losses, census_genes,
for
stat
in
stat_list
[
5
:]:
for
stat
in
stat_list
[
5
:]:
converted_stats
.
append
(
float
(
stat
.
split
(
" ("
)[
0
]))
converted_stats
.
append
(
float
(
stat
.
split
(
" ("
)[
0
]))
list_stats
.
append
(
converted_stats
)
list_stats
.
append
(
converted_stats
)
overlap_genes
(
all_results
,
report_file
)
#
overlap_genes(all_results, report_file)
make_plots
(
list_stats
,
reps
,
sizes
,
plot_dir
)
make_plots
(
list_stats
,
reps
,
sizes
,
plot_dir
)
def
overlap_genes
(
all_results
,
report_file
):
def
overlap_genes
(
all_results
,
report_file
):
...
@@ -60,7 +60,7 @@ def plot_size_differences(df_stats, value_y_axis, list_sizes, nr_reps, plot_dir)
...
@@ -60,7 +60,7 @@ def plot_size_differences(df_stats, value_y_axis, list_sizes, nr_reps, plot_dir)
"""Plot the differences between analyses using different sample sizes."""
"""Plot the differences between analyses using different sample sizes."""
sns
.
set_style
(
"whitegrid"
)
sns
.
set_style
(
"whitegrid"
)
g
=
sns
.
factorplot
(
x
=
"Sample size"
,
y
=
value_y_axis
,
col
=
"Type"
,
hue
=
"Tool"
,
data
=
df_stats
,
kind
=
"box"
,
g
=
sns
.
factorplot
(
x
=
"Sample size"
,
y
=
value_y_axis
,
col
=
"Type"
,
hue
=
"Tool"
,
data
=
df_stats
,
kind
=
"box"
,
size
=
5
,
aspect
=
1
,
palette
=
sns
.
cubehelix_palette
(
8
,
start
=
.
5
,
rot
=-
.
75
,
dark
=
.
2
)
)
size
=
5
,
aspect
=
1
,
palette
=
[
"#5975A4"
,
"#5F9E6E"
]
)
g
.
set_axis_labels
(
"Sample size"
,
value_y_axis
).
set_titles
(
"{col_name}"
).
despine
(
bottom
=
True
)
g
.
set_axis_labels
(
"Sample size"
,
value_y_axis
).
set_titles
(
"{col_name}"
).
despine
(
bottom
=
True
)
#add_significance(g, df_stats, list_sizes, value_y_axis)
#add_significance(g, df_stats, list_sizes, value_y_axis)
png_file
=
os
.
path
.
join
(
plot_dir
,
value_y_axis
.
replace
(
" "
,
"_"
)
+
".png"
)
png_file
=
os
.
path
.
join
(
plot_dir
,
value_y_axis
.
replace
(
" "
,
"_"
)
+
".png"
)
...
...
scripts/ReportTools.py
View file @
f17dcbd8
...
@@ -86,6 +86,8 @@ def make_gene_file_overlap(gene_lists, out_both):
...
@@ -86,6 +86,8 @@ def make_gene_file_overlap(gene_lists, out_both):
def
venn3_overlap
(
gene_lists
,
known_genes
,
out_venn
):
def
venn3_overlap
(
gene_lists
,
known_genes
,
out_venn
):
known
=
parse_gene_file
(
known_genes
,
np
.
inf
)
known
=
parse_gene_file
(
known_genes
,
np
.
inf
)
plt
.
subplots
(
figsize
=
(
7
,
7
))
plt
.
subplots
(
figsize
=
(
7
,
7
))
overlap_tools
=
set
(
gene_lists
[
0
]).
intersection
(
set
(
gene_lists
[
1
]))
print
(
overlap_tools
.
intersection
(
set
(
known
)))
venn_sets
=
[
set
(
gene_lists
[
0
]),
set
(
gene_lists
[
1
]),
set
(
known
)]
venn_sets
=
[
set
(
gene_lists
[
0
]),
set
(
gene_lists
[
1
]),
set
(
known
)]
c
=
venn3
(
venn_sets
,
(
'GISTIC2'
,
'RUBIC'
,
' Known genes'
))
c
=
venn3
(
venn_sets
,
(
'GISTIC2'
,
'RUBIC'
,
' Known genes'
))
c
.
get_patch_by_id
(
'100'
).
set_color
(
'#5975A4'
),
c
.
get_patch_by_id
(
'010'
).
set_color
(
'#5F9E6E'
)
c
.
get_patch_by_id
(
'100'
).
set_color
(
'#5975A4'
),
c
.
get_patch_by_id
(
'010'
).
set_color
(
'#5F9E6E'
)
...
...
Write
Preview
Supports
Markdown
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