<p>As @Michael said PyMOL can do this. PyMOL is not only an app, but also a python package —installed <a href="https://anaconda.org/schrodinger/pymol" rel="nofollow noreferrer">via conda</a> not via the regular download (you can have both).</p>
<pre><code>import pymol2
with pymol2.PyMOL() as pymol:
     pymol.cmd.load(infile,'myprotein')
     pymol.cmd.save(infile.replace('.cif', '.pdb'), selection='myprotein')
</code></pre>
<p>This runs the parallelisable instance, so you can have that context manager block running on how many threads or processes you fancy.</p>

CC BY-SA 4.0
2020-10-15T22:08:54.093Z
Dear Matteo, thanks for that. Unfortunately it gives me back the error that 'name 'infile' is not defined'.
Balint Biro
CC BY-SA 4.0
2020-10-15T22:16:48.877Z
@BalintBiro You need to change that part so that it matches the name of the file you are using.
user438383
CC BY-SA 4.0
2020-10-15T22:32:47.040Z
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.
M__
CC BY-SA 4.0
2020-10-15T21:26:11.710Z
2020-10-15T21:26:11.710Z
Matteo Ferla
<p>can you please give me an advice how to convert .cif files into .pdb preferably using python?</p>
<p>Thanks in advance!
Best,
Balint Biro</p>

CC BY-SA 4.0
2020-10-15T16:13:05.013Z
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
M__
CC BY-SA 4.0
2020-10-15T22:07:58.157Z
Dear Michael,yes, that is the case but I cant see how should I modify my question...
Balint Biro
CC BY-SA 4.0
2020-10-16T10:20:55.480Z
Using the [edit] button :-)
Kamil S Jaron
<python><pdb>
.cif .pdb conversion with python
# .cif .pdb conversion with python

(Asked by: username_0 on 2020-10-15)

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

Thanks in advance!
Best,
Balint Biro

**Tags:** python, pdb
> **Comments:**
> **username_1**: 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  
> **username_0**: Dear Michael,yes, that is the case but I cant see how should I modify my question...  
> **username_2**: Using the [edit] button :-)  

---

## 1 answers

### Answer by username_3 on 2020-10-15. Score: 3 | Accepted answer

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.

> **Comments:**
> **username_0**: Dear Matteo, thanks for that. Unfortunately it gives me back the error that 'name 'infile' is not defined'.  
> **username_4**: @BalintBiro You need to change that part so that it matches the name of the file you are using.  
> **username_1**: 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.  

---

