snappy icon indicating copy to clipboard operation
snappy copied to clipboard

Hangs when generating report with recent data

Open iMilnb opened this issue 4 years ago • 0 comments

As explained in the README, I have updated the data/ files. I had to modify a couple of dependencies in the requirements.txt file but the update went well. I replaced the json files in the data directory and re-run snappy. Since then, when clicking Generate Report, it would hang forever with the waiting in progress circle. waiting

Edit

The javascript console says the following:

"SyntaxError: Expected "#", ")", ",", "<!--", or [ \t\r\n] but "T" found.
    at peg$buildStructuredError (webpack-internal:///246:317:14)
    at Object.peg$parse [as parse] (webpack-internal:///246:1033:13)
    at Function.parseGenosetCriteria (webpack-internal:///100:174:48)
    at Function.getRawQuery (webpack-internal:///100:712:34)
    at Object.eval [as match] (webpack-internal:///100:727:27)
    at eval (webpack-internal:///100:1111:26)"

So I assume there's malformed / unexpected data in genosets.json

All 5 json files are valid (successfully parsed by json_pp).

Edit

When disabling Enable genosets the report is correctly generated, so it confirms the error occurs when reading genosets.json.

Edit

I have successfully reproduced the bug and fixed it in a standalone Javascript code, this is what's failing:

{ c: 'and(\nor(rs73885319(A;G),rs60910145(G;T)),\nor(rs71785313(-;TTATAA),rs71785313(D;I))\n)',
  m: 5.5,
  r: 'Bad',
  s: '~6x higher risk for end-stage renal disease' }
ERROR: Parsing Failure:
ERROR: line 3 (column 18): ),\nor(rs71785313(-;TTATAA),rs71785313(D;
ERROR: -----------------------------------------^
ERROR: Expected "#", ")", ",", "<!--", or [ \t\r\n] but "T" found.

Changing [AGCTDI-] to [AGCTDI-]+ in my standalone code does the trick, but makes snappy fail with this error:

Error evaluating async computed property: TypeError: fn is not a function

Fix

Probably not the cleanest fix ever, but here's a patch for gs-criteria.pegjs that makes genosets work:

diff --git a/src/snappy/gs-criteria.pegjs b/src/snappy/gs-criteria.pegjs
index da7483b..79d3bee 100644
--- a/src/snappy/gs-criteria.pegjs
+++ b/src/snappy/gs-criteria.pegjs
@@ -23,7 +23,7 @@ Base
   = [AGCTDI-]
 
 Genotype
-  = allele1:Base ';' allele2:Base { return { type: 'Genotype', allele1, allele2 } }
+  = allele1:Base ';' allele2:Base Base* { return { type: 'Genotype', allele1, allele2 } }
 
 Number
   = n:[0-9]+ { return parseInt(n.join('')) }

iMilnb avatar Feb 23 '20 08:02 iMilnb