mirror of
https://github.com/chanzuckerberg/cellxgene.git
synced 2026-09-29 16:38:12 +08:00
Dunitz 1685 hosted annotations (#1789)
* save tiledb array to s3, dont cache user annotations * Add option to disable annotation filename prompt (#1787) Co-authored-by: Madison Dunitz <dunitzm@gmail.com> * set tiledb default context in cxg_adaptor Co-authored-by: maniarathi <arathi.mani@chanzuckerberg.com> Co-authored-by: Severiano Badajoz <sbadajoz@chanzuckerberg.com>
This commit is contained in:
co-authored by
Madison Dunitz
maniarathi
Severiano Badajoz
parent
5dfe0043c3
commit
65ea1b673f
@@ -33,7 +33,8 @@ def data_with_tmp_tiledb_annotations(ext: MatrixDataType):
|
||||
data_locator = DataLocator(fname)
|
||||
config = AppConfig()
|
||||
config.update_server_config(
|
||||
multi_dataset__dataroot=data_locator.path, authentication__type="test"
|
||||
multi_dataset__dataroot=data_locator.path,
|
||||
authentication__type="test",
|
||||
)
|
||||
config.update_default_dataset_config(
|
||||
embeddings__names=["umap"],
|
||||
@@ -49,7 +50,7 @@ def data_with_tmp_tiledb_annotations(ext: MatrixDataType):
|
||||
data = MatrixDataLoader(data_locator.abspath()).open(config)
|
||||
annotations = AnnotationsHostedTileDB(
|
||||
tmp_dir,
|
||||
DbUtils("postgresql://postgres:test_pw@localhost:5432")
|
||||
DbUtils("postgresql://postgres:test_pw@localhost:5432"),
|
||||
)
|
||||
return data, tmp_dir, annotations
|
||||
|
||||
|
||||
@@ -21,6 +21,9 @@ class auth(object):
|
||||
def get_user_id():
|
||||
return "1234"
|
||||
|
||||
def get_user_name():
|
||||
return "person name"
|
||||
|
||||
|
||||
class WritableTileDBStoredAnnotationTest(unittest.TestCase):
|
||||
def setUp(self):
|
||||
@@ -70,7 +73,7 @@ class WritableTileDBStoredAnnotationTest(unittest.TestCase):
|
||||
self.assertEqual(type(df), tiledb.array.SparseArray)
|
||||
|
||||
# convert to pandas df
|
||||
pandas_df = self.annotations.convert_to_pandas_df(df)
|
||||
pandas_df = self.annotations.convert_to_pandas_df(df, annotation.schema_hints)
|
||||
self.assertEqual(type(pandas_df), pd.DataFrame)
|
||||
|
||||
def test_write_labels_creates_a_dataset_if_it_doesnt_exist(self):
|
||||
@@ -111,7 +114,9 @@ class WritableTileDBStoredAnnotationTest(unittest.TestCase):
|
||||
|
||||
self.assertEqual(pandas_df.shape, (self.n_rows, 2))
|
||||
self.assertEqual(set(pandas_df.columns), {"cat_A", "cat_B"})
|
||||
|
||||
self.assertTrue(self.data.original_obs_index.equals(pandas_df.index))
|
||||
|
||||
self.assertTrue(np.all(pandas_df["cat_A"] == ["label_A"] * self.n_rows))
|
||||
self.assertTrue(np.all(pandas_df["cat_B"] == ["label_B"] * self.n_rows))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user