-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
11 changed files
with
218 additions
and
79 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
from .dataset import Dataset | ||
from .tss import get_canonical_transcripts, get_exons, get_transcripts, map_symbols | ||
from . import tss | ||
from .homology import get_orthologs | ||
|
||
__all__ = ["Dataset", "get_canonical_transcripts", "get_exons", "get_transcripts", "tss"] |
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,24 @@ | ||
from .dataset import Dataset | ||
import numpy as np | ||
|
||
|
||
def get_orthologs(biomart_dataset: Dataset, gene_ids, organism="mmusculus"): | ||
""" | ||
Map ensembl gene ids to orthologs in another organism | ||
""" | ||
|
||
gene_ids_to_map = np.unique(gene_ids) | ||
mapping = biomart_dataset.get_batched( | ||
[ | ||
biomart_dataset.attribute("ensembl_gene_id"), | ||
biomart_dataset.attribute("external_gene_name"), | ||
biomart_dataset.attribute(f"{organism}_homolog_ensembl_gene"), | ||
biomart_dataset.attribute(f"{organism}_homolog_associated_gene_name"), | ||
], | ||
filters=[ | ||
biomart_dataset.filter("ensembl_gene_id", value=gene_ids_to_map), | ||
], | ||
) | ||
mapping = mapping.groupby("ensembl_gene_id").first() | ||
|
||
return mapping[f"{organism}_homolog_ensembl_gene"].reindex(gene_ids).values |
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
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
Oops, something went wrong.