mirror of
https://github.com/chanzuckerberg/cellxgene.git
synced 2026-10-07 23:58:11 +08:00
Merge pull request #116 from chanzuckerberg/csweaver/packaging
Csweaver/packaging
This commit is contained in:
@@ -44,3 +44,9 @@ server/app/web/static/css/
|
|||||||
server/app/web/static/img/
|
server/app/web/static/img/
|
||||||
server/app/web/static/js/
|
server/app/web/static/js/
|
||||||
server/app/web/templates/index\.html
|
server/app/web/templates/index\.html
|
||||||
|
|
||||||
|
|
||||||
|
*.egg-info
|
||||||
|
dist/*
|
||||||
|
build/*
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,2 @@
|
|||||||
|
recursive-include server/app/web/templates *
|
||||||
|
recursive-include server/app/web/static *
|
||||||
Executable
+10
@@ -0,0 +1,10 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
npm install --prefix client/ client
|
||||||
|
npm run --prefix client build
|
||||||
|
mkdir -p server/app/web/static/img
|
||||||
|
cp client/build/index.html server/app/web/templates/
|
||||||
|
cp -r client/build/static server/app/web/
|
||||||
|
|
||||||
|
cp client/build/favicon.png server/app/web/static/img
|
||||||
|
cp client/build/service-worker.js server/app/web/static/js/
|
||||||
Binary file not shown.
@@ -0,0 +1,32 @@
|
|||||||
|
{
|
||||||
|
"CellName": {
|
||||||
|
"type": "string",
|
||||||
|
"variabletype": "categorical",
|
||||||
|
"displayname": "Name",
|
||||||
|
"include": true
|
||||||
|
},
|
||||||
|
"n_genes": {
|
||||||
|
"type": "int",
|
||||||
|
"variabletype": "continuous",
|
||||||
|
"displayname": "Num Genes",
|
||||||
|
"include": true
|
||||||
|
},
|
||||||
|
"percent_mito": {
|
||||||
|
"type": "float",
|
||||||
|
"variabletype": "continuous",
|
||||||
|
"displayname": "Mitochondrial Percentage",
|
||||||
|
"include": true
|
||||||
|
},
|
||||||
|
"n_counts": {
|
||||||
|
"type": "float",
|
||||||
|
"variabletype": "continuous",
|
||||||
|
"displayname": "Num Counts",
|
||||||
|
"include": true
|
||||||
|
},
|
||||||
|
"louvain": {
|
||||||
|
"type": "string",
|
||||||
|
"variabletype": "categorical",
|
||||||
|
"displayname": "Louvain Cluster",
|
||||||
|
"include": true
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,55 +0,0 @@
|
|||||||
import os
|
|
||||||
|
|
||||||
from flask import Flask
|
|
||||||
from flask_compress import Compress
|
|
||||||
from flask_cors import CORS
|
|
||||||
from flask_restful_swagger_2 import get_swagger_blueprint
|
|
||||||
|
|
||||||
from .web import webapp
|
|
||||||
from .rest_api.rest import get_api_resources
|
|
||||||
|
|
||||||
app = Flask(__name__)
|
|
||||||
Compress(app)
|
|
||||||
CORS(app)
|
|
||||||
|
|
||||||
# Config
|
|
||||||
CXG_DIR = os.environ.get("CXG_DIRECTORY", default="/Users/charlotteweaver/Documents/Git/cxg-v2/data/")
|
|
||||||
SECRET_KEY = os.environ.get("CXG_SECRET_KEY", default="SparkleAndShine")
|
|
||||||
ENGINE = os.environ.get("CXG_ENGINE", default="scanpy")
|
|
||||||
TITLE = os.environ.get("DATASET_TITLE", default="PBMC 3K")
|
|
||||||
# TODO remove the 2 when this is prod
|
|
||||||
CXG_API_BASE = os.environ.get("CXG_API_BASE2", default="http://0.0.0.0:5005/api/")
|
|
||||||
|
|
||||||
app.config.update(
|
|
||||||
SECRET_KEY=SECRET_KEY,
|
|
||||||
CXG_API_BASE=CXG_API_BASE,
|
|
||||||
ENGINE=ENGINE,
|
|
||||||
DATA=CXG_DIR,
|
|
||||||
DATASET_TITLE=TITLE
|
|
||||||
)
|
|
||||||
|
|
||||||
app.config["PROFILE"] = True
|
|
||||||
# app.wsgi_app = ProfilerMiddleware(app.wsgi_app, restrictions=[15])
|
|
||||||
|
|
||||||
# Application Data
|
|
||||||
data = None
|
|
||||||
if app.config["ENGINE"] == "scanpy":
|
|
||||||
from .scanpy_engine.scanpy_engine import ScanpyEngine
|
|
||||||
data = ScanpyEngine(app.config["DATA"], schema="data_schema.json")
|
|
||||||
|
|
||||||
REACTIVE_LIMIT = 1_000_000
|
|
||||||
|
|
||||||
# A list of swagger document objects
|
|
||||||
docs = []
|
|
||||||
resources = get_api_resources()
|
|
||||||
docs.append(resources.get_swagger_doc())
|
|
||||||
|
|
||||||
|
|
||||||
app.register_blueprint(webapp.bp)
|
|
||||||
app.register_blueprint(resources.blueprint)
|
|
||||||
app.register_blueprint(
|
|
||||||
get_swagger_blueprint(docs, "/api/swagger", produces=["application/json"], title="cellxgene rest api",
|
|
||||||
description="An API connecting ExpressionMatrix2 clustering algorithm to cellxgene"))
|
|
||||||
|
|
||||||
|
|
||||||
app.add_url_rule("/", endpoint="index")
|
|
||||||
|
|||||||
@@ -0,0 +1,57 @@
|
|||||||
|
import os
|
||||||
|
|
||||||
|
from flask import Flask
|
||||||
|
from flask_compress import Compress
|
||||||
|
from flask_cors import CORS
|
||||||
|
from flask_restful_swagger_2 import get_swagger_blueprint
|
||||||
|
|
||||||
|
from .web import webapp
|
||||||
|
from .rest_api.rest import get_api_resources
|
||||||
|
|
||||||
|
REACTIVE_LIMIT = 1_000_000
|
||||||
|
|
||||||
|
app = Flask(__name__)
|
||||||
|
Compress(app)
|
||||||
|
CORS(app)
|
||||||
|
|
||||||
|
# Config
|
||||||
|
CXG_DIR = os.environ.get("CXG_DIRECTORY", default="/Users/charlotteweaver/Documents/Git/cxg-v2/data/")
|
||||||
|
SECRET_KEY = os.environ.get("CXG_SECRET_KEY", default="SparkleAndShine")
|
||||||
|
ENGINE = os.environ.get("CXG_ENGINE", default="scanpy")
|
||||||
|
TITLE = os.environ.get("DATASET_TITLE", default="PBMC 3K")
|
||||||
|
# TODO remove the 2 when this is prod
|
||||||
|
CXG_API_BASE = os.environ.get("CXG_API_BASE2", default="http://0.0.0.0:5005/api/")
|
||||||
|
|
||||||
|
app.config.update(
|
||||||
|
SECRET_KEY=SECRET_KEY,
|
||||||
|
CXG_API_BASE=CXG_API_BASE,
|
||||||
|
ENGINE=ENGINE,
|
||||||
|
DATA=CXG_DIR,
|
||||||
|
DATASET_TITLE=TITLE
|
||||||
|
)
|
||||||
|
|
||||||
|
app.config["PROFILE"] = True
|
||||||
|
# app.wsgi_app = ProfilerMiddleware(app.wsgi_app, restrictions=[15])
|
||||||
|
|
||||||
|
# Application Data
|
||||||
|
data = None
|
||||||
|
if app.config["ENGINE"] == "scanpy":
|
||||||
|
from .scanpy_engine.scanpy_engine import ScanpyEngine
|
||||||
|
data = ScanpyEngine(app.config["DATA"], schema="data_schema.json")
|
||||||
|
|
||||||
|
# A list of swagger document objects
|
||||||
|
docs = []
|
||||||
|
resources = get_api_resources()
|
||||||
|
docs.append(resources.get_swagger_doc())
|
||||||
|
|
||||||
|
app.register_blueprint(webapp.bp)
|
||||||
|
app.register_blueprint(resources.blueprint)
|
||||||
|
app.register_blueprint(
|
||||||
|
get_swagger_blueprint(docs, "/api/swagger", produces=["application/json"], title="cellxgene rest api",
|
||||||
|
description="An API connecting ExpressionMatrix2 clustering algorithm to cellxgene"))
|
||||||
|
|
||||||
|
app.add_url_rule("/", endpoint="index")
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
app.run(host="0.0.0.0", debug=True, port=5005)
|
||||||
@@ -88,7 +88,7 @@ class InitializeAPI(Resource):
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
def get(self):
|
def get(self):
|
||||||
from app import data, REACTIVE_LIMIT
|
from server.app.app import data, REACTIVE_LIMIT
|
||||||
return make_payload({
|
return make_payload({
|
||||||
"schema": data.schema,
|
"schema": data.schema,
|
||||||
"cellcount": data.cell_count,
|
"cellcount": data.cell_count,
|
||||||
@@ -191,7 +191,7 @@ class CellsAPI(Resource):
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
def get(self):
|
def get(self):
|
||||||
from app import data
|
from server.app.app import data
|
||||||
payload = {
|
payload = {
|
||||||
"metadata": [],
|
"metadata": [],
|
||||||
"cellcount": 0,
|
"cellcount": 0,
|
||||||
@@ -199,8 +199,8 @@ class CellsAPI(Resource):
|
|||||||
"ranges": {},
|
"ranges": {},
|
||||||
}
|
}
|
||||||
# get query params
|
# get query params
|
||||||
filter = parse_filter(request.args, data.schema)
|
cells_filter = parse_filter(request.args, data.schema)
|
||||||
filtered_data = data.filter_cells(filter)
|
filtered_data = data.filter_cells(cells_filter)
|
||||||
payload["metadata"] = data.metadata(filtered_data)
|
payload["metadata"] = data.metadata(filtered_data)
|
||||||
payload["ranges"] = data.metadata_ranges(filtered_data)
|
payload["ranges"] = data.metadata_ranges(filtered_data)
|
||||||
payload["graph"] = data.create_graph(filtered_data)
|
payload["graph"] = data.create_graph(filtered_data)
|
||||||
@@ -251,7 +251,7 @@ class ExpressionAPI(Resource):
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
def get(self):
|
def get(self):
|
||||||
from app import data
|
from server.app.app import data
|
||||||
expression_data = data.expression()
|
expression_data = data.expression()
|
||||||
return make_payload(expression_data)
|
return make_payload(expression_data)
|
||||||
|
|
||||||
@@ -309,7 +309,7 @@ class ExpressionAPI(Resource):
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
def post(self):
|
def post(self):
|
||||||
from app import data
|
from server.app.app import data
|
||||||
args = request.get_json()
|
args = request.get_json()
|
||||||
cell_list = args.get("celllist", [])
|
cell_list = args.get("celllist", [])
|
||||||
gene_list = args.get("genelist", [])
|
gene_list = args.get("genelist", [])
|
||||||
@@ -415,7 +415,7 @@ class DifferentialExpressionAPI(Resource):
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
def post(self):
|
def post(self):
|
||||||
from app import data
|
from server.app.app import data
|
||||||
args = request.get_json()
|
args = request.get_json()
|
||||||
cell_list_1 = args.get("celllist1", [])
|
cell_list_1 = args.get("celllist1", [])
|
||||||
cell_list_2 = args.get("celllist2", [])
|
cell_list_2 = args.get("celllist2", [])
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
aniso8601==3.0.2
|
aniso8601==3.0.2
|
||||||
anndata==0.6.1
|
anndata==0.6.4
|
||||||
certifi==2018.4.16
|
certifi==2018.4.16
|
||||||
chardet==3.0.4
|
chardet==3.0.4
|
||||||
click==6.7
|
click==6.7
|
||||||
@@ -30,7 +30,7 @@ pyparsing==2.2.0
|
|||||||
python-dateutil==2.7.3
|
python-dateutil==2.7.3
|
||||||
pytz==2018.4
|
pytz==2018.4
|
||||||
requests==2.19.1
|
requests==2.19.1
|
||||||
scanpy==1.2.2
|
scanpy==1.0.4
|
||||||
scikit-learn==0.19.1
|
scikit-learn==0.19.1
|
||||||
scipy==1.1.0
|
scipy==1.1.0
|
||||||
seaborn==0.8.1
|
seaborn==0.8.1
|
||||||
@@ -38,4 +38,4 @@ six==1.11.0
|
|||||||
statsmodels==0.9.0
|
statsmodels==0.9.0
|
||||||
tables==3.4.4
|
tables==3.4.4
|
||||||
urllib3==1.23
|
urllib3==1.23
|
||||||
Werkzeug==0.14.1
|
Werkzeug==0.14.1
|
||||||
+1
-1
@@ -1,3 +1,3 @@
|
|||||||
from app import app
|
from app.app import app
|
||||||
|
|
||||||
app.run(host="0.0.0.0", debug=True, port=5005)
|
app.run(host="0.0.0.0", debug=True, port=5005)
|
||||||
|
|||||||
@@ -0,0 +1,30 @@
|
|||||||
|
from setuptools import setup, find_packages
|
||||||
|
|
||||||
|
with open("README.md", "r") as fh:
|
||||||
|
long_description = fh.read()
|
||||||
|
|
||||||
|
with open('server/requirements.txt') as fh:
|
||||||
|
requirements = fh.read().splitlines()
|
||||||
|
|
||||||
|
setup(
|
||||||
|
name='cellxgene',
|
||||||
|
version='0.0.1',
|
||||||
|
packages=find_packages(),
|
||||||
|
url='https://github.com/chanzuckerberg/cellxgene',
|
||||||
|
license='MIT',
|
||||||
|
author='Colin Megill, Charlotte Weaver',
|
||||||
|
author_email='cweaver@chanzuckerberg.com',
|
||||||
|
description='Web application for exploration of large scale scRNA-seq datasets',
|
||||||
|
long_description=long_description,
|
||||||
|
install_requires=requirements,
|
||||||
|
include_package_data=True,
|
||||||
|
zip_safe=False,
|
||||||
|
classifiers=(
|
||||||
|
"Programming Language :: Python :: 3",
|
||||||
|
"License :: OSI Approved :: MIT License",
|
||||||
|
),
|
||||||
|
entry_points={
|
||||||
|
'console_scripts':
|
||||||
|
['cellxgene = server.app.app:main']
|
||||||
|
}
|
||||||
|
)
|
||||||
Reference in New Issue
Block a user