Address PR review issues

This commit is contained in:
Charlotte Weaver
2018-07-20 11:43:31 -07:00
parent 9c72f2c2d5
commit de5e0f4ea7

View File

@@ -1,5 +1,5 @@
import os
import argparse
import os
from flask import Flask
from flask_compress import Compress
@@ -40,7 +40,7 @@ app.register_blueprint(
app.add_url_rule("/", endpoint="index")
def run(args):
def run_scanpy(args):
global data
title = args.title
if not title:
@@ -50,23 +50,20 @@ def run(args):
DATASET_TITLE=title,
CXG_API_BASE=api_base
)
if args.engine == "scanpy":
from .scanpy_engine.scanpy_engine import ScanpyEngine
data = ScanpyEngine(args.data_directory, schema="data_schema.json")
from .scanpy_engine.scanpy_engine import ScanpyEngine
data = ScanpyEngine(args.data_directory, schema="data_schema.json")
app.run(host="0.0.0.0", debug=True, port=args.port)
def main():
parser = argparse.ArgumentParser(description="Cellxgene is a tool for exploring single cell expression.")
parser.add_argument("--title", "-t", help="Title to display -- if this is omitted the title will be the name "
"of the directory from the data_directory arg")
parser.add_argument("--port", help="Port to run server on.", type=int, default=5005)
subparsers = parser.add_subparsers(dest="cellxgene_command")
run_subparser = subparsers.add_parser("run", help="run cellxgene")
run_subparser.add_argument("--title", "-t", help="Title to display (default = data directory name")
run_subparser.add_argument("--port", help="Port to run server on.", type=int, default=5005)
run_subparser.add_argument("engine", help="The underlying structure of the data")
run_subparser.add_argument("data_directory", metavar="dir", help="Directory containing data and schema")
run_subparser.set_defaults(func=run)
scanpy_subparser = subparsers.add_parser("scanpy", help="run cellxgene using the scanpy engine")
scanpy_subparser.add_argument("data_directory", metavar="dir", help="Directory containing data and schema file")
scanpy_subparser.set_defaults(func=run_scanpy)
args = parser.parse_args()
args.func(args)
# app.run(host="0.0.0.0", debug=True, port=5005)