[Biopython] Writing into a PDB file using PDBIO module

life happy iitlife2008 at gmail.com
Thu Jul 23 17:45:46 UTC 2009


Hi Peter ,

Thanks, the links were helpful. But I am facing this problem.

from Bio.PDB.PDBParser import PDBParser
parser = PDBParser()
filehandle = gzip.open(os.path.join("3dh4.pdb"), 'rb')
structure = parser.get_structure( "3DH4", filehandle)
filehandle.close()
Select = Bio.PDB.Select()
class GlySelect(Select):
    def accept_residue(self, residue):
        if residue.get_name()=='GLY':
            return 1
        else:
            return 0
io=PDBIO()
io.set_structure(structure)
io.save('gly_only.pdb', GlySelect())

I use this code but I am getting the following error!

File "aligned_matches_written_to_new_pdb_file.py", line 34, in <module>
    class GlySelect(Select):
TypeError: Error when calling the metaclass bases
    this constructor takes no arguments

I have also tried the example in
http://biopython.org/wiki/Remove_PDB_disordered_atoms.I get the same error
message. What  does this mean? Any remedy?

Secondly, I didn't understand your answer to my question.."In which step are
we sending the transformed co-ordinates into the PDB file? " The
Superimposer is a black box for me. I give it atom lists, it gives me RMSD.
But I want the aligned co-ordinates of the given atom lists, so that I can
see the alignment in PyMol.I don't know how to extract aligned atom
co-ordinates!

Your example :-

http://www2.warwick.ac.uk/fac/sci/moac/currentstudents/peter_cock/python/protein_superposition/?fromGo=http%3A%2F%2Fgo.warwick.ac.uk%2Fpeter_cock%2Fpython%2Fprotein_superposition%2F

does this job perfectly.It aptly prints out aligned models into a new PDB
file.But I am working on two atom lists from two different proteins, unlike
two models of same structure.Can you give me little push on how to deal
superimposing two different structures?

sincerely,
Kumar.


On Tue, Jul 21, 2009 at 1:48 PM, Peter <biopython at maubp.freeserve.co.uk>wrote:

> On Tue, Jul 21, 2009 at 9:35 PM, life happy<iitlife2008 at gmail.com> wrote:
> > I have tried using   io.save("pdb_out_filename",
> se.accept_model(alt_model))
> >
> >        I get error as , 'int' object has no attribute 'accept_model'
>
> If "se" really is an integer, that isn't surprising!
>
> > If I use  io.save("pdb_out_filename", se = accept_model(alt_model))
> >
> >       I get Error: name 'accept_model' is not defined
> >
> > In both the cases I created 'se' an object of Bio.PDB.Select()
> > Do you have an example for printing out some part of PDB?
>
> The examples here may help:
> http://lists.open-bio.org/pipermail/biopython/2009-May/005173.html
> http://biopython.org/wiki/Remove_PDB_disordered_atoms
> http://lists.open-bio.org/pipermail/biopython/2009-March/005005.html
>
> See also pages 5 and 6 of the Bio.PDB documentation, the bit
> on the Select class:
> http://biopython.org/DIST/docs/cookbook/biopdb_faq.pdf
>
> Peter
>



More information about the Biopython mailing list