refactor config to support different config options for datasets in different dataroots. (#1596)

This will give us the ability to specify different config options for
different dataroots.

the key of the dataroot dictionary is no longer the same as the dataroot_url.
Previously key==dataroot_url, and now those are separated.

Added an "is_multi_dataset" function to simplify logic where it branched on single vs multi.

Simplified the rest.py interface by no longer passing in the user annotations object, since
that can be retrieved from the dataset.
This commit is contained in:
bmccandless
2020-07-10 16:21:40 -07:00
committed by GitHub
parent 13246cb6d1
commit f69d141336
21 changed files with 1021 additions and 710 deletions
+6 -13
View File
@@ -24,11 +24,10 @@ class CxgAdaptor(DataAdaptor):
{"sm.tile_cache_size": 8 * 1024 * 1024 * 1024, "sm.num_reader_threads": 32, "vfs.s3.region": "us-east-1"}
)
def __init__(self, data_locator, config=None):
super().__init__(config)
def __init__(self, data_locator, app_config=None, dataset_config=None):
super().__init__(data_locator, app_config, dataset_config)
self.lock = threading.Lock()
self.data_locator = data_locator
self.url = data_locator.uri_or_path
if self.url[-1] != "/":
self.url += "/"
@@ -66,8 +65,8 @@ class CxgAdaptor(DataAdaptor):
return 0
@staticmethod
def open(data_locator, args):
return CxgAdaptor(data_locator, args)
def open(data_locator, app_config, dataset_config=None):
return CxgAdaptor(data_locator, app_config, dataset_config)
def get_about(self):
return self.about if self.about else super().get_about()
@@ -75,12 +74,6 @@ class CxgAdaptor(DataAdaptor):
def get_title(self):
return self.title if self.title else super().get_title()
def get_location(self):
return self.url
def get_data_locator(self):
return self.data_locator
def get_name(self):
return "cellxgene cxg adaptor version"
@@ -196,9 +189,9 @@ class CxgAdaptor(DataAdaptor):
def compute_diffexp_ttest(self, maskA, maskB, top_n=None, lfc_cutoff=None):
if top_n is None:
top_n = self.config.diffexp__top_n
top_n = self.dataset_config.diffexp__top_n
if lfc_cutoff is None:
lfc_cutoff = self.config.diffexp__lfc_cutoff
lfc_cutoff = self.dataset_config.diffexp__lfc_cutoff
return diffexp_cxg.diffexp_ttest(self, maskA, maskB, top_n, lfc_cutoff)
def get_colors(self):