schrodinger.application.bioluminate.protein module

Module to gather residue property data for proteins.

Copyright (c) Schrodinger, LLC. All rights reserved

schrodinger.application.bioluminate.protein.find_residue_atom(st, chain, resnum, inscode)
schrodinger.application.bioluminate.protein.get_residue_asl(residue, ca=False)

Creates an ASL based on a residue’s chain, residue number and inscode. The ASL can optionally only include the alpha carbon of the residue.

Parameters:residue (schrodinger.structure._Residue) – The residue to create an ASL for
Raises:RuntimeError – If the passed in residue is incorrect type
Returns:ASL expression for residue
Return type:str
schrodinger.application.bioluminate.protein.get_residues_asl(residues, ca=False)

Creates an ASL based on a list of residue’s chains, residue numbers and inscodes. The ASL can optionally only include the alpha carbon of the residue.

Parameters:

residue (list or tuple of `schrodinger.structure._Residue`s) – The residues to create an ASL for

Raises:
  • RuntimeError – If residues are not a list or tuple
  • RuntimeError – If any passed in residues are incorrect type
Returns:

ASL expression for all residues

Return type:

str

schrodinger.application.bioluminate.protein.valid_asl(st, asl)

Returns True/False depending on whether the asl is a valid expression or not.

schrodinger.application.bioluminate.protein.get_residues_within(st, residues, within=0.0, ca=False)

Returns a list of residues for st that are within within angstroms of each residue. If the ca keyword is True the within calculation will only look for alpha carbon in residues. This means that if within is set to 5.5 angstroms and there is only a single atom that belongs to a residue at that cutoff, the residue that the atom belongs to will be refined.

Parameters:
  • st (schrodinger.structure.Structure) – Structure to evaluate and which all residues correspond
  • residues (list or tuple of `schrodinger.structure._Residue`s) – All residues targeted for refinement
  • within (float) – Distance (angstroms) of residues to include in refinement
  • ca (bool) – Use only alpha carbons to find residues within
Returns:

List of schrodinger.structure._Residue objects

Return type:

list

schrodinger.application.bioluminate.protein.residue_is_polar(residue)

Tests whether a residue is polar

Parameters:residue (structure._Residue) – Residue to test
Return type:bool
schrodinger.application.bioluminate.protein.residue_is_nonpolar(residue)

Tests whether a residue is nonpolar

Parameters:residue (structure._Residue) – Residue to test
Return type:bool
schrodinger.application.bioluminate.protein.atom_is_nonpolar(atom)

Returns true if the atom is considered non-polar. Here are the rules for non-polar atoms:

  • The atom’s element is a C or S
  • The atom’s element is a H and one bonded atom’s element is C or S
class schrodinger.application.bioluminate.protein.PrimeConfig(st_filename, set_defaults=True, **kwargs)

Bases: schrodinger.application.prime.input.Prime

Class containing the methods to write Prime input files. NOTE THAT THIS ALWAYS USES OPLS2005

ALL_RESIDUES = 'all'
__init__(st_filename, set_defaults=True, **kwargs)

Accepts one argument which is either a path or a keyword dictionary.

addResidues(residues=None)

Adds residues to consider for refinement. The passed in argument can take the form of:

prepEnergy()
prepMinimize(residues=None)
prepResidue(residues=None)
prepSidechain(residues=None)
prepSidechainCBeta(residues=None)
prepSidechainBB(residues=None)
prepActive(lig_id, residues=None)
prepLoop(start_res=None, end_res=None, res_sphere=7.5, maxcalpha=None, protocol='LOOP_BLD', loop2=None, max_jobs=0, residues=None)
Parameters:
  • start_res (string) – loop start residue, e.g. A:15
  • end_res (string) – loop start residue, e.g. A:20
  • res_sphere (float) – radius of nearby residue refinement
  • maxcalpha (float) – CA atom movement constraint
  • protocol (string) – loop refinement protocol
  • loop2 (list) – the definition of the second loop, e.g. [‘A:4’,’A:6’]
  • residues (None) – Unused, kept for API compatibility
  • max_jobs (int) – how many processes will be run simultaneously
prepAntibodyLoop(start_res=None, end_res=None, cpus=1, residues=None)
prepBldStruct(jobname, dirname)
__contains__()

True if D has a key k, else False.

__len__

Return len(self).

as_bool(key)

Accepts a key as input. The corresponding value must be a string or the objects (True or 1) or (False or 0). We allow 0 and 1 to retain compatibility with Python 2.2.

If the string is one of True, On, Yes, or 1 it returns True.

If the string is one of False, Off, No, or 0 it returns False.

as_bool is not case sensitive.

Any other input will raise a ValueError.

>>> a = ConfigObj()
>>> a['a'] = 'fish'
>>> a.as_bool('a')
Traceback (most recent call last):
ValueError: Value "fish" is neither True nor False
>>> a['b'] = 'True'
>>> a.as_bool('b')
1
>>> a['b'] = 'off'
>>> a.as_bool('b')
0
as_float(key)

A convenience method which coerces the specified value to a float.

If the value is an invalid literal for float, a ValueError will be raised.

>>> a = ConfigObj()
>>> a['a'] = 'fish'
>>> a.as_float('a')  #doctest: +IGNORE_EXCEPTION_DETAIL
Traceback (most recent call last):
ValueError: invalid literal for float(): fish
>>> a['b'] = '1'
>>> a.as_float('b')
1.0
>>> a['b'] = '3.2'
>>> a.as_float('b')  #doctest: +ELLIPSIS
3.2...
as_int(key)

A convenience method which coerces the specified value to an integer.

If the value is an invalid literal for int, a ValueError will be raised.

