Code Monkey home page Code Monkey logo

isambard's Introduction

ISAMBARD

Intelligent System for Analysis, Model Building And Rational Design.

CircleCI Python Version MIT licensed

ISAMBARD is a Python-based framework for structural analysis and rational design of biomolecules, with a particular focus on parametric modelling of proteins. It is developed and maintained by members of the Woolfson group, University of Bristol.

Citing ISAMBARD

Any publication arising from use of the ISAMBARD software package should cite the following reference:

Wood CW et al (2017) ISAMBARD: an open-source computational environment for biomolecular analysis, modelling and design. Bioinformatics, 33, 3043-50

Installation

ISAMBARD can be installed straight from PyPI using pip:

pip install isambard

Or if you want to try an experimental build (you'll need a C compiler), download from GitHub either by downloading the zipped file or cloning, then navigate to the ISAMBARD folder and type:

pip install .

External Programs

If you want to add side chains to your designs, you need to have Scwrl4 installed and available on your system path.

Upgrading to ISAMBARD 2

If you were already using ISAMBARD prior to the 2.0.0 release, here's a handy guide on the differences between version 1 and 2.

Quick Start

Note
If you're not sure what parametric modelling of proteins is, have a play with CCBuilder 2.0.

Let's build a coiled-coil dimer with typical parameters:

import isambard.specifications as specifications
import isambard.modelling as modelling
import isambard.optimisation

my_dimer = specifications.CoiledCoil.from_parameters(2, 28, 5, 225, 283)
dimer_sequences = [
    'EIAALKQEIAALKKENAALKWEIAALKQ',
    'EIAALKQEIAALKKENAALKWEIAALKQ'
]
my_dimer = modelling.pack_side_chains_scwrl(my_dimer, dimer_sequences)
print(my_dimer.pdb)
# OUT:
# HEADER ISAMBARD Model                                                                  
# ATOM      1  N   GLU A   1      -5.364  -1.566  -0.689  1.00  0.00           N  
# ATOM      2  CA  GLU A   1      -4.483  -2.220   0.308  1.00  0.00           C  
# ATOM      3  C   GLU A   1      -3.886  -1.143   1.216  1.00  0.00           C  
# ATOM      4  O   GLU A   1      -3.740  -1.337   2.425  1.00  0.00           O  
# ATOM      5  CB  GLU A   1      -3.389  -3.028  -0.392  1.00  0.00           C  
# ...

Don't know what your parameters might be? Let's optimise them then!

import budeff
import isambard.optimisation.evo_optimizers as ev_opts
from isambard.optimisation.evo_optimizers import Parameter

specification = specifications.CoiledCoil.from_parameters
sequences = [
    'EIAALKQEIAALKKENAALKWEIAALKQ',
    'EIAALKQEIAALKKENAALKWEIAALKQ'
]
parameters = [
    Parameter.static('Oligomeric State', 2),
    Parameter.static('Helix Length', 28),
    Parameter.dynamic('Radius', 5.0, 1.0),
    Parameter.dynamic('Pitch', 200, 60),
    Parameter.dynamic('PhiCA', 283, 27),  # 283 is equivalent a g position
]

def get_buff_total_energy(ampal_object):
    return budeff.get_internal_energy(ampal_object).total_energy

opt_ga = ev_opts.GA(specification, sequences, parameters, get_buff_total_energy)
opt_ga.run_opt(100, 5, cores=8)
# OUT:
# gen	evals	avg     	std    	min     	max     
# 0  	61   	-820.401	42.0119	-908.875	-750.001
# 1  	59   	-859.86 	31.4194	-950.15 	-807.265
# 2  	60   	-887.028	23.8683	-951.153	-847.346
# 3  	70   	-907.257	15.9615	-952.863	-882.028
# 4  	81   	-922.522	14.6206	-972.335	-903.444
# Evaluated 431 models in total in 0:00:29.523487
# Best fitness is (-972.3348571854714,)
# Best parameters are [2, 28, 4.678360526981807, 151.35365923229745, 277.2061538048508]
optimized_model = opt_ga.best_model

This quick example of parametric modelling with ISAMBARD, the next thing to do is take a look at the docs from tutorials on the tools available, or just take a look through the code base and hack around. Feel free to contact us through email or the issues if you get stuck.

Release Notes

v2.3.1

  • Fixes a minor bug in the DSSP output parsing code

v2.3.0

  • Introduces functionality to calculate the packing density (measured as the atomic contact number) of all non-hydrogen atoms in a Polymer / Assembly object.

v2.2.0

  • Adds pacc module for parametric analysis of coiled coils.

isambard's People

Contributors

ajasja avatar chriswellswood avatar kls93 avatar prasun30 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

isambard's Issues

Getting the z_shift in pacc

I'd also be interested in getting the z_shift (I guess it's just the distance between the correct C_alpha atoms projected onto the reference axis?).

