import CalcModes2 import os,sys,string,re, time import analyspdb def start_it(): pdb_codes = ['1qla_ABC'] dir = '' errors = [] for code in pdb_codes: pdbstruct = open( 'structures/' + code + '.pdb', 'r').read() pdbfilename = dir + code + '.pdb' pdbfile = open(pdbfilename, 'w') pdbfile.write(pdbstruct) pdbfile.close() # Checking for the length of the structure. No structure should be larger # than 20000 residues. calphanb = analyspdb.analyspdb(pdbstruct) if (calphanb > 20000): results['messages'] = 'This server does not support systems with more than 20000 residues' results['status']='FAILED' else: print 'number of ca atoms:',calphanb ## calculation of the modes print 'Calculating the normal modes...' if exists(dir + code + '.mode') == 1: modefile_name = dir + code + '.mode' else: try: result = CalcModes2.CalcModes(pdbfilename, dir + code + '.mode') print result except AttributeError: errors.append(code) print 'modes cannot be calulated' print errors def exists(name): exists = 1 try: about = os.stat(name) print "Size of file is "+str(about[6])+ " bytes" except OSError: print "File does not exist or is not accessible" exists = 0 return exists if __name__ == '__main__': start_it()