>>> a = ConfigObj()
>>> a['a'] = 'fish'
>>> a.as_int('a')
Traceback (most recent call last):
ValueError: invalid literal for int() with base 10: 'fish'
>>> a['b'] = '1'
>>> a.as_int('b')
1
>>> a['b'] = '3.2'
>>> a.as_int('b')
Traceback (most recent call last):
ValueError: invalid literal for int() with base 10: '3.2'
as_list(key)

A convenience method which fetches the specified value, guaranteeing that it is a list.

>>> a = ConfigObj()
>>> a['a'] = 1
>>> a.as_list('a')
[1]
>>> a['a'] = (1,)
>>> a.as_list('a')
[1]
>>> a['a'] = [1]
>>> a.as_list('a')
[1]
clear()

A version of clear that also affects scalars/sections Also clears comments and configspec.

Leaves other attributes alone :
depth/main/parent are not affected
copy() → a shallow copy of D
dict()

Return a deepcopy of self as a dictionary.

All members that are Section instances are recursively turned to ordinary dictionaries - by calling their dict method.

>>> n = a.dict()
>>> n == a
1
>>> n is a
0
fromkeys()

Returns a new dict with keys from iterable and values equal to value.

get(key, default=None)

A version of get that doesn’t bypass string interpolation.

getSpecsString()

Return a string of specifications. One keywords per line. Raises ValueError if this class has no specifications.

items() → list of D's (key, value) pairs, as 2-tuples
iteritems() → an iterator over the (key, value) items of D
iterkeys() → an iterator over the keys of D
itervalues() → an iterator over the values of D
keys() → list of D's keys
merge(indict)

A recursive update - useful for merging config files.

>>> a = '''[section1]
...     option1 = True
...     [[subsection]]
...     more_options = False
...     # end of file'''.splitlines()
>>> b = '''# File is user.ini
...     [section1]
...     option1 = False
...     # end of file'''.splitlines()
>>> c1 = ConfigObj(b)
>>> c2 = ConfigObj(a)
>>> c2.merge(c1)
>>> c2
ConfigObj({'section1': {'option1': 'False', 'subsection': {'more_options': 'False'}}})
pop(key, default=<object object>)

‘D.pop(k[,d]) -> v, remove specified key and return the corresponding value. If key is not found, d is returned if given, otherwise KeyError is raised’

popitem()

Pops the first (key,val)

printout()

Print all keywords of this instance to stdout.

This method is meant for debugging purposes.

reload()

Reload a ConfigObj from file.

This method raises a ReloadError if the ConfigObj doesn’t have a filename attribute pointing to a file.

rename(oldkey, newkey)

Change a keyname to another, without changing position in sequence.

Implemented so that transformations can be made on keys, as well as on values. (used by encode and decode)

Also renames comments.

reset()

Clear ConfigObj instance and restore to ‘freshly created’ state.

restore_default(key)

Restore (and return) default value for the specified key.

This method will only work for a ConfigObj that was created with a configspec and has been validated.

If there is no default value for this key, KeyError is raised.

restore_defaults()

Recursively restore default values to all members that have them.

This method will only work for a ConfigObj that was created with a configspec and has been validated.

It doesn’t delete or modify entries without default values.

setdefault(key, default=None)

A version of setdefault that sets sequence if appropriate.

update(indict)

A version of update that uses our __setitem__.

validate(validator, preserve_errors=False, copy=False, section=None)

Test the ConfigObj against a configspec.

It uses the validator object from validate.py.

To run validate on the current ConfigObj, call:

test = config.validate(validator)

(Normally having previously passed in the configspec when the ConfigObj was created - you can dynamically assign a dictionary of checks to the configspec attribute of a section though).

It returns True if everything passes, or a dictionary of pass/fails (True/False). If every member of a subsection passes, it will just have the value True. (It also returns False if all members fail).

In addition, it converts the values from strings to their native types if their checks pass (and stringify is set).

If preserve_errors is True (False is default) then instead of a marking a fail with a False, it will preserve the actual exception object. This can contain info about the reason for failure. For example the VdtValueTooSmallError indicates that the value supplied was too small. If a value (or section) is missing it will still be marked as False.

You must have the validate module to use preserve_errors=True.

You can then use the flatten_errors function to turn your nested results dictionary into a flattened list of failures - useful for displaying meaningful error messages.

validateValues(preserve_errors=True, copy=True)

Validate the values read in from the InputConfig file.

Provide values for keywords with validators that have default values.

If a validator for a keyword is specified without a default and the keyword is missing from the input file, a RuntimeError will be raised.

Parameters:
  • preserve_errors (bool) –
    If set to False, this method returns True if
    all tests passed, and False if there is a failure. If set to True, then instead of getting False for failed checkes, the actual detailed errors are printed for any validation errors encountered.

    Even if preserve_errors is True, missing keys or sections will still be represented by a False in the results dictionary.

  • copy (bool) – If False, default values (as specified in the ‘specs’ strings in the constructor) will not be copied to object’s “defaults” list, which will cause them to not be written out when writeInputFile() method is called. If True, then all keywords with a default will be written out to the file via the writeInputFile() method. NOTE: Default is True, while in ConfigObj default is False.
values() → list of D's values
walk(function, raise_errors=True, call_on_sections=False, **keywargs)

Walk every member and call a function on the keyword and value.

Return a dictionary of the return values

If the function raises an exception, raise the errror unless raise_errors=False, in which case set the return value to False.

Any unrecognised keyword arguments you pass to walk, will be pased on to the function you pass in.

Note: if call_on_sections is True then - on encountering a subsection, first the function is called for the whole subsection, and then recurses into it’s members. This means your function must be able to handle strings, dictionaries and lists. This allows you to change the key of subsections as well as for ordinary members. The return value when called on the whole subsection has to be discarded.

