else: file_out.write("HETATM") file_out.write(" %6s"%Atom.number) #2 file_out.write(" " + Atom.element) #3 file_out.write(" %5s"%Atom.name) #4 file_out.write(" " + Atom.parent.type) #5 if Atom.parent.parent.name == ' ': file_out.write(" ?") #6 else: file_out.write(" " + Atom.parent.parent.name) file_out.write(" %5d"%int(Atom.parent.number)) #7 file_out.write(" %7.3f"%Atom._coords[0][0]) #8 file_out.write(" %7.3f"%Atom._coords[0][1]) #9 file_out.write(" %7.3f"%Atom._coords[0][2]) #10 file_out.write(" %6.2f"%float(Atom.occupancy)) #11 file_out.write(" %6.2f"%float(Atom.temperatureFactor)) #12 file_out.write("\n") file_out.close() if __name__ == '__main__': from MolKit.mmcifParser import MMCIFParser parser = MMCIFParser( filename='Tests/Data/1CRN.cif' ) print "Reading molecule" mol = parser.parse() print "Done parsing" SS_Data = parser.parseSSData( mol ) print "Done parsing secondary structure" writer = MMCIFWriter() writer.write('Tests/Data/1CRN_.cif',mol) print "Done"
file_out.write("HETATM") file_out.write(" %6s" % Atom.number) #2 file_out.write(" " + Atom.element) #3 file_out.write(" %5s" % Atom.name) #4 file_out.write(" " + Atom.parent.type) #5 if Atom.parent.parent.name == ' ': file_out.write(" ?") #6 else: file_out.write(" " + Atom.parent.parent.name) file_out.write(" %5d" % int(Atom.parent.number)) #7 file_out.write(" %7.3f" % Atom._coords[0][0]) #8 file_out.write(" %7.3f" % Atom._coords[0][1]) #9 file_out.write(" %7.3f" % Atom._coords[0][2]) #10 file_out.write(" %6.2f" % float(Atom.occupancy)) #11 file_out.write(" %6.2f" % float(Atom.temperatureFactor)) #12 file_out.write("\n") file_out.close() if __name__ == '__main__': from MolKit.mmcifParser import MMCIFParser parser = MMCIFParser(filename='Tests/Data/1CRN.cif') print "Reading molecule" mol = parser.parse() print "Done parsing" SS_Data = parser.parseSSData(mol) print "Done parsing secondary structure" writer = MMCIFWriter() writer.write('Tests/Data/1CRN_.cif', mol) print "Done"
def test_parseSSData(self): """Check that parseSSData() parses secondary structure""" parser1 = MMCIFParser(filename='Data/1CRN.cif') mols1 = parser1.parse() ssDataForMol = parser1.parseSSData(mols1)