mirror of
https://github.com/Novartis/cellxgene-gateway.git
synced 2026-10-09 22:20:56 +08:00
#81 Add support for gene sets
This adds the flag `GATEWAY_ENABLE_GENE_SETS` to enable support for gene sets. To simplify implementation, activating this flag also activates `GATEWAY_ENABLE_ANNOTATIONS`. The gene sets are saved in a file that has the same name as the annotations `csv` but with `_gene_sets` appended to the file name (before the extension). This file is hidden in filecrawler, and the gene sets are loaded when the associated annotations file is loaded. If the annotations file is missing, then an Exception is raised. I have updated one unit test to make it expect `--disable-gene-sets-save` in the default case (i.e. if `GATEWAY_ENABLE_ANNOTATIONS = 0`). All units tests pass. I have updated the README to document `GATEWAY_ENABLE_GENE_SETS`.
This commit is contained in:
committed by
Alok Saldanha
parent
390fe24ea4
commit
81c8ce4219
@@ -14,7 +14,12 @@ from flask_api import status
|
||||
|
||||
from cellxgene_gateway.cache_entry import CacheEntryStatus
|
||||
from cellxgene_gateway.dir_util import make_annotations
|
||||
from cellxgene_gateway.env import cellxgene_args, enable_annotations, enable_backed_mode
|
||||
from cellxgene_gateway.env import (
|
||||
cellxgene_args,
|
||||
enable_annotations,
|
||||
enable_backed_mode,
|
||||
enable_gene_sets,
|
||||
)
|
||||
from cellxgene_gateway.process_exception import ProcessException
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -32,6 +37,16 @@ class SubprocessBackend:
|
||||
extra_args = f" --annotations-file {annotation_file_path}"
|
||||
else:
|
||||
extra_args = " --disable-annotations"
|
||||
if enable_gene_sets and not annotation_file_path is None:
|
||||
if annotation_file_path == "":
|
||||
raise Exception(
|
||||
"GATEWAY_ENABLE_GENE_SETS is true but --annotation_file_path not set"
|
||||
)
|
||||
else:
|
||||
gene_sets_file_path = annotation_file_path[:-4] + "_gene_sets.csv"
|
||||
extra_args += f" --gene-sets-file {gene_sets_file_path}"
|
||||
else:
|
||||
extra_args += " --disable-gene-sets-save"
|
||||
if enable_backed_mode:
|
||||
extra_args += " --backed"
|
||||
if not cellxgene_args is None:
|
||||
|
||||
Reference in New Issue
Block a user