Difference between revisions of "Pdb to movie.py"

From CUC3
Jump to navigation Jump to search
import>Mp466
import>Mp466
Line 1: Line 1:
#! /usr/bin/env python
+
#! /usr/bin/env python
  +
 
"""
+
"""
 
Calculates the movieseg from a given PDB file
 
Calculates the movieseg from a given PDB file
  +
 
 
arguments:
 
arguments:
+
 
PDBfile - the PDB file to score
 
PDBfile - the PDB file to score
  +
 
50 format('CA: ',3(f8.3,1x),'CB: ',3(f8.3,1x),'Ox: ', 3(f8.3,1x))
 
334 format(4(i8,1x),' nmres nmcrd numpro nmsnap')
  +
 
"""
  +
 
import sys
 
import string
 
from Bio.PDB.PDBParser import PDBParser
   
 
PDBfile='1uzc'
50 format('CA: ',3(f8.3,1x),'CB: ',3(f8.3,1x),'Ox: ', 3(f8.3,1x))
 
 
pars = PDBParser(PERMISSIVE = 1)
334 format(4(i8,1x),' nmres nmcrd numpro nmsnap')
 
 
struct = pars.get_structure(PDBfile.rstrip('.pdb'), PDBfile)
 
model = struct.child_list[0]
 
chain = model.child_list[0]
  +
 
print " 69 3 1 1 nmres nmcrd numpro nmsnap"
   
 
for residue in chain:
"""
 
 
import sys
 
import string
 
from Bio.PDB.PDBParser import PDBParser
 
 
PDBfile='1uzc'
 
pars = PDBParser(PERMISSIVE = 1)
 
struct = pars.get_structure(PDBfile.rstrip('.pdb'), PDBfile)
 
model = struct.child_list[0]
 
chain = model.child_list[0]
 
 
print " 69 3 1 1 nmres nmcrd numpro nmsnap"
 
 
for residue in chain:
 
 
cx=0.0
 
cx=0.0
 
cy=0.0
 
cy=0.0
Line 35: Line 35:
 
oy=0.0
 
oy=0.0
 
oz=0.0
 
oz=0.0
  +
 
 
if residue.has_id("CA"):
 
if residue.has_id("CA"):
 
ca=residue["CA"]
 
ca=residue["CA"]
Line 41: Line 41:
 
cy=ca.get_coord()[1]
 
cy=ca.get_coord()[1]
 
cz=ca.get_coord()[2]
 
cz=ca.get_coord()[2]
  +
 
 
if residue.has_id("CB"):
 
if residue.has_id("CB"):
 
cb=residue["CB"]
 
cb=residue["CB"]
# print "CB"
+
# print "CB"
# print cb.get_coord()
+
# print cb.get_coord()
 
cbx=cb.get_coord()[0]
 
cbx=cb.get_coord()[0]
 
cby=cb.get_coord()[1]
 
cby=cb.get_coord()[1]
Line 56: Line 56:
 
if residue.has_id("O"):
 
if residue.has_id("O"):
 
o=residue["O"]
 
o=residue["O"]
# print " O"
+
# print " O"
# print o.get_coord()
+
# print o.get_coord()
 
ox=o.get_coord()[0]
 
ox=o.get_coord()[0]
 
oy=o.get_coord()[1]
 
oy=o.get_coord()[1]

Revision as of 20:23, 8 May 2009

#! /usr/bin/env python

"""
   Calculates the movieseg from a given PDB file

   arguments:
    
   PDBfile - the PDB file to score

50       format('CA: ',3(f8.3,1x),'CB: ',3(f8.3,1x),'Ox: ', 3(f8.3,1x))
334     format(4(i8,1x),' nmres nmcrd numpro nmsnap')

"""

import sys
import string
from Bio.PDB.PDBParser import PDBParser
PDBfile='1uzc'
pars = PDBParser(PERMISSIVE = 1)
struct = pars.get_structure(PDBfile.rstrip('.pdb'), PDBfile)
model = struct.child_list[0]
chain = model.child_list[0]

print "      69        3        1        1  nmres nmcrd numpro nmsnap"
for residue in chain:
  cx=0.0
  cy=0.0
  cz=0.0
  cbx=0.0
  cby=0.0
  cbz=0.0
  ox=0.0
  oy=0.0
  oz=0.0

  if residue.has_id("CA"):
      ca=residue["CA"]
      cx=ca.get_coord()[0]
      cy=ca.get_coord()[1]
      cz=ca.get_coord()[2]

  if residue.has_id("CB"):
      cb=residue["CB"]
#       print "CB"
#       print cb.get_coord()
      cbx=cb.get_coord()[0]
      cby=cb.get_coord()[1]
      cbz=cb.get_coord()[2]
  else:
      cbx=cx
      cby=cy
      cbz=cz
  if residue.has_id("O"):
      o=residue["O"]
#       print " O"
#       print o.get_coord()
      ox=o.get_coord()[0]
      oy=o.get_coord()[1]
      oz=o.get_coord()[2]
  print "CA: %8.3f %8.3f %8.3f CB: %8.3f %8.3f %8.3f OX: %8.3f %8.3f %8.3f" % (cx,cy,cz,cbx,cby,cbz,ox,oy,oz)