Skip to main content

Simple Python MotEvo wrapper.

Project description

Tests Upload Python Package

motevowrapper

Simple Python parser for MotEvo files.

To install, run:

pip install motevowrapper

MotEvo

MotEvo (Arnold et al. 2012) is a Bayesian probabilistic model for prediction of transcription factor binding sites (TFBSs) for a given set of position weight matrices (PWMs) and DNA sequences. It was developed by van Nimwegen lab at the Biozentrum (University of Basel, Switzerland) and it can be acquired here.

This repository contains the source code for a simple Python package that allows you to:

  1. Run MotEvo with given parameters
  2. Parse MotEvo output files
  3. Visualize visualize site density per motif

Installing MotEvo

MotEvo source code can be downloaded from the SwissRegulon website. You can either download the source and compile it, or download binaries for MacOS or Linux. Don't forget to add path to executables to your .bashrc or .bash_profile. You can do it by simply running

export PATH=$PATH:/path/to/motevo/bin

Running MotEvo from MotevoWrapper

Method for running MotEvo is run_motevo(...). Method description is the following:

sites_file, priors_file = mw.run_mote(
    sequences_file=None,        # Or alignments file
    wm_path=None,               # Path to PWM file
    working_directory="./",     # (optional) Working directory where MotEvo will be ran
    mode="TFBS",                # Mode
    tree=None,                  # (optional) Tree if available, otherwise no other species are assumed
    ref_species=None,           # Reference species
    em_prior=None,              # Expectation Maximization prior
    ufe_wm_prior=None,          # (optional) UFE weight matrix prior. Essentially number of other possible PWMs. Tied to other 'ufe' parameters
    ufe_wm_file=None,           # (optional) UFE file. Generated by running "runUFE" on a given tree and nucleotide likelihood. Tied to other 'ufe' parameters
    ufe_wm_len=None,            # (optional) UFE weight matrix length. Length of other 'competing' motifs on given sequences. If set to 'auto', given motif length is used.
    background_prior=None,      # Background prior. 1-background_prior == probability that a given motif has a site on a given sequence
    bgA=0.25,                   # Probability of randomly seeing nucleotide 'A' in a given sequence
    bgT=0.25,                   # Probability of randomly seeing nucleotide 'T' in a given sequence
    bgG=0.25,                   # Probability of randomly seeing nucleotide 'G' in a given sequence
    bgC=0.25,                   # Probability of randomly seeing nucleotide 'C' in a given sequence
    sites_file=None,            # (optional) Path to storing 'sites' file. Default path is {working_directory}/sites_{motif}.wm
    priors_file=None,           # (optional) Path to storing 'priors' file. Default path is {working_directory}/priors_{motif}.wm
    print_site_als=1,           # (optional) Outputting alignments in the sites file.
    minposterior=0.1,           # Minimal posterior allowed. Minimal probability that a motif will bind on a a given sequence. Only 1 site!
    try_until_succeeding=False, # Option that allows user to run MotEvo until it works. Sometimes MotEvo breaks due to memory allocation which is where this option might be useful.
    verbose=False,              # Verbose
)

For example, in order to use it you can use the following example:

import motevowrapper.motevowrapper as mw

sites_file, priors_file = run_motevo(
    sequences_file="zebrafish_promoters.fa",
    working_directory="./",
    wm_path="REST.wm",
    tree="(danRer11: 1.0);",
    ref_species="danRer11",
    em_prior=0,
    background_prior=0.8,
)

Parsing MotEvo files from MotevoWrapper

MotEvo produces 2 files: sites and priors file. Usage of the package is simple. For a given MotEvo sites file stored at /path/to/sites_MOTIF.wm by calling:

import motevowrapper.motevowrapper as mw

df_sites = mw.parse_sites('/path/to/sites_file') # Motif binding sites
df_priors = mw.parse_sites('/path/to/priors_file') # Final file with priors

you get a Pandas data frame containing parsed data from the MotEvo run. Further manipulation with the dataframe allows getting motif binding density on all sequences, number of binding sites, number of different species from alignment used, etc.

Visualizing site density per motif using MotevoWrapper

df = mw.parse_sites("sites_REST.wm")
mw.plot_site_distribution("REST", df)

References

  1. Arnold, Phil, et al. "MotEvo: integrated Bayesian probabilistic methods for inferring regulatory sites and motifs on multiple alignments of DNA sequences." Bioinformatics 28.4 (2012): 487-494.

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

motevowrapper-0.0.4.tar.gz (7.2 kB view hashes)

Uploaded Source

Built Distribution

motevowrapper-0.0.4-py3-none-any.whl (7.6 kB view hashes)

Uploaded Python 3

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