Skip to content

Require that datasets contain feature IDs #21

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/api/file_common_dataset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ info:
name: feature_name
description: A human-readable name for the feature, usually a gene symbol.
required: true
- type: string
name: feature_id
description: A database identifier for the feature, usually an ENSEMBL ID.
required: true
obsm:
- type: double
name: X_pca
Expand Down
4 changes: 4 additions & 0 deletions src/api/file_dataset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ info:
name: feature_name
description: A human-readable name for the feature, usually a gene symbol.
required: true
- type: string
name: feature_id
description: A database identifier for the feature, usually an ENSEMBL ID.
required: true
obsm:
- type: double
name: X_pca
Expand Down
4 changes: 4 additions & 0 deletions src/api/file_solution.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ info:
name: feature_name
description: A human-readable name for the feature, usually a gene symbol.
required: true
- type: string
name: feature_id
description: A database identifier for the feature, usually an ENSEMBL ID.
required: true
obsm:
- type: double
name: X_pca
Expand Down
2 changes: 2 additions & 0 deletions src/methods/geneformer/script.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
f"(dataset_organism == '{adata.uns['dataset_organism']}')"
)

# Set adata.var_names to gene IDs
adata.var_names = adata.var["feature_id"]
is_ensembl = all(var_name.startswith("ENSG") for var_name in adata.var_names)
if not is_ensembl:
raise ValueError(f"Geneformer requires adata.var_names to contain ENSEMBL gene ids")
Expand Down
Loading