See the encode and decode methods for examples, including functions.

caution

You can use walk to transform the names of members of a section but you mustn’t add or delete members.

>>> config = '''[XXXXsection]
... XXXXkey = XXXXvalue'''.splitlines()
>>> cfg = ConfigObj(config)
>>> cfg
ConfigObj({'XXXXsection': {'XXXXkey': 'XXXXvalue'}})
>>> def transform(section, key):
...     val = section[key]
...     newkey = key.replace('XXXX', 'CLIENT1')
...     section.rename(key, newkey)
...     if isinstance(val, (tuple, list, dict)):
...         pass
...     else:
...         val = val.replace('XXXX', 'CLIENT1')
...         section[newkey] = val
>>> cfg.walk(transform, call_on_sections=True)
{'CLIENT1section': {'CLIENT1key': None}}
>>> cfg
ConfigObj({'CLIENT1section': {'CLIENT1key': 'CLIENT1value'}})
write(filename)

Writes a simplified input file to filename.

This input file needs to be run via $SCHRODINGER/prime.

writeInputFile(filename, ignore_none=False, yesno=False, smartsort=False)

Write the configuration to a file in the InputConfig format.

Parameters:
  • filename (a file path or an open file handle) – The file to write the configuration to.
  • ignore_none (bool) – If True, keywords with a value of None will not be written to the input file.
  • yesno (bool) – If True, boolean keywords will be written as “yes” and “no”, if False, as “True” and “False”.
  • smartsort (bool) – If True, keywords that are identical except for the numbers at the end will be sorted such that “2” will go before “10”.
class schrodinger.application.bioluminate.protein.PrimeStructure(jobname)

Bases: object

__init__(jobname)

Initialize self. See help(type(self)) for accurate signature.

createTemplateFile(template_seq, filename=None)

Writes a template PDB file as .ent

createAlignFile(reference_seq, template_seq, filename=None)

Writes an alignment file for the template. If no filename is supplied the file will be named <jobname>.aln.

Parameters:
  • reference_seq (sequence) – The reference sequence
  • template_seq (sequence) – The template sequence
exception schrodinger.application.bioluminate.protein.PropkaError

Bases: Exception

A custom exception for any propka failures

__init__

Initialize self. See help(type(self)) for accurate signature.

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

class schrodinger.application.bioluminate.protein.OrderedResidueDict(residues, default_value=None)

Bases: collections.OrderedDict

Creates an ordered dictionary for residues in a structure

__init__(residues, default_value=None)

Initialize self. See help(type(self)) for accurate signature.

__contains__()

True if D has a key k, else False.

__len__

Return len(self).

clear() → None. Remove all items from od.
copy() → a shallow copy of od
fromkeys(S[, v]) → New ordered dictionary with keys from S.

If not specified, the value defaults to None.

get(k[, d]) → D[k] if k in D, else d. d defaults to None.
items() → a set-like object providing a view on D's items
keys() → a set-like object providing a view on D's keys
move_to_end()

Move an existing element to the end (or beginning if last==False).

Raises KeyError if the element does not exist. When last=True, acts like a fast version of self[key]=self.pop(key).

pop(k[, d]) → v, remove specified key and return the corresponding

value. If key is not found, d is returned if given, otherwise KeyError is raised.

popitem() → (k, v), return and remove a (key, value) pair.

Pairs are returned in LIFO order if last is true or FIFO order if false.

setdefault(k[, d]) → od.get(k,d), also set od[k]=d if k not in od
update([E, ]**F) → None. Update D from dict/iterable E and F.

If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]

values() → an object providing a view on D's values
class schrodinger.application.bioluminate.protein.PropertyCalculator(struct, jobname, cleanup=True, nbcutoff=14.0, residues=None, lig_asl=None)

Bases: object

Class for calculating properties of proteins and protein residues.

Here is an example of how to calculate properties for a protein:

from schrodinger import structure
from schrodinger.application.bioluminate import protein

# Get the input structure
st = structure.Structure.read('receptor.maegz')

# Define the properties to calculate
calculations = [ 'e_pot', 'e_internal', 'e_interaction', 'prime_energy',
                 'pka', 'sasa_polar', 'sasa_nonpolar', 'sasa_total']

# Create the calculator
calculator = protein.PropertyCalculator(st, "my_calculator_jobname")

# Calculate the properties
properties = calculator.calculate(*calculations)

In the example above the properties output would look something like this:

properties = {
    'e_pot'         : 1573.4,
    'e_internal'    : 624.7,
    'e_interaction' : 994.8,
    'prime_energy'  : 744.2,
    'pka'           : 124.1,
    'sasa_polar',   : 3122.3,
    'sasa_nonpolar' : 271.1,
    'sasa_total'    : 3393.4
}
AGGREGATE_CALCULATIONS = ['e_pot', 'prime_energy', 'pka', 'sasa_polar', 'sasa_nonpolar', 'sasa_total', 'hydropathy', 'rotatable', 'vdw_surf_comp']
RESIDUE_CALCULATIONS = ['e_pot', 'e_internal', 'e_interaction', 'pka', 'sasa_polar', 'sasa_nonpolar', 'sasa_total', 'hydropathy', 'rotatable', 'vdw_surf_comp']
__init__(struct, jobname, cleanup=True, nbcutoff=14.0, residues=None, lig_asl=None)

Construct a ProteinCalculator class from a structure file and a jobname.

Parameters:
  • struct (schrodinger.structure.Structure object) – The protein structure or protein/ligand structures
  • jobname – The jobname that will be used for all calculations that require output files.
  • residues (Iterable of schrodinger.structure._Residue objects.) – An iterable of _Residue objects to analyze. If not specified, all residues in the structure are considered.
  • lig_asl (str) – The ASL for the ligand substructure. Used for calculating the vdW surface complementarity.
