mirror of
https://github.com/chanzuckerberg/cellxgene.git
synced 2026-10-02 15:58:11 +08:00
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:
@@ -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)
|
||||
|
||||
@@ -174,12 +174,12 @@ class MatrixDataLoader(object):
|
||||
|
||||
if not app_config:
|
||||
return True
|
||||
if not app_config.dataroot:
|
||||
if not app_config.multi_dataset__dataroot:
|
||||
return True
|
||||
if len(app_config.multi_dataset_allowed_matrix_type) == 0:
|
||||
if len(app_config.multi_dataset__allowed_matrix_types) == 0:
|
||||
return True
|
||||
|
||||
for val in app_config.multi_dataset_allowed_matrix_type:
|
||||
for val in app_config.multi_dataset__allowed_matrix_types:
|
||||
try:
|
||||
if self.matrix_data_type == MatrixDataType(val):
|
||||
return True
|
||||
|
||||
Reference in New Issue
Block a user