Introduce a config file to cellxgene (#1264)

* Introduce a config file to cellxgene

The config file format is in yaml.  The default config is located
in server/common/default_config.py.  A user may create a yaml file
that contains a subset of these fields.  It can be used during cellxgene
launch, or for hosted cellxgene.

The code has also been refactored.  Much of the logic to check arguments
has moved from launch to app config.

It is now possible to set the tiledb context parameters using the config
file.  Other feature will soon be handled in a similar way.
This commit is contained in:
bmccandless
2020-03-22 09:34:11 -07:00
committed by GitHub
parent 1351c8f724
commit 8180be83b8
19 changed files with 691 additions and 348 deletions
+5 -9
View File
@@ -16,12 +16,8 @@ class DataAdaptor(metaclass=ABCMeta):
"""Base class for loading and accessing matrix data"""
def __init__(self, config):
# config will normally be a type that inherits from AppConfig.
# the following is for backwards compatability with tests
if config is None:
config = AppConfig()
elif type(config) == dict:
config = AppConfig(**config)
if type(config) != AppConfig:
raise TypeError("config expected to be of type AppConfig")
# config is the application configuration
self.config = config
@@ -140,8 +136,8 @@ class DataAdaptor(metaclass=ABCMeta):
features = [
AppFeature("/cluster/", method="POST", available=False),
AppFeature("/layout/obs", method="GET", available=self.get_embedding_names() is not None),
AppFeature("/layout/obs", method="PUT", available=self.config.enable_reembedding),
AppFeature("/diffexp/", method="POST", available=not self.config.disable_diffexp),
AppFeature("/layout/obs", method="PUT", available=self.config.embeddings__enable_reembedding),
AppFeature("/diffexp/", method="POST", available=self.config.diffexp__enable),
AppFeature("/annotations/obs", method="PUT", available=annotations is not None),
]
return features
@@ -290,7 +286,7 @@ class DataAdaptor(metaclass=ABCMeta):
if top_n is None:
top_n = DEFAULT_TOP_N
result = diffexp_ttest(self, obs_mask_A, obs_mask_B, top_n, self.config.diffexp_lfc_cutoff)
result = diffexp_ttest(self, obs_mask_A, obs_mask_B, top_n, self.config.diffexp__lfc_cutoff)
try:
return jsonify_numpy(result)