Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New JavaScript API #405

Closed
wants to merge 844 commits into from
Closed

New JavaScript API #405

wants to merge 844 commits into from

Conversation

ElDeveloper
Copy link
Member

@ElDeveloper ElDeveloper commented Jun 22, 2015

The goal of this branch (new-api), is to add the core JavaScript objects and basic functionality needed to simultaneously create 2D, 3D and parallel plots using Emperor. These efforts are focused on enhancing the modularity and usability of the objects, allowing developers to quickly build on top of this existing framework whenever a new use-case becomes available.

For now we will be working against a branch called new-api, it will not yet be merged into master and it will have small and atomic pull requests (except for the initial one). This branch will not break backwards compatibility in the Python/CLI interface, and is planned to be released as part of the 0.9.6 series so we can test and debug before releasing 1.0.

For reviewers, note that these changes will not be immediately integrated into the main GUI code, since the idea is to get rid of most of the code in emperor.js.

In general the plan is as follows:

While there are other features that will soon be added, we need to at least have the changes described above in place before moving forward in other directions.


If you are curious our slides for the BD2K presentation can be found here.

@emperor-helper
Copy link

The test build for this pull request can be found here: http://emperor.microbio.me/pull_405/make_emperor/

@josenavas
Copy link
Member

Thanks for starting this @ElDeveloper
excited to start moving forward for the rise of the new emperor!

@mortonjt
Copy link
Contributor

It looks good! Thanks @ElDeveloper !
On Jun 22, 2015 3:21 PM, "josenavas" notifications@github.com wrote:

Thanks for starting this @ElDeveloper https://github.com/ElDeveloper
excited to start moving forward for the rise of the new emperor!


Reply to this email directly or view it on GitHub
#405 (comment).

@mortonjt
Copy link
Contributor

Thanks @ElDeveloper , @josenavas for putting this together!

Do you guys think it would be worth while to add additional tests for multiple viewports within Penguin McHelper? Or should that be a future PR?

@mortonjt
Copy link
Contributor

Btw. Looks like there is a weird error in travis concerning the virtualenv

@ElDeveloper
Copy link
Member Author

That should be a future PR for sure.

On (Jun-30-15|15:39), mortonjt wrote:

Thanks @ElDeveloper , @josenavas for putting this together!

Do you guys think it would be worth while to add additional tests for multiple viewports within Penguin McHelper? Or should that be a future PR?


Reply to this email directly or view it on GitHub:
#405 (comment)

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.05%) to 93.956% when pulling 1d80f02 on new-api into 2ed99e2 on master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.03%) to 93.956% when pulling 182a9d5 on new-api into 55bc1bf on master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.03%) to 93.956% when pulling b46c8df on new-api into 55bc1bf on master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.03%) to 93.956% when pulling 659eed8 on new-api into 55bc1bf on master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.3%) to 93.694% when pulling abaafba on new-api into 55bc1bf on master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.3%) to 93.694% when pulling fec0c99 on new-api into 55bc1bf on master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.3%) to 93.694% when pulling 0695a70 on new-api into 55bc1bf on master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.3%) to 93.694% when pulling f7a0d03 on new-api into 55bc1bf on master.

@coveralls
Copy link

coveralls commented Apr 28, 2016

Coverage Status

Coverage decreased (-0.4%) to 93.56% when pulling b56a990 on new-api into 55bc1bf on master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.4%) to 93.56% when pulling b56a990 on new-api into 55bc1bf on master.

@coveralls
Copy link

coveralls commented Apr 28, 2016

Coverage Status

Coverage decreased (-0.4%) to 93.56% when pulling 4dae206 on new-api into 55bc1bf on master.

@coveralls
Copy link

coveralls commented Apr 30, 2016

Coverage Status

Coverage decreased (-0.4%) to 93.56% when pulling f15dd61 on new-api into 55bc1bf on master.

@coveralls
Copy link

coveralls commented May 3, 2016

Coverage Status

Coverage decreased (-0.6%) to 93.381% when pulling 56f769f on new-api into 55bc1bf on master.

@coveralls
Copy link

coveralls commented May 4, 2016

Coverage Status

Coverage decreased (-0.6%) to 93.381% when pulling ab5c050 on new-api into 55bc1bf on master.

@coveralls
Copy link

coveralls commented May 10, 2016

Coverage Status

