15
$\begingroup$

Apologies in advance, this is the first I've messed with ProteinData and access through WolframAlpha, so clearly I may not know how Mathematica and Alpha decide on what is the 'right way' to ask for things of this ilk.

I'd like to grab ProteinData[], specifically a 3D model of the "RibbonStructure", of rhodopsin.

I can easily get a low-resolution, static image from Alpha, directly in Mathematica:

Alpha pod

but I'd prefer the manipulatable 3D sort one gets from ProteinData[], since this is much better for classroom demos, interactive explanation, etc.

ribbon model of A2M

So, I try to look up rhodopsin via ProteinData in a wide variety of ways, by name, by PDB name, nada-

attempts

Let's try an alias ---

ProteinData works

Success! But, there is no MoleculePlot

missing MoleculePlot

It knows a few things about "RHO", but not the things I need; and, more importantly, what Alpha is able to return.

So I'm at a loss here. I've tried other aliases ("OPN2", "visual purple") to no avail. I'm curious about ---

  • Is there any way to figure out what WolframAlpha is doing with my request, since it can clearly interpret rhodopsin or rhodopsin protein?

  • Is there a better way to use ProteinData than just randomly trying things? Is there a mapping somewhere of PDB <-> aliases, etc?

  • Is there a way to as Alpha to return a higher resolution image than the sort-of-lame 320× I get? I know how to ask for just that pod, but it's unclear if there are any ways of asking for better / different pod content.

$\endgroup$
  • 1
    $\begingroup$ When you click the subpod containing the low-res image and then right click to paste the computable WolframAlpha call you see that even this doesn't work. $\endgroup$ – halirutan Feb 1 '17 at 16:23
  • $\begingroup$ The typical way to find entities is to use inline free-form input. For example "AAMP protein" gives you an entity for that protein if you search for it in this way. Free-form search for "rhodopsin protein" does not give you an entity, which suggests to me that it doesn't exist. $\endgroup$ – C. E. Feb 1 '17 at 16:29
  • $\begingroup$ yet, "RHO" exists, which is rhodopsin... so lord knows what it's thinking. $\endgroup$ – flip Feb 1 '17 at 17:20
  • 1
    $\begingroup$ @halirutan - yeah- I forgot to mention that too. Intuition = fails. I now have a notebook called Finding Rhodopsin full of frustration :) $\endgroup$ – flip Feb 1 '17 at 17:26
  • 3
    $\begingroup$ Looking at the paclet, it seems you are only going to get a "MoleculePlot" if the entity has a "PrimaryPDBID" property. For instance, ProteinData["RHOA", "MoleculePlot"] works because ProteinData["RHOA", "PrimaryPDBID"]. For now you'll have to use halirutan's workaround, but I would like to fix this soon. $\endgroup$ – Jason B. Feb 1 '17 at 17:41
10
$\begingroup$

Here's a workaround that directly queries the PDB search API and returns the first num search results as a Dataset[]. The routine is more complicated than I'd like, due to the finicky nature of the API (it only takes queries in XML format), as well as the somewhat clunky way XML is represented in Mathematica:

pdbFindMoleculeName[name_String, num : (_Integer?Positive) : 10] := 
   Module[{query, res},
          query = XMLObject["Document"][{
                  XMLObject["Declaration"]["Version" -> "1.0", "Encoding" -> "UTF-8"]},
                  XMLElement["orgPdbQuery", {},
                  {XMLElement["queryType", {}, {"org.pdb.query.simple.StructTitleQuery"}],
                   XMLElement["struct.title.comparator", {}, {"contains"}],
                   XMLElement["struct.title.value", {}, {name}]}], {}];

          res = URLRead[HTTPRequest["http://www.rcsb.org/pdb/rest/search/",
                <|"ContentType" -> "application/x-www-form-urlencoded", 
                  "Body" -> ExportString[query, "XML"], "Method" -> "POST"|>]];

          If[! FailureQ[res], res = Import[res];
             If[res =!= "null", res = DeleteDuplicates[Flatten[res]];
                res = Dataset[AssociationThread[{"PDB ID", "Title", "Structure"},
                {#, Cases[Import["http://www.rcsb.org/pdb/rest/describePDB?structureId=" <>
                                 #, "XML"], ("title" -> t_) :> t, ∞][[1]], 

                 Import["https://files.rcsb.org/download/" <> # <> ".pdb", "PDB"]}] & /@
                Take[res, UpTo[num]]],
                res = Failure["NoResults",
                <|"MessageTemplate" :> "No results found for `name`", 
                  "MessageParameters" -> <|"name" -> name|>|>]]];
          res]

As a demo:

rhod = pdbFindMoleculeName["bovine rhodopsin"]

Dataset for bovine rhodopsin

Of course, the Dataset[] format allows for convenient querying; e.g., if you want to see the structure of 1HZX:

First[rhod[Select[#"PDB ID" === "1HZX" &], "Structure"]]

1HZX structure

|improve this answer|||||
$\endgroup$
  • 2
    $\begingroup$ I, for one, applaud our API using overlords. $\endgroup$ – PlaysDice Feb 1 '17 at 21:22
8
$\begingroup$

Try this here

Import["http://www.rcsb.org/pdb/download/downloadFile.do?fileFormat=pdb&compression=NO&structureId=1U19", "PDB"]

Mathematica graphics

|improve this answer|||||
$\endgroup$
  • $\begingroup$ Cheating :) ! But seriously, this is the way I've done it up until now, I was sort of hoping to use more of the nice builtin stuff, but I see it's rather incomplete. $\endgroup$ – flip Feb 1 '17 at 17:22
8
$\begingroup$

A quick and dirty is to download the PDB file from the main PDB database (eg Bovine rhodopsin), use the Download button/dropdown on the top right and select Text format then

rhodopsin= Import["DownloadedFileAndPath","Rendering"->"Structure"]

Naturally, you could get Mathematica to do the download too.

Options for alternate renderings can be found in the documentation for PDB format

|improve this answer|||||
$\endgroup$
  • 2
    $\begingroup$ What? You beat me by 5min.. Haven't seen your answer :( Get my upvote as you were clearly faster. $\endgroup$ – halirutan Feb 1 '17 at 16:35
  • 1
    $\begingroup$ guys guys--- we're all winners here. $\endgroup$ – flip Feb 1 '17 at 17:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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