Protein Database files PDB import

   3982   6   2
User Avatar
Member
20 posts
Joined: Nov. 2016
Offline
Hello

I would like to import file from protein data bank into Houdini .

Is there any way how to work with pdb files in Houdini?
Is there any pipeline how to get those files inside?

There should be Blender plugin, old 3dMax and Maya importer, but would be nice to have it at home

thanks
User Avatar
Member
1743 posts
Joined: March 2012
Offline
Erikbartos
I would like to import file from protein data bank into Houdini .

Is there any way how to work with pdb files in Houdini?
There is! There's a utility that comes with Houdini called gpdbthat will convert pdb files to point clouds in geo or bgeo format. If you have a set of pdb files all representing some large molecule (due to the atom limit in pdb files), you can specify multiple pdb files, e.g.:
gpdb inputfile1.pdb inputfile2.pdb inputfile3.pdb outputfile.bgeo

It doesn't support some of the newer formats that the Protein Data Bank uses, but it should convert all ATOM and HETATM lines from pdb files, with the various columns converted to attributes and groups on the points. At some point, I used my Load Data Table asset to load cif format files (after manually deleting all of the non-atom lines), so if you need those too, I've attached a file that should work for (abridged) cif files.

Attachments:
ProteinDataBank_CIF.hip (93.7 KB)

Writing code for fun and profit since... 2005? Wow, I'm getting old.
https://www.youtube.com/channel/UC_HFmdvpe9U2G3OMNViKMEQ [www.youtube.com]
User Avatar
Member
1743 posts
Joined: March 2012
Offline
Oh, I forgot that I added support to the File SOP for pdb files, so you can just Ctrl+Click on the File button on the Create toolbar and select a pdb file, haha.
Writing code for fun and profit since... 2005? Wow, I'm getting old.
https://www.youtube.com/channel/UC_HFmdvpe9U2G3OMNViKMEQ [www.youtube.com]
User Avatar
Member
20 posts
Joined: Nov. 2016
Offline
Thanks! ndickson!

You really helped me.

Now i am getting at least molecule as point cloud, but i am not sure if i ever find out connections between atoms from attribute table.
User Avatar
Member
1743 posts
Joined: March 2012
Offline
Yeah, apparently the vast majority of pdb files don't bother putting in bonds, (so I don't think I added support for them in the importer). They just assume people will be able to figure out bonds based on bond length tables and such, which get a bit dicey in some cases, but at least usually give a reasonable guess as to whether there's some sort of bond between two atoms.

The attribute data in large pdb files often indicates things like what higher-level structures the atoms are part of, like particular alpha helices and beta sheets, so that might be useful, too. There are probably a bunch of oxygens that are really the water that the molecule was suspended in, but those should be in a group that you can easily delete, if you want.
Writing code for fun and profit since... 2005? Wow, I'm getting old.
https://www.youtube.com/channel/UC_HFmdvpe9U2G3OMNViKMEQ [www.youtube.com]
User Avatar
Member
20 posts
Joined: Nov. 2016
Offline
I got smaller pdb and it has attributes @name like H and C (helium carbon i suppose)
Now everything is clear except my lamesness

Trying to change size and color depending on @name
so i am trying to use atrribexpression, or attribwrangler, but duno how to exactly change string to scale.

if(@name=“H”) {
scale = 1,33;
else
scale = 1;
}



i am really confused of where to write and what
Edited by Erikbartos - July 28, 2017 09:41:32
User Avatar
Member
1743 posts
Joined: March 2012
Offline
The ProteinDataBank_CIF.hip file I posted has an example of one way to do it. I made groups for each element, then assigned them colours with the Color SOP:

@group_oxygen = (s@element=="O");
@group_nitrogen = (s@element=="N");
@group_carbon = (s@element=="C");
@group_sulfur = (s@element=="S");

That file had no hydrogen (H), phosphorus (P), fluorine (F), chlorine (Cl), or iron (Fe) in it, so I didn't bother creating groups for them. That's probably most of the elements you'll encounter in pdb files for organic molecules. The “s” prefix on “s@element” indicates to VEX that the attribute is a string, (it assumes float if it can't guess from the attribute name). The “group_” indicates that it's a group, instead of a regular attribute.

Alternatively, I could have done:

if (s@element=="O") {
@pscale = ...; // Replace the dots with some value representing the radius
@Cd = {0.9, 0, 0}; // Cd is the colour attribute, this one is red.
}
else if (s@element=="N") {
@pscale = ...;
@Cd = {0, 0.345, 0.9};
}
else if (s@element=="C") {
@pscale = ...;
@Cd = {0.00625, 0.00625, 0.00625};
}
else if (s@element=="S") {
@pscale = ...;
@Cd = {0.9, 0.9, 0};
}
else {
@pscale = ...;
@Cd = {1, 1, 1};
}
Edited by neil_math_comp - July 28, 2017 11:34:44
Writing code for fun and profit since... 2005? Wow, I'm getting old.
https://www.youtube.com/channel/UC_HFmdvpe9U2G3OMNViKMEQ [www.youtube.com]
  • Quick Links