Giter Site home page Giter Site logo

zhaofengli / snappy Goto Github PK

View Code? Open in Web Editor NEW
47.0 3.0 10.0 21.54 MB

Helps you browse through and interpret your genotype data

Home Page: https://snappy.zhaofeng.li

License: BSD 2-Clause "Simplified" License

JavaScript 43.38% HTML 0.68% Makefile 0.38% Python 13.54% Vue 41.95% CSS 0.07%
genotype-data snpedia 23andme ancestrydna

snappy's Issues

Hangs when generating report with recent data

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('')) }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.