mailr13165 - in /branches/xyz: data/mol_res_spin.py generic_fns/structure/main.py


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

Header


Content

Posted by hasu on June 22, 2011 - 17:11:
Author: han87
Date: Wed Jun 22 17:11:05 2011
New Revision: 13165

URL: http://svn.gna.org/viewcvs/relax?rev=13165&view=rev
Log:
Debugging the user function load_spins() and add_item().

In the function load_spins() in generic_fns/structure/main.py a parameter 
'res_num_exist' was added to check whether in the structural data the residue 
number exists or not. Normally in the pdb file there is a residue number and 
in the xyz file not. And then this parameter was used as a flag in the 
add_item() to avoid the Error message 'RelaxError("The residue number '" + 
repr(res_num) + "' already exists in the sequence.")' in case for xyz file 
when residue number does not exist. 

Modified:
    branches/xyz/data/mol_res_spin.py
    branches/xyz/generic_fns/structure/main.py

Modified: branches/xyz/data/mol_res_spin.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/xyz/data/mol_res_spin.py?rev=13165&r1=13164&r2=13165&view=diff
==============================================================================
--- branches/xyz/data/mol_res_spin.py (original)
+++ branches/xyz/data/mol_res_spin.py Wed Jun 22 17:11:05 2011
@@ -458,7 +458,7 @@
         return text
 
 
-    def add_item(self, res_name=None, res_num=None):
+    def add_item(self, res_name=None, res_num=None, res_num_exist=None):
         """Append an empty ResidueContainer to the ResidueList."""
 
         # If no residue data exists, replace the empty first residue with 
this residue.
@@ -478,7 +478,8 @@
                 # No residue numbers.
                 else:
                     if self[i].name == res_name:
-                        raise RelaxError("The unnumbered residue name '" + 
repr(res_name) + "' already exists.")
+                        if res_num_exist==False:
+                            raise RelaxError("The unnumbered residue name '" 
+ repr(res_name) + "' already exists.")
 
             # Append a new ResidueContainer.
             self.append(ResidueContainer(res_name, res_num))

Modified: branches/xyz/generic_fns/structure/main.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/xyz/generic_fns/structure/main.py?rev=13165&r1=13164&r2=13165&view=diff
==============================================================================
--- branches/xyz/generic_fns/structure/main.py (original)
+++ branches/xyz/generic_fns/structure/main.py Wed Jun 22 17:11:05 2011
@@ -175,6 +175,7 @@
     res_names = []
     spin_nums = []
     spin_names = []
+    res_num_exist = False
 
     # Loop over all atoms of the spin_id selection.
     model_index = -1
@@ -185,6 +186,10 @@
             model_index = model_index + 1
             last_model = model_num
 
+        # Check whether the res_num exists
+        if not res_num:
+            res_num_exist = True
+
         # Remove the '+' regular expression character from the mol, res, and 
spin names!
         if mol_name and search('\+', mol_name):
             mol_name = replace(mol_name, '+', '')
@@ -237,7 +242,7 @@
         # Add the residue if it doesn't exist.
         if res_cont == None:
             # Add the residue.
-            mol_cont.res.add_item(res_name=res_name, res_num=res_num)
+            mol_cont.res.add_item(res_name=res_name, res_num=res_num, 
res_num_exist=res_num_exist)
 
             # Get the container.
             res_cont = mol_cont.res[-1]




Related Messages


Powered by MHonArc, Updated Wed Jun 22 17:20:01 2011