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
Yoann DUFRESNE
linked reads molecule ordering
Commits
bb20e13b
Commit
bb20e13b
authored
Mar 14, 2019
by
Yoann Dufresne
Browse files
global stats
parent
566d08b3
Changes
1
Hide whitespace changes
Inline
Side-by-side
evaluate.py
View file @
bb20e13b
...
...
@@ -12,6 +12,8 @@ def parse_args():
parser
=
argparse
.
ArgumentParser
(
description
=
'Process some integers.'
)
parser
.
add_argument
(
'filename'
,
type
=
str
,
help
=
'The output file to evalute'
)
parser
.
add_argument
(
'--light-print'
,
'-l'
,
action
=
'store_true'
,
help
=
'Print only wrong nodes and paths'
)
args
=
parser
.
parse_args
()
...
...
@@ -78,14 +80,35 @@ def parse_graph_frequencies(graph, only_wrong=False, file_pointer=sys.stdout):
def
print_summary
(
frequencies
,
file_pointer
=
sys
.
stdout
):
if
file_pointer
==
None
:
return
print
(
"--- Global summary ---"
,
file
=
file_pointer
)
# --- Frequency usage ---
# Tags
distinct_theoritical_nodes
=
len
(
frequencies
[
0
])
distinct_observed_nodes
=
len
(
frequencies
[
1
])
print
(
f
"Distinct barcodes:
{
distinct_observed_nodes
}
/
{
distinct_theoritical_nodes
}
"
,
file
=
file_pointer
)
# molecules
cumulative_theoritical_nodes
=
sum
(
frequencies
[
0
].
values
())
cumulative_observed_nodes
=
sum
(
frequencies
[
1
].
values
())
print
(
f
"Molecules:
{
cumulative_observed_nodes
}
/
{
cumulative_theoritical_nodes
}
"
,
file
=
file_pointer
)
# Wrong splits
over_split
=
0
under_split
=
0
for
barcode
in
frequencies
[
0
]:
observed
=
frequencies
[
1
][
barcode
]
theoritic
=
frequencies
[
0
][
barcode
]
over_split
+=
max
(
observed
-
theoritic
,
0
)
under_split
+=
max
(
theoritic
-
observed
,
0
)
print
(
f
"Under/Over splitting:
{
under_split
}
-
{
over_split
}
"
)
def
main
():
args
=
parse_args
()
graph
=
load_graph
(
args
.
filename
)
frequencies
=
parse_graph_frequencies
(
graph
)
frequencies
=
parse_graph_frequencies
(
graph
,
only_wrong
=
args
.
light_print
)
print_summary
(
frequencies
)
...
...
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