legumeinfo / gcv

Federating genomes with love (and synteny derived from functional annotations)
https://gcv.legumeinfo.org/
Apache License 2.0
41 stars 10 forks source link

error from aln algorithms #265

Closed adf-ncgr closed 4 years ago

adf-ncgr commented 4 years ago

induced by trying to do a multi-view http://dev.lis.ncgr.org:50011/epic_search/gcv/gene;lis=phavu.Phvul.002G084300,cajca.C.cajan_30497,cicar.CDCFrontier.Ca_18074,glyma.Glyma.01G048700,glyma.Glyma.02G108300,lupan.Lup031256,lupan.Lup008648,lupan.Lup006732,vigan.Vang0065s00170,vigra.Vradi11g10390,vigun.Vigun02g059700?sources=lis&neighbors=10&matched=4&intermediate=5&algorithm=repeat&match=10&mismatch=-1&gap=-1&score=30&threshold=20&bmatched=20&bintermediate=10&bmask=10&linkage=average&bregexp=&border=chromosome&regexp=&order=chromosome

which freezes mid-way through rendering, probably because of the error shown in the console below.

core.js:6014 ERROR TypeError: Cannot read property 'length' of undefined at align (repeat.ts:68) at repeat (repeat.ts:181) at aligner (clustered-and-aligned-micro-tracks.selector.ts:197) at reducer (clustered-and-aligned-micro-tracks.selector.ts:207) at Array.reduce () at clustered-and-aligned-micro-tracks.selector.ts:214 at store.js:946 at memoized (store.js:869) at defaultStateFn (store.js:901) at store.js:955

switching algorithm in above tURL smith-waterman seems to have same problem, so probably the problem is really elsewhere:

core.js:6014 ERROR TypeError: Cannot read property 'length' of undefined at align (smith-waterman.ts:31) at smithWaterman (smith-waterman.ts:142) at aligner (clustered-and-aligned-micro-tracks.selector.ts:197) at reducer (clustered-and-aligned-micro-tracks.selector.ts:207) at Array.reduce () at clustered-and-aligned-micro-tracks.selector.ts:214 at store.js:946 at memoized (store.js:869) at defaultStateFn (store.js:901) at store.js:955

alancleary commented 4 years ago

This appears to be related to issue #261, that is, clustering and alignment occurs every time the query track selector emits (i.e. whenever one of multiple query tracks is returned from the backend) rather than waiting until all query tracks have been loaded. This is causing the bug mentioned here because whenever a cluster is emitted tracks similar to the cluster's consensus track are retrieved from the backend. What's happening is one of the initial clusterings contains two clusters, so similar tracks are fetched for both clusters' consensus tracks. But before the similar tracks are loaded, a new clustering is emitted that only contains one cluster. When the similar tracks for the second cluster are finally loaded, GCV attempts to align the tracks to their now undefined consensuses, thus the "Cannot read property 'length' of undefined" error.

As the astute reader may have gathered, similar track HTTP requests are not being cancelled in flight when new requests are made. This is because GCV is federated, so concurrent requests are merged, rather than switched. To fix this, a manual switch needs to be triggered at the appropriate time, i.e. when a new clustering is emitted. Since similar tracks are not the only request afflicted by this, a different issue will be opened to address it.

adf-ncgr commented 4 years ago

thanks for the detailed explanation. Making no claim to being the astute reader, but I did kind of suspect a relationship to #261. The links to the rxjs docs look informative (having glanced only superficially, in order to maintain non-astute status). good luck getting this resolved. I hope someday the pharse "because GCV is federated" will be on a pin we can all wear with pride...

alancleary commented 4 years ago

This issue has been resolved by issues #261 and #267 and commit 1f7a150475d6788cdfd2fe1df7c3442b9eab0b56.