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
SOaAS
dbxref
Commits
f05f4c7f
Commit
f05f4c7f
authored
Jan 24, 2018
by
Lukas Jelonek
Browse files
Fix bug: Pfam retriever crashes when no go_terms are available (fixes #20)
parent
1b03797b
Changes
2
Hide whitespace changes
Inline
Side-by-side
dbxref/retrieve/pfam.py
View file @
f05f4c7f
...
...
@@ -63,14 +63,15 @@ def read_annotation(entry):
'comment'
:
entry
.
find
(
'pfam:comment'
,
ns
).
text
.
strip
()
}
go_terms
=
entry
.
find
(
'pfam:go_terms'
,
ns
)
categories
=
go_terms
.
findall
(
'pfam:category'
,
ns
)
for
category
in
categories
:
terms
=
category
.
findall
(
'pfam:term'
,
ns
)
for
term
in
terms
:
annotation
[
'terms'
].
append
({
'id'
:
term
.
attrib
[
'go_id'
],
'description'
:
term
.
text
})
if
go_terms
:
categories
=
go_terms
.
findall
(
'pfam:category'
,
ns
)
for
category
in
categories
:
terms
=
category
.
findall
(
'pfam:term'
,
ns
)
for
term
in
terms
:
annotation
[
'terms'
].
append
({
'id'
:
term
.
attrib
[
'go_id'
],
'description'
:
term
.
text
})
return
annotation
if
__name__
==
"__main__"
:
...
...
tests/test_pfam.py
0 → 100644
View file @
f05f4c7f
import
unittest
from
dbxref
import
retriever
,
resolver
class
TestPfam
(
unittest
.
TestCase
):
def
test_no_go_terms
(
self
):
'''regression test for missing go terms in pfam entry'''
documents
=
retriever
.
retrieve
([{
'db'
:
'pfam'
,
'id'
:
'PF10423.8'
}])
# this test failed due to an error due to missing None handling,
# so no assertions here. Once fixed. this should suffice
Write
Preview
Markdown
is supported
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