Skip to content
GitLab
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
Hide 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,
for
tool
in
'GISTIC'
,
'RUBIC'
:
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
)
if
tool
not
in
all_results
.
keys
():
all_results
[
tool
]
=
{}
all_results
[
tool
][
size
]
=
[
parsed_results
]
else
:
all_results
[
tool
][
size
]
=
all_results
[
tool
][
size
]
+
[
parsed_results
]
#
if tool not in all_results.keys():
#
all_results[tool] = {}
#
all_results[tool][size] = [parsed_results]
#
else:
#
all_results[tool][size] = all_results[tool][size] + [parsed_results]
stats_results
=
get_stats
(
parsed_results
,
size
)
for
stat_list
in
stats_results
[
0
],
stats_results
[
1
]:
converted_stats
=
[
tool
]
+
stat_list
[
0
:
2
]
...
...
@@ -33,7 +33,7 @@ def make_report(size_gistic, size_rubic_gains, size_rubic_losses, census_genes,
for
stat
in
stat_list
[
5
:]:
converted_stats
.
append
(
float
(
stat
.
split
(
" ("
)[
0
]))
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
)
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)
"""Plot the differences between analyses using different sample sizes."""
sns
.
set_style
(
"whitegrid"
)
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
)
#add_significance(g, df_stats, list_sizes, value_y_axis)
png_file
=
os
.
path
.
join
(
plot_dir
,
value_y_axis
.
replace
(
" "
,
"_"
)
+
".png"
)
...
...
scripts/ReportTools.py
View file @
f17dcbd8
...
...
@@ -24,11 +24,11 @@ def make_report(gistic_results, rubic_gain_results, rubic_loss_results,
parsed
.
append
(
parsed_results
)
stats
.
append
(
get_stats
(
parsed_results
,
tool
))
stats
.
append
(
parse_bed_overlap
(
bed_overlap
,
known_genes
,
census_genes
))
table_all_regions
(
parsed
,
file_regions
)
#make table with all regions
make_tool_report
(
file_tools
,
stats
)
#make tool report
table_all_regions
(
parsed
,
file_regions
)
#make table with all regions
make_tool_report
(
file_tools
,
stats
)
#make tool report
all_genes
=
make_gene_files
(
parsed
,
file_genes_GISTIC
,
file_genes_RUBIC
,
file_genes_both
,
known_genes
,
file_venn
)
#make gene files and venn overlap plot
plot_histogram_sizes
(
parsed
,
file_swarmplot
)
#plot histogram with the sizes of the regions
make_bed_known_regions
(
known_genes
,
biomart_file
,
bed_known_genes
)
#Make bed file with the locations of known genes.
plot_histogram_sizes
(
parsed
,
file_swarmplot
)
#plot histogram with the sizes of the regions
make_bed_known_regions
(
known_genes
,
biomart_file
,
bed_known_genes
)
#Make bed file with the locations of known genes.
def
make_tool_report
(
file_tools
,
stats_tools
):
"""Make a report of the results from GISTIC and RUBIC."""
...
...
@@ -86,6 +86,8 @@ def make_gene_file_overlap(gene_lists, out_both):
def
venn3_overlap
(
gene_lists
,
known_genes
,
out_venn
):
known
=
parse_gene_file
(
known_genes
,
np
.
inf
)
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
)]
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'
)
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment