Skip to content

Commit

Permalink
organoids
Browse files Browse the repository at this point in the history
  • Loading branch information
ebezzi committed Jan 9, 2025
1 parent e15138b commit 5f05cba
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ def make_anndata_cell_filter(filter_spec: AnnDataFilterSpec) -> AnnDataFilterFun
def _filter(ad: AnnDataProxy) -> AnnDataProxy:
"""Filter observations and features per Census schema."""
var_mask = ad.var.feature_biotype == "gene"
obs_mask = pd.Series(np.ones(ad.n_obs, dtype=bool), index=ad.obs.index)
obs_mask = ad.obs.tissue_type.isin(["tissue", "organoid"])

# Handle multi-species edge case
var_organisms = set(ad.var.feature_reference[var_mask].unique())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,9 +239,9 @@ def validate_axis_dataframes_global_ids(
(obs_unique_joinids[0] == 0) and (obs_unique_joinids[-1] == (len(obs_unique_joinids) - 1))
)

# Validate that we only contain primary tissue cells, no organoid, cell culture, etc.
# Validate that we only contain primary tissue cells and organoids, no cell culture, etc.
# See census schema for more info.
# assert (census_obs_df.tissue_type == "tissue").all()
assert (census_obs_df.tissue_type.isin(["tissue", "organoid"])).all()

# Assert the stats values look reasonable
assert all(
Expand Down
3 changes: 2 additions & 1 deletion tools/cellxgene_census_builder/tests/anndata/test_anndata.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ def test_make_anndata_cell_filter_filters_out_organoids_cell_culture(
filtered_adata_with_organoids_and_cell_culture = func(adata_with_organoids_and_cell_culture)

assert adata_with_organoids_and_cell_culture.var.equals(filtered_adata_with_organoids_and_cell_culture.var)
assert filtered_adata_with_organoids_and_cell_culture.obs.shape[0] == 4
# tissue(2) and organoid(1). cell_culture should be excluded
assert filtered_adata_with_organoids_and_cell_culture.obs.shape[0] == 3


def test_make_anndata_cell_filter_organism(tmp_path: pathlib.Path, h5ad_with_organism: str) -> None:
Expand Down

0 comments on commit 5f05cba

Please sign in to comment.