Skip to content


Subversion checkout URL

You can clone with
Download ZIP

This branch is 138 commits behind master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.



inmembrane is a pipeline for proteome annotation to predict if a protein is exposed on the surface of a bacteria.

Installation and Configuration

Dowload the latest version of inmembrane from the github repository:

This package includes tests, examples, data files, docs and a few included libraries (Beautiful Soup, mechanize and twill).

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. The parameters are:

  • the path location of the binaries for SignalP, LipoP, TMHMM, HMMSEARCH, and MEMSAT. This can be the full path, or just the binary name if it is on the system path environment. Use which to check.
  • 'protocol' to indicate which analysis you want to use. Currently, we support:
    • gram_pos the analysis of surface-exposed proteins of Gram+ bacteria;
    • gram_neg the sub-cellular location of Gram- bacteria.
  • 'hmm_profiles_dir': the location of the HMMER profiles for any HMM peptide sequence motifs
  • for HMMER, you can set the cutoffs for significance, the E-value 'hmm_evalue_max', and the score 'hmm_score_min'
  • the shortest length of a loop that sticks out of the peptidoglycan layer of a Gram+ bacteria. The SurfG+ determined this to be 50 amino acids for terminal loops, and twice that for internal loops, 100
  • 'helix_programs' you can choose which of the transmembrane-helix prediction programs you want to use

We provide a number of unit tests for inmembrane:


As inmembrane has a lot of dependencies, these tests are really useful in working out if the dependencies are installed in a way that is compatible with inmembrane. Since not all the binaries are needed, not all tests (and corresponding dependencies) are required for inmembrane to work.


inmembrane was written in Python 2.7. It takes a FASTA input file and runs a number of external bioinformatic programs on the sequences. It then collects the output to make the final analysis, which is printed out and stored in a CSV file.

inmembrane can be run in two modes. It can be run as a command-line program:

python your_fasta_file

If run in this mode, the CSV will be given the same basename as the FASTA file.

The other way of running is with a custom script, such as where all pertinent input is in the script itself. You can either run this on the command-line like this:


or simply double-click in a file-manager. You can change this by simply duplicating, and editing the parameters in a text editor. In particular, the fields in the parameters include:

  • 'fasta' the input FASTA file
  • 'out_dir' the directoyr that stores intermediate output
  • 'csv' the output CSV file

Output format

The output of inembrane consists of four columns of output. This is printed out on standard out and in a CSV file, which can be opened in 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.

Here's an example:

SPy_0008   CYTOPLASM     .                   "SPy_0008 from AE004092"
SPy_0009   CYTOPLASM     .                   "SPy_0009 from AE004092"
SPy_0010   PSE           tmhmm(1)            "SPy_0010 from AE004092"
SPy_0012   PSE           hmm(GW1);signalp    "SPy_0012 from AE004092"
  • the first column is the SeqID which is the first token in the identifier line of the sequence in the FASTA file

  • the second column is the prediction, it is CYTOPLASM, MEMBRANE, PSE, or SECRETED. A value of PSE (Potentially Surface Exposed) means that inmembrane has predicted the protein to be surface exposed and will be found in a membrane-shaving experiment.

  • the third line is a summary of features picked up by the other program:

    • tmhmm(2) means 2 transmembrane helices were found
    • hmm(GW1) means the GW1 motif was found in HMMER
    • signalp means a secretion signal was found
    • lipop means a Sp II secretion signal found with an appropriate CYS residue at the cleavage site, which will be attached to a phospholipid in the membrane
  • the rest of the line gives the full identifier of the sequence in the FASTA file. This is enclosed by quotation marks "" in the CSV file.

Installing dependencies

As it is the nature of bioinformatic programs that they are changed and updated severely with different versions, stable APIs with consistent output formats are the exception rather than the norm. It is very important that you have the exact version that we have programmed against.

Required dependencies, and their versions:

  • TMHMM 2.0 or MEMSAT3
  • SignalP 4.0
  • LipoP 1.0
  • HMMER 3.0

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


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

SignalP 4.0


  • Download HMMER 3.0 from
  • The HMMER user guide describes how to install it. For the pre-compiled packages, this is as simple as putting the binaries on your PATH.

LipoP 1.0


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

Modification guide

It is a fact of life for bioinformatics that new versions of basic tools changes output formats and API. 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 program or web-site have been wrapped into a single python plugin module, and placed in the 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 amout of flexibility, we can extract the analysis with very little code.

inmembrane development style guide:

Here are some guidelines for understanding and extending the code.

  • Confidence: Plugins that wrap an external program should have at least one high level test which is executed by This allows new users to immediately determine if their dependencies are operating as expected.
  • Interface: A plugin that wraps an external program must receive a params data structure (derived from inmembrane.config) and a proteins data structure (which is a dictionary keyed by sequence id). Plugins should return a 'proteins' object.
  • Flexibility: Plugins should have a 'force' boolean argument that will force the analysis to re-run and overwrite output files.
  • Efficiency: All plugins should write an output file which is read upon invocation to avoid the analysis being re-run.
  • Documentation: A plugin must have a Python docstring describing what it does, what parameters it requires in the params dictionary and what it adds to the proteins data structure. See the code for examples.
  • Anal: Unique sequence ID strings (eg gi|1234567) are called 'seqid'. 'name' is ambiguous. 'prot_id' is reasonable, however conceptually a 'protein' is not the same thing as a string that represents it's 'sequence' - hence the preference for 'seqid'.
  • Anal: All file handles should be closed when they are no longer needed.
Something went wrong with that request. Please try again.