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
+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: