-
Notifications
You must be signed in to change notification settings - Fork 4
[WIP] Add filtering functionality and testing framework #40
Conversation
* Testing framework added to grunt pipeline * Tests added for utility functions
Coolness! This was a lot to process but you made it very entertaining LOL. I'll try to review this tomorrow, still struggling with some microscopium changes (the CLI needed some TLC... =P) |
Alrighty, some usage notes:
On the plus side:
You seem to know what to do next, anyway. Regarding your massively chained methods, it is indeed unacceptable that they would appear more than once! Why would chaining methods be a problem when defining another method? e.g. in Python, if I want to add a
Anyway, I won't comment on the code while you're still working on it. I hope at least some issues above were undiscovered! =) |
Future me will thank me if I need to add other checkboxes to any other part of the UI.
* The sample indices get shuffled around during the d3 enter/update/exit/pattern, so use the sample _id's to lookup data instead
@jni The commits above fixed the issues that I have checked off! With respect to the outstanding points..
New issue that's become apparent:
I like the checkboxes in the terminal too! I also think Jasmine's way of using strings to describe how the tests should behave is great. |
Really awesome! I didn't even think that you could prevent the alpha stacking, but that would be absolutely brilliant! =D Other than that, excellent progress, I'm excited! =D |
8c86916
to
cac7003
Compare
* Add opacity as parameter to set in constructor * extend d3.selection object with moveToBack method * change opacity of plot points when they're not in the filter
@jni -- Just pinging you to let you know there's been a few updates. Check them out if you'd like. Currently all that's outstanding is getting the SVG opacities to stop stacking. It's weird, I can get it to work when I place all the points in a |
@starcalibre fantastic! I'd seen some of these earlier today but I'm still fixing the mess I made when I assumed there would be three channels in the input stream instead of 1-3. =P I'll look this over very soon! |
btw is it very dramatic to add some |
I feel your pain :P This was the exact problem I had when I wrote the original batch stitching function.. it was a classic "oh this is easy....." 4 hours later "throws computer out window* moment. Is there something about the way I went about it that's incompatible in your new code? Not really, I'm gonna try a solution where I move SVGs between two
This is also nice because the points not being filtered will be rendered after the points being filtered, so they'll always appear on top. |
No, not really, I just need to move stuff around, ensure the API is nice (ie specify blank channels with And make sure I don't break your existing stuff! =P |
@starcalibre are you still working on this? Currently, performance is excruciating. Set filter, spinning beach ball of death... eventually the filter works. In addition, filtering for PLK in the 10A screen results in everything disappearing... |
Are any errors reported to the console? It's running fine on my end. However I've only tested in Chrome so far, I'm away from my machine running Firefox and IE at the moment. |
Console log looks clean. Let me try it in Chrome, see if I get better results. (Was using Safari/OSX.) |
Well the good news is that I was being an idiot and I hadn't correctly pulled in git. =P The bad news is that now I don't even get to the testing... My spinner just keeps on spinning, even after the screen info comes up. At that point I can do nothing other than reload the page. This is on Safari, and emptying the cache didn't help. This is the only error-y output in the console:
In Chrome, |
@starcalibre are you able to meet up around VLSCI tomorrow or Thurs? We can have a mini-sprint perhaps? =) |
Is there anything reported to the browsers console? In Safari or Chrome? I'll be in tomorrow, I can come in after midday?
|
Woot, I'll see you then! Maybe we can go to the University club. =) Here's some ominous-looking things when I press Enter in the gene search box:
Let's try to figure it out in the morning. Goodnight! =) |
* Prevent default browser behavour on submit * Hitting enter on textbox updates gene filter * Cache jQuery selectors and use selector chaining where possible
* The use of the SVG opacity filter has been removed. This was proving to be really computationally intensive, particularly in Firefox and Safari. The opacity is now set at a low value (0.25), and this can be adjusted in the NeighbourPlot constructor. The opacity value stacks, but points not being filtered are moved to the front so they're visible. * The opacity set each time the plot updates by reducing the opacity of ALL points in the plot, then increasing the opacity of all points that are currently being filtered. This is done by iterating the points. D3's update-select-exit pattern does not seem particularly well suited to this task. * Where possible, I am caching the selectors in jQuery. * Finally, a few selectors and HTML tags have been updated to ensure the Filter loads correctly when the screen is changed.
@starcalibre Are you done with this? It's basically ready, imho! There's a couple of minor bugs, and it's a bit sluggish, but I'm happy to leave these things to later developments. What do you think? The bugs I'm talking about:
Feel free to clear these tickboxes either by piling on commits here or by creating issues. =) |
@jni - Done, with a little bonus optimization thrown in |
@starcalibre Fan-friggin-tastic. Merging, finally. =D btw, once filters are active, everything slows way down... Is that just because of the transparency, or is there some additional continuing processing going on? |
[WIP] Add filtering functionality and testing framework
Right now I suspect it's the transparency -- the performance was fine until that was introduced. I'm playing around the profiling tools in Firefox now, I'll see if that can reveal anything. |
A quick thing to try might be to replace transparency with just a very light blue colour, see if that improves things. I'm raising an issue to continue this discussion. See #42. |
regexFilter
have been moved to their own JS file. Why? Because..I was looking at tooltips to check the filtering was working as expected.. I realised quickly this was stupid because the functions used to filter the data are easily testable. You know how in Python you simply import pytest, write your tests, run them and you're good to go? Well, it's pretty much the same in JS...AHAHAHAHAHA yeah right. It's a little more involved.. I'll try an explain how it works:
Testing in JS needs two components..
(Other choices here include "Chai" and "Mocha".. I swear I'm not making this shit up. I've chosen Jasmine and Karma because I'm most familiar with them and they're currently the most popular. Though I'm sure 'Affogato' has just been released and is all the rage.. until next week 'Decaf Latte' comes out and is the testing suite du jour. :P :P :P).
So, how it works is.. you write your tests in Jasmine in a JS file, then this file gets sent to Karma. Karma usually runs in a browser (because you need something to run your JS), and it gives you the results of the tests in a HTML file.
However, I find this a little cumbersome.. and I want to add the tests to my Grunt pipeline, so I can see how my tests went along with my JSHint every time I change the code. That's where PhantomJS comes in. It's a 'headless' browser, which means it's a browser with no GUI that doesn't render the DOM. It just keeps the DOM in memory and is able to run JavaScript though, so Karma can use it to run the tests. This usually makes testing faster, because you don't have the overhead of the browser GUI and DOM rendering. The results of the tests can then be outputed to your terminal running Grunt.
The above wall of text suggests this is complicated to setup, but the grunt plugin
grunt-contrib-karma
does most of this for you.Two things outstanding..
appears about 4830439593 times so I'm going to put it into its own function. It's a bunch of chained methods though, so I just need to work out how to do with this without making D3 crap the bed.
FInally.. If you run this branch locally, remember to
npm install
so you download everything you need to run the tests. :)