[Biopython] Merging different pdbs into a single object structure and writing it

Claudia Millán Nebot cmncri at ibmb.csic.es
Wed Jun 25 15:48:21 UTC 2014


Hi :) I'm newbie to BioPython and I am trying to do the following:

I have a set of different pdbs that I want to merge together into a single
file. I would like to take into consideration that there could be issues
with the naming, so, after reading a few other posts in this same list, I
came up with the following code:

            list_parsers=[]
            list_of_structures=[]
            for index in range(len(list_of_filenames)):
                parser=PDBParser()
                list_parsers.append(parser)

structure=parser.get_structure(list_of_filenames[index][:-4],list_of_filenames[index])
                list_of_structures.append(structure)
            i_chain = 65
            for structure in list_of_structures:
              for chain in structure:
                chain.id = chr(i_chain)
                i_chain += 1
            io=PDBIO()
            for structure in list_of_structures:
                io.set_structure(structure)
            io.save(clust_fold+key[:-4]+"_fused.pda")

This is not working, as I guess i'm just changing the structure set each
time I do  io.set_structure, and writing the last one. And as there is not
such a thing as the append_structure() method I have just tried a silly
thing. So my question would be which is the best way to get the pdbs
merged? Should I save as independent unfold entities and then write them by
using a Select class?

Thanks in advance and regards,

Claudia Millán (cmncri at ibmb.csic.es)

Crystallographic Methods Group

http://chango.ibmb.csic.es

Institut de Biologia Molecular de Barcelona (IBMB-CSIC)

Barcelona, Spain
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.open-bio.org/pipermail/biopython/attachments/20140625/724219ba/attachment.html>


More information about the Biopython mailing list