Example analysis of antiparallel dimer

Do you have an example of analysing an antiparallel CC?
Here is a nice example for a parallel CC.

The pacc.py does say "that it works also for ap", but I get very strange values.

cc = ampal.load_pdb("data/APH.pdb")
cc_eval = pacc.PACCAnalysis(cc)
print(cc_eval.generate_report())
Output
Register Assignment
-------------------
defgabcdefgabcdefgabcdefgabcdefgabcdefga
LEEELKQLEEELQAIEEQLAQLQWKAQARKEKLAQLKEKL
LEEELKQLEEELQAIEEQLAQLQWKAQARKEKLAQLKEKL

Fit Quality - Mean Angular Discrepancy = 54.25 (Std Dev = 80.25)

Coiled Coil Parameters
----------------------
 Res#   Radius    Alpha  CrAngle
    1  +30.529  +59.150   -4.094
    2  +29.039  +60.957  +94.653
    3  +27.622  +62.827  +14.537
    4  +26.151  +64.865  -64.196
    5  +24.654  +69.249  +35.965
    6  +23.203  +72.976 +137.016
    7  +21.726  +66.770 -116.027
    8  +20.238  +68.305  -15.827
    9  +18.787  +74.746  +82.384
   10  +17.336  +74.234   +6.006
   11  +15.856  +71.319  -70.044
   12  +14.397  +75.708  +28.520
   13  +12.973  +79.890 +128.179
   14  +11.532  +78.676 -128.453
   15  +10.092  +79.886  -27.663
   16   +8.715  +84.085  +71.396
   17   +7.399  +86.550   -8.391
   18   +6.156  +87.714  -87.877
   19   +5.193  +89.461  +12.361
   20   +4.911  +90.293 +112.990
   21   +5.454  +89.728 -148.180
   22   +6.473  +86.676  -49.504
   23   +7.737  +84.222  +52.946
   24   +9.115  +84.020 +154.491
   25  +10.503  +80.605 -108.473
   26  +11.910  +75.504   -8.590
   27  +13.365  +76.341  +96.881
   28  +14.822  +76.757 -163.136
   29  +16.257  +71.077  -66.362
   30  +17.717  +67.692  +37.077
   31  +19.199  +71.723 +142.996
   32  +20.655  +70.122 -119.547
   33  +22.108  +63.452  -20.800
   34  +23.592  +64.620  +86.538
   35  +25.070  +68.340   +9.092
   36  +26.523  +65.119  -72.256
   37  +28.014  +63.220  +30.008
   38  +29.488  +61.428 +131.219
   39  +30.922  +59.343 -128.847
   40  +32.387   +0.000   +0.000
--------------------------------
  Ave  +17.696  +73.786   +1.461
Std D   +8.269   +9.197  +88.641

I guess flip_reference_axis_if_antiparallel should come in to play somewhere, but ampal.analyse_protein.flip_reference_axis_if_antiparallel(cc_eval.cc[0], cc_eval.ra) doesn't cut it :)

image

(Here is the example pdb APH.pdb.gz)

Conda installation

Hello,
Out of curiosity, are you planning to build an isambard conda package?
All the python codes I use for molecular modelling are now available as conda packages which facilitate their installation (although a pip installation is not complicated), management of the python environment, management of other python dependencies and easy update of all the packages.
It kind of creates a one-stop shop for every scientific codes for easy installation and update, so perhaps of interest for isambard.
Eric

isambard and budeff installation through pip

When trying to install these packages using pip, the following errors appears:

