mailr18538 - /trunk/generic_fns/structure/pdb_write.py


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

Header


Content

Posted by edward on February 20, 2013 - 16:40:
Author: bugman
Date: Wed Feb 20 16:40:01 2013
New Revision: 18538

URL: http://svn.gna.org/viewcvs/relax?rev=18538&view=rev
Log:
Created the generic_fns.structure.pdb_write._handle_text() function.

This private function is used to convert text into PDB suitable format 
(uppercase and values of None
converted to empty strings).


Modified:
    trunk/generic_fns/structure/pdb_write.py

Modified: trunk/generic_fns/structure/pdb_write.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/generic_fns/structure/pdb_write.py?rev=18538&r1=18537&r2=18538&view=diff
==============================================================================
--- trunk/generic_fns/structure/pdb_write.py (original)
+++ trunk/generic_fns/structure/pdb_write.py Wed Feb 20 16:40:01 2013
@@ -47,6 +47,26 @@
 
     # Normal value.
     return value
+
+
+def _handle_text(text):
+    """Auxiliary function for handling text values.
+
+    This will convert None to empty strings and make sure everything is 
capitalised.
+
+
+    @param text:    The text to convert.
+    @type text:     anything
+    @return:        If the text is None, then an empty string.  All text 
will be capitalised.
+    @rtype:         anything
+    """
+
+    # Handle None.
+    if text == None:
+        return ''
+
+    # Return capitalised text.
+    return text.upper()
 
 
 def _record_validate(record):
@@ -849,7 +869,7 @@
         _handle_none(seq_num),
         _handle_none(icode),
         _handle_none(num_het_atoms),
-        _handle_none(text),
+        _handle_text(text),
         ''
     )
 
@@ -1082,7 +1102,7 @@
         'HETNAM',
         _handle_none(continuation),
         _handle_none(het_id),
-        _handle_none(text)
+        _handle_text(text)
     )
 
     # Validate.




Related Messages


Powered by MHonArc, Updated Wed Feb 20 17:00:01 2013