Commit Graph

313 Commits

Author SHA1 Message Date
Bruce Martin
f2fbeff511 add support for corpora default_embedding field (#1696)
* fix mispelling

* re-implement re-embedding

* always load base embedding to fetch counts

* format

* lint

* fix tests

* lint

* fix accept handling

* test log

* more debug

* more

* more

* more

* more

* remove logging

* logging

* jsonify

* remove debugging logs

* lint

* clean up errors a bit

* fix issue found in PR review

* add support for corpora default_embedding

* fix botched merge

* PR review

* PR review
2020-07-31 07:36:48 -07:00
Bruce Martin
75cb513dd9 re-implement re-embeddings (#1679)
* fix mispelling

* re-implement re-embedding

* always load base embedding to fetch counts

* format

* lint

* fix tests

* lint

* fix accept handling

* test log

* more debug

* more

* more

* more

* more

* remove logging

* logging

* jsonify

* remove debugging logs

* lint

* clean up errors a bit

* fix issue found in PR review

* PR review changes
2020-07-30 12:31:36 -07:00
bmccandless
bd147abb3f Fix eb logging. (#1692)
It now logs the requests to the file

Fixes #1611
2020-07-29 16:03:47 -07:00
bmccandless
5633d7c761 Fix server exception classes (#1683)
str(e) and e.message will both show the error message.
refactored the error.py file to simplify our exception class definitions
2020-07-29 13:05:59 -07:00
Bruce Martin
59f989d26f initial support for corpora schema conventions (#1676)
* initial support for corpora schema conventions

* remove debugging print

* add corpora util module

* tests

* lint

* PR review edits

* PR changes

* more PR changes

* more PR chnages

* PR fixes

* formatting

* PR updates

* lint

* PR review
2020-07-28 17:32:27 -07:00
bmccandless
5285556415 Add basic authentication in the server (#1670)
* Add basic authentication in the server

A pattern for creating authentication methods is introduced, with three
authentication types defined:
  none - no authentication
  session - like the current session based auth used for user annotations
  test - used to test the login/logout process end to end

The config endpoint now returns informations about the authentication, like if
the user is authenticated and their username.  The redirect uri's for login and
logout are also returned if the authentication type requires login

This is the first a several PRs for authentication.

*. Update server tests to avoid hardcoded ports

test_api and test_nan_rest now use a common function for starting a test server,
than will initially choose a random port.
2020-07-28 13:28:30 -07:00
bmccandless
0344cfacce Fix the app config for reembedding and add a test (#1664)
* Fix the app config for reembedding and add a test

* Add scanpy to requirements-dev
2020-07-23 12:27:53 -07:00
bmccandless
2cb3ae7046 Fix error handling in plugin module (#1645) 2020-07-17 08:14:10 -07:00
bmccandless
f223d7504e Small fix for handling display versions (#1625)
* Small fix for handling display versions

Making a distinction between __version__ and the version we display in the info panel (displayr_version).
The hosted cellxgene can overwrite the display_version using a plugin.

Improve version handling in the customized assets
2020-07-16 15:11:37 -07:00
Bruce Martin
2f700b377f permit NaN in embedding coordinates (#1631)
* permit NaN in embedding coordinates

* lint
2020-07-16 11:43:56 -07:00
bmccandless
3c6d90a4db Better error checking on bad params (#1626) 2020-07-16 11:08:27 -07:00
bmccandless
f69d141336 refactor config to support different config options for datasets in different dataroots. (#1596)
This will give us the ability to specify different config options for
different dataroots.

the key of the dataroot dictionary is no longer the same as the dataroot_url.
Previously key==dataroot_url, and now those are separated.

Added an "is_multi_dataset" function to simplify logic where it branched on single vs multi.

Simplified the rest.py interface by no longer passing in the user annotations object, since
that can be retrieved from the dataset.
2020-07-10 16:21:40 -07:00
bmccandless
f3d5081d38 exclude a tiledb version that has a known bug (#1604)
exclude a tiledb version that has a known bug
2020-07-07 08:39:50 -07:00
Matt Weiden
e5670d1732 Do not cache index.html (#1603)
* Fix typo

* Run black for code formatting

* Do not cache index.html
2020-07-01 14:35:44 -07:00
bmccandless
5015c5ca3f Return float32 for embedding data type (#1597) 2020-06-30 14:16:55 -07:00
Matt Weiden
152c07a28e Change default branch from 'master' to 'main' (#1589)
The default branch has been changed. This PR cleans up references to
`master` and fixes links that would otherwise be broken.

For more background see the following references:
* https://www.independent.co.uk/life-style/gadgets-and-tech/news/github-master-slave-slavery-whitelist-language-inclusive-a9568576.html
* https://tools.ietf.org/id/draft-knodel-terminology-00.html
2020-06-25 14:04:30 -07:00
Timmy Huang
83376627e8 1510-smoke-test (#1548)
* 1510-smoke-test

* config default

* update tests

* update test config

* fix linter errors

* more comments

* address comments

* use npm install in push_tests.yml

* use environment.default.json

* adding docs

* Take care of @mweiden's nits

* Save screenshots in the __tests__/screenshots/ directory

* typo

* docs

* Add chart tests (#1580)

* merge tests

* check if bin creation returned null before rendering charts (#1576)

* check if bin creation returned null before rendering charts

* refactor chart rendering into functions (#1577)

* little fixes from PR

* reintroduce fix to check for null values

* change getAllByClass to return element

* slice instead

* new stackedbar test

* feedback-1573-test (#1579)

* feedback-1573-test

* enable whole test set

* revert tests

Co-authored-by: Timmy Huang <tihuan@users.noreply.github.com>

* tweak test to actually render chart

* include snapshot

* remove async

* fix getAllHistograms

* properly grab id

Co-authored-by: Timmy Huang <tihuan@users.noreply.github.com>

Co-authored-by: Matt Weiden <538456+mweiden@users.noreply.github.com>
Co-authored-by: Severiano Badajoz <sbadajoz@chanzuckerberg.com>
2020-06-24 11:45:39 -07:00
bmccandless
e22e671f10 Return 404 when the dataset does not exist (#1581)
Also in this PR, restructure the exception handling.

fixes #1566
2020-06-23 17:14:42 -07:00
bmccandless
99d004d1f0 add config option to handle multiple dataroots (#1531)
#1513
2020-06-04 19:29:37 -07:00
Matt Weiden
101f446f8d Add .gitignore file added by elastic beanstalk (#1506) 2020-06-03 09:14:24 -07:00
bmccandless
76523d4f32 sparse column shift encoding. (#1502)
Many of our matrices are log normalized, which tends to eliminate
the number of non zero values (if there were any).  This prevents
the matrix from being stored as a sparse matrix.  The solution here
is to use a simple transformation to make it sparse again.  The most
common value from each column is subtracted from that column.  These
values that were subtracted are saved in an array called X_col_shift.

The cellxgene code needs to understand how to undo the transformation when
operating over the X matrix.

- added script to create a synthetic dataset for testing
- added a script to convert an existing CXG dataset to a sparse CXG dataset
2020-06-02 08:23:52 -07:00
bmccandless
d0577b94af Return an empty matrix if no rows or columns are selected (#1501)
Return an empty matrix if no rows or columns are selected

Fixes #1499
2020-05-29 14:47:46 -07:00
bmccandless
f7585eef1e Support for sparse tiledb arrays for the X matrix (#1496)
Support for sparse tiledb arrays for the X matrix

1. cxgtool can now output sparse matrices
2. cxg_adaptor and diffexp_cxg updated to handle sparse matrices
3. added a test in test_diffexp to test sparse diffexp and get_X_array
2020-05-28 18:36:02 -07:00
bmccandless
030eea1898 Update run_diffexp.py (#1494)
You can now select labels within groups instead of random rows.
2020-05-26 16:06:33 -07:00
Matt Weiden
51758a0be9 Remove the trusted types requirement (#1495)
There seem to be breaking changes in Chrome that are causing this to
fail. We've weighed the risk of disabling the feature with the issues
we've encountered using it and decided to disable it for now.
2020-05-26 12:31:56 -07:00
bmccandless
4d100d4507 Upgrade to tiledb 2.0 (#1485)
* Upgrade to tiledb 2.0
2020-05-21 14:55:11 -07:00
Matt Weiden
e21997799c Upgrade python requirements to click>=7.1.2 (#1472)
6.7 does not have the `hidden` flag used in the code. Users building the
app with an older version of click within the current range specified by
requirements.txt may fail.
2020-05-14 10:04:28 -07:00
Matt Weiden
730410c5e1 Autoformat python to fix lint errors (#1470)
* Autoformat python to fix lint errors

* Fix lint errors not caught by black
2020-05-12 13:19:38 -07:00
Bruce Martin
c1bf491a96 Hooks for sentry integration (#1460)
* add sentry webpack plugin

* allow override of webpack config

* work around cheerio inability to parse jinga templates

* webpack can not minify jinja templates

* allow script injection to specify other attributes

* allow script injection to specify other attributes

* Adjustments to make plugin systems work

* Add sourcemaps for javascript in prod webpack

* Update .gitignore

* Fix spelling errors

Co-authored-by: Matt Weiden <538456+mweiden@users.noreply.github.com>
2020-05-08 15:59:56 -07:00
bmccandless
f49507f18a app_config, fix bug with list/tuple command line arguments. (#1464)
* app_config, fix bug with list/tuple command line arguments.

There was a error caused by pyyaml using lists, and click using tuples.
Now tuples are automatically converted to lists when the config is
updated.
2020-05-06 12:00:02 -07:00
Matt Weiden
5947306ca0 Add server plugin system (#1447)
* Add server plugin system

Plugins are optional modules loaded at runtime. Specification:
* Plugins are loaded from the server.plugins module (directory
  server/plugins)
* The import_plugins method is run as part of the initialization of the
  server module in __init__.py

* Add plugins to the EB build process

* Remove bit of dead code

* Respond to feedback from @bmccandless
2020-05-05 17:05:42 -07:00
bmccandless
55a7967001 Add a process for specifying exact requirements for an EB deployment (#1451)
Add a process for keeping specifying exact requirements for an EB deployment
2020-05-05 10:51:02 -07:00
bmccandless
61ca75e846 hosted, update order to look for config file. (#1452)
* hosted, update order to look for config file.

The app now uses a local config.yaml file bundled with the artifact
(if present), if it exists, then looks in the CXG_CONFIG_FILE
environment variable.  This is the reverse of previous behavior.
The purpose of this change is to move away from using the
config file on s3, since that could lead to problem where an older
version of the app uses a newer version of the config.

Also in this PR:
1. Changed documentation around dataroot, to describe the posibility of using lustre.
2. Added a few improvements around the secret manager region name.  If we use lustre for dataroot and a local config file, then we will no longer be able to
auto determine the region for the secret manager.  I plan to start using the
environment variable option for hosted cellxgene.

* small edit to README

Co-authored-by: Severiano Badajoz <sbadajoz@chanzuckerberg.com>
2020-05-05 10:50:28 -07:00
Matt Weiden
1ee76826c7 Pin tiledb version 0.5.9 (#1453)
There is a regression in 0.6.0
2020-05-05 10:03:57 -07:00
Bruce Martin
f42f5151a6 Refactor build and CSP headers for Safari compat (#1442)
* add unsafe-inline directive to style-src

* debugging - turn on csp reporting

* revert reporting only csp

* do not inline JS and CSS in build

* enable HTTPs only when in production mode

* remove debug printf

* fix clean target

* revert force_https removal
2020-05-04 12:47:35 -07:00
bmccandless
b255e32548 Add a more consistent way to customize the eb deployment (#1446)
* Add a more consistent way to customize the eb deployment

Plus a few minor bugfixes
2020-05-04 09:52:03 -07:00
Matt Weiden
a17fff83cf Return empty colors for .cxg v0.0 files (#1441)
* Return empty colors for .cxg v0.0 files

Fixes https://github.com/chanzuckerberg/cellxgene/issues/1440

The CxgAdaptor.get_colors method currently assumes that the .cxg file has
cxg_group_metadata. As a result, the /api/v0.2/colors endpoint always fails for
.cxg v0.0 files.

* Add test fixture
2020-04-30 17:21:20 -07:00
bmccandless
cd821a0344 Update the EB build process to package in scripts (#1434)
This is implemented specifically to handle the google analytics
script for hosted cellxgene
2020-04-28 14:38:35 -07:00
bmccandless
e495c571c3 Change the EB log level from DEBUG to INFO (#1435)
The log level was mistakenly set to DEBUG, which sent out tons
of less than useful messages.  INFO works much more useful,
and much less verbose.
2020-04-28 14:37:41 -07:00
Bruce Martin
05fcdaf93c Revised terms and privacy consent dialog, analytics hooks (#1426)
* revised terms and privacy consent

* reorg code

* fix conditional

* Overlay reflects un-dissmissable state

* add inline scripts, and consent callback

* add csp_directive config hook

* revert config.yaml

* fix logic error

Co-authored-by: Colin Megill <colinmegill@gmail.com>
2020-04-28 14:21:53 -07:00
Matt Weiden
546e272a60 Add user-defined category-label colors (#1402)
* Add user-defined category-label colors

Fixes https://github.com/chanzuckerberg/cellxgene/issues/1152

As described in https://github.com/chanzuckerberg/cellxgene/issues/1307

* Respond to feedback from @bkmartinjr in nodejs

* Respond to feedback from @bkmartinjr in python

* Add tests to the server module

* Autoformat python, run linter

* Make colors_get error handling specific

* Respond to feedback from @bkmartinjr

* Respond to feedback from @bkmartinjr

* Fix whitespace

* Fix python lint errrors

* Update documentation

* Add --disable-user-colors option to launch and cxgtool.py

* Fix python formatting

* Rename '--disable-user-colors' to '--disable-custom-colors'
2020-04-26 22:52:57 -07:00
Eduardo Lopez
565a3f148d [feature] Prototype a Heroku deployment of hosted cellxgene (#1427)
* hello world

* stuff

* successful build

* updates"

* maybe a basic example

* simplify

* reamde into dockerfile

* some more stuff

* Release procfile

* package.json at top levle

* don't release in procfile for now

* more package.json stuff

* copy assets

* merge master

* not in the relase phase

* revert not necessary

* pin gunicorn version

* reset common.mk

* Update package.json

Co-authored-by: Madison Dunitz <dunitzm@gmail.com>
2020-04-24 12:44:38 -07:00
Bruce Martin
735eb11eb7 refinments to csp (#1422) 2020-04-23 09:54:09 -07:00
Bruce Martin
55ef1448e8 CSP content hashes (#1406)
* remove duplicate content-type header

* plumbing to compute CSP content hashes

* add logging of missing CSP hashes

* convert sub-class init protocol to static

* factor function

* lint
2020-04-17 11:42:09 -07:00
Bruce Martin
d22300e3db fix typo in cxgtool bool handler (#1404) 2020-04-17 11:11:14 -07:00
bmccandless
03a75ec566 s3 listings were cached, preventing new datasets from being accessible (#1408)
Fixes #1407
2020-04-17 10:14:24 -07:00
Matt Weiden
58e4c2489b Auto format python, make sure it passes lint checks (#1401) 2020-04-16 08:07:10 -07:00
bmccandless
7e7ed74b92 Provide a hook into the AWS Secret Manager for the flask secret key (#1398)
Also, the secret manager required a region name, so there was some
refactoring around how regions are handled.

Fixes #1239
2020-04-15 14:33:40 -07:00
bmccandless
5c0b8c6296 Improve diffexp for tiledb (#1388)
* Improve diffexp for tiledb

- The rows from the A and B sets are gathered and processed at the same time.  In this
  way the matrix is only accessed once instead of twice for each tile.
- There is now a single thread queue that gets shared between all callers of the diffexp.
  This will slow down work if diffexp gets too busy.
- There is a target_workunit amount of work given to each thread.  Previously the
  workunit was (rows selected * width of tile), which could be small.  Now multiple
  column tiles can be combined into one workunit.  If the target is too small then
  thread and other overheads may reduce performance.  If target_workunit is too large
  then the size of the gathered sub matrix may take up too much memory.
- add configuration parameters (max_workers, cpu_multiplier, and  target_workunit)
2020-04-13 18:53:13 -07:00
Bruce Martin
136093d583 add GET routes for expression data (#1387)
* add GET routes for expression data

* fix comment typo
2020-04-13 11:28:35 -07:00