Move computation options to app (#386)

no need to import scanpy engine for CLI help so speeds up time response
This commit is contained in:
Charlotte Weaver
2018-10-26 17:07:21 -07:00
committed by GitHub
parent 75ca14e4aa
commit 26d222cd75
2 changed files with 7 additions and 16 deletions
+7 -7
View File
@@ -110,13 +110,13 @@ cellxgene is a local web application for exploring single cell expression.
help="Limit for the cardinality of a categorical annotation, beyond which the" help="Limit for the cardinality of a categorical annotation, beyond which the"
" annotation will not be available for user selection in the front-end", " annotation will not be available for user selection in the front-end",
default=100) default=100)
try: # TODO scanpy specific; rethink when we add another engine
from .scanpy_engine.scanpy_engine import ScanpyEngine computation_group = launch_group.add_argument_group('computational arguments')
except ImportError as e: # TODO these choices should be generated from the actual available methods see GH issue #94
# We will handle more engines when they come computation_group.add_argument("-l", "--layout", choices=["umap", "tsne"], default="umap",
raise ImportError('Scanpy is required for cellxgene, please install scanpy and try again', e) from e help="Algorithm to use for graph layout")
else: computation_group.add_argument("-d", "--diffexp", choices=["ttest"], default="ttest",
ScanpyEngine.add_to_parser(launch_group) help="Algorithm to used to calculate differential expression")
return parser return parser
@@ -65,15 +65,6 @@ class ScanpyEngine(CXGDriver):
raise TypeError(f"Annotations of type {curr_axis[ann].dtype} are unsupported by cellxgene.") raise TypeError(f"Annotations of type {curr_axis[ann].dtype} are unsupported by cellxgene.")
self.schema["annotations"][ax].append(ann_schema) self.schema["annotations"][ax].append(ann_schema)
@classmethod
def add_to_parser(cls, subparser):
computation_group = subparser.add_argument_group('computational arguments')
# TODO these choices should be generated from the actual available methods see GH issue #94
computation_group.add_argument("-l", "--layout", choices=["umap", "tsne"], default="umap",
help="Algorithm to use for graph layout")
computation_group.add_argument("-d", "--diffexp", choices=["ttest"], default="ttest",
help="Algorithm to used to calculate differential expression")
@staticmethod @staticmethod
def _load_data(data): def _load_data(data):
# See https://scanpy.readthedocs.io/en/latest/api/scanpy.api.read.html # See https://scanpy.readthedocs.io/en/latest/api/scanpy.api.read.html