Coverage decreased (-0.6%) to 93.381% when pulling 7039245 on new-api into 55bc1bf on master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.6%) to 93.381% when pulling 81aca23 on new-api into 55bc1bf on master.

ElDeveloper and others added 29 commits November 29, 2018 12:25
Fixes a problem where passing a dataframe with no metadata columns would
lead to a failure in the UI. The problem originated from the way we were
using the apply function to transform the values to strings, and how we
were merging the index names.

Fixes #700
* BLD: General updates to the repository

- Updates the setup.py file to no longer use distutils.
- Improves the long_description section to load the README.md file.
- Adds publications to the README.md file

* Add 3.7

* Modernize test running and coverage collection

* Add ability to run 3.7

* Add phantom.js as a conda dependency 👻

Install it from conda-forge.

* Another stab at python 3.7

* Update travis CI

* Update scikit-learn through conda

* Install scikit-learn from conda-forge

* ENH: Install from pip with no wheel

* STY: Remove trailing space in travis

* Add descriptor for Python 3.4

* ENH: Add cython

* Pin down scikit-learn

* Re-add testing for python 3.4
* WIP: Improve camera positioning

The camera was currently being positioned at the origin, instead of at
the center of the current data on screen.

* WIP: I have not been able to reset the camera

* BUG: Remove control damping

When damping is enabled it makes the recenternig the orbit controls go
to a point close to the center but not exactly it. This is because the
object is trying to simulate inertia during the recentering. I have now
disabled it.

* TST: Expand unit tests for ScenePlotView3D

* STY: Fix stylistic issues
* BUG: Fix problem with two-dimensional data

If the plot was initialized with two dimensions, the UI would fail to
instantiate as several objects had the dimensions hard-coded. I've
changed this to make it dependant on the data. In addition the Python
API will now check for one-dimensional data.

Fixes #686
Fixes #705

* Remove unnecessary print

Fixes #709

* Address @antgonza's review comment
* ENH: export plot to vega editor

* SQUASH

* ENH: Experimental features are by default available


This allows for a bit more flexibility while we figure out how to handle
this new functionality. Also, it won't lead to any test updates that
might be a bit too cumbersome.

I added custom icons in the context menu for "experimental" and for "biplot labels".

* SQUASH: linty lint
* REL: Bump version strings for release

* STY: Fix PEP8 error
* BLD: bump version string

* BLD: Remove PY3.4  build

Tests started failing and we have no reason to officially support/test
this version.
* color palette edit

* getDiscreteColorPalette unit test

* getDiscreteColorPalette unit test

* remove logs and changed function name to getPaletteColor

* fixed a long line

* fixed a long line
An axis would only be inverted if the loaded setting was "True", however
this would not honor the inversions that needed to happen if an axis was
currently set to True but should be changing to False.

I've included a unit test for this bug.

Fixes #717
* BLD: Remove dependency cap on sphinx

* Remove scikit-learn install

* Install certifi from conda

* Add a comment and remove requests installation

* Install requests using conda

* Update .travis.yml

* Re-add sphinx cap
* Fast animation by splitting tubes into static and dynamic portions such that only the dynamic portions require update each frame.

animate.js - now tracks the previous frame.  Should allow rewind in the future.
animations-controller.js - now treats static and dynamic tube segments separately
draw.js - Added method for creation of TubeBufferGeometry object for static tube segments.
		added method for updating draw range of TubeBufferGeometry
sceneplotview3d.js - now adds both static and dynamic tubes to the scene.
trajectory.js - New function to grab an interpolated tube segment / last two points of a trajectory for the current frame
view.js - split tubes into static and dynamic

* Updated tests for split of tubes field

* Fix for potential divide by zero

* Updated test for trajectory to check dynamic tube section equivalence

* Updated comment for jsdoc

* Moved variable declaration into for loop.  Added utility method to view to retrieve all tubes

* Added test for interpolating trajectories with duplicate points

* Removed drawTrajectoryLine

* Used preferred Material property setting through constructor.  Removed the Blah.

* Updated material constructor parameters for consistency.  Added dispose functions for each tube type.  Moving forward, project should decide if it wants to dispose all meshes the same, or each type of mesh differently, difference is whether or not materials and geometries should have potential to be reused.

* animations-controller now disposes of tube objects when removing them from the scene.  Draw no longer sets matrixAutoUpdate property on tube materials -- matrixAutoUpdate is a property of meshes.  It's unclear what was intended by setting it previously

