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
hem
hamlet
Commits
be72b712
Commit
be72b712
authored
May 08, 2018
by
bow
Browse files
Update summary script
parent
ea202861
Changes
1
Hide whitespace changes
Inline
Side-by-side
scripts/create_summary.py
View file @
be72b712
...
...
@@ -176,14 +176,23 @@ def post_process(cs):
return
cs
def
add_variant_plots
(
idm_fh
,
var_plot_dir
):
idms
=
set
([])
for
lineno
,
line
in
enumerate
(
idm_fh
):
def
parse_idm
(
fh
):
idms
=
[]
for
lineno
,
line
in
enumerate
(
fh
):
if
lineno
==
0
:
continue
_
,
gsym
,
_
=
line
.
strip
().
split
(
"
\t
"
)
assert
gsym
not
in
idms
,
gsym
gid
,
gsym
,
raw_tids
=
line
.
strip
().
split
(
"
\t
"
)
tids
=
raw_tids
.
split
(
","
)
idms
.
append
({
"gene_id"
:
gid
,
"gene_symbol"
:
gsym
,
"transcript_ids"
:
tids
})
return
idms
def
add_variant_plots
(
idm
,
var_plot_dir
):
idms
=
set
([])
for
item
in
idm
:
gsym
=
item
[
"gene_symbol"
]
assert
gsym
not
in
idms
,
item
idms
.
add
(
gsym
)
plots
=
[]
...
...
@@ -224,11 +233,13 @@ def main(id_mappings_path, var_plot_dir,
insert_stats_path
,
exon_cov_stats_path
,
vep_stats_path
,
run_name
,
sample_name
,
pipeline_version
):
"""Helper script for combining multiple stats files into one JSON."""
idm
=
parse_idm
(
id_mappings_path
)
combined
=
{
"metadata"
:
{
"pipeline_version"
:
pipeline_version
,
"run_name"
:
run_name
,
"sample_name"
:
sample_name
,
"genes_of_interest"
:
idm
,
},
"stats"
:
{
"seq"
:
process_seq_stats
(
seq_stats_path
),
...
...
@@ -238,10 +249,12 @@ def main(id_mappings_path, var_plot_dir,
"ins"
:
process_insert_stats
(
insert_stats_path
),
"var"
:
process_var_stats
(
vep_stats_path
),
},
"snv_indels"
:
{
"plots"
:
[]},
"results"
:
{
"var"
:
{
"plots"
:
[]},
},
}
combined
[
"
snv_indels
"
][
"plots"
].
extend
(
add_variant_plots
(
id
_mappings_path
,
var_plot_dir
))
combined
[
"
results"
][
"var
"
][
"plots"
].
extend
(
add_variant_plots
(
id
m
,
var_plot_dir
))
combined
[
"stats"
]
=
post_process
(
combined
[
"stats"
])
print
(
json
.
dumps
(
combined
,
separators
=
(
","
,
":"
),
sort_keys
=
True
))
...
...
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