Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SOaAS
dbxref
Commits
51f84a07
Commit
51f84a07
authored
Apr 09, 2018
by
Lukas Jelonek
Browse files
Fix bug: uniprot handler has problems with position tag
parent
f05f4c7f
Changes
2
Show whitespace changes
Inline
Side-by-side
dbxref/retrieve/uniprot.py
View file @
51f84a07
...
...
@@ -58,8 +58,10 @@ def retrieve(dbxrefs, basic=True, sequence=True, organism=True, annotation=True,
output
.
update
(
read_annotation
(
child
))
if
features
:
output
[
'features'
]
=
read_features
(
child
)
except
KeyError
:
logger
.
warn
(
'Error in retrieving %s'
,
str
(
entry
))
raise
except
RuntimeError
as
e
:
print
(
e
.
message
)
output
[
'message'
]
=
'an error occurred'
try
:
html
=
HTML
.
document_fromstring
(
r
.
text
.
replace
(
'
\n
'
,
' '
))
...
...
@@ -166,8 +168,17 @@ def read_features(entry):
if
f
.
find
(
'uniprot:location'
,
ns
).
find
(
'uniprot:position'
,
ns
)
is
not
None
:
feature
[
'position'
]
=
f
.
find
(
'uniprot:location'
,
ns
).
find
(
'uniprot:position'
,
ns
).
attrib
[
'position'
]
else
:
feature
[
'begin'
]
=
f
.
find
(
'uniprot:location'
,
ns
).
find
(
'uniprot:begin'
,
ns
).
attrib
[
'position'
]
feature
[
'end'
]
=
f
.
find
(
'uniprot:location'
,
ns
).
find
(
'uniprot:end'
,
ns
).
attrib
[
'position'
]
begin
=
f
.
find
(
'uniprot:location'
,
ns
).
find
(
'uniprot:begin'
,
ns
)
if
'position'
in
begin
.
attrib
:
feature
[
'begin'
]
=
begin
.
attrib
[
'position'
]
else
:
feature
[
'begin'
]
=
begin
.
attrib
[
'status'
]
end
=
f
.
find
(
'uniprot:location'
,
ns
).
find
(
'uniprot:end'
,
ns
)
if
'position'
in
end
.
attrib
:
feature
[
'end'
]
=
end
.
attrib
[
'position'
]
else
:
feature
[
'end'
]
=
end
.
attrib
[
'status'
]
features
.
append
(
feature
)
return
features
...
...
tests/test_uniprot.py
0 → 100644
View file @
51f84a07
import
unittest
from
dbxref.retrieve
import
uniprot
class
TestPfam
(
unittest
.
TestCase
):
def
test_no_position
(
self
):
'''regression test for missing position parameter in uniprot entry'''
documents
=
uniprot
.
retrieve
([{
'db'
:
'UniProtKB/Swiss-Prot'
,
'id'
:
'P0CM58'
}])
# 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