boscoh / inmembrane

BSD 2-Clause "Simplified" License
9 stars 10 forks source link

NOTE: inmembrane is no longer maintained, hasn't been updated for Python 3 and most of the webservices it used have gone offline or made breaking changes. Maybe one day it will be ressurected, however I'd suggest most users should not attempt to use it in it's current state.


========== inmembrane

inmembrane is a pipeline for proteome annotation to predict if a protein is exposed on the surface of a bacteria. It orchestrates the analysis of protein sequences to provides a summary of which targets may be surface exposed based on predicted subcellular localization signals and membrane topology. Currently protocols have been implemented for gram+ and gram- bacterial proteomes.

Typical usage is via the script inmembrane_scan, eg::

$ inmembrane_scan mysequences.fasta

The provided sequences (in FASTA format <http://en.wikipedia.org/wiki/FASTA_format>_) are subjected to an number of sequence analyses using external programs (see below) and the result summarized like::

SPy_0008 CYTOPLASM(non-PSE) . SPy_0008 from AE004092 SPy_0010 PSE-Membrane tmhmm(1) SPy_0010 from AE004092 SPy_0012 PSE-Cellwall hmm(GW2|GW3|GW1);signalp SPy_0012 from AE004092 SPy_0016 MEMBRANE(non-PSE) tmhmm(12) SPy_0016 from AE004092 SPy_0019 SECRETED signalp SPy_0019 from AE004092

As well as output to stdout, this will generate a summary CSV file mysequences.csvand a directory mysequences containing output files generated during the run.

Although inmembrane is primarily designed to be used as a stand alone program, it can also be used as a library like::

import inmembrane params = inmembrane.get_params() params['fasta'] = "input.fasta" annotations = inmembrane.process(params)

where annotations is a dictionary of the results, with protein sequence IDs as keys.

You can also test the functionality of the analysis plugins that are part of inmembrane by typing::

$ inmembrane_scan --test

This can be useful for determining which binary dependences are correctly installed, or exposing any broken / offline web services required for a particular analysis.

Running under Docker

Docker containers provide a convenient way to run the software in a more reproducible environment.

To create a Docker container and run tests::

$ docker build -t inmembrane:latest .
$ docker run -it inmembrane -t --skip-tests test_tmhmm,test_signalp4,test_lipop1,test_memsat3

A Dockerfile-memsat3 is also included that creates a container with MEMSAT3 and the required Swissprot BLAST database, however you must accept the MEMSAT3 license before using this (ie, no commercial use).

To run an analysis using the container::

# Run once to get a template inmembrane.config in the current working directory
$ docker run -it -v $(pwd):/data inmembrane

# Edit inmembrane.config as required. Use signap_scrape_web, tmhmm_scrape_web and lipop_scrape_web
# as the binary versions won't exist in the default container
# Then, assuming my_proteome.fasta exists in the current working directory, run:
$ docker run -it -v $(pwd):/data inmembrane my_proteome.fasta

Installation and Configuration

The latest stable release of inmembrane can be installed via pip, or the bleeding edge from Github.

Via pip::

$ sudo pip install inmembrane

Or from Github::

$ git clone http://github.com/boscoh/inmembrane.git
$ cd inmembrane
$ sudo python setup.py install

The package includes tests, examples, data files, docs. HMMER3 is the only required external dependency, however for large analyses (multiple proteomes) it is suggested that local versions of other analysis programs are installed rather than relying on web services (see Installing dependencies_ below).

The editable parameters of inmembrane are found in inmembrane.config, which is always located in the same directory as the main script. If no such file exists, a default inmembrane.config will be generated. By default, you probably don't need to change anything.

The parameters are:

Output format

The output of inmembrane gram_pos protocol consists of four columns of output. This is printed to stdout and written as a CSV file, which can be opened in spreadsheet software such as EXCEL. The standard text output can be parsed using space delimiters (empty fields in the third column are indicated with a "."). Logging information are prefaced by a '#' character, and is sent to stderr.

Here's an example::

SPy_0008 CYTOPLASM(non-PSE) . SPy_0008 from AE004092 SPy_0009 CYTOPLASM(non-PSE) . SPy_0009 from AE004092 SPy_0010 PSE-Membrane tmhmm(1) SPy_0010 from AE004092 SPy_0012 PSE-Cellwall hmm(GW2|GW3|GW1);signalp SPy_0012 from AE004092 SPy_0013 PSE-Membrane tmhmm(1) SPy_0013 from AE004092 SPy_0015 PSE-Membrane tmhmm(2) SPy_0015 from AE004092 SPy_0016 MEMBRANE(non-PSE) tmhmm(12) SPy_0016 from AE004092 SPy_0019 SECRETED signalp SPy_0019 from AE004092

.. _dependencies:

Installing dependencies

While inmembrane only requires a local installation of HMMER 3.0 and can used web services for TMHMM, SignalP, LipoP and various OMP beta-barrel predictors, for large scale analyses (5000 sequences+) it is suggested that locally installed versions are used in the interest of speed, at to be polite to publicly available web services.

With each dependency, it is important that you have the exact version that inmembrane is written to inter-operate with, otherwise inmembrane is likely to be unable to interpret the output of the downstream analysis program.

Required dependencies, and their versions:

These instructions have been tailored for Debian-based systems, in particular Ubuntu 11.10+. Each of these dependencies are licensed free to academic users.

HMMER 3.0

On Ubuntu (and other Debian-derived) Linux distributions::

$ sudo apt-get install hmmer

should be enough.

Alternatively:

TMHMM 2.0

Only one of TMHMM or MEMSAT3 are required, but users that want to compare transmembrane segment predictions can install both.

SignalP 4.1

LipoP 1.0

MEMSAT3

(Note the the 'runmemsat' script refers to PSIPRED v2, but it means MEMSAT3 - PSIPRED is NOT required).

Python libraries

inmembrane depends on the following Python libraries ( Beautiful Soup <http://www.crummy.com/software/BeautifulSoup/>, mechanize <http://wwwsearch.sourceforge.net/mechanize> and twill <http://twill.idyll.org/>, Suds <https://fedorahosted.org/suds/> and Requests <http://python-requests.org>_).

pip should handle installing these for you automatically.

Modification guide

It is a fact of life for bioinformatics that new versions of basic tools change output formats and APIs. We believe that it is an essential skill to rewrite parsers to handle the subtle but significant changes in different versions. We have written inmembrane to be easily modifiable and extensible. Protocols which embody a particular high level workflow are found in inmembrane/protocols.

All interaction with a specific external programs or web services have been wrapped into a single python plugin module, and placed in the inmembrane/plugins directory. This contains the code to both run the program and to parse the output. We have tried to make the parsing code as concise as possible. Specifically, by using the native Python dictionary, which allows an enormous amount of flexibility, we can collate the results of various analyses with very little code.

A more comprehensive overview can be found at http://boscoh.github.com/inmembrane/api.html.

inmembrane development style guide:

Here are some guidelines for understanding and extending the code.