Author: bugman Date: Tue Mar 19 13:48:34 2013 New Revision: 18874 URL: http://svn.gna.org/viewcvs/relax?rev=18874&view=rev Log: HELIX PDB records are now read, stored, and written out by the internal structural object. This affects the structure.read_pdb and structure.write_pdb user functions. The helix is stored as a metadata type object - its elements do not correspond to the atoms in the structural object. Modified: trunk/generic_fns/structure/internal.py trunk/generic_fns/structure/pdb_write.py Modified: trunk/generic_fns/structure/internal.py URL: http://svn.gna.org/viewcvs/relax/trunk/generic_fns/structure/internal.py?rev=18874&r1=18873&r2=18874&view=diff ============================================================================== --- trunk/generic_fns/structure/internal.py (original) +++ trunk/generic_fns/structure/internal.py Tue Mar 19 13:48:34 2013 @@ -444,6 +444,16 @@ # No match, therefore assume to be out of the secondary structure section. if lines[i][:6] not in records: break + + # A helix. + if lines[i][:5] == 'HELIX': + # Parse the record. + record_type, ser_num, helix_id, init_res_name, init_chain_id, init_seq_num, init_icode, end_res_name, end_chain_id, end_seq_num, end_icode, helix_class, comment, length = pdb_read.helix(lines[i]) + + # Store the data. + if not hasattr(self, 'helices'): + self.helices = [] + self.helices.append([helix_id, init_chain_id, init_res_name, init_seq_num, end_chain_id, end_res_name, end_seq_num, helix_class, length]) # Return the remaining lines. return lines[i:] @@ -1851,6 +1861,23 @@ pdb_write.formul(file, comp_num=i+1, het_id=het[1], text=formula) + ############################### + # Secondary structure section # + ############################### + + # The HELIX records. + #################### + + # Printout. + print("HELIX") + + # Loop over and unpack the helix data. + index = 1 + for helix_id, init_chain_id, init_res_name, init_seq_num, end_chain_id, end_res_name, end_seq_num, helix_class, length in self.helices: + pdb_write.helix(file, ser_num=index, helix_id=helix_id, init_chain_id=init_chain_id, init_res_name=init_res_name, init_seq_num=init_seq_num, end_chain_id=end_chain_id, end_res_name=end_res_name, end_seq_num=end_seq_num, helix_class=helix_class, length=length) + index += 1 + + ###################### # Coordinate section # ###################### Modified: trunk/generic_fns/structure/pdb_write.py URL: http://svn.gna.org/viewcvs/relax/trunk/generic_fns/structure/pdb_write.py?rev=18874&r1=18873&r2=18874&view=diff ============================================================================== --- trunk/generic_fns/structure/pdb_write.py (original) +++ trunk/generic_fns/structure/pdb_write.py Tue Mar 19 13:48:34 2013 @@ -686,7 +686,7 @@ file.write('\n') -def helix(file, ser_num='', helix_id='', init_res_name='', init_chain_id='', init_seq_id='', init_icode='', end_res_name='', end_chain_id='', end_seq_num='', end_icode='', helix_class='', comment='', length=''): +def helix(file, ser_num='', helix_id='', init_res_name='', init_chain_id='', init_seq_num='', init_icode='', end_res_name='', end_chain_id='', end_seq_num='', end_icode='', helix_class='', comment='', length=''): """Generate the HELIX record. The following is the PDB v3.3 documentation U{http://www.wwpdb.org/documentation/format33/sect5.html#HELIX}. @@ -788,8 +788,8 @@ @type init_res_name: str @keyword init_chain_id: The chain identifier @type init_chain_id: str - @keyword init_seq_id: The sequence number of the initial residue - @type init_seq_id: int + @keyword init_seq_num: The sequence number of the initial residue + @type init_seq_num: int @keyword init_icode: The insertion code of the initial residue @type init_icode: str @keyword end_res_name: The name of the terminal residue @@ -815,7 +815,7 @@ _handle_none(helix_id), _handle_none(init_res_name), _handle_none(init_chain_id), - _handle_none(init_seq_id), + _handle_none(init_seq_num), _handle_none(init_icode), _handle_none(end_res_name), _handle_none(end_chain_id),