#!/usr/bin/python # takes the 'blank' pdb file and fills in x,y,z values from the corresponding # residues in the 1ihr pdb file # we have to be able to open, read and write to .gz files... # we note that the T0240 index 15 corresponds to index 216 in 1ihr # then skip fifteen again and continue with 1ihr include gzip PDB = "/projects/compbio/data/pdb/" CASP = "~/casp6/T0240/dimer/" def skiptoatoms(pdb,tolines=None): for i in range(len(pdb)): if pdb[i][0:4]=="ATOM": break if tolines: tolines.append(pdb[i]) # truncate the file pdb = pdb[i:] def skipresidues(pdb,start,count): # get current residues fields = pdb[start].split() if f = GZipFile.open(PDB+"1ihr.pdb.gz") ihr = f.readlines() f.close() f = GZipFile.open(CASP+"T0240.blank.pdb.gz") T0240 = f.readlines() f.close() T0240new = [] skiptoatoms(ihr) skiptoatoms(T0240,T0240new) # skip 15 residues