#14 enabled new annotations

Due to issue with opening annotation files with "-" in the name, this doesn't quite work.
This commit is contained in:
Alok Saldanha
2019-12-28 21:55:43 -05:00
parent f41db75a24
commit c03098af17
13 changed files with 252 additions and 106 deletions
+14 -5
View File
@@ -11,21 +11,30 @@ import logging
import subprocess
from flask_api import status
from cellxgene_gateway.env import enable_annotations
from cellxgene_gateway.process_exception import ProcessException
from cellxgene_gateway.dir_util import make_annotations
from cellxgene_gateway.path_util import get_file_path, get_annotation_file_path
class SubprocessBackend:
def __init__(self):
pass
def create_cmd(self, cellxgene_loc, file_path, port, scripts):
def create_cmd(self, cellxgene_loc, file_path, port, scripts, annotation_file_path):
if enable_annotations and not annotation_file_path is None:
annotation_args_prefix = " --experimental-annotations"
if annotation_file_path == "":
annotation_args = f"{annotation_args_prefix} --experimental-annotations-output-dir {make_annotations(file_path)}"
else:
annotation_args = f"{annotation_args_prefix} --experimental-annotations-file {annotation_file_path}"
else:
annotation_args = ""
cmd = (
f"yes | {cellxgene_loc} launch {file_path}"
+ " --port "
+ str(port)
+ " --host 127.0.0.1"
+ annotation_args
)
for s in scripts:
@@ -36,7 +45,7 @@ class SubprocessBackend:
def launch(self, cellxgene_loc, scripts, cache_entry):
cmd = self.create_cmd(
cellxgene_loc, cache_entry.file_path, cache_entry.port, scripts
cellxgene_loc, get_file_path(cache_entry.key), cache_entry.port, scripts, get_annotation_file_path(cache_entry.key)
)
logging.getLogger("cellxgene_gateway").info(f"launching {cmd}")
process = subprocess.Popen(