-
Notifications
You must be signed in to change notification settings - Fork 35
Bring main to release #182
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
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
e4d55ab
Add check fi all genes are filtered
bputzeys ba62371
Adjust test to throw error when no matching genes are found
bputzeys 1396691
Catch error when no gene names are mapped to ensembl ids
bputzeys 7b02e00
Add tests for UCE gene embeddings retrieval
bputzeys 652260e
Merge pull request #177 from helicalAI/add-check-if-all-genes-were-fi…
bputzeys 4718f8a
Small fixes (#178)
mattwoodx e900c4b
Add hash for Geneformer v2 with 33 layers. (#179)
giogix2 93e6596
Bump causal-conv1d
bputzeys 5bcd4f1
Update version
bputzeys 5fd39eb
Clarify installation steps for mamba-ssm
bputzeys 2c4e89d
Merge pull request #181 from helicalAI/fix-mamba-ssm-installation-issue
bputzeys File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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,39 @@ | ||
| from helical.models.uce.gene_embeddings import load_gene_embeddings_adata | ||
| from anndata import AnnData | ||
| import pandas as pd | ||
| import numpy as np | ||
| from pathlib import Path | ||
| import pytest | ||
| from pathlib import Path | ||
| CACHE_DIR_HELICAL = Path(Path.home(), '.cache', 'helical', 'models') | ||
|
|
||
| class TestUCEGeneEmbeddings: | ||
|
|
||
| adata = AnnData( | ||
| X=np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]), | ||
| obs=pd.DataFrame({"species": ["human", "mouse", "rat"]}), | ||
| var=pd.DataFrame({"gene": ["gene1", "gene2", "gene3"]}) | ||
| ) | ||
| species = ["human"] | ||
| embedding_model = "ESM2" | ||
| embeddings_path = Path(CACHE_DIR_HELICAL, 'uce', "protein_embeddings") | ||
|
|
||
| def test_load_gene_embeddings_adata_filtering_all_genes(self): | ||
| with pytest.raises(ValueError): | ||
| load_gene_embeddings_adata(self.adata, self.species, self.embedding_model, self.embeddings_path) | ||
|
|
||
| def test_load_gene_embeddings_adata_filtering_no_genes(self): | ||
| self.adata.var_names = ['hoxa6', 'cav2', 'txk'] | ||
| anndata, mapping_dict = load_gene_embeddings_adata(self.adata, self.species, self.embedding_model, self.embeddings_path) | ||
| assert (anndata.var_names == ['hoxa6', 'cav2', 'txk']).all() | ||
| assert (anndata.obs == self.adata.obs).all().all() | ||
| assert (anndata.X == self.adata.X).all() | ||
| assert len(mapping_dict['human']) == 19790 | ||
|
|
||
| def test_load_gene_embeddings_adata_filtering_some_genes(self): | ||
| self.adata.var_names = ['hoxa6', 'cav2', '1'] | ||
| anndata, mapping_dict = load_gene_embeddings_adata(self.adata, self.species, self.embedding_model, self.embeddings_path) | ||
| assert (anndata.var_names == ['hoxa6', 'cav2']).all() | ||
| assert (anndata.obs == self.adata.obs).all().all() | ||
| assert (anndata.X == [[1, 2], [4, 5], [7, 8]]).all() | ||
| assert len(mapping_dict['human']) == 19790 |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor typo: name of the function should be test_process_data_mapping_to_ensembl_ids (ensembl instead of ensemble)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(apologies for intruding - I was checking the repository after learning about HelicalAI during the Festival of Genomics, and I saw this commit)