17 from rosetta
import Pose
18 from rosetta
import pose_from_pdb
21 def cleanATOM( pdb_file , out_file = '', edit = -4 ):
23 Writes all lines in the PDB file <pdb_file> beginning with "ATOM" or
24 "TER" into <out_file> (defaults to <pdb_file>.clean.pdb)
25 note: the third argument, <edit>, if for PDB files not ending in .pdb
40 if os.path.exists( os.getcwd() +
'/' + pdb_file ):
42 fid =
open(pdb_file,
'r')
43 data = fid.readlines()
47 if i[:5] ==
'ATOM ' or i[:4] ==
'TER ':
52 out_file = pdb_file[:edit]+
'.clean.pdb'
54 print 'if the file',out_file,
'already exists, it will be overwritten'
55 fid =
open(out_file,
'w')
58 print 'PDB',pdb_file,
'successfully cleaned, non-ATOM lines removed\nclean data written to',out_file
61 print 'No such file or directory named '+pdb_file
68 def cleanCRYS( pdb_file , olig = 2 , out_file = '' ):
70 Writes a PDB file for a monomer of <pdb_file> if it is a <olig>-mer
71 to <out_file> (defaults to <pdb_file>.mono.pdb)
72 note: this is a simple sequence comparison
75 cleanCRYS('1YY8.pdb',2)
84 if os.path.exists( os.getcwd() +
'/' + pdb_file ):
86 pose = pose_from_pdb(pdb_file)
87 tot = pose.total_residue()
91 match = [
False]*(olig-1)
94 for f
in range(
int(olig)):
98 for f
in range(
int(olig-1)):
99 match[f] = (frags[0]==frags[f+1])
101 if sum(match)==(olig-1):
102 for i
in range(frac*
int(olig-1)):
103 pose.delete_polymer_residue(frac+1)
106 out_file = pdb_file[:-4]+
'.mono.pdb'
107 print 'if the file',out_file,
' already exists, it will be overwritten'
108 pose.dump_pdb(out_file)
109 print 'PDB',pdb_file,
'successfully cleaned, redundant monomers removed\nmonomer data written to',out_file
112 print pdb_file,
'is not a '+str(
int(olig))+
'-mer'
115 print 'No such file or directory named '+pdb_file
Real sum(ddGs &scores_to_sum)
bool open(utility::io::izstream &db_stream, std::string const &db_file, bool warn)
Open a database file on a provided stream.
core::Real round(core::Real d, core::Size digits)