Prepare fixes (#416)

* Error on overwrite=false but no output file

* Add prepare requirements to requirements.txt

* no saved output error -> warning

* Catch clustering import error

* lint fixes

* Fix missing output message
This commit is contained in:
Charlotte Weaver
2018-11-09 13:51:30 -08:00
committed by GitHub
parent dd56d0937c
commit aa29c91470
3 changed files with 15 additions and 3 deletions
+1 -1
View File
@@ -74,7 +74,7 @@ def launch(data, layout, diffexp, title, verbose, debug, obs_names, var_names,
app.config.update(
DATASET_TITLE=title,
CXG_API_BASE=api_base
)
)
if not verbose:
log = logging.getLogger("werkzeug")
+10 -1
View File
@@ -47,6 +47,10 @@ def prepare(data, layout, recipe, output, plotting, sparse, overwrite,
raise click.UsageError("Cannot use a recipe when forcing sparsity")
output = expanduser(output)
if not output:
click.echo("Warning: No file will be saved, to save the results of cellxgene prepare include "
"--output <filename> to save output to a new file")
if isfile(output) and not overwrite:
raise click.UsageError(f"Cannot overwrite existing file {output}, try using the flag --overwrite")
@@ -112,7 +116,12 @@ def prepare(data, layout, recipe, output, plotting, sparse, overwrite,
sc.pp.neighbors(adata)
def run_louvain(adata):
sc.tl.louvain(adata)
try:
sc.tl.louvain(adata)
except ModuleNotFoundError:
click.echo("\nWarning: louvain module is not installed, no clusters will be calculated. "
"To fix this please install cellxgene with the optional feature louvain enabled: "
"`pip install cellxgene[louvain]`")
def run_layout(adata):
if len(unique(adata.obs["louvain"].values)) < 10:
+4 -1
View File
@@ -26,5 +26,8 @@ setup(
entry_points={
"console_scripts":
["cellxgene = server.cli.cli:cli"]
}
},
extras_require=dict(
louvain=['python-igraph', 'louvain>=0.6'],
),
)