Hi Yuri,

for example, you can use cctbx for this. Using cctbx you can do somethings
as simple as b-factor statistics (see example below) or as complex as write
your own refinement program (phenix.refine can serve as an example).

Example: compute min/max/mean B-factor for all atoms and for CA atoms in
chain A:

********
from scitbx.array_family import flex
import iotbx.pdb
import sys

def run(args):
  assert len(args) == 1
  pdb_file_name = args[0]
  pdb_input = iotbx.pdb.input(file_name = pdb_file_name)
  atoms = pdb_input.atoms()
  b_factors = atoms.extract_b()
  print "Min, max, mean b_factor:", flex.min(b_factors),
flex.max(b_factors), \
    flex.mean(b_factors)
  pdb_hierarchy = pdb_input.construct_hierarchy()
  selection_ca_atoms = pdb_hierarchy.atom_selection_cache().selection(
    string = "chain A and name CA")
  b_factors_ca = b_factors.select(selection_ca_atoms)
  print "Number of CA atoms in chain A:", selection_ca_atoms.count(True)
  print "Total number of atoms:", selection_ca_atoms.size()
  print "Min, max, mean b_factor for CA atoms in chain A:", \
    flex.min(b_factors_ca), flex.max(b_factors_ca), flex.mean(b_factors_ca)

if (__name__ == "__main__"):
  run(args=sys.argv[1:])
********

Save the code enclosed between "********" into a file, say example.py, and
then run it with your PDB file like this:

cctbx.python example.py model.pdb

and it will output something like this:

Min, max, mean b_factor: 4.4 44.08 9.82779166667
Number of CA atoms in chain A: 16
Total number of atoms: 240
Min, max, mean b_factor for CA atoms in chain A: 5.14 8.29 6.390625

Pavel

On Mon, Jan 23, 2012 at 8:59 PM, Ethan Merritt <merr...@u.washington.edu>wrote:

> On Monday, 23 January 2012, Yuri Pompeu wrote:
> > Hello Everyone,
> > I want to play around with some coding/programming. Just simple
> calculations from an
> > input PDB file, B factors averages, occupancies, molecular weight, so
> forth...
> > What should I use python,C++, visual basic?
>
> What you describe is primarily a task of processing the text in a PDB file.
> I would recommend perl, with python as a more trendy alternative.
>
> If this is to be a springboard for a larger project, then you might choose
> instead to use a standard library like cctbx to do the fiddly stuff and
> call it from a higher level language (C or C++).
>
>        Ethan
>

Reply via email to