Compare commits

..
Author SHA1 Message Date
Timmy Huang afb4ba906b server update 2024-01-24 10:16:38 -08:00
Timmy Huang ede95bfe4b update requirements.txt 2024-01-23 10:56:56 -08:00
Timmy Huang 7d61f47a31 updated visium branch 2024-01-23 10:48:27 -08:00
12 changed files with 5735 additions and 28916 deletions
@@ -2,7 +2,6 @@ const path = require("path");
const webpack = require("webpack");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const FaviconsWebpackPlugin = require("favicons-webpack-plugin");
const ScriptExtHtmlWebpackPlugin = require("script-ext-html-webpack-plugin");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const { merge } = require("webpack-merge");
@@ -73,9 +72,6 @@ const devConfig = {
CXG_SERVER_PORT: process.env.CXG_SERVER_PORT || "5005",
}),
}),
new ScriptExtHtmlWebpackPlugin({
async: "obsolete",
}),
],
infrastructureLogging: {
level: "warn",
@@ -3,8 +3,6 @@ const webpack = require("webpack");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const { CleanWebpackPlugin } = require("clean-webpack-plugin");
const TerserJSPlugin = require("terser-webpack-plugin");
const CleanCss = require("clean-css");
const OptimizeCSSAssetsPlugin = require("optimize-css-assets-webpack-plugin");
const FaviconsWebpackPlugin = require("favicons-webpack-plugin");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
@@ -27,12 +25,7 @@ const prodConfig = {
},
optimization: {
minimize: true,
minimizer: [
new TerserJSPlugin({}),
new OptimizeCSSAssetsPlugin({
cssProcessor: CleanCss,
}),
],
minimizer: [new TerserJSPlugin({})],
},
devtool: "source-map",
module: {
@@ -1,22 +1,12 @@
const path = require("path");
const fs = require("fs");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const ObsoleteWebpackPlugin = require("obsolete-webpack-plugin");
// eslint-disable-next-line @blueprintjs/classes-constants -- incorrect match
const ScriptExtHtmlWebpackPlugin = require("script-ext-html-webpack-plugin");
const src = path.resolve("src");
const nodeModules = path.resolve("node_modules");
const publicPath = "";
const rawObsoleteHTMLTemplate = fs.readFileSync(
`${__dirname}/obsoleteHTMLTemplate.html`,
"utf8"
);
const obsoleteHTMLTemplate = rawObsoleteHTMLTemplate.replace(/'/g, '"');
module.exports = {
entry: [
"core-js",
@@ -61,14 +51,4 @@ module.exports = {
},
],
},
plugins: [
new ObsoleteWebpackPlugin({
name: "obsolete",
template: obsoleteHTMLTemplate,
promptOnNonTargetBrowser: false,
}),
new ScriptExtHtmlWebpackPlugin({
async: "obsolete",
}),
],
};
+5541 -28871
View File
File diff suppressed because it is too large Load Diff
+2 -3
View File
@@ -84,6 +84,8 @@
"@babel/plugin-proposal-function-bind": "^7.10.5",
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.10.4",
"@babel/plugin-proposal-optional-chaining": "^7.10.4",
"@babel/plugin-proposal-private-methods": "^7.18.6",
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
"@babel/plugin-transform-react-constant-elements": "^7.13.13",
"@babel/plugin-transform-runtime": "^7.13.15",
"@babel/preset-env": "^7.13.15",
@@ -133,12 +135,9 @@
"lodash.map": "^4.6.0",
"lodash.zip": "^4.2.0",
"mini-css-extract-plugin": "^1.5.0",
"obsolete-webpack-plugin": "^0.5.6",
"optimize-css-assets-webpack-plugin": "^5.0.3",
"prettier": "^2.0.5",
"puppeteer": "^8.0.0",
"rimraf": "^3.0.2",
"script-ext-html-webpack-plugin": "^2.1.4",
"serve-favicon": "^2.5.0",
"terser-webpack-plugin": "^5.1.1",
"webpack": "^5.34.0",
+2 -2
View File
@@ -275,14 +275,14 @@ class MenuBar extends React.PureComponent {
{layoutChoice?.available?.includes(globals.spatialEmbeddingKeyword) && (
<ButtonGroup className={styles.menubarButton}>
<Tooltip
content={"Toggle image"}
content="Toggle image"
position="bottom"
hoverOpenDelay={globals.tooltipHoverOpenDelay}
>
<AnchorButton
type="button"
data-testid="toggle-image-underlay"
icon={"media"}
icon="media"
intent={imageUnderlay.isActive ? "primary" : "none"}
active={imageUnderlay.isActive}
onClick={() => {
@@ -0,0 +1,20 @@
The MIT License (MIT)
Copyright (c) 2017-2021 Chan Zuckerberg Initiative
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,151 @@
Metadata-Version: 2.1
Name: cellxgene
Version: 1.0.0
Summary: Web application for exploration of large scale scRNA-seq datasets
Home-page: https://github.com/chanzuckerberg/cellxgene
Author: Chan Zuckerberg Initiative
Author-email: cellxgene@chanzuckerberg.com
License: MIT
Classifier: Framework :: Flask
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Natural Language :: English
Classifier: Operating System :: POSIX
Classifier: Operating System :: Unix
Classifier: Operating System :: MacOS :: MacOS X
Classifier: Programming Language :: JavaScript
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
Requires-Python: >=3.6
Description-Content-Type: text/markdown
License-File: LICENSE.txt
Requires-Dist: anndata >=0.7.6
Requires-Dist: boto3 >=1.12.18
Requires-Dist: click >=7.1.2
Requires-Dist: Flask >=1.0.2
Requires-Dist: Flask-Compress >=1.4.0
Requires-Dist: Flask-Cors >=3.0.9
Requires-Dist: Flask-RESTful >=0.3.6
Requires-Dist: flask-server-timing >=0.1.2
Requires-Dist: flask-talisman >=0.7.0
Requires-Dist: flatbuffers <2.0.0,>=1.11.0
Requires-Dist: flatten-dict >=0.2.0
Requires-Dist: fsspec <0.8.0,>=0.4.4
Requires-Dist: gunicorn >=20.0.4
Requires-Dist: h5py >=3.0.0
Requires-Dist: matplotlib >=3.5.0
Requires-Dist: numba >=0.51.2
Requires-Dist: numpy >=1.17.5
Requires-Dist: packaging >=20.0
Requires-Dist: pandas !=1.1,>=1.0
Requires-Dist: PyYAML >=5.4
Requires-Dist: scipy >=1.4
Requires-Dist: requests >=2.22.0
Requires-Dist: s3fs ==0.4.2
Provides-Extra: prepare
Requires-Dist: python-igraph >=0.8 ; extra == 'prepare'
Requires-Dist: louvain >=0.6 ; extra == 'prepare'
Requires-Dist: scanpy ; extra == 'prepare'
Requires-Dist: umap-learn <0.5.0 ; extra == 'prepare'
<img src="./docs/cellxgene-logo.png" width="300">
_an interactive explorer for single-cell transcriptomics data_
[![DOI](https://zenodo.org/badge/105615409.svg)](https://zenodo.org/badge/latestdoi/105615409) [![PyPI](https://img.shields.io/pypi/v/cellxgene)](https://pypi.org/project/cellxgene/) [![PyPI - Downloads](https://img.shields.io/pypi/dm/cellxgene)](https://pypistats.org/packages/cellxgene) [![GitHub last commit](https://img.shields.io/github/last-commit/chanzuckerberg/cellxgene)](https://github.com/chanzuckerberg/cellxgene/pulse)
[![Push Tests](https://github.com/chanzuckerberg/cellxgene/workflows/Push%20Tests/badge.svg)](https://github.com/chanzuckerberg/cellxgene/actions?query=workflow%3A%22Push+Tests%22)
[![Compatibility Tests](https://github.com/chanzuckerberg/cellxgene/workflows/Compatibility%20Tests/badge.svg)](https://github.com/chanzuckerberg/cellxgene/actions?query=workflow%3A%22Compatibility+Tests%22)
![Code Coverage](https://codecov.io/gh/chanzuckerberg/cellxgene/branch/main/graph/badge.svg)
cellxgene Desktop (pronounced "cell-by-gene") is an interactive data explorer for single-cell datasets, such as those coming from the [Human Cell Atlas](https://humancellatlas.org). Leveraging modern web development techniques to enable fast visualizations of at least 1 million cells, we hope to enable biologists and computational researchers to explore their data.
Whether you need to visualize one thousand cells or one million, cellxgene Desktop helps you gain insight into your single-cell data.
<img src="https://github.com/chanzuckerberg/cellxgene/raw/main/docs/images/crossfilter.gif" width="350" height="200" hspace="30"><img src="https://github.com/chanzuckerberg/cellxgene/raw/main/docs/images/category-breakdown.gif" width="350" height="200" hspace="30">
# Getting started
### The comprehensive guide to cellxgene Desktop
[The cellxgene documentation is your one-stop-shop for information about cellxgene Desktop](https://github.com/chanzuckerberg/cellxgene-documentation/blob/main/README.md)! You may be particularly interested in:
- Seeing [what cellxgene Desktop can do](https://github.com/chanzuckerberg/cellxgene-documentation/blob/main/explore-data/explorer-tutorials.md)
- Learning more about cellxgene [installation](https://github.com/chanzuckerberg/cellxgene-documentation/blob/main/desktop/install.md) and [usage](https://github.com/chanzuckerberg/cellxgene-documentation/blob/main/desktop/quick-start.md#quick-start-1)
- [Preparing your own data](https://github.com/chanzuckerberg/cellxgene-documentation/blob/main/desktop/data-reqs.md) for use in cellxgene Desktop
- Checking out [our roadmap](https://github.com/chanzuckerberg/cellxgene-documentation/blob/main/roadmap.md) for future development
- [Contributing](https://github.com/chanzuckerberg/cellxgene-documentation/blob/main/contribute.md) to cellxgene Desktop
### Quick start
To install cellxgene Desktop you need Python 3.6+. We recommend [installing cellxgene Desktop into a conda or virtual environment.](https://github.com/chanzuckerberg/cellxgene-documentation/blob/main/desktop/install.md)
Install the package.
```bash
pip install cellxgene
```
Launch cellxgene Desktop with an example [anndata](https://anndata.readthedocs.io/en/latest/) file
```bash
cellxgene launch https://cellxgene-example-data.czi.technology/pbmc3k.h5ad
```
To explore more datasets already formatted for cellxgene Desktop, check out the [Demo data](https://github.com/chanzuckerberg/cellxgene-documentation/blob/main/desktop/quick-start.md#example-datasets) or
see [Preparing your data](https://github.com/chanzuckerberg/cellxgene-documentation/blob/main/desktop/data-reqs.md) to learn more about formatting your own
data for cellxgene Desktop.
### Supported browsers
cellxgene Desktop currently supports the following browsers:
- Google Chrome 61+
- Edge 15+
- Firefox 60+
Please [file an issue](https://github.com/chanzuckerberg/cellxgene/issues/new/choose) if you would like us to add support for an unsupported browser.
### Finding help
We'd love to hear from you!
For questions, suggestions, or accolades, [join the `#cellxgene-users` channel on the CZI Science Slack](https://join-cellxgene-users.herokuapp.com/) and say "hi!".
For any errors, [report bugs on Github](https://github.com/chanzuckerberg/cellxgene/issues).
# Developing with cellxgene Desktop
### Contributing
We warmly welcome contributions from the community! Please see our [contributing guide](https://github.com/chanzuckerberg/cellxgene-documentation/blob/main/contribute.md) and don't hesitate to open an issue or send a pull request to improve cellxgene Desktop. Please see the [dev_docs](https://github.com/chanzuckerberg/cellxgene/tree/main/dev_docs) for pull request suggestions, unit test details, local documentation preview, and other development specifics.
This project adheres to the Contributor Covenant [code of conduct](https://github.com/chanzuckerberg/.github/blob/master/CODE_OF_CONDUCT.md). By participating, you are expected to uphold this code. Please report unacceptable behavior to opensource@chanzuckerberg.com.
### Reuse
This project was started with the sole goal of empowering the scientific community to explore and understand their data.
As such, we encourage other scientific tool builders in academia or industry to adopt the patterns, tools, and code from
this project. All code is freely available for reuse under the [MIT license](https://opensource.org/licenses/MIT).
Before extending cellxgene, we encourage you to reach out to us with ideas or questions. It might be possible that an
extension could be directly contributed, which would make it available for a wider audience, or that it's on our
[roadmap](https://github.com/chanzuckerberg/cellxgene-documentation/blob/main/roadmap.md) and under active development.
See the [cellxgene extensions](https://github.com/chanzuckerberg/cellxgene-documentation/blob/main/community-extensions.md) section of our documentation for examples of community use and cellxgene extensions.
### Security
If you believe you have found a security issue, we would appreciate notification. Please send email to <security@chanzuckerberg.com>.
# Inspiration
We've been heavily inspired by several other related single-cell visualization projects, including the [UCSC Cell Browser](http://cells.ucsc.edu/), [Cytoscape](http://www.cytoscape.org/), [Xena](https://xena.ucsc.edu/), [ASAP](https://asap.epfl.ch/), [GenePattern](http://genepattern-notebook.org/), and many others. We hope to explore collaborations where useful as this community works together on improving interactive visualization for single-cell data.
We were inspired by Mike Bostock and the [crossfilter](https://github.com/crossfilter) team for the design of our filtering implementation.
We have been working closely with the [scanpy](https://github.com/theislab/scanpy) team to integrate with their awesome analysis tools. Special thanks to Alex Wolf, Fabian Theis, and the rest of the team for their help during development and for providing an example dataset.
We are eager to explore integrations with other computational backends such as [Seurat](https://github.com/satijalab/seurat) or [Bioconductor](https://github.com/Bioconductor)
@@ -0,0 +1,2 @@
[console_scripts]
cellxgene = server.cli.cli:cli
@@ -0,0 +1,3 @@
build
server
test
+11 -6
View File
@@ -294,7 +294,9 @@ def layout_obs_get(request, data_adaptor):
try:
return make_response(
data_adaptor.layout_to_fbs_matrix(fields, data_adaptor.get_spatial()), HTTPStatus.OK, {"Content-Type": "application/octet-stream"}
data_adaptor.layout_to_fbs_matrix(fields, data_adaptor.get_spatial()),
HTTPStatus.OK,
{"Content-Type": "application/octet-stream"},
)
except (KeyError, DatasetAccessError) as e:
return abort_and_log(HTTPStatus.BAD_REQUEST, str(e), include_exc_info=True)
@@ -380,7 +382,7 @@ def summarize_var_helper(request, data_adaptor, key, raw_query):
HTTPStatus.OK,
{"Content-Type": "application/octet-stream"},
)
except (ValueError) as e:
except ValueError as e:
return abort(HTTPStatus.NOT_FOUND, description=str(e))
except (UnsupportedSummaryMethod, FilterError) as e:
return abort(HTTPStatus.BAD_REQUEST, description=str(e))
@@ -399,9 +401,10 @@ def summarize_var_post(request, data_adaptor):
key = request.args.get("key", default=None)
return summarize_var_helper(request, data_adaptor, key, request.get_data())
def spatial_image_get(request, data_adaptor):
import io
import matplotlib.pyplot
import matplotlib.pyplot
resolution = "hires"
spatial = data_adaptor.get_spatial()
@@ -417,7 +420,9 @@ def spatial_image_get(request, data_adaptor):
return abort_and_log(HTTPStatus.BAD_REQUEST, "spatial information does not contain images")
if resolution not in spatial[library_id]["images"]:
return abort_and_log(HTTPStatus.BAD_REQUEST, f"spatial information does not contain requested resolution '{resolution}'")
return abort_and_log(
HTTPStatus.BAD_REQUEST, f"spatial information does not contain requested resolution '{resolution}'"
)
response_image = io.BytesIO()
img = spatial[library_id]["images"][resolution]
@@ -425,7 +430,7 @@ def spatial_image_get(request, data_adaptor):
response_image.seek(0)
try:
return send_file(response_image, attachment_filename=f"{library_id}-{resolution}.png", mimetype="image/png")
return send_file(response_image, download_name=f"{library_id}-{resolution}.png", mimetype="image/png")
except (KeyError, DatasetAccessError) as e:
return abort_and_log(HTTPStatus.BAD_REQUEST, str(e), include_exc_info=True)
except PrepareError:
@@ -434,4 +439,4 @@ def spatial_image_get(request, data_adaptor):
f"No spatial image available {request.path}",
loglevel=logging.ERROR,
include_exc_info=True,
)
)
+2 -2
View File
@@ -3,7 +3,7 @@
anndata>=0.7.6 # we need to_memory(), added in 0.7.6
boto3>=1.12.18
click>=7.1.2
Flask>=1.0.2
Flask==2.2.3
Flask-Compress>=1.4.0
Flask-Cors>=3.0.9 # CVE-2020-25032
Flask-RESTful>=0.3.6
@@ -22,4 +22,4 @@ pandas>=1.0,!=1.1 # pandas 1.1 breaks tests, https://github.com/pandas-dev/pand
PyYAML>=5.4 # CVE-2020-14343
scipy>=1.4
requests>=2.22.0
s3fs==0.4.2
Werkzeug==2.2.3