This is a test version of Biostars. For the public version, visit https://www.biostars.org.
finding segment from multiple files
 import Bio.PDB as PDB

p = PDB.PDBParser()

s = p.get_structure("1aac", "1aacH")
io = PDB.PDBIO()
io.set_structure(s)
outfile = '1aac.pdb'
io.save(outfile)
print("Printed %s" % outfile)

i need to add a loop for getting structure of 50 more files in my folder

python bio rna protein pdb

Please spend more time on your question. This is too vauge, and lacks any reproducible examples.

For instance, it’s not clear what peptides you want, what relevance the filenames have, or what relevance your PDB searches were.

To get better answers, you should also show some attempt at writing the code you expect from us...

You want do download 100 PDB files?

i downloaded a zip file from this link i need read these files in python the problem is these files dont have extension as .pdb

The extension doesn’t matter. Extensions are arbitrary. If they are PDB files internally, you can just add the extension on, but it isn’t needed.

    import Bio.PDB as PDB

p = PDB.PDBParser()

s = p.get_structure("1aac", "1aacH")
io = PDB.PDBIO()
io.set_structure(s)
outfile = '1aac.pdb'
io.save(outfile)
print("Printed %s" % outfile)

but i get a pdb construction warning..how do i add a loop here for 50 remaining files

Please don’t delete content from your posts that is needed to answer your question. Without that link, we can’t test your data.

Hello a4appy23!

We believe that this post does not fit the main topic of this site.

Not really a bioinformatics question, and is a duplicate of an earlier post by OP

For this reason we have closed your question. This allows us to keep the site focused on the topics that the community can help with.

If you disagree please tell us why in a reply below, we'll be happy to talk about it.

Cheers!

1 answer

If you want to learn how to loop files in a directory, just look at (for instance) this link:

https://stackoverflow.com/questions/10377998/how-can-i-iterate-over-files-in-a-given-directory

You could really have googled this in no time at all.

Log in to answer this question.