[BioPython] add models to a structure

thamelry at binf.ku.dk thamelry at binf.ku.dk
Sat Jul 30 09:08:07 EDT 2005


Hi Ramon,

>     I would like to convert two structures created from different PDB
> files through the PDBparser into two models of a new structure. Or
> alternatively, add one of the structures as another model (a new child)
> of the first structute instance.
> Being s1 and s2 structures, I tried:
> s1.add(s2[0])
> but this doesn't work, probably because both model id's are the same
> (=0). How can this model id be changed?

Try model.id=1 for example, before adding the model.

>     The question may be very naive, but it is more general. How can I
> convert a group of chains into a new model or a new structure or
> vice-versa?

Well, you can for example do:

s=Structure("Test")
m=Model(0)
s.add(m)
m.add(chain1)
m.add(chain2)

Best regards,

-Thomas








More information about the BioPython mailing list