[BioPython] transformation and PDBIO

Hua Wong wong at ebgm.jussieu.fr
Tue Jun 22 04:05:28 EDT 2004


I worked on this part of the night, and I would like to have a bit more
information about using the transform method in atom.

So basically, when I want to transform only one chain, in one model, I
do:
>>> parser=PDBParser(PERMISSIVE=0)
>>> structure=parser.get_structure('0b','1F88.pdb')
>>> model=structure[0]
>>> chain=model['A']
>>> for residue in chain.get_iterator():
...     for atom in residue.get_iterator():
...             atom.transform(rot,trans)  # rot & trans being any given
value I fancy...

Tried atom.transform(90,0)
And by looking at the PDBIO output with pymol it works fine (at least,
it changes the coordinate)...
But I didn't manage to understand how to use it correctly.

For example, how to tell him to do a rotation on one axis only?
A 90° degree rotation on X for example?
atom.transform([90,0,0],0) is what I tried, because it was the only idea
that came to me at 2.00 am... 

atom.transform() didn't seems to mind. But not PDBIO.

Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/home/pif/wong/Softwares/MMTK/lib/python/Bio/PDB/PDBIO.py", line
134, in save
    resseq, icode, chain_id)
  File "/home/pif/wong/Softwares/MMTK/lib/python/Bio/PDB/PDBIO.py", line
71, in _get_atom_line
    x, y, z=atom.get_coord()
TypeError: unpack non-sequence

Second part of my question is more PDBIO specific.
I want to save only the part I modified...
I read the various online biopython docs about save in PDBIO and typed:

>>> io=PDBIO()
>>> io.set_structure(structure)
>>> io.save('out.pdb',io.select=(chain)) ## thought about
chain=model['A']
SyntaxError: keyword can't be an expression

or 
>>> io.save('out.pdb',io.select=(accept_chain(chain))
...
...

I am out of idea for now...any help would be just fine.

Thanks



More information about the BioPython mailing list