0
$\begingroup$

can you please give me an advice how to convert .cif files into .pdb preferably using python?

Thanks in advance! Best, Balint Biro

$\endgroup$
  • 1
    $\begingroup$ Its certainly doable and PyMol will also do this. A number of site members hold this expertise. What I think is that the format you are downloading in is cif rather than what you want which is pdb. If that is the case please modify your question $\endgroup$ – Michael Oct 15 at 16:13
  • $\begingroup$ Dear Michael,yes, that is the case but I cant see how should I modify my question... $\endgroup$ – Balint Biro Oct 15 at 22:07
  • $\begingroup$ Using the edit button :-) $\endgroup$ – Kamil S Jaron Oct 16 at 10:20
2
$\begingroup$

As @Michael said PyMOL can do this. PyMOL is not only an app, but also a python package —installed via conda not via the regular download (you can have both).

import pymol2
with pymol2.PyMOL() as pymol:
     pymol.cmd.load(infile,'myprotein')
     pymol.cmd.save(infile.replace('.cif', '.pdb'), selection='myprotein')

This runs the parallelisable instance, so you can have that context manager block running on how many threads or processes you fancy.

| improve this answer | |
$\endgroup$
  • $\begingroup$ Dear Matteo, thanks for that. Unfortunately it gives me back the error that 'name 'infile' is not defined'. $\endgroup$ – Balint Biro Oct 15 at 22:08
  • $\begingroup$ @BalintBiro You need to change that part so that it matches the name of the file you are using. $\endgroup$ – user438383 Oct 15 at 22:16
  • 1
    $\begingroup$ Hi @BalintBiro please upvote or mark 'accepted'. This is the answer. You need to define the location of the infile before the with statement starts, thats why you have the error. You need a certain degree of coding proficiency. $\endgroup$ – Michael Oct 15 at 22:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.