Skip to content

Commit

Permalink
🎨 Do not check embedding in .validate
Browse files Browse the repository at this point in the history
  • Loading branch information
sunnyosun committed Jan 6, 2025
1 parent 5b073b5 commit f8cf5b8
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions cellxgene_lamin/curate.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,19 +270,6 @@ def validate(self) -> bool:
" reserved from previous schema versions."
)

# cellxgene requires an embedding
embedding_pattern = r"^[a-zA-Z][a-zA-Z0-9_.-]*$"
exclude_key = "spatial"
matching_keys = [
key
for key in self._adata.obsm.keys()
if re.match(embedding_pattern, key) and key != exclude_key
]
if len(matching_keys) == 0:
raise ValueError(
"Unable to find an embedding key. Please calculate an embedding."
)

return super().validate(organism=self.organism)

def to_cellxgene_anndata(
Expand All @@ -305,6 +292,19 @@ def to_cellxgene_anndata(
# Create a copy since we modify the AnnData object extensively
adata_cxg = self._adata.copy()

# cellxgene requires an embedding
embedding_pattern = r"^[a-zA-Z][a-zA-Z0-9_.-]*$"
exclude_key = "spatial"
matching_keys = [
key
for key in adata_cxg.obsm.keys()
if re.match(embedding_pattern, key) and key != exclude_key
]
if len(matching_keys) == 0:
raise ValueError(
"Unable to find an embedding key. Please calculate an embedding."
)

# convert name column to ontology_term_id column
for column in adata_cxg.obs.columns:
if column in self.categoricals and not column.endswith("_ontology_term_id"):
Expand Down

0 comments on commit f8cf5b8

Please sign in to comment.