* Ran fixjsstyle

* Manually fixed lines over 80 characters
Allows for feature metadata to not include some of the features
represented in the ordination. The errors and warnings have been updated
to properly refer to either features or samples. I've added a couple of
tests to validate the error/warning messages.

Fixes #730
Fixes #733
Several modules in the codebase were not used anywhere. The biplots
module has now been replaced by the biplot functionality available in
scikit-bio, the parsing functionality is all handled elswhere or using a
Pandas DataFrame, and the filtering/sorting functionality is no longer
needed.

Fixes #262
Fixes #261
The output is truncated to 5 missing elements.
* WIP for search bar for categories in view controllers

* Make the searchbar look less awful

* Improve the order of the searchbar

* ENH: Add searchbar to attribute view controller

* break long line

* TST: Add tests for searchbar functionality

Fixes #710

* STY: Small cleanup

* Make searchbar available for continuous values and remove new line

* BUG: Fix "results not found" position

The legend would cover the checkbox for continuous values.

* ENH: Hide searchbar while controller is disabled

* BUG: Fix issue with "No results found" message

Fixes an extraneous tooltip (for the plotMenu) would erroneously show on
screen. We change the context where the tooltip exists and limit it to
be the search bar only.
ENH:Allow for missing features in feature metadata
…cted (#728)

* BUG: Avoid matches with hidden objects

Improve the raycasting callback to ignore objects that are currently set
as invisible. Also, update the shader to ignore calls if opacity is set
to zero.

* Refine checks

* Add nosetests to setup.py
* Added multi-model, which takes on calculation of dimension bounds across multiple DecompositionModel objects from sceneplotview3d.  Added viewtype-controller, which lets the user choose between scatter and parallel plots.  Updated for display of parallel plots, still need to track down what needs to be done with scene/camera when switching back and forth

* Fixed camera reset on swapping scatter and parallel plot, fixed axes to use all axes rather than just visibleDimenions

* Moved choice between scatter and parallel plot to axes-controller, deleted viewtype-controller.

* Axes controller now saves viewType.  Changing color now updates the colors of the current scatter or parallel plot (but colors are lost when switching viewType)

* Color support for changing colors (but not generating correctly when colors are already set

* Controllers set applicable parameters on switching back and forth between scatter and parallel-plot

EmperorViewControllerABC adds a forceRefresh function, and defaults it to a toJSON followed by a fromJSON.
ScenePlotView3D's checkUpdate now returns a bit vector of required actions rather than a single boolean.
This is handled in new controller logic.
Attribute setters updated to set attributes for with correct indexing in parallel plot mode.
Shape changes are ignored
Axes changes are ignored

* Animations are no longer shown in parallel plot mode

* Fixed visible count for parallel plots

* Fixed issue in refreshing the controller state when number of points was >20000

* Stopgap measure for memory leaks, until we have a framework for disposing objects

* Ran fixjsstyle

* Fixed long lines

* Re ran fixjsstyle

* Fixed stupidity introduced when fixing line lengths

* Fixed sloppy var scoping from before I knew I could declare variables in for loops in javascript

* gjslinter is dumb, so I turned UPDATE_FLAGS enum into constants and it stopped complaining

* Update emperor/support_files/js/axes-controller.js

Co-Authored-By: Yoshiki Vázquez Baeza <yoshiki89@gmail.com>

* Disabled buildDisplayTable when in parallel plot mode.  This hides the axis chooser from the axes controller tab

* Added ui-state, a model class with events that fire when properties are changed

* Moved view's usesPointCloud property to ui-state as the first usage example, no change tracking on it yet

* Moved usesPointCloud property initialization

* Rough skeleton for adding/removing tabs that uses the UI state framework

* Added a viewType field to ui-state to show what linked events will look like in the parallel plots branch

* Working on adding/removing tabs in jquery

* Err... had to fix the .css call to the proper syntax when passing a dictionary

* Updated parallel plots to use UIState and events.  Updated UIState state change events to only be fired when properties change, rather than every time setProperty is called

* Oops.  UI state only fires events when properties are modified.

* Gave up on modifying jquery for useless tab reordering.  controller.js now holds on to a constant tab order list, we will enable disable controllers individually rather than adding and removing from that list

* Controller now hides the shape tab while in parallel plots mode

* Set default radio button checked in axes controller.  Hide shape and animations tabs when parallel plots are enabled

* Fixed minor comments for pull request

* Removed scale attribute from parallel plot shader

* Fixed png screenshot functionality for parallel plots

* Disabled scale controller when in parallel plots mode

* Disabled context menu options that needed to be turned off when in parallel-plot mode.  Turned off autorotation upon entering parallel-plot mode.

* Updated raycasting to support parallel plots

* Separate cameras+controllers for scatter and parallel plots

* Fixed label display with aspect ratio in parallel plots

* axis labels are resized when screen is resized

* Fixed bug found by unit tests

* index.html now references new files.  all tests painstakingly updated to use new DecompositionView(multiModel, modelKey)

* Continuing to fix unit tests for new DecompositionView constructor

* Removed two unit tests checking for throw errors: rather than throwing errors when passing a biplot and/or jackknifed plot to DecompositionView, it now switches back to its basic mode instead of using fastinit

* axes tests now know about viewtype field

* Passed correct multimodel to each test.  Added 1 to expected counts of objects in scene due to addition of separate parallel-plot mode camera object

* Ran gjslint + fixjsstyle.  Fixed remaining Line too long errors manually

* Revert "Removed two unit tests checking for throw errors: rather than throwing errors when passing a biplot and/or jackknifed plot to DecompositionView, it now switches back to its basic mode instead of using fastinit"

This reverts commit 49fcce2.

* Restored error throwing behavior on display of biplots in fast mode.
Fixed unit test to correctly pass jackknifed plot when looking for errors in jackknife code paths

* Cleanup: removed redundant css, added braces for if statements, moved early breakout before variable definition, added comment blocks

* Added UIState to constructors of abc-view-controller, animations-controller, axes-controller, color-view-controller, controller, opacity-view-controller, scale-view-controller, sceneplotview3d, shape-controller, view-controller, view, visibility-controller.
Fixed extremely confusing error resulting from creating variable named scope at the global scope, and then referencing it in a callback method.
Updated controller to construct a UIState instance and pass it through constructors to all necessary objects.
Updated tests with new UIState construction pattern - This helps fix the issue of tests incorrectly sharing objects, but adds significant complexity to test setup.  A full IOC framework, or further extraction of test setup could alleviate this.

* Removed references to the word 'singleton' as the UIstate is no longer a singleton

* Fixed Axes Controller radio button behavior with multiple emperor instances
* BUG: Remove duplicated block of code

This bug was introduced in the conflict resolution of the parallel plots
PR, and the invisible touchable point PR. Both features changed the way
in which we find the intersected objects. We only keep the strategy
followed the parallel plot PR.

* BUG: Fix problem with global variable

The variable intersect was accidentally declared as global and was
leading to incorrect intersections.

* BUG: Fix issue with mesh visibility
* BUG: Fix issue with slickgrid re-rendering

The grid was not re-rendered after the model's contents were updated.

Fixes #744

* TST: Add tests as requested by @antgonza
* BLD: Drop support for Python 2.7

* BLD: Fix build file

* BLD: Add sudo

* BLD: Fix pip

* BLD: Trying something different

* BLD: Add py27

* BLD: Use system-wide py27

* BLD: Debug build in travis

* BLD: Add a custom environment for py27

* BLD: Add missing six dependency

* BUG: Should have been && not ;

* TST: Fix broken tests in test_core.py

* TST: fix broken/outdated tests

* Use conda run

Co-Authored-By: Matthew Dillon <matthewrdillon@gmail.com>

* Use conda run

Co-Authored-By: Matthew Dillon <matthewrdillon@gmail.com>

* BLD: Better use of conda run

Thanks @thermokarst

* BLD: Remove deactivate

* TST: Fix broken test

This failure was being hidden from the PR that just got merged today.

* ENH: Join shader string

Co-authored-by: Matthew Dillon <matthewrdillon@gmail.com>
* Fixes the _removeObjectsWithPrefix function to remove -all- objects prefixed with a given name, rather than exactly one object with each name, as names of objects in the scene are not guaranteed to be unique

* STY: Fix gjslint errors

Fixes #748

* TST: Add polyfills to make tests pass

Co-authored-by: Daniel Hakim <dhakimdahakim@gmail.com>
The code was using the old way to access grid data. I looked in the rest
of the codebase and there checked there aren't any other usages of
getData (only when necessary).

Fixes #754
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow user to change the shape of the samples
10 participants