mirror of
https://github.com/chanzuckerberg/cellxgene.git
synced 2026-10-05 07:08:11 +08:00
Launch browser to cellxgene (#325)
* Launch browser to cellxgene Also added --no-launch command line parameter * Don't launch browser for tests * rename no-launch to no-open * Rejigger -no-open to positive destination so later logic looks cleaner
This commit is contained in:
@@ -42,14 +42,11 @@ Started in the context of the Human Cell Atlas Consortium, cellxgene hopes to bo
|
|||||||
|
|
||||||
**Install server**
|
**Install server**
|
||||||
|
|
||||||
|
|
||||||
pip install -e .
|
pip install -e .
|
||||||
|
|
||||||
**Run (with demo data)**
|
**Run (with demo data)**
|
||||||
|
|
||||||
cellxgene --title PBMC3K scanpy example-dataset/
|
cellxgene --title PBMC3K scanpy example-dataset/
|
||||||
*In google chrome, navigate to the viewer via the web address printed in your console.
|
|
||||||
E.g.,* `Running on http://0.0.0.0:5005/`
|
|
||||||
|
|
||||||
**Help**
|
**Help**
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import argparse
|
import argparse
|
||||||
import os
|
import os
|
||||||
import warnings
|
import warnings
|
||||||
|
import webbrowser
|
||||||
|
|
||||||
from flask import Flask
|
from flask import Flask
|
||||||
from flask_caching import Cache
|
from flask_caching import Cache
|
||||||
@@ -61,6 +62,8 @@ def run_scanpy(args):
|
|||||||
host = "0.0.0.0"
|
host = "0.0.0.0"
|
||||||
else:
|
else:
|
||||||
host = "127.0.0.1"
|
host = "127.0.0.1"
|
||||||
|
if args.open_browser:
|
||||||
|
webbrowser.open(f"http://{host}:{args.port}")
|
||||||
app.run(host=host, debug=True, port=args.port)
|
app.run(host=host, debug=True, port=args.port)
|
||||||
|
|
||||||
|
|
||||||
@@ -69,6 +72,7 @@ def main():
|
|||||||
parser.add_argument("--title", "-t", help="Title to display -- if this is omitted the title will be the name "
|
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")
|
"of the directory from the data_directory arg")
|
||||||
parser.add_argument("--port", help="Port to run server on.", type=int, default=5005)
|
parser.add_argument("--port", help="Port to run server on.", type=int, default=5005)
|
||||||
|
parser.add_argument("--no-open", help="Do not launch the webbrowser.", action="store_false", dest="open_browser")
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--bind-all",
|
"--bind-all",
|
||||||
help="Bind to all interfaces (this makes the server accessible beyond this computer)",
|
help="Bind to all interfaces (this makes the server accessible beyond this computer)",
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ class EndPoints(unittest.TestCase):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setUpClass(cls):
|
def setUpClass(cls):
|
||||||
cls.ps = Popen(["cellxgene", "scanpy", "example-dataset/"])
|
cls.ps = Popen(["cellxgene", "--no-open", "scanpy", "example-dataset/"])
|
||||||
session = requests.Session()
|
session = requests.Session()
|
||||||
for i in range(90):
|
for i in range(90):
|
||||||
try:
|
try:
|
||||||
|
|||||||
Reference in New Issue
Block a user