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
genotoul-bioinfo
D-GENIES
Commits
64addeff
Commit
64addeff
authored
Jan 17, 2018
by
Floreal Cabanettes
Browse files
Improve summary performanes
parent
59a0771e
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/dgenies/lib/paf.py
View file @
64addeff
...
...
@@ -9,6 +9,7 @@ import matplotlib as mpl
mpl
.
use
(
'Agg'
)
from
matplotlib
import
pyplot
as
plt
import
json
from
collections
import
Counter
class
Paf
:
...
...
@@ -517,24 +518,20 @@ class Paf:
self
.
parse_paf
(
False
,
False
)
if
self
.
parsed
:
percents
=
{}
position_idy
=
{}
position_idy
=
[
"-1"
]
*
self
.
len_t
cats
=
sorted
(
self
.
lines
.
keys
())
for
cat
in
cats
:
for
line
in
self
.
lines
[
cat
]:
position_idy
.
update
(
position_idy
.
fromkeys
(
range
(
line
[
0
],
line
[
1
]
+
1
),
cat
))
percents
[
cat
]
=
0
start
=
line
[
0
]
end
=
line
[
1
]
+
1
position_idy
[
start
:
end
]
=
[
cat
]
*
(
end
-
start
)
import
time
start
=
time
.
time
()
counts
=
Counter
(
position_idy
)
total
=
self
.
len_t
percents
[
"-1"
]
=
(
total
-
len
(
position_idy
))
/
total
*
100
position_idy_values
=
list
(
position_idy
.
values
())
for
cat
in
cats
:
percents
[
cat
]
=
position_idy_values
.
count
(
cat
)
/
total
*
100
for
cat
in
counts
:
percents
[
cat
]
=
counts
[
cat
]
/
self
.
len_t
*
100
with
open
(
summary_file
,
"w"
)
as
summary_file
:
summary_file
.
write
(
json
.
dumps
(
percents
))
...
...
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