Genotations
Python library to work with genomes and annotations, mostly Ensembl genomes. Also supports visualization of transcripts/gene features and primer selection. As pandas and polars are libraries of everyday use for many python developers this library focus on annotations representation in a dataframe way.
The library allows:
- downloading Ensembl annotations and genomes (uses genomepy under the hood)
- working with genomic annotations like with polars dataframes
- getting sequences for selected genes
- visualizing the genes features
- designing primers for selected transcripts with Primer3 python wrapper
Usage
Install with pip:
pip install genotations
In some cases you may also need to install ucsc annotation tools, you can add them to your micromamba/conda environment as they are installed from bioconda channel. Here how it may look in your environment file:
name: genotations
channels:
- conda-forge
- BjornFJohansson
- bioconda
- defaults
dependencies:
- python=3.10
- ucsc-bedtogenepred
- ucsc-genepredtobed
- ucsc-genepredtogtf
- ucsc-gff3togenepred
- ucsc-gtftogenepred
- pip
- pip:
- genotations
Now you can start using it, for example:
from genotations import ensembl
human = ensembl.human # getting human genome
mouse = ensembl.mouse # getting mosue genome
mouse.annotations.exons().annotations_df # getting exons as DataFrame
mouse.annotations.protein_coding().exons().annotations_df # getting exons of protein coding genes
mouse.annotations.transcript_gene_names_df # getting transcript gene names
mouse.annotations.with_gene_name_contains("Foxo1").protein_coding().transcripts() #getting only coding Foxo1 transcripts
mouse.annotations.with_gene_name_contains("Foxo1").genes_visual(mouse.genome)[0].plot() # plotting features of the Foxo1 gene
cow_assemblies = ensembl.search_assemblies("Bos taurus") # you can also search genomes by species name if it exists in Ensembl
cow1 = ensembl.SpeciesInfo("Cow", cow_assemblies[-1][0]) # selecting one of several cow assemblies
cow1.annotations.annotations_df # getting annotations as dataframe
You can also use the library to annotate existing gene expression data with gene and transcript symbols and features. For example
from genotations.quantification import *
from genotations import ensembl
base = "."
examples = base / "examples"
data = examples / "data"
expressions = pl.read_parquet(str(data / "PRJNA543661_transcripts.parquet"))
with_expressions_summaries(expressions, min_avg_value = 1)
expressions_ext = ensembl.mouse.annotations.extend_with_annotations_and_sequences(expressions, ensembl.mouse.genome) # extend expression data with annotations and sequences
For more examples, check example notebook to see the usage and API
Working with the library code
Use micromamba (or conda) and environment.yaml to install the dependencies
micromamba create -f environment.yaml
micromamba activate genotations
Metadata
Release files for genotations 0.1.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| genotations-0.1.7.tar.gz | 24.8 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| genotations-0.1.7-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details |
Total release size: 49.6 kB
Release files / genotations-0.1.7.tar.gz
| Download URL | genotations-0.1.7.tar.gz |
|---|---|
| Size | 24.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9f84455057cccd4eea8206ccd5d49dd7219612fad476043647d198ff993ece85
|
|
BLAKE2b-256 checksum How to use checksums |
9a53090ae886f5795ee3be6e6ee99cea7936ba50cff0afd5b24e34c237f137bd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.8
|
Release files / genotations-0.1.7-py2.py3-none-any.whl
| Download URL | genotations-0.1.7-py2.py3-none-any.whl |
|---|---|
| Size | 24.8 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
7ff004840ae7949b3c6893e8309431d9559c3c66e6c38b1f13dbe067a0e16461
|
|
BLAKE2b-256 checksum How to use checksums |
182342a15a87f99f558aa54bb3701ebb16fa606ea4e78467c84d104438dcde4b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.8
|
Security for genotations 0.1.7
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.