Author: bugman Date: Mon Jan 12 14:13:02 2009 New Revision: 8406 URL: http://svn.gna.org/viewcvs/relax?rev=8406&view=rev Log: Shifted __fill_object_from_pdb() from the Internal class to MolContainer. Modified: branches/multi_structure/generic_fns/structure/internal.py Modified: branches/multi_structure/generic_fns/structure/internal.py URL: http://svn.gna.org/viewcvs/relax/branches/multi_structure/generic_fns/structure/internal.py?rev=8406&r1=8405&r2=8406&view=diff ============================================================================== --- branches/multi_structure/generic_fns/structure/internal.py (original) +++ branches/multi_structure/generic_fns/structure/internal.py Mon Jan 12 14:13:02 2009 @@ -192,42 +192,6 @@ # Return the information. return bonded_num, bonded_name, element, pos, attached_name, None - - - def __fill_object_from_pdb(self, records, model_index, mol_index): - """Method for generating a complete Structure_container object from the given PDB records. - - @param records: A list of structural PDB records. - @type records: list of str - @param model_index: The model index. - @type model_index: int - @param mol_index: The molecule index. - @type mol_index: int - """ - - # Loop over the records. - for record in records: - # Parse the record. - record = self.__parse_pdb_record(record) - - # Nothing to do. - if not record: - continue - - # Add the atom. - if record[0] == 'ATOM' or record[0] == 'HETATM': - self.atom_add(pdb_record=record[0], atom_num=record[1], atom_name=record[2], res_name=record[4], chain_id=record[5], res_num=record[6], pos=[record[8], record[9], record[10]], segment_id=record[13], element=record[14], model_index=model_index, mol_index=mol_index) - - # Connect atoms. - if record[0] == 'CONECT': - # Loop over the atoms of the record. - for i in xrange(len(record)-2): - # Skip if there is no record. - if record[i+2] == None: - continue - - # Make the connection. - self.atom_connect(index1=self.__atom_index(record[1], struct_index), index2=self.__atom_index(record[i+2], struct_index), struct_index=struct_index) def __find_bonded_atoms(self, index, struct_index, radius=1.2): @@ -1009,7 +973,7 @@ self.structural_data[-1].mol.add_item(mol_name=new_mol_name, mol_cont=mol) # Fill the molecular data object. - self.__fill_object_from_pdb(mol_records, model_index=len(self.structural_data), mol_index=len(self.structural_data[-1].mol)) + self.structural_data[-1].mol[-1].__fill_object_from_pdb(mol_records) # Increment the molecule index. mol_index = mol_index + 1 @@ -1450,3 +1414,35 @@ # The z coordinate (array of float). self.z = [] + + + def __fill_object_from_pdb(self, records): + """Method for generating a complete Structure_container object from the given PDB records. + + @param records: A list of structural PDB records. + @type records: list of str + """ + + # Loop over the records. + for record in records: + # Parse the record. + record = self.__parse_pdb_record(record) + + # Nothing to do. + if not record: + continue + + # Add the atom. + if record[0] == 'ATOM' or record[0] == 'HETATM': + self.atom_add(pdb_record=record[0], atom_num=record[1], atom_name=record[2], res_name=record[4], chain_id=record[5], res_num=record[6], pos=[record[8], record[9], record[10]], segment_id=record[13], element=record[14]) + + # Connect atoms. + if record[0] == 'CONECT': + # Loop over the atoms of the record. + for i in xrange(len(record)-2): + # Skip if there is no record. + if record[i+2] == None: + continue + + # Make the connection. + self.atom_connect(index1=self.__atom_index(record[1], struct_index), index2=self.__atom_index(record[i+2], struct_index))