Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use esummary 2.0 response format #32

Merged
merged 1 commit into from
Mar 25, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 18 additions & 9 deletions mutalyzer/Retriever.py
Original file line number Diff line number Diff line change
Expand Up @@ -585,24 +585,33 @@ def retrievegene(self, gene, organism, upstream, downstream) :
'Could not get mapping information for gene %s.' % gene)
return None

if unicode(summary[0]["NomenclatureSymbol"]).lower() == gene.lower() : # Found it.
if not summary[0]["GenomicInfo"] :
try:
document = summary['DocumentSummarySet']['DocumentSummary'][0]
except (KeyError, IndexError):
self._output.addMessage(__file__, -1, 'INFO',
'Error parsing Entrez esummary result.')
self._output.addMessage(__file__, 4, 'ERETR',
'Could not get mapping information for gene %s.' % gene)
return None

if unicode(document["NomenclatureSymbol"]).lower() == gene.lower() : # Found it.
if not document["GenomicInfo"] :
self._output.addMessage(__file__, 4, "ENOMAPPING",
"No mapping information found for gene %s." % gene)
return None
#if
ChrAccVer = unicode(summary[0]["GenomicInfo"][0]["ChrAccVer"])
ChrLoc = unicode(summary[0]["GenomicInfo"][0]["ChrLoc"])
ChrStart = int(summary[0]["GenomicInfo"][0]["ChrStart"])
ChrStop = int(summary[0]["GenomicInfo"][0]["ChrStop"])
ChrAccVer = unicode(document["GenomicInfo"][0]["ChrAccVer"])
ChrLoc = unicode(document["GenomicInfo"][0]["ChrLoc"])
ChrStart = int(document["GenomicInfo"][0]["ChrStart"])
ChrStop = int(document["GenomicInfo"][0]["ChrStop"])
break
#if

# Collect official symbols that has this gene as alias in case we
# can not find anything.
if gene in [unicode(a) for a in summary[0]["OtherAliases"]] and \
summary[0]["NomenclatureSymbol"] :
aliases.append(unicode(summary[0]["NomenclatureSymbol"]))
if gene in [unicode(a) for a in document["OtherAliases"]] and \
document["NomenclatureSymbol"] :
aliases.append(unicode(document["NomenclatureSymbol"]))
#for

if not ChrAccVer : # We did not find any genes.
Expand Down