PubTator unable to process query

48 Views Asked by At

I'm trying to submit a query to PubTator, following the example code they provide in their API documentation.

Here is the code I'm running:

text = ('Humboldtia vahliana Wight. is an endangered species belonging to the '
'family Leguminosae (subfamily Caesalpinioideae). Though the plant propagates '
'through seeds, low seed setting, seed infestation, poor viability of seed, '
'reduction in natural regeneration of seedlings as well as anthropogenic '
'activities like overexploitation, habitat destruction and fragmented '
'distribution in localities are the major factors hindering the survival of the '
'species. Hence, strategies must be devised urgently for the conservation of this '
'species as these recalcitrant seeds do not contribute significantly to the seed '
'bank. The present attempt was to understand the seed physiology and biochemistry '
'during embryogenesis and embryo desiccation. H. vahliana seeds took 120 days '
'after anthesis to acquire full maturity. Immature seeds had higher moisture '
'content (87.40%) which gradually reduced during maturity and reached 55.42% '
'at the time of seed shed a true recalcitrant behavior of the seeds. Freshly '
'fallen mature seeds showed an optimal germination percentage of 82.32% which '
'was severely affected by the decrease in seed moisture content and the critical '
'moisture content was found to be 33.63% in which the percentage of germination '
'was only 30%. Cell membrane damage of seed was found to cause quick loss of '
'seed viability. The LC-MS/MS analysis showed insignificant amounts of ribose, '
'arabinose and trehalose but a significant accumulation of fructose in the mature '
'embryos rather than glucose and sucrose. Embryo drying significantly reduced the '
'level of these sugars including the stress related trehalose indicating the lack '
'of biosynthetic machinery to counter desiccation stress in these recalcitrant '
'seeds.')

r = requests.post(
    'https://www.ncbi.nlm.nih.gov/research/pubtator-api/annotations/annotate/submit/All',
    data=text.encode('utf-8'))
session_num = r.text

status_code = 404
while status_code == 404:
    result = requests.get(
    'https://www.ncbi.nlm.nih.gov/research/pubtator-api/annotations/annotate/retrieve/' + session_num)
    status_code = result.status_code

print(status_code, result.text)

The API documentation says that the server will return a 404 code until the request is done being processed, which is why I wrote a while loop to keep checking the status code. However, when I let it run, it finishes with a status code of 500, and the message "We have trouble processing your query".

I haven't been able to find any information about what this actually means, and as far as I can tell, I'm following the example code's request format exactly. Does anyone have any idea what's going on here?

0

There are 0 best solutions below