progress = None

Variable that can be used to get the progress of calculations. This variable is only set in self.calculateOverResidues. Since that method returns a generator, each step can query self.progress to get a description of the progress. This variable is a tuple with the form ( step, total steps ).

minimizer

The minimizer used in energy calculations.

runpKa()

Runs PROPKA to get the pKa of all residues in the self.struct, then sets self.pka_data.

getResiduepKa(residue)

Returns the pKa for specified residue

Parameters:residue (structure._Residue) – Residue to get internal energy for
Return type:float
getTotalpKa()

Gets the sum of the pKa values for the protein.

Return type:float
setpKaData(summary, renum_map=None)

Compares residues from the PROPKA summary with the residues in self.residues and when matches are found the summary’s pKa is set for that residue in self.pka_data

getTotalPrimeEnergy()

Run Prime Minimization on self.struct. This will launch a job using job control. After the job completes the total energy will be taken from the first CT using the “r_psp_Prime_Energy” property.

Returns:Prime energy of protein
Return type:float
getPrimeEnergyByResidues(residues)

Run Prime Minimization on self.struct only minimizing the residues in residues. This will launch a job using job control. After the job completes the total energy will be taken from the first CT using the “r_psp_Prime_Energy” property.

Parameters:residues (list of residues) – Residues to minimize
Returns:Prime energy of protein
Return type:float
getResiduePotentialEnergy(residue)

Return the potential energy for a residue.

Parameters:residue (structure._Residue) – Residue to get potential energy for
Return type:float
getPotentialEnergyGenerator()

Return a generator that iterates over each residue in self.struct yielding the schrodinger.structure._Residue object and it’s potential energy.

Return type:generator
See:schrodinger.structutils.minimize.Minimizer.getSelfEnergy
See:schrodinger.structutils.minimize.Minimizer.getInteractionEnergy
getTotalPotentialEnergy()

Get the potential energy of self.struct which is calculated using schrodinger.structutils.minimize.Minimizer. The potential energy is the sum of the internal energies and the interaction energies.

Returns:Total potential energy of all the residues
Return type:float
See:schrodinger.structutils.minimize.Minimizer.getSelfEnergy
See:schrodinger.structutils.minimize.Minimizer.getInteractionEnergy
getResidueInternalEnergy(residue)

Return the residue’s internal energy.

Parameters:residue (structure._Residue) – Residue to get internal energy for
Return type:float
See:schrodinger.structutils.minimize.Minimizer.getSelfEnergy
getInternalEnergyGenerator()

Return a generator that iterates over each residue in self.struct. This yields the schrodinger.structure._Residue object and it’s internal energy.

Return type:generator
See:schrodinger.structutils.minimize.Minimizer.getSelfEnergy
getResidueInteractionEnergy(residue)

Return the residue’s interaction energy.

Parameters:residue (structure._Residue) – Residue to get interaction energy for
Return type:float
See:schrodinger.structutils.minimize.Minimizer.getInteractionEnergy
getInteractionEnergyGenerator()

Return a generator that iterates over each residue in self.struct. This yields the schrodinger.structure._Residue object and it’s interaction energy.

Return type:generator
See:schrodinger.structutils.minimize.Minimizer.getInteractionEnergy
getResidueAtomicPolarSASA(residue, sidechain=False)

Returns SASA for all polar atoms in residue

Parameters:
  • residue (structure._Residue) – Residue to get atomic polar SASA contribution for
  • sidechain (bool) – Only consider sidechain atoms when calculating SASA
Return type:

float

getAtomicPolarSASAGenerator(sidechain=False)

Returns a generator that yields the schrodinger.structure._Residue object and its calculated SASA for only the polar atoms in each residue in self.struct.

Parameters:sidechain (bool) – Only consider sidechain atoms when calculating SASA
Return type:generator
getResidueAtomicNonPolarSASA(residue, sidechain=False)

Returns SASA for only the nonpolar atoms in residue

Parameters:
  • residue (structure._Residue) – Residue to get atomic nonpolar SASA contribution for
  • sidechain (bool) – Only consider sidechain atoms when calculating SASA
Return type:

float

getAtomicNonPolarSASAGenerator(sidechain=False)

Returns a generator that yields the schrodinger.structure._Residue object and its calculated SASA for only the nonpolar atoms in each residue in self.struct.

Parameters:sidechain (bool) – Only consider sidechain atoms when calculating SASA
Return type:generator
getResidueSASA(residue, sidechain=False)

Returns the SASA for residue.

Parameters:
  • residue (structure._Residue) – Residue to get SASA for
  • sidechain (bool) – Only consider sidechain atoms when calculating SASA
Return type:

float

getSASAPolarGenerator(sidechain=False)

Returns a generator that yields the schrodinger.structure._Residue object and its calculated SASA for each polar residue in self.struct.

Parameters:sidechain (bool) – Only consider sidechain atoms when calculating SASA
Return type:generator
getTotalSASAPolar(sidechain=False)

Returns the total approximate solvent accessible surface area for all polar residues.

Parameters:sidechain (bool) – Only consider sidechain atoms when calculating SASA
Return type:float
getSASANonPolarGenerator(sidechain=False)

Returns a generator that yields the schrodinger.structure._Residue object and its calculated SASA for each nonpolar residue in self.struct.

Parameters:sidechain (bool) – Only consider sidechain atoms when calculating SASA
Return type:generator
getTotalSASANonPolar(sidechain=False)

Returns the total approximate solvent accessible surface area for all non-polar residues.

Parameters:sidechain (bool) – Only consider sidechain atoms when calculating SASA
Return type:float
getSASAGenerator(sidechain=False)

