core library (#711)

* move app creation to function

* create engine without load

* flake 8 fixes

* cleanup original scanpy test

* add default config

* handle missing data

* test data changes

* unify update

* load data isn't static anymore

* make app a class
This commit is contained in:
Charlotte Weaver
2019-04-22 12:24:07 -07:00
committed by GitHub
parent 1f735abe2b
commit 9c6273eb94
10 changed files with 171 additions and 60 deletions
+24 -13
View File
@@ -11,13 +11,27 @@ Sort order for methods
class CXGDriver(metaclass=ABCMeta):
def __init__(self, data, args):
self.data = self._load_data(data)
self.layout_method = args["layout"]
self.diffexp_method = args["diffexp"]
self.max_category_items = args["max_category_items"]
self.diffexp_lfc_cutoff = args["diffexp_lfc_cutoff"]
self.cluster = None
def __init__(self, data=None, args={}):
self.config = self._get_default_config()
self.config.update(args)
if data:
self._load_data(data)
else:
self.data = None
def update(self, data=None, args={}):
self.config.update(args)
if data:
self._load_data(data)
@staticmethod
def _get_default_config():
return {
"layout": None,
"diffexp": None,
"max_category_items": None,
"diffexp_lfc_cutoff": None
}
@property
def features(self):
@@ -27,18 +41,15 @@ class CXGDriver(metaclass=ABCMeta):
"diffexp": {"available": False},
}
# TODO - Interactive limit should be generated from the actual available methods see GH issue #94
if self.layout_method:
if self.config["layout"]:
# TODO handle "var" when gene layout becomes available
features["layout"]["obs"] = {"available": True, "interactiveLimit": 50000}
if self.diffexp_method:
if self.config["diffexp"]:
features["diffexp"] = {"available": True, "interactiveLimit": 50000}
if self.cluster:
features["cluster"] = {"available": True, "interactiveLimit": 50000}
return features
@staticmethod
@abstractmethod
def _load_data(data):
def _load_data(self, data):
pass
@abstractmethod