clean up type inferencing (#2332)

* unit tests for 64 bit conversion

* clean up type handling

* type inference tests

* more type inference fixes

* use schema to determine user intent for data typing

* stop using deprecated API

* fbs type encoding test

* add missing test

* add more tests

* correctly infer X type for CXG adaptor

* lint

* fix typo

* ts migration

* cleanup from PR review

* lint

* PR review changes
This commit is contained in:
Bruce Martin
2021-07-28 15:10:12 -07:00
committed by GitHub
parent 1140676106
commit 32f60a1547
15 changed files with 730 additions and 346 deletions
@@ -125,7 +125,11 @@ class AnndataAdaptor(DataAdaptor):
def _create_schema(self):
self.schema = {
"dataframe": {"nObs": self.cell_count, "nVar": self.gene_count, "type": str(self.data.X.dtype)},
"dataframe": {
"nObs": self.cell_count,
"nVar": self.gene_count,
**get_schema_type_hint_of_array(self.data.X),
},
"annotations": {
"obs": {"index": self.parameters.get("obs_names"), "columns": []},
"var": {"index": self.parameters.get("var_names"), "columns": []},
@@ -335,7 +339,7 @@ class AnndataAdaptor(DataAdaptor):
"""return the approximate distribution of the X matrix."""
if self.X_approximate_distribution is None:
"""Not yet evaluated."""
assert(self.dataset_config.X_approximate_distribution == "auto")
assert self.dataset_config.X_approximate_distribution == "auto"
self.data = self.data.to_memory() # loads data
self.X_approximate_distribution = estimate_distribution.estimate_approximate_distribution(self.data.X)