mailr27285 - in /trunk: lib/structure/internal/coordinates.py pipe_control/structure/main.py


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by edward on January 23, 2015 - 10:05:
Author: bugman
Date: Fri Jan 23 10:05:12 2015
New Revision: 27285

URL: http://svn.gna.org/viewcvs/relax?rev=27285&view=rev
Log:
The sequence alignment arguments are now passed all the way to the internal 
structural object backend.

These are the arguments of the structure.align user function.


Modified:
    trunk/lib/structure/internal/coordinates.py
    trunk/pipe_control/structure/main.py

Modified: trunk/lib/structure/internal/coordinates.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/lib/structure/internal/coordinates.py?rev=27285&r1=27284&r2=27285&view=diff
==============================================================================
--- trunk/lib/structure/internal/coordinates.py (original)
+++ trunk/lib/structure/internal/coordinates.py Fri Jan 23 10:05:12 2015
@@ -26,23 +26,35 @@
 from numpy import array, float64
 
 
-def assemble_coord_array(objects=None, object_names=None, molecules=None, 
models=None, atom_id=None, seq_info_flag=False):
+def assemble_coord_array(objects=None, object_names=None, molecules=None, 
models=None, atom_id=None, algorithm='NW70', matrix='BLOSUM62', 
gap_open_penalty=1.0, gap_extend_penalty=1.0, end_gap_open_penalty=0.0, 
end_gap_extend_penalty=0.0, seq_info_flag=False):
     """Assemble the atomic coordinates 
  
-    @keyword objects:       The list of internal structural objects to 
assemble the coordinates from.
-    @type objects:          list of str
-    @keyword object_names:  The list of names for each structural object to 
use in printouts.
-    @type object_names:     list of str
-    @keyword models:        The list of models for each structural object.  
The number of elements must match the objects argument.  If set to None, then 
all models will be used.
-    @type models:           None or list of lists of int
-    @keyword molecules:     The list of molecules for each structural 
object.  The number of elements must match the objects argument.  If set to 
None, then all molecules will be used.
-    @type molecules:        None or list of lists of str
-    @keyword atom_id:       The molecule, residue, and atom identifier 
string of the coordinates of interest.  This matches the spin ID string 
format.
-    @type atom_id:          None or str
-    @keyword seq_info_flag: A flag which if True will cause the atomic 
sequence information to be assembled and returned.  This includes the 
molecule names, residue names, residue numbers, atom names, and elements.
-    @type seq_info_flag:    bool
-    @return:                The array of atomic coordinates (first dimension 
is the model and/or molecule, the second are the atoms, and the third are the 
coordinates); a list of unique IDs for each structural object, model, and 
molecule; the common list of molecule names (if the seq_info_flag is set); 
the common list of residue names (if the seq_info_flag is set); the common 
list of residue numbers (if the seq_info_flag is set); the common list of 
atom names (if the seq_info_flag is set); the common list of element names 
(if the seq_info_flag is set).
-    @rtype:                 numpy rank-3 float64 array, list of str, list of 
str, list of str, list of int, list of str, list of str
+    @keyword objects:                   The list of internal structural 
objects to assemble the coordinates from.
+    @type objects:                      list of str
+    @keyword object_names:              The list of names for each 
structural object to use in printouts.
+    @type object_names:                 list of str
+    @keyword models:                    The list of models for each 
structural object.  The number of elements must match the objects argument.  
If set to None, then all models will be used.
+    @type models:                       None or list of lists of int
+    @keyword molecules:                 The list of molecules for each 
structural object.  The number of elements must match the objects argument.  
If set to None, then all molecules will be used.
+    @type molecules:                    None or list of lists of str
+    @keyword atom_id:                   The molecule, residue, and atom 
identifier string of the coordinates of interest.  This matches the spin ID 
string format.
+    @type atom_id:                      None or str
+    @keyword algorithm:                 The pairwise sequence alignment 
algorithm to use.
+    @type algorithm:                    str
+    @keyword matrix:                    The substitution matrix to use.
+    @type matrix:                       str
+    @keyword gap_open_penalty:          The penalty for introducing gaps, as 
a positive number.
+    @type gap_open_penalty:             float
+    @keyword gap_extend_penalty:        The penalty for extending a gap, as 
a positive number.
+    @type gap_extend_penalty:           float
+    @keyword end_gap_open_penalty:      The optional penalty for opening a 
gap at the end of a sequence.
+    @type end_gap_open_penalty:         float
+    @keyword end_gap_extend_penalty:    The optional penalty for extending a 
gap at the end of a sequence.
+    @type end_gap_extend_penalty:       float
+    @keyword seq_info_flag:             A flag which if True will cause the 
atomic sequence information to be assembled and returned.  This includes the 
molecule names, residue names, residue numbers, atom names, and elements.
+    @type seq_info_flag:                bool
+    @return:                            The array of atomic coordinates 
(first dimension is the model and/or molecule, the second are the atoms, and 
the third are the coordinates); a list of unique IDs for each structural 
object, model, and molecule; the common list of molecule names (if the 
seq_info_flag is set); the common list of residue names (if the seq_info_flag 
is set); the common list of residue numbers (if the seq_info_flag is set); 
the common list of atom names (if the seq_info_flag is set); the common list 
of element names (if the seq_info_flag is set).
+    @rtype:                             numpy rank-3 float64 array, list of 
str, list of str, list of str, list of int, list of str, list of str
     """
 
     # Assemble the atomic coordinates of all structures.

