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
  +
  +
"""
  +
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"):
 
if residue.has_id("CB"):

Revision as of 20:22, 8 May 2009

  1. ! /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"]
  1. print "CB"
  2. 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"]
  1. print " O"
  2. 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)