Returns a generator that yields the schrodinger.structure._Residue object and its calculated SASA for each residue in self.struct.

Parameters:sidechain (bool) – Only consider sidechain atoms when calculating SASA
Return type:generator
getTotalSASA(sidechain=False)

Returns the total approximate solvent accessible surface area for all residues.

Parameters:sidechain (bool) – Only consider sidechain atoms when calculating SASA
Return type:float
getResidueHydropathy(residue, sidechain=False)

Returns hydropathy value for residue

Parameters:
  • residue (structure._Residue) – Residue to get hydropathy value for
  • sidechain (bool) – Only consider sidechain atoms when calculating SASA
Return type:

float

getHydropathyGenerator(sidechain=False)

Returns a generator that yields the schrodinger.structure._Residue object and its calculated hydropathy for each residue in self.struct.

Parameters:sidechain (bool) – Only consider sidechain atoms when calculating SASA
Return type:generator
getTotalHydropathy(sidechain=False)

Returns the total calculated hydropathy value for all residues.

Parameters:sidechain (bool) – Only consider sidechain atoms when calculating SASA
Return type:float
getResidueRotatableBonds(residue)

Return the number of rotors for a residue.

Parameters:residue (structure._Residue) – Residue to get rotor count for
Return type:int
getRotatableBondsGenerator()

Returns a generator that yields the schrodinger.structure._Residue object and its number of rotors for each residue in self.struct.

Return type:generator
getTotalRotatableBonds()
Returns:Sum of rotors for all residues.
Return type:float
getTotalSurfComp()
Returns:Median of vdW surface complementarity values for all surface points for all residues.
Return type:float
getResidueSurfComp(residue)
Returns:Median of vdW surface complementarity values for all accounted points on the surface of this residue.
Return type:float
Parameters:residue (structure._Residue) – Residue to get the value for
calculateOverResidues(*properties)

Helper method that returns a generator which will calculate multiple properties for self.struct. All results will be returned in a tuple with the form ( structure._Residue, calc dict ). Here is a list of valid properties to calculate:

  • e_pot
  • e_internal
  • e_interaction
  • pka
  • sasa_polar
  • sasa_nonpolar
  • sasa_total
  • hydropathy
  • rotatable
  • vdw_surf_comp
Parameters:properties (str (see PropertyCalculator.RESIDUE_CALCULATIONS)) – Properties to calculate
Raises:KeyError – If a property passed in is invalid
Returns:Generator that yields structure._Residue and dict where keys are properties passed in and values are the total value of the property for the protein. e.g (_Residue, {‘e_pot’:1324.3})
Return type:generator
calculate(*properties)

Helper method to calculate multiple properties for self.struct. All results will be returned in a dict where the keys are each of the properties in properties, and their values are the values returned from their corresponding method. Here is a list of valid properties to calculate:

  • e_pot
  • sasa_polar
  • sasa_nonpolar
  • sasa_total
  • prime_energy
  • pka
  • hydropathy
  • rotatable
  • vdw_surf_comp
Parameters:properties (str (see PropertyCalculator.AGGREGATE_CALCULATIONS)) – Properties to calculate
Raises:KeyError – If a property passed in is invalid
Returns:Dict where keys are properties passed in and values are the total value of the property for the protein. e.g {‘e_pot’: 1324.3, ‘sasa_total’: 1846.9}
Return type:dict
getTotalAggregation()
getTotalSolubility()
getTotalComplementarity()
class schrodinger.application.bioluminate.protein.Mutation(ref_struct, struct, residue_map)

Bases: object

Helper class for Mutator. This will store a mutated structure and the resides that were mutated.

__init__(ref_struct, struct, residue_map)
Parameters:
class schrodinger.application.bioluminate.protein.Mutator(ref_struct, mutations, concurrent=1, sequential=False, idealize=True)

Bases: object

Mutates a set of residues in a protein structure allowing concurrent mutations as well as the option to limit concurrent mutations to sequential residues only.

Here is an example of a mutation of a Ser residue to: Asp, Glu, Asn, & Gln (one-letter codes are D, E, N, & Q respectively). The Ser residue is in chain A and has a residue number of 22. This example will write a file named ‘mutated_structures.maegz’ that has the reference structure as the first CT and each mutation CT after that. Five total structures will be in the output file:

from schrodinger import structure
from schrodinger.application.bioluminate import protein

# Get the input structure
reference_st = structure.Structure.read('receptor.maegz')

# Create the writer for the output file and append the reference
writer = structure.StructureWriter('mutated_structures.maegz')
writer.append(reference_st)

# Define the residues and mutations
residues = ['A:22']
muts     = 'DENQ'

# Get a compatible list of mutations. The above turns into
# [('A', 22, 'DENQ')]
mutations = protein.Mutator.convert_residue_list(residues, muts)

# Construct the mutator
mutator = protein.Mutator(st, mutations)

# Loop over each mutation
for mutation in mutator.generate():
    #
    mutated_structure = mutation.struct
    residue_map       = mutation.residue_map

    res_str = ", ".join(str(res) for res in residue_map.values())
    print 'Residues affected by this mutation: %s' % res_str

    # Do something with the mutated structure (refine maybe)

    writer.append(mutated_structure)

@todo: Add logging

