Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added new command line argument for port number #6

Merged
merged 2 commits into from
Feb 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 20 additions & 3 deletions yomix/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,23 @@ def main():
parser.add_argument(
"file", type=str, nargs="?", default=None, help="the .ha5d file to open"
)

parser.add_argument(
"--port",
"-p",
type=int,
default=5006,
help="port on which the app should run",
)

parser.add_argument(
"--name",
"-n",
type=str,
default="",
help="name given to the main plot",
)

parser.add_argument(
"--subsampling",
type=int,
Expand All @@ -55,16 +72,16 @@ def main():

if filearg.exists():

modify_doc = yomix.server.gen_modify_doc(filearg, args.subsampling)
modify_doc = yomix.server.gen_modify_doc(filearg, args.subsampling, args.name)

io_loop = IOLoop.current()

bokeh_app = Application(FunctionHandler(modify_doc))

server = Server({"/": bokeh_app}, io_loop=io_loop)
server = Server({"/": bokeh_app}, io_loop=io_loop, port=args.port)
server.start()

print("Opening Yomix on http://localhost:5006/\n")
print(f"Opening Yomix on http://localhost:{args.port}/\n")

io_loop.add_callback(server.show, "/")
io_loop.start()
2 changes: 1 addition & 1 deletion yomix/plotting/figure.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import matplotlib.pyplot as plt
from pathlib import Path

MAX_UNIQUE_VALUES = 70
MAX_UNIQUE_VALUES = 200
MAX_UNIQUE_RATIO = 0.5


Expand Down
7 changes: 5 additions & 2 deletions yomix/server/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@
import numpy as np
import anndata
from scipy.sparse import issparse
import os


def gen_modify_doc(filearg, subsampling):
def gen_modify_doc(filearg, subsampling, title):

xd = anndata.read_h5ad(filearg.absolute())

Expand Down Expand Up @@ -101,7 +102,7 @@ def build_figure(embedding_key):
sl_component1,
sl_component2,
sl_component3,
) = yomix.plotting.main_figure(xd, embedding_key, 890, 390, "")
) = yomix.plotting.main_figure(xd, embedding_key, 890, 390, title)

resize_width_input_bis.visible = False
resize_height_input_bis.visible = False
Expand Down Expand Up @@ -367,4 +368,6 @@ def f():

doc.add_periodic_callback(f, 100)

doc.title = f"Yomix - {os.path.basename(filearg)}"

return modify_doc
Loading