pip install isambard
Collecting isambard
  Using cached https://files.pythonhosted.org/packages/9c/ba/636028b8e309e217e171016e34b2a9f5f0b37f3be916d02ad55f97cf4991/ISAMBARD-2.2.0.tar.gz
Requirement already satisfied: ampal in /mnt/storage/home/ba13026/anaconda3/lib/python3.6/site-packages (from isambard) (1.3.0)
Collecting budeff (from isambard)
  Using cached https://files.pythonhosted.org/packages/33/89/a7ea41131ab0db5c4232902ede026d5c21e05966b3abe59b84600fbb947d/BUDEFF-1.0.0.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-6g9ul6lu/budeff/setup.py", line 17, in <module>
        long_description=readme(),
      File "/tmp/pip-install-6g9ul6lu/budeff/setup.py", line 11, in readme
        return inf.read()
      File "/mnt/storage/home/ba13026/anaconda3/lib/python3.6/encodings/ascii.py", line 26, in decode
        return codecs.ascii_decode(input, self.errors)[0]
    UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 4726: ordinal not in range(128)
    
    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-6g9ul6lu/budeff/

and

pip install budeff
Collecting budeff
  Using cached https://files.pythonhosted.org/packages/33/89/a7ea41131ab0db5c4232902ede026d5c21e05966b3abe59b84600fbb947d/BUDEFF-1.0.0.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-kkqqy1fw/budeff/setup.py", line 17, in <module>
        long_description=readme(),
      File "/tmp/pip-install-kkqqy1fw/budeff/setup.py", line 11, in readme
        return inf.read()
      File "/mnt/storage/home/ba13026/anaconda3/lib/python3.6/encodings/ascii.py", line 26, in decode
        return codecs.ascii_decode(input, self.errors)[0]
    UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 4726: ordinal not in range(128)
    
    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-kkqqy1fw/budeff/

As suggested on some forums, to solve the Command "python setup.py egg_info" failed with error code 1 issue, I tried:

pip install --upgrade setuptools
pip install ez_setup

Nothing works so far.

I would appreciate your help.

Bets wishes,
Broncio

Make variable for Scwrl executable path.

It'd be useful to have an executable_path argument for run_scwrl, scwrl_available and pack_side_chains_scwrl with a default value of Scwrl4 (i.e. on the path), so that people can use Scwrl even if it's not on their path.

scwrl4 compatability on Macs

Fails to implement Scwrl4 correctly when using ISAMBARD on Mac OS - gives the following error

CalledProcessError                        Traceback (most recent call last)
/var/folders/fp/z81k35zn0tgg05n4p_cm85lm0000gp/T/ipykernel_13690/3544206324.py in <module>
----> 1 x = modelling.pack_side_chains_scwrl(my_pdb, sequences)
 
~/opt/anaconda3/lib/python3.9/site-packages/isambard/modelling/scwrl.py in pack_side_chains_scwrl(assembly, sequences, rigid_rotamer_model, hydrogens)
    168                          'number of Polypeptides ({}).'.format(
    169                              len(sequences), len(protein)))
--> 170     scwrl_std_out, scwrl_pdb = run_scwrl(
    171         assembly.pdb, ''.join(sequences), path=False,
    172         rigid_rotamer_model=rigid_rotamer_model, hydrogens=hydrogens)
 
~/opt/anaconda3/lib/python3.9/site-packages/isambard/modelling/scwrl.py in run_scwrl(pdb, sequence, path, rigid_rotamer_model, hydrogens)
     86             if not hydrogens:
     87                 scwrl_command.append('-h')
---> 88             scwrl_std_out = subprocess.check_output(scwrl_command)
     89             scwrl_out.seek(0)
     90             scwrl_pdb = scwrl_out.read()
 
~/opt/anaconda3/lib/python3.9/subprocess.py in check_output(timeout, *popenargs, **kwargs)
    422         kwargs['input'] = empty
    423 
--> 424     return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
    425                **kwargs).stdout
    426 
 
~/opt/anaconda3/lib/python3.9/subprocess.py in run(input, capture_output, timeout, check, *popenargs, **kwargs)
    526         retcode = process.poll()
    527         if check and retcode:
--> 528             raise CalledProcessError(retcode, process.args,
    529                                      output=stdout, stderr=stderr)
    530     return CompletedProcess(process.args, retcode, stdout, stderr)
 