MUTATIONS_PROPERTY = 's_bioluminate_Mutations'
UNFOLDED_PROPERTY = 'r_bioluminate_Unfolded_Contribution'
UNFOLDED_PROPERTY_PRIME = 'r_bioluminate_Unfolded_Contribution_Prime'
GXG_DATA = {'ALA': -100.736, 'ARG': -118.478, 'ARN': -118.478, 'ASH': -149.255, 'ASN': -137.153, 'ASP': -149.255, 'CYS': -100.845, 'GLH': -143.536, 'GLN': -136.183, 'GLU': -143.536, 'GLY': -105.658, 'HID': -104.977, 'HIE': -104.977, 'HIP': -104.977, 'HIS': -104.977, 'ILE': -84.13, 'LEU': -92.4, 'LYN': -110.759, 'LYS': -110.759, 'MET': -99.708, 'PHE': -96.483, 'PRO': -66.763, 'SER': -96.365, 'THR': -98.156, 'TRP': -105.114, 'TYR': -101.858, 'VAL': -93.493}
GXG_DATA_PRIME = {'ALA': -112.635, 'ARG': -142.467, 'ARN': -142.467, 'ASH': -154.559, 'ASN': -156.375, 'ASP': -154.559, 'CYS': -113.747, 'GLH': -141.673, 'GLN': -152.611, 'GLU': -141.673, 'GLY': -116.263, 'HID': -121.6, 'HIE': -121.6, 'HIP': -121.6, 'HIS': -121.6, 'ILE': -97.541, 'LEU': -107.106, 'LYN': -123.751, 'LYS': -123.751, 'MET': -112.643, 'PHE': -113.719, 'PRO': -81.734, 'SER': -112.693, 'THR': -116.048, 'TRP': -122.407, 'TYR': -123.497, 'VAL': -109.017}
SUPPORTED_BUILD_RESIDUES = ['ALA', 'ARG', 'ASN', 'ASP', 'CYS', 'GLN', 'GLU', 'GLY', 'HIS', 'HIP', 'HIE', 'ILE', 'LEU', 'LYS', 'MET', 'PHE', 'PRO', 'SER', 'THR', 'TRP', 'TYR', 'VAL']
__init__(ref_struct, mutations, concurrent=1, sequential=False, idealize=True)
Parameters:
  • ref_struct (schrodinger.structure.Structure instance) – The reference (starting) structure
  • mutations (List of tuples) – A list of the mutations to carry out on the ref_struct. Each element of the list is a tuple of (“res num.”, [“pdbnames”]) where “res num.” is the residue number being altered and “pdbnames” is a list of the standard PDB residue names to mutate it to.
  • concurrent (int) – Maximum concurrent mutations
  • sequential (bool) – Limit concurrent mutations to being sequential
  • idealize (bool) – Whether to idealize the reference structure by self-mutating the affected residues before calculating properties.
Raises:

RuntimeError – If concurrent is not between 1 and 99.

See:

For easy creation of mutations variable Mutator.convert_residue_list

static validate_mutated_residues(residues)

Method for validating the residues used in mutations passed in to the MutateProtein class.

Raises:ValueError – If the 3-letter residue name is not supported by the build,mutate method.
@todo: Convert the return to raise a custom MutateProteinError.
This will help in letting front-end know why it fails.

@todo: Add validation for assuring chain and resnum are in self.struct

static validate_mutations(mutations)

Private method for validating the mutations passed in to the MutateProtein class.

Raises:ValueError – If the mutations passed in is not a list, if each item in the list is not a tuple, if the tuple is not of length 4 (chain, resnum idx, inscode, mutation resnames), if the resnum is not an integer, or any of the 3-letter residue names in “mutation resnames” is not supported by the build,mutate method.
@todo: Convert the return to raise a custom MutateProteinError.
This will help in letting front-end know why it fails.

@todo: Add validation for assuring chain and resnum are in self.struct

mutations

The list of mutations that will be carried out

total_mutations

Total number of mutations that will be generated

