Skip to content
Snippets Groups Projects
Commit 2801c926 authored by Vermaat's avatar Vermaat
Browse files

Merge pull request #32 from LUMC/fix-esummary

Use esummary 2.0 response format
parents 298e2f24 42e2f88a
No related branches found
No related tags found
No related merge requests found
...@@ -585,24 +585,33 @@ class GenBankRetriever(Retriever): ...@@ -585,24 +585,33 @@ class GenBankRetriever(Retriever):
'Could not get mapping information for gene %s.' % gene) 'Could not get mapping information for gene %s.' % gene)
return None return None
if unicode(summary[0]["NomenclatureSymbol"]).lower() == gene.lower() : # Found it. try:
if not summary[0]["GenomicInfo"] : 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", self._output.addMessage(__file__, 4, "ENOMAPPING",
"No mapping information found for gene %s." % gene) "No mapping information found for gene %s." % gene)
return None return None
#if #if
ChrAccVer = unicode(summary[0]["GenomicInfo"][0]["ChrAccVer"]) ChrAccVer = unicode(document["GenomicInfo"][0]["ChrAccVer"])
ChrLoc = unicode(summary[0]["GenomicInfo"][0]["ChrLoc"]) ChrLoc = unicode(document["GenomicInfo"][0]["ChrLoc"])
ChrStart = int(summary[0]["GenomicInfo"][0]["ChrStart"]) ChrStart = int(document["GenomicInfo"][0]["ChrStart"])
ChrStop = int(summary[0]["GenomicInfo"][0]["ChrStop"]) ChrStop = int(document["GenomicInfo"][0]["ChrStop"])
break break
#if #if
# Collect official symbols that has this gene as alias in case we # Collect official symbols that has this gene as alias in case we
# can not find anything. # can not find anything.
if gene in [unicode(a) for a in summary[0]["OtherAliases"]] and \ if gene in [unicode(a) for a in document["OtherAliases"]] and \
summary[0]["NomenclatureSymbol"] : document["NomenclatureSymbol"] :
aliases.append(unicode(summary[0]["NomenclatureSymbol"])) aliases.append(unicode(document["NomenclatureSymbol"]))
#for #for
if not ChrAccVer : # We did not find any genes. if not ChrAccVer : # We did not find any genes.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment