Is there a way to extract from PDB files, the solvent-oxygen atom coordinates?
The only thing I’ve come up with so far is to take the coordinates in “VertexCoordinates” that are not in “ResidueCoordinates”. Is there something more direct?
Is there a way to extract from PDB files, the solvent-oxygen atom coordinates?
The only thing I’ve come up with so far is to take the coordinates in “VertexCoordinates” that are not in “ResidueCoordinates”. Is there something more direct?
Dear Veit,
I know nothing about pdb, but perhaps this hack may be a useful direction for you? Here a GraphicsComplex is deconstructed to extract information.
example =
Import["ExampleData/1PPT.pdb", "Rendering" -> "Spacefilling"]
centers = Cases[example, GraphicsComplex[a_, __] :> a, Infinity][[1]]
spheres = Cases[example, GraphicsComplex[a_, b_] :> b, Infinity][[1]]
types = Partition[SplitBy[spheres, (Head[#] == RGBColor) &], 2]
typeColors = Flatten[First /@ types]
typeCoordinates =
Cases[#, Sphere[coord_, _] :> centers[[coord]], Infinity] & /@ types
(*examples*)
typeColors[[2]]
typeCoordinates[[2]]
Graphics3D[{typeColors[[2]],
Sphere[#, 150] & /@ typeCoordinates[[2]]}]
Graphics3D[{typeColors[[3]],
Sphere[#, 150] & /@ typeCoordinates[[3]]}]
Thanks!
Here’s what I’ve been doing:
pdb = "1W41";
vertex = Transpose[{Import[directory <> pdb <> ".pdb",
"VertexTypes"],
Import[directory <> pdb <> ".pdb", "VertexCoordinates"]}];
residue =
Transpose[{Flatten[
Import[directory <> pdb <> ".pdb", "ResidueAtoms"], 2],
Flatten[Import[directory <> pdb <> ".pdb", "ResidueCoordinates"],
2]}];
solvent =
Map[#[[2]] &,
Select[Complement[vertex, residue], #[[1]] == "O" &]];
Length[solvent]
I get 94 solvent oxygens for this protein (1W41). Your example, 1PPT, doesn’t have solvent atoms in the structure, only one Zn ion.
Dear Veit, note, you are pointing to the data on your local drive - inaccessible to other people - meaning they cannot run your code. You should always try to point to online resources - assuming you know where they are. In your case this proteine can be found in PDB database. But even better - you can just attach .PDB file to your post.
Import["http://www.rcsb.org/pdb/download/downloadFile.do?fileFormat=pdb&compression=NO&structureId=1W41",
"PDB", "Rendering" -> #, ImageSize -> 400] & /@ {Automatic, "BallAndStick", "Wireframe", "Spacefilling"}
Hello Veit, Although I have not seen such an application in Mathematica, if you need to solve this problem under time contraints sooner than allow for finding an equivalent solution in Mathematica I suggest FORTRAN with some adaptations to some codes I have. Additionally there are utilities in the GROMACS toolkit such as trjconv -- http://manual.gromacs.org/online/trjconv.html
Thanks Guy, but I prefer Mathematica to FORTRAN and GROMACS. The solution in my second post works fine, even if it is a hack. I encourage the Mathematica developers to add this functionality via a “SolventAtom” option.
Vitaliy: I was well aware that my code would not work without the PDB file. However, my question was not about aquiring PDB files, but the available options for Import when reading these files.
Dear Veit, I was just pointing out that if you provide code that uses custom data - it is impossible to run that code without those data. Some people prefer to actually play with code a bit before giving an answer.