Modified: trunk/pipe_control/structure/main.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/pipe_control/structure/main.py?rev=27285&r1=27284&r2=27285&view=diff
==============================================================================
--- trunk/pipe_control/structure/main.py        (original)
+++ trunk/pipe_control/structure/main.py        Fri Jan 23 10:05:12 2015
@@ -151,8 +151,22 @@
     if centre_type not in allowed:
         raise RelaxError("The superimposition centre type '%s' is unknown.  
It must be one of %s." % (centre_type, allowed))
 
+    # Check the penalty arguments.
+    if gap_open_penalty != None:
+        if gap_open_penalty < 0.0:
+            raise RelaxError("The gap opening penalty %s must be a positive 
number." % gap_open_penalty)
+    if gap_extend_penalty != None:
+        if gap_extend_penalty < 0.0:
+            raise RelaxError("The gap extension penalty %s must be a 
positive number." % gap_extend_penalty)
+    if end_gap_open_penalty != None:
+        if end_gap_open_penalty < 0.0:
+            raise RelaxError("The end gap opening penalty %s must be a 
positive number." % end_gap_open_penalty)
+    if end_gap_extend_penalty != None:
+        if end_gap_extend_penalty < 0.0:
+            raise RelaxError("The end gap extension penalty %s must be a 
positive number." % end_gap_extend_penalty)
+
     # Assemble the atomic coordinates and obtain the corresponding element 
information.
-    coord, ids, mol_names, res_names, res_nums, atom_names, elements = 
assemble_coordinates(pipes=pipes, molecules=molecules, models=models, 
atom_id=atom_id, seq_info_flag=True)
+    coord, ids, mol_names, res_names, res_nums, atom_names, elements = 
assemble_coordinates(pipes=pipes, molecules=molecules, models=models, 
atom_id=atom_id, algorithm=algorithm, matrix=matrix, 
gap_open_penalty=gap_open_penalty, gap_extend_penalty=gap_extend_penalty, 
end_gap_open_penalty=end_gap_open_penalty, 
end_gap_extend_penalty=end_gap_extend_penalty, seq_info_flag=True)
 
     # Catch missing data.
     if len(coord[0]) == 0:
@@ -200,19 +214,33 @@
         i += 1
 
 
-def assemble_coordinates(pipes=None, molecules=None, models=None, 
atom_id=None, seq_info_flag=False):
-    """Assemble the atomic coordinates 
+def assemble_coordinates(pipes=None, molecules=None, models=None, 
atom_id=None, algorithm='NW70', matrix='BLOSUM62', gap_open_penalty=1.0, 
gap_extend_penalty=1.0, end_gap_open_penalty=0.0, end_gap_extend_penalty=0.0, 
seq_info_flag=False):
+    """Assemble the atomic coordinates.
  
-    @keyword pipes:         The data pipes to assemble the coordinates from.
-    @type pipes:            None or list of str
-    @keyword models:        The list of models for each data pipe.  The 
number of elements must match the pipes argument.  If set to None, then all 
models will be used.
-    @type models:           None or list of lists of int
-    @keyword molecules:     The list of molecules for each data pipe.  The 
number of elements must match the pipes argument.
-    @type molecules:        None or list of lists of str
-    @keyword atom_id:       The molecule, residue, and atom identifier 
string of the coordinates of interest.  This matches the spin ID string 
format.
-    @type atom_id:          None or str
-    @return:                The array of atomic coordinates (first dimension 
is the model and/or molecule, the second are the atoms, and the third are the 
coordinates); a list of unique IDs for each structural object, model, and 
molecule; the common list of molecule names (if the seq_info_flag is set); 
the common list of residue names (if the seq_info_flag is set); the common 
list of residue numbers (if the seq_info_flag is set); the common list of 
atom names (if the seq_info_flag is set); the common list of element names 
(if the seq_info_flag is set).
-    @rtype:                 numpy rank-3 float64 array, list of str, list of 
str, list of str, list of int, list of str, list of str
+    @keyword pipes:                     The data pipes to assemble the 
coordinates from.
+    @type pipes:                        None or list of str
+    @keyword models:                    The list of models for each data 
pipe.  The number of elements must match the pipes argument.  If set to None, 
then all models will be used.
+    @type models:                       None or list of lists of int
+    @keyword molecules:                 The list of molecules for each data 
pipe.  The number of elements must match the pipes argument.
+    @type molecules:                    None or list of lists of str
+    @keyword atom_id:                   The molecule, residue, and atom 
identifier string of the coordinates of interest.  This matches the spin ID 
string format.
+    @type atom_id:                      None or str
+    @keyword algorithm:                 The pairwise sequence alignment 
algorithm to use.
+    @type algorithm:                    str
+    @keyword matrix:                    The substitution matrix to use.
+    @type matrix:                       str
+    @keyword gap_open_penalty:          The penalty for introducing gaps, as 
a positive number.
+    @type gap_open_penalty:             float
+    @keyword gap_extend_penalty:        The penalty for extending a gap, as 
a positive number.
+    @type gap_extend_penalty:           float
+    @keyword end_gap_open_penalty:      The optional penalty for opening a 
gap at the end of a sequence.
+    @type end_gap_open_penalty:         float
+    @keyword end_gap_extend_penalty:    The optional penalty for extending a 
gap at the end of a sequence.
+    @type end_gap_extend_penalty:       float
+    @keyword seq_info_flag:             A flag which if True will cause the 
atomic sequence information to be assembled and returned.  This includes the 
molecule names, residue names, residue numbers, atom names, and elements.
+    @type seq_info_flag:                bool
+    @return:                            The array of atomic coordinates 
(first dimension is the model and/or molecule, the second are the atoms, and 
the third are the coordinates); a list of unique IDs for each structural 
object, model, and molecule; the common list of molecule names (if the 
seq_info_flag is set); the common list of residue names (if the seq_info_flag 
is set); the common list of residue numbers (if the seq_info_flag is set); 
the common list of atom names (if the seq_info_flag is set); the common list 
of element names (if the seq_info_flag is set).
+    @rtype:                             numpy rank-3 float64 array, list of 
str, list of str, list of str, list of int, list of str, list of str
     """
 
     # The data pipes to use.
@@ -241,7 +269,7 @@
         object_names.append(pipes[pipe_index])
 
     # Call the library method to do all of the work.
-    return assemble_coord_array(objects=objects, object_names=object_names, 
molecules=molecules, models=models, atom_id=atom_id, 
seq_info_flag=seq_info_flag)
+    return assemble_coord_array(objects=objects, object_names=object_names, 
molecules=molecules, models=models, atom_id=atom_id, algorithm=algorithm, 
matrix=matrix, gap_open_penalty=gap_open_penalty, 
gap_extend_penalty=gap_extend_penalty, 
end_gap_open_penalty=end_gap_open_penalty, 
end_gap_extend_penalty=end_gap_extend_penalty, seq_info_flag=seq_info_flag)
 
 
 def atomic_fluctuations(pipes=None, models=None, molecules=None, 
atom_id=None, measure='distance', file=None, format='text', dir=None, 
force=False):




Related Messages


Powered by MHonArc, Updated Fri Jan 23 11:00:03 2015