classmethod convert_res_file(filename, regex=re.compile('\n (?P<chain>[a-zA-Z_]{1})\n :\n (?P<resnum>-?\\d+)\n (?P<inscode>[a-zA-Z]{1})? # optional\n \\s? # optional\n (?P<mutations>(ALA|ARG|ASN|ASP|CYS|GLN|GLU|GLY, re.VERBOSE))

Converts lines in filename into a list of mutations to use. Returns a list of tuples where each tuple is ( “chain”, “resnum”, “inscode”, “three-letter resnames for mutation”).

Each line could be multiple mutations (one residue to multiple mutation states)

Parameters:
  • filename (str) – Name of file containing the list of mutations.
  • regex (regular expression object) – Regular expression for matching residues
Raises:

RuntimeError – If any of chain, resnum or mutation is missing

Returns:

List of mutations with valid syntax for the class

Return type:

list of tuples

classmethod convert_res_list(reslist, regex=re.compile('\n (?P<chain>[a-zA-Z_]{1})\n :\n (?P<resnum>-?\\d+)\n (?P<inscode>[a-zA-Z]{1})? # optional\n \\s? # optional\n (?P<mutations>(ALA|ARG|ASN|ASP|CYS|GLN|GLU|GLY, re.VERBOSE), validate=True)

Converts list of residues into a list of mutations to use. Returns a list of tuples where each tuple is ( “chain”, “resnum”, “inscode”, “three-letter resnames for mutation”).

Each residue string could be multiple mutations (one residue to multiple mutation states)

Parameters:
  • reslist (list of str) – List of residues to convert to mutations
  • regex (regular expression object) – Regular expression for matching residues
  • validate (bool) – Whether to validate the potential mutations
Returns:

List of mutations with valid syntax for the class or None if any item in the list is not valid

Return type:

list of tuples or None

static convert_res_to_muts(res_str, regex=re.compile('\n (?P<chain>[a-zA-Z_]{1})\n :\n (?P<resnum>-?\\d+)\n (?P<inscode>[a-zA-Z]{1})? # optional\n \\s? # optional\n (?P<mutations>(ALA|ARG|ASN|ASP|CYS|GLN|GLU|GLY, re.VERBOSE), validate=True)
Converts a residue string into a list of mutations to use. Returns a list of tuples of (“chain”, “resnum”, “inscode”, “three-letter resnames for mutation”). Will return None if any item

in the list is not a valid residue string.

A residue string could be multiple mutations (one residue to multiple mutation states)

param res_str:Residue string to convert to mutations
type res_str:str
param regex:Regular expression for matching residues
type regex:regular expression object
param validate:Whether to run validation on the mutation
type validate:bool
return:List of mutations with valid syntax for the class or None if the res_str is not valid.
rtype:list tuples or None
static convert_muts_file(muts_file, regex=re.compile('\n (?P<chain>[a-zA-Z_]{1})\n :\n (?P<resnum>-?\\d+)\n (?P<inscode>[a-zA-Z]{1})? # optional\n ->\n (?P<new_resname>(ALA|ARG|ASN|ASP|CYS|GLN|GLU|GLY|HIS|HIP|HID|HIE|ILE|LEU|LYS|MET|P, re.VERBOSE))

Converts lines in filename into a list of mutations to use. Returns a list of tuples where each tuple is ( “chain”, “resnum”, “inscode”, “three-letter resnames for mutation”).

Also supports loop insertion and deletion.

Each line is one mutation (could be multiple residues)

static convert_residue_list(residues, mutations, regex=re.compile('\n (?P<chain>[a-zA-Z_]{1})\n :\n (?P<resnum>-?\\d+)\n (?P<inscode>[a-zA-Z]{1})? # optional\n \\s? # optional\n (?P<mutations>(ALA|ARG|ASN|ASP|CYS|GLN|GLU|GLY, re.VERBOSE))

Convert a list of residues and mutations to a standard list of mutations. Returns a list of tuples where each tuple is ( “chain”, “resnum”, “inscode”, “three-letter resnames for mutation”).

Parameters:residues (list of strings (Syntax: <chain>:<resnum> if no chain use "_")) – Residues that will be mutated.
:param mutations : The three-letter names for the residues that will be
used in mutation.
Raises:RuntimeError – If any of chain, resnum or mutation is missing or if there is an invalid residue name
Returns:List of mutations with valid syntax for the class
Return type:list of tuples
calculateMutationsList()

Calculate the mutations that will be performed, based on the input residues and their mutations, and the “concurrent” and “sequential” settings.

generate()

Used to loop over all mutations. Each mutation consists of the mutated structure and a residue mapping dict. The structure is raw, that is, unrefined in any way.

Returns:Generator for all mutations defined in self.mutations Each step of generator yields a mutation.
Return type:generator
getMutationFromChanges(changes)
getLoopMutation(mutated_st, res_str, new_resname)

build loop insertion or deletion

class schrodinger.application.bioluminate.protein.Refiner(struct, residues=None, local=False)

Bases: object

Creates input files and runs calculations for protein refinement jobs using Prime and our schrodinger.structutils.minimize.Minimizer class.

Here is an example of how to refine a protein that just had a residue mutated. In this example only the residues within 7.0 angstroms of the mutated residue will be refined:

from schrodinger.structure import StructureReader
from schrodinger.structutils import build
from schrodinger.application.bioluminate import protein

# Get the structure
st = StructureReader('receptor.maegz')

# Atom number 30 is the alpha carbon of a GLU
ca = st.atom[30]

# Mutate GLU -> ASP
renum_map = build.mutate(st, ca.index, "ASP")

# Get the residue that was mutated
mutated_residue = None
for res in st.residue:
    ca_keys  = (ca.chain,  ca.resnum,  ca.inscode)
    res_keys = (res.chain, res.resnum, res.inscode)
    if ca_keys == res_keys:
        mutated_residue = res
        break

# We want to use the reference to gather the residues to refine
refine_residues = protein.get_residues_within(
    st,
    [mutated_residue],
    within = 7.0
)

# Create the refiner
refiner = protein.Refiner(st, residues=refine_residues)

# Run Prime minimization which returns the refined structure
refined_struct = refiner.runPrimeMinimization('my_refinement_jobname')
PYTHON_MINIMIZE = 'python_minimize'
PRIME_MINIMIZE = 'prime_minimize'
PRIME_RESIDUE = 'prime_residue'
PRIME_SIDECHAIN = 'prime_sidechain'
PRIME_SIDECHAIN_CBETA = 'prime_sidechain_cbeta'
PRIME_SIDECHAIN_BB = 'prime_sidechain_bb'
PRIME_LOOP_PRED = 'prime_loop_prediction'
PRIME_ANTIB_LOOP_PRED = 'prime_antibody_loop_prediction'
__init__(struct, residues=None, local=False)
Parameters:
  • struct (schrodinger.structure.Structure) – The structure being refined
  • residues (None or list/tuple of structure.structure._Residue) – Residues to consider for refinement
  • local – deprecated
setResidues(residues)

Set the residues to refine. This is a list of integers refering to the residue indices for the structure.

clean()

Remove all files created from the refinement job

writePrimeInput(refine_type, input_file, st_filename, **kwargs)

Writes the input file for a Prime refinement job.

Parameters:
  • refine_type (str) – The type of Prime refinement to run (see class variables)
  • input_file (str) – Name of the input file for the refinement job
  • st_filename (str) – Filename of the structure to be refined
Raises:

RuntimeError – If refine_type is not supported

Return type:

None

refinePrime(refine_type, jobname, completed_callback=None, **kwargs)

Run a Prime refinement job through job control and return the refined output structure.

Parameters:
  • refine_type (str) – The type of Prime refinement to run (see class variables)
  • jobname (str) – Jobname to use
  • completed_callback (callable) – Whether to start the job and wait, or call given function with Job object is parameter on completion.
Raises:
  • RuntimeError – If refine_type is not supported
  • RuntimeError – If launching the refinement job fails
  • RuntimeError – If the refinement job fails
Returns:

Refined structure

Return type:

schrodinger.structure.Structure object or schrodinger.job.jobcontrol.Job

runPrimeMinimization(jobname)

Shortcut to run a Prime minimization job

See:Refiner.refinePrime documentation
runPrimeResidue(jobname)

Shortcut to run a Prime residue refinement job

See:Refiner.refinePrime documentation
runPrimeSidechain(jobname)

Shortcut to run a Prime sidechain refinement job

See:Refiner.refinePrime documentation
runPrimeSidechainCBeta(jobname)

Shortcut to run a Prime sidechain refinement job with CA-CB vector sampling. This will vary the orientation of the CA-CB bond by up to 30 degrees from the initial direction.

See:Refiner.refinePrime documentation
runPrimeSidechainBB(jobname)

Shortcut to run a Prime sidechain refinement job with backbone sampling. This will sample the backbone by running a loop prediction on a set of 3 residues centered on the residue for which the side chain is being refined.

See:Refiner.refinePrime documentation
runPrimeLoopPrediction(jobname, start_res=None, end_res=None)

Shortcut to run a Prime loop prediction refinement job..

See:Refiner.refinePrime documentation
runPythonMinimize(jobname)

Shortcut to run a schrodinger.structutils.minimize.Minimizer job.

Parameters:jobname (str) – Jobname to use
Returns:Minimized structure
Return type:schrodinger.structure.Structure object
runRefinement(refine_type, jobname, **kwargs)

Shortcut to run any of the available refinement jobs.

Parameters:
  • refine_type (str) – The type of Prime refinement to run (see class variables)
  • jobname (str) – Jobname to use
Raises:
  • RuntimeError – If refine_type is not supported
  • RuntimeError – If the refinement job fails
Returns:

Refined structure

Return type:

schrodinger.structure.Structure object

class schrodinger.application.bioluminate.protein.Consensus(asl_map, minimum_number, dist_cutoff=2.0)

Bases: object

Access the atoms, residues, and molecules (or just their indices) that are considered to be consensus objects for a template structure and query structure. All properties are returned as an OrderedDict that maps the template objects to their consensus objects from the query structure.

Here is an example of how to get all the consensus waters between two protein structures. We define the cutoff here at 2 Angstroms:

from schrodinger.structure import StructureReader
from schrodinger.application.bioluminate import protein

pt = maestro.project_table_get()

# Create an ASL map for all ligands in the WS
asl_map = []
for row in pt.included_rows:
    st = row.getStructure()
    ligands = analyze.find_ligands(st)
    if not ligands:
        continue
    indices = []
    for ligand in ligands:
        indices.extend([str(i) for i in ligand.atom_indexes])

    asl = 'atom.n %s' % ','.join(indices)

    asl_map.append((st, asl))

# Create a consensus of all ligands, specifying that at least three
# structures must have a ligand atom within 2A from one another.
consensus = protein.Consensus(asl_map, 3, dist_cutoff=2)

# To get the atom objects
consensus_atoms = consensus.atoms

# To get the molecule objects
molecules = consensus.molecules
ASL_WATER = 'water and NOT (atom.ele H)'
ASL_IONS = 'ions'
ASL_LIGAND = '(((m.atoms 5-130)) and not ((ions) or (res.pt ACE ACT ACY BCT BME BOG CAC CIT CO3 DMS EDO EGL EPE FES FMT FS3 FS4 GOL HEC HED HEM IOD IPA MES MO6 MPD MYR NAG NCO NH2 NH3 NO3 PG4 PO4 POP SEO SO4 SPD SPM SUC SUL TRS )))'
__init__(asl_map, minimum_number, dist_cutoff=2.0)
Parameters:
  • asl_map (tuple of (structure, ASL)) – List of structures and the ASL used to limit the atoms used when calculating the consensus
  • minimum_number (int) – The minimum number of matches within structures. An atom will be considered a “consensus” atom if it is within the dist_cutoff of at least minimum_number of structures in the list of passed in structures.
  • dist_cutoff (float) – Distance in Angstroms used to define a consensus match
Attention:

The list of consensus atoms (or molecules, residues, indices, etc. depending on the property called, i.e. self.molecules) will all be unique and will depend on the ASL passed in. If the ASL is not specific enough you may end up with poor results.

getClosest(ref_atom, mob_atoms)

Gets the closest atom to the ref_atom from mob_atoms.

atoms

Get the map of atom objects of consensus atoms.

Returns:Atoms of consensus atoms
Return type:OrderedDict of atom objects where the keys are the template atoms and their values are the consensus atoms from the query.
atom_indices

Get the map of atom indices of consensus atoms.

Returns:Atom indices of consensus atoms
Return type:OrderedDict of ints where the keys are the template atom indices and their values are the consensus atom indices from the query.
residues

Get the list of residue objects of consensus atoms for each structure in self.asl_map.

Returns:Residues of consensus atoms
Return type:list of unique consensus residue objects for each structure in self.asl_map. (Order is maintained)
residue_indices

Get the map of residue indices of consensus atoms.

Returns:Residue indices of consensus atoms
Return type:list of unique consensus residue indices for each structure in self.asl_map. (Order is maintained)
molecules

Get the map of molecule objects of consensus atoms.

Returns:Molecules of consensus atoms
Return type:list of unique consensus molecule objects for each structure in self.asl_map. (Order is maintained)
molecule_indices

Get the map of molecule indices of consensus atoms.

Returns:Molecule indices of consensus atoms
Return type:list of unique consensus molecule indices for each structure in self.asl_map. (Order is maintained)