re-implement re-embeddings (#1679)

* fix mispelling

* re-implement re-embedding

* always load base embedding to fetch counts

* format

* lint

* fix tests

* lint

* fix accept handling

* test log

* more debug

* more

* more

* more

* more

* remove logging

* logging

* jsonify

* remove debugging logs

* lint

* clean up errors a bit

* fix issue found in PR review

* PR review changes
This commit is contained in:
Bruce Martin
2020-07-30 12:31:36 -07:00
committed by GitHub
parent bd147abb3f
commit 75cb513dd9
18 changed files with 225 additions and 179 deletions
+10 -8
View File
@@ -73,21 +73,23 @@ class EndPoints(object):
# attempt to reembed with umap over 100 cells.
endpoint = "layout/obs"
url = f"{self.URL_BASE}{endpoint}"
header = {"Accept": "application/octet-stream"}
data = {}
data["filter"] = {}
data["filter"]["obs"] = {}
data["filter"]["obs"]["index"] = list(range(100))
data["method"] = "umap"
result = self.session.put(url, headers=header, json=data)
result = self.session.put(url, json=data)
self.assertEqual(result.status_code, HTTPStatus.OK)
df = decode_fbs.decode_matrix_FBS(result.content)
self.assertEqual(df["n_rows"], 100)
self.assertEqual(df["n_cols"], 2)
cols = list(df["col_idx"])
self.assertTrue(cols[0].startswith("reembed:umap_") and cols[0].endswith("_0"))
self.assertTrue(cols[1].startswith("reembed:umap_") and cols[1].endswith("_1"))
result_data = result.json()
self.assertIsInstance(result_data, dict)
self.assertEqual(result_data["type"], "float32")
self.assertTrue(result_data["name"].startswith("reembed:umap_"))
self.assertIsInstance(result_data["dims"], list)
self.assertEqual(len(result_data["dims"]), 2)
dims = result_data["dims"]
self.assertTrue(dims[0].startswith("reembed:umap_") and dims[0].endswith("_0"))
self.assertTrue(dims[1].startswith("reembed:umap_") and dims[1].endswith("_1"))
def test_bad_filter(self):
endpoint = "data/var"