Package schrodinger :: Package application :: Package bioluminate :: Module protein :: Class Mutator
[hide private]
[frames] | no frames]

Class Mutator

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.StructureReader('receptor.maegz').next()

 # 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_mutation_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)

To Do: Add logging

Instance Methods [hide private]
 
__init__(self, ref_struct, mutations, concurrent=1, sequential=False)
generator
generate(self)
Used to loop over all mutations.
Static Methods [hide private]
 
validate_mutated_residues(residues)
Method for validating the residues used in mutations passed in to the C{MutateProtein} class.
 
validate_mutations(mutations)
Private method for validating the mutations passed in to the C{MutateProtein} class.
list of tuples
convert_mutation_file(filename, regex=re.compile(r'(?x)(?P<chain>[a-zA-Z_]{1}):(?P<resnum>\d+)(?P<in...)
Converts lines in filename into a list of mutations to use.
list of tuples
convert_mutation_list(residues, mutations)
Validates a list of residues and mutations returning a list of tuples.
Class Variables [hide private]
  MUTATIONS_PROPERTY = 's_bioluminate_Mutations'
  UNFOLDED_PROPERTY = 'r_bioluminate_Unfolded_Contribution'
  GXG_DATA = {'ALA': 6.34321223709, 'ARG': 14.0057361377, 'ARN':...
  SUPPORTED_BUILD_RESIDUES = ['ALA', 'ARG', 'ASN', 'ASP', 'CYS',...
Properties [hide private]
  mutations
The list of mutations that will be carried out
  total_mutations
Total number of mutations that will be generated
Method Details [hide private]

__init__(self, ref_struct, mutations, concurrent=1, sequential=False)
(Constructor)

 
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 (only support 1 or 2 now)
  • sequential (bool) - Limit concurrent mutations to being sequential
Raises:
  • RuntimeError - If concurrent is not set to 1 or 2

See Also: For easy creation of mutations variable Mutator.convert_mutation_list

validate_mutated_residues(residues)
Static Method

 

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

@raise ValueError: If the 3-letter residue name is not supported
                   by the L{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

validate_mutations(mutations)
Static Method

 

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

@raise ValueError: If the C{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 L{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

convert_mutation_file(filename, regex=re.compile(r'(?x)(?P<chain>[a-zA-Z_]{1}):(?P<resnum>\d+)(?P<in...)
Static Method

 

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

Parameters:
  • fileobj (file) - The open file object containing the list of mutations.
Returns: list of tuples
List of mutations with valid syntax for the class
Raises:
  • RuntimeError - If any of chain, resnum or mutation is missing

convert_mutation_list(residues, mutations)
Static Method

 

Validates a list of residues and mutations returning a list of tuples. Each tuple is ( "chain", "resnum", "inscode", "three-letter resnames for mutations").

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

generate(self)

 

Used to loop over all mutations.

Returns: generator
Generator for all mutations defined in self.mutations Each step of generator yields a mutation.

Class Variable Details [hide private]

GXG_DATA

Value:
{'ALA': 6.34321223709,
 'ARG': 14.0057361377,
 'ARN': 14.0057361377,
 'ASH': 5.51864244742,
 'ASN': 16.2906309751,
 'ASP': 5.51864244742,
 'CYS': 12.9995219885,
 'GLH': 7.98757170172,
...

SUPPORTED_BUILD_RESIDUES

Value:
['ALA',
 'ARG',
 'ASN',
 'ASP',
 'CYS',
 'GLN',
 'GLU',
 'GLY',
...

Property Details [hide private]

mutations

The list of mutations that will be carried out

Get Method:
unreachable.mutations(self) - The list of mutations that will be carried out
Set Method:
unreachable.mutations(self, mutations) - The setter method for self.mutations.

total_mutations

Total number of mutations that will be generated

Get Method:
unreachable.total_mutations(self) - Total number of mutations that will be generated