PDB Importer

My first script :stuck_out_tongue:

It’s a basic PDB importer for Blender. I tested it out on a few different PDB files and it appears to be functioning correctly.

Current features:

  • Capable of quickly loading 10,000s of atoms into the scene
  • Imports molecules as space filling models
  • Atom models are created by particle systems so that large molecules can be imported. Particle locations are defined by the vertices of the molecule object.
  • Compatible with render instancing
  • Atoms coloured by element
  • Option to import all models (slightly different versions of the same molecule)
  • Option to import file-listed multimers
  • Option to choose the size of the imported molecule and atoms

Here’s the python file

Pictures: ATP synthase F0,
40 tobacco mosaic virus capsid proteins,
10 models of insulin
9 multimers of insulin (different file)
Screenshot of the import screen, showing the options

http://i1032.photobucket.com/albums/a407/jonathanngsj/PDB%20Importer/th_atp_synthase_f0-1.png http://i1032.photobucket.com/albums/a407/jonathanngsj/PDB%20Importer/th_tmv-40-1.png http://i1032.photobucket.com/albums/a407/jonathanngsj/PDB%20Importer/th_insulin_multi_models-1.png http://i1032.photobucket.com/albums/a407/jonathanngsj/PDB%20Importer/th_insulinbiomolecules-1.png http://i1032.photobucket.com/albums/a407/jonathanngsj/PDB%20Importer/th_interface10-1.png

I switched to using particles when I discovered that Blender doesn’t like having more than a few thousand objects at once.

So how do you use this 2.5 script?

I opened the script in a text window and I run it and nothing happens?

Do I need an external molecule database to make use of this script?

Can you post a link where we can get these required PDB files?

Thanks!

Oh it appears as a menu option under file–>import–>Protein Databank

I didn’t think there were other ways of using it as I was following the format of the other bundled scripts. Whooops :stuck_out_tongue:

The script doesn’t use an external database. The atomic information is contained within the script.

I got my PDB test files from RCSB Protein Data Bank. I normally look at the molecules of the month as they are more likely to be well known.

Thanks for the info and the link to the site.

Do you know of a better way to just get the entire database? That site only allows single compound downloads.

Hmm…

I ran it it on an older build and I did not get any errors. But now that I run the script on r31068 it no longer works? Has anyone else tried this script on a recent build?

I guess the Python API has changed again. It is supposedly still unstable and undergoing development, according the the wiki page. The script does work on the beta release.

Cool! Using particles to speed things up is a very novel approach. We are doing something similiar, but due to project requirement, i have to use individual objects (shared mesh).

http://blog.mikepan.com/wp-content/uploads/Cal1-560x315.jpg

Now it works with blender 2.53 r31445
http://seo4you.pl/pliki/blender/import_pdb.zip
(and 2.53 and 2.54)

This file works:
http://dl.dropbox.com/u/10271881/1mbs.pdb

http://dl.dropbox.com/u/10271881/PDB.PNG

But this not
http://dl.dropbox.com/u/10271881/1hiu.pdb
Bug is in parse file , after week I fix it

Hmm… it appears that PDB file is based on an older format guidelines. Specifically it doesn’t list the chains in the COMPND records, which I assumed would always be present. I used the list to initialize chain objects, although perhaps that might not be the best way to go about doing it.

Actually I can’t say I’m too familiar with the format because the format guide I got is 200 pages long :stuck_out_tongue:

BTW did you file from the RCSB too? I was kind of hoping they kept all their files in the latest format :stuck_out_tongue:

I download 1hiu.pdb (INSULIN (HUMAN) ) from

edit:
old blender PDB import scripts:
http://www.malte-reimold.de/blender/pdb2blend.html
http://www2.inf.fh-brs.de/~mgante2s/pdb_importer.html
http://blenderartists.org/forum/showthread.php?t=67279

This thread saved my day. Thanks for the effort guys :slight_smile:

Hey there, I’ve downloaded and tried to import the script with the Blender ver: 2.54 interface. It’s blocking me from enabling it. Can you tell me why this is happening and how I can go about fixing it?

  • Is it likely to be a compatibility issue with the script and the new blender version?
  • Kind of a noob to blender, but I want to import PDB files to make a movie for a presentation coming up soon.
  • Ve: 8 | Fa:6 |Ob:1-3 |La:1 (if any of that helps…)

I also experienced the problem and I think it caused by the Python API not being stable yet so changes in the new version causes the script to fail. Download 2.53 from blender.org and run it there instead, that works fine.

@ Litterate, okay then I’m content with a work-around… do you have a direct link? I couldn’t find it on the site anymore :frowning:
Do you know any mirror site for the Blender ver 2.53 for Linux 32 bit?

http://download.blender.org/release/Blender2.53beta/

bah,… it was on the site after all! - by the way thanks for the quick replies man.

is it possible to get the entire database

Update to 2.54 and 2.53
http://seo4you.pl/pliki/blender/import_pdb.zip

(and mirror: http://dl.dropbox.com/u/10271881/import_pdb.zip )

In ZIP you found versions:

blender_253 - official blender 2.53
blender_253_31445 - trunk revision 31445 (between 253 and 254)
blender_254 - official blender 2.54

examples - sample files:
1mbs.pdb - works
1hiu.pdb - don’t work (TO DO)

Thank you very much for this script, mariuszekpl.

I wanted to play with it in latest Blender trunk and made it work with revision 35616, there were some changes to the API sometime ago. If anybody is interested:

Diff against the latest script (was for Blender 2.54)
Whole script (I added today’s Blender revision to the filename)

I don’t know if all changes are necessary, especially all the added lines. I used the official addons as reference and hopefully got it right.

Found this script on our tracker, Sanne thanks for the update, committed to trunk (so it comes with blender by default), will be in 2.60.
https://svn.blender.org/svnroot/bf-extensions/trunk/py/scripts/addons/io_mesh_pdb

It still does not work on 2.6. Using r41562. Windows XP 64.

I tried a couple of the PDB files from here.

I get crashes and or nothing happens at all.