CalledProcessError: Command '['Scwrl4', '-i', '/var/folders/fp/z81k35zn0tgg05n4p_cm85lm0000gp/T/tmpd6p1uafm', '-o', '/var/folders/fp/z81k35zn0tgg05n4p_cm85lm0000gp/T/tmpilzc7q65', '-s', '/var/folders/fp/z81k35zn0tgg05n4p_cm85lm0000gp/T/tmpeg5akh6c', '-v', '-h']' returned non-zero exit status 1.

Scwrl4 is installed correctly and on the users PATH.

Issue is solved by editing the scwrl.py file to give the location of the Scwrl4.ini file as well in the code:

scwrl_command = ['Scwrl4',
                             '-i', scwrl_tmp.name,
                             '-o', scwrl_out.name,
                             '-s', scwrl_seq.name,
                             '-p','/Path/to/scwrl4/Scwrl4.ini']

Finding H-bonds and KIHs with Isambard2

Hi,

I'm struggling to find a way with the ampal module to get all H-bonds (Sidechain-Sidechain, Sidechain-Mainchain, etc) and Knobs into Holes, given a PDB.

With previous isambard versions I used to do something like:

import isambard_dev

# Passed a PDB which already includes hydrogens		
p = isambard_dev.ampal.convert_pdb_to_ampal(pdb_path)

hbonds = isambard_dev.interactions.find_hydrogen_bonds(p)
# Find all H-bonds and select those between sidechain atoms
sc_hbonds = [hb for hb in hbonds if hb.is_sidechain_sidechain == True]

# Get donor/acceptor info
hb = sc_hbonds[0]
donor_H = [hb.donor.ampal_parent.id , hb.donor.res_label]
acceptor_O = [hb.acceptor.ampal_parent.id , hb.acceptor.res_label]

and

kihs = isambard_dev.add_ons.knobs_into_holes.find_kihs(p)

# Get KIH info
kih = kihs[0]
knob_data = kih.knob.unique_id
hole_data = [kih.hole[x].unique_id for x in range(len(kih.hole))]

I would appreciate any help so that I can upgrade my code to Isambard2.

Cheers,
Broncio

Trouble finding documentation

I'm having trouble finding the documentation for two common tasks:

  • Running the tests after installation
  • Configuring paths for external dependencies

I'm sure that used to be online already.
import isambard; isambard.settings.configure()

no longer seems to work (and that info is in the old repo on the wiki)

Is there a way to generate all register combinations for a given dimer?

The researcher I am working with has asked me to come up with all possible register positions for candidate PDBs for a structure we are interested in. I was able to create a pdb of a dimer I am attempting to look at with the following code:

import sys
import isambard.specifications as specifications
import isambard.modelling as modelling
import isambard.optimisation
import budeff
import isambard.optimisation.evo_optimizers as ev_opts
from isambard.optimisation.evo_optimizers import Parameter

specification = specifications.CoiledCoil.from_parameters
sequences = [
    'QAQAQAQAQAQAQAQAQAQAQAQAQAQA',
    'QAQAQAQAQAQAQAQAQAQAQAQAQAQA'
]
parameters = [
    Parameter.static('Oligomeric State', 2),
    Parameter.static('Helix Length', 28),
    Parameter.dynamic('Radius', 5.0, 1.0),
    Parameter.dynamic('Pitch', 200, 60),
    Parameter.dynamic('PhiCA', 283, 27),  # 283 is equivalent a g position
]

def get_buff_total_energy(ampal_object):
    return budeff.get_internal_energy(ampal_object).total_energy

opt_ga = ev_opts.GA(specification, sequences, parameters, get_buff_total_energy)
opt_ga.run_opt(100, 5, cores=8)
optimized_model = opt_ga.best_model

I noticed in the tutorial you give the option on changing the register here:https://gist.github.com/ChrisWellsWood/41a8baf9785e1b39a39c70d651d98129

I am new to this so I might be wrong here, but it seems to me you just change the order of the sequence such that the 'F' amino acid is now listed first in the dimer.

With the repeat I have, is the only option I have to change the initial sequence to AQ(n)?

Simplify Installation

Much like in AMPAL, we should simplify installation by adding Cython in setup_requires.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.