-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8443107
commit 94c2cbe
Showing
36 changed files
with
485 additions
and
546 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
import numpy as np | ||
import tiledb | ||
|
||
from backend.wmg.data.schemas.tiledb_filters import filters_categorical, filters_numeric | ||
|
||
expression_summary_indexed_dims = [ | ||
"group_id", | ||
] | ||
|
||
|
||
expression_summary_non_indexed_dims = [ | ||
"gene_ontology_term_id", | ||
] | ||
|
||
# The full set of logical cube dimensions by which the cube can be queried. | ||
expression_summary_logical_dims = expression_summary_indexed_dims + expression_summary_non_indexed_dims | ||
|
||
|
||
expression_summary_domain = tiledb.Domain( | ||
[ | ||
tiledb.Dim( | ||
name=cube_indexed_dim, | ||
domain=(0, np.iinfo(np.uint32).max - 1), | ||
tile=None, | ||
dtype=np.uint32, | ||
filters=filters_numeric, | ||
) | ||
for cube_indexed_dim in expression_summary_indexed_dims | ||
] | ||
) | ||
# The cube attributes that comprise the core data stored within the cube. | ||
expression_summary_logical_attrs = [ | ||
tiledb.Attr(name="sum", dtype=np.float32, filters=filters_numeric), | ||
tiledb.Attr(name="sqsum", dtype=np.float32, filters=filters_numeric), | ||
] | ||
|
||
# The TileDB `Attr`s of the cube TileDB Array. This includes the | ||
# logical cube attributes, above, along with the non-indexed logical | ||
# cube dimensions, which we models as TileDB `Attr`s. | ||
expression_summary_physical_attrs = [ | ||
tiledb.Attr(name=nonindexed_dim, dtype="ascii", var=True, filters=filters_categorical) | ||
for nonindexed_dim in expression_summary_non_indexed_dims | ||
] + expression_summary_logical_attrs | ||
|
||
expression_summary_schema = tiledb.ArraySchema( | ||
domain=expression_summary_domain, | ||
sparse=True, | ||
allows_duplicates=True, | ||
attrs=expression_summary_physical_attrs, | ||
cell_order="row-major", | ||
tile_order="row-major", | ||
capacity=10000, | ||
) | ||
|
||
# Cell Counts Array | ||
|
||
cell_counts_indexed_dims = [ | ||
"cell_type_ontology_term_id", | ||
"tissue_ontology_term_id", | ||
"organism_ontology_term_id", | ||
] | ||
|
||
cell_counts_non_indexed_dims_excluding_dataset_id = [ | ||
"publication_citation", | ||
"disease_ontology_term_id", | ||
"self_reported_ethnicity_ontology_term_id", | ||
"sex_ontology_term_id", | ||
] | ||
cell_counts_non_indexed_dims = cell_counts_non_indexed_dims_excluding_dataset_id + ["dataset_id"] | ||
|
||
cell_counts_logical_dims = cell_counts_indexed_dims + cell_counts_non_indexed_dims | ||
|
||
cell_counts_logical_dims_exclude_dataset_id = ( | ||
cell_counts_indexed_dims + cell_counts_non_indexed_dims_excluding_dataset_id | ||
) | ||
|
||
cell_counts_domain = tiledb.Domain( | ||
[ | ||
tiledb.Dim(name=cell_counts_indexed_dim, domain=None, tile=None, dtype="ascii", filters=filters_categorical) | ||
for cell_counts_indexed_dim in cell_counts_indexed_dims | ||
] | ||
) | ||
|
||
cell_counts_logical_attrs = [ | ||
# total count of cells, regardless of expression level | ||
tiledb.Attr(name="n_cells", dtype=np.uint32, filters=filters_numeric), | ||
# groups corresponding to dimensions in cell_counts_logical_dims_exclude_dataset_id | ||
tiledb.Attr(name="group_id", dtype=np.uint32, filters=filters_numeric), | ||
# groups corresponding to dimensions in cell_counts_indexed_dims | ||
tiledb.Attr(name="group_id_simple", dtype=np.uint32, filters=filters_numeric), | ||
] | ||
|
||
cell_counts_physical_attrs = [ | ||
tiledb.Attr(name=nonindexed_dim, dtype="ascii", var=True, filters=filters_categorical) | ||
for nonindexed_dim in cell_counts_non_indexed_dims | ||
] + cell_counts_logical_attrs | ||
|
||
|
||
cell_counts_schema = tiledb.ArraySchema( | ||
domain=cell_counts_domain, | ||
sparse=True, | ||
allows_duplicates=True, | ||
attrs=cell_counts_physical_attrs, | ||
cell_order="row-major", | ||
tile_order="row-major", | ||
capacity=10000, | ||
) |
62 changes: 0 additions & 62 deletions
62
backend/wmg/data/schemas/expression_summary_cube_schemas_diffexp.py
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.