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
Mutalyzer
mutalyzer2
Commits
97d7a703
Commit
97d7a703
authored
Aug 19, 2019
by
Mihai
Browse files
Update HGVS descriptions retrieval for SNP converter (
#482
)
parent
bffd1999
Changes
5
Hide whitespace changes
Inline
Side-by-side
mutalyzer/ncbi.py
View file @
97d7a703
...
...
@@ -394,7 +394,7 @@ def rsid_to_descriptions(rsid, output):
try
:
# Parse the output.
doc
=
minidom
.
parseString
(
response_text
)
rs
=
doc
.
getElementsByTagName
(
'
Rs'
)[
0
]
docsum
=
doc
.
getElementsByTagName
(
'
DOCSUM'
)[
0
].
childNodes
[
0
].
data
except
expat
.
ExpatError
:
# TODO: Log error.
raise
ServiceError
()
...
...
@@ -402,7 +402,11 @@ def rsid_to_descriptions(rsid, output):
# The expected root element is not present, this has also been
# observed as a response for non-existing rs#.
output
.
addMessage
(
__file__
,
2
,
'EENTREZ'
,
'Non existing %s in the DB or no root element.'
%
rsid
)
'Non existing %s in the DB or no root element.'
%
rsid
)
return
[]
return
[
hgvs
.
lastChild
.
data
for
hgvs
in
rs
.
getElementsByTagName
(
'hgvs'
)]
for
part
in
docsum
.
split
(
'|'
):
if
part
.
startswith
(
'HGVS='
):
return
part
.
split
(
'='
)[
1
].
split
(
','
)
return
[]
tests/data/rs9919552.xml.bz2
View file @
97d7a703
No preview for this file type
tests/test_scheduler.py
View file @
97d7a703
...
...
@@ -76,18 +76,17 @@ def test_snp_converter():
"""
snps
=
[
'rs9919552'
]
expected
=
[[
'rs9919552'
,
'|'
.
join
([
'NC_000011.9:g.111959625C>T'
,
'NG_012337.2:g.7055C>T'
,
'NG_033145.1:g.2898G>A'
,
'NM_001276503.1:c.169+928C>T'
,
'NM_001276504.1:c.87C>T'
,
'NM_001276506.1:c.204C>T'
,
'|'
.
join
([
'NC_000011.10:g.112088901C>T'
,
'NC_000011.9:g.111959625C>T'
,
'NG_012337.3:g.7055C>T'
,
'NM_003002.4:c.204C>T'
,
'NM_003002.3:c.204C>T'
,
'NP_001263433.1:p.Ser29='
,
'NP_001263435.1:p.Ser68='
,
'NP_002993.1:p.Ser68='
,
'NM_001276506.2:c.204C>T'
,
'NM_001276506.1:c.204C>T'
,
'NM_001276504.2:c.87C>T'
,
'NM_001276504.1:c.87C>T'
,
'NR_077060.1:n.288C>T'
,
'N
T
_033
899.8:g.15522041C>T
'
])]]
'N
G
_033
145.1:g.2898G>A
'
])]]
# Patch Bio.Entrez.efetch to return dbSNP record for rs9919552.
def
mock_efetch
(
*
args
,
**
kwargs
):
...
...
tests/test_services_soap.py
View file @
97d7a703
...
...
@@ -445,9 +445,8 @@ def test_getdbsnpdescriptions(api):
r
=
api
(
'getdbSNPDescriptions'
,
'rs9919552'
)
assert
'NC_000011.9:g.111959625C>T'
in
r
.
string
assert
'NG_012337.
2
:g.7055C>T'
in
r
.
string
assert
'NG_012337.
3
:g.7055C>T'
in
r
.
string
assert
'NM_003002.3:c.204C>T'
in
r
.
string
assert
'NP_002993.1:p.Ser68='
in
r
.
string
@
pytest
.
mark
.
usefixtures
(
'hg19_transcript_mappings'
)
...
...
tests/test_website.py
View file @
97d7a703
...
...
@@ -364,9 +364,8 @@ def test_snp_converter_valid(website):
assert
'0 Errors'
in
r
.
data
assert
'0 Warnings'
in
r
.
data
assert
'NC_000011.9:g.111959625C>T'
in
r
.
data
assert
'NG_012337.
2
:g.7055C>T'
in
r
.
data
assert
'NG_012337.
3
:g.7055C>T'
in
r
.
data
assert
'NM_003002.3:c.204C>T'
in
r
.
data
assert
'NP_002993.1:p.Ser68='
in
r
.
data
def
test_snp_converter_invalid
(
website
):
...
...
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