Skip to main content

Genotations - python library to work with genomes and primers

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

genotations-0.1.6.tar.gz (23.7 kB view details)

Uploaded Source

Built Distribution

genotations-0.1.6-py2.py3-none-any.whl (23.8 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file genotations-0.1.6.tar.gz.

File metadata

  • Download URL: genotations-0.1.6.tar.gz
  • Upload date:
  • Size: 23.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.6

File hashes

Hashes for genotations-0.1.6.tar.gz
Algorithm Hash digest
SHA256 49d1deffd1dcd5bcb25104d61316d8b1d7a2ce276c3d94ffc74452694b7189d5
MD5 77999761696d13d06e5d1f682dca4931
BLAKE2b-256 039b03d93ea05b119b96bbc3ce8d075b4457aedf5f0722bcb4f2c0e2788992d9

See more details on using hashes here.

File details

Details for the file genotations-0.1.6-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for genotations-0.1.6-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 9d7969f12000ec84f2c304879b506b5e34c026ba1bb25ed84901ee5b356217f9
MD5 267893dcd3893fae629da5c9d19b9118
BLAKE2b-256 e2d551bc39747eb69559fcb4c4fd38de037d1d903542f983a0997e70b8846664

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page