cyREST icon indicating copy to clipboard operation
cyREST copied to clipboard

Support for JSON "Infinity" values for double and integers

Open AlexanderPico opened this issue 5 years ago • 1 comments

Currently, a "Infinity" values within attribute lists of doubles or integers lead to an error:

"Could not parse the input JSON for updating table because: Non-standard token 'Infinity': enable JsonParser.Feature.ALLOW_NON_NUMERIC_NUMBERS to allow\n at [Source: org.glassfish.jersey.message.internal.EntityInputStream@78b71950; line: 13, column: 24]"

R encodes infinity as Inf. The conversion to JSON appears to be working as it translate these to Infinity. But I suspect the conversion to Java is failing. Java has Double.POSITIVE_INFINITY, but I'm not sure Cytoscape handles this well. I'm not sure in general how we want to handle infinity in Cytoscape.

In the meantime, this means folks coming from Python, R and other scripting languages have to consciously avoid infinity when working with CyREST. Not ideal...

Here's an example that I ran via Swagger to reproduce the error. It assumes you have a network with these GO term nodes in it already...

RCy3::cyrestPUT, HTTP Error Code: 500
 url=http://localhost:1234/v1/networks/3476/tables/defaultnode
 body={
 "key": "id",
"dataKey": "id",
"data": [
{
 "id": "GO:0005215",
"pvalue": 2.606047e-15,
"oddsRatio": 3.502064
},
{
 "id": "GO:0008556",
"pvalue": 2.632002e-15,
"oddsRatio":   Infinity
}
]}

AlexanderPico avatar May 16 '19 00:05 AlexanderPico

I'm digging into the code right now to find out how well Cytoscape does this.

dotasek avatar Oct 02 '19 19:10 dotasek