Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am working with the 3-D coordinates of proteins. The file format I import and modify coordinates of is in the .PDB format, and the string to import is also in this same format. Currently, when I try to export as in "final.pdb", I get: "Export::type: "String cannot be exported to the !(\"PDB\") format." However, when I export with the extension .txt, and use:

Import["final.txt", "PDB"]

The file imports as the protein structure.

My question: Is there a way to export using the .PDB extension. Or even force the export. Having the .pdb extension would be much easier for other programs. If there is a way, please let me know.

share|improve this question

In Documentation there are two examples on export as .PDB which work fine - you can follow the links and go through them. I'll give you here another example to show that export as .PDB works.

Import a large PDB file from independent source - the RCSB Protein Data Bank website.

data = Import["
compression=NO&structureId=1tf6", {"PDB", "Rules"}]

enter image description here

Note we imported as rules, which is needed for Export. If we wouldn't specify "Rules" - it would give you 3D graphics and loose information about protein structure. Now let's export these rules back as some test.PDB file and import it right back to verify that export worked properly:

Export["test.PDB", data]



enter image description here

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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