That looks wonderful, Rolf.
I'll let you know after I try it.
Thanks so much!!
-Eric

On 1/13/16 2:28 PM, Rolf Huehne wrote:
> On 01/13/2016 08:22 PM, Rolf Huehne wrote:
>> On 01/13/2016 07:37 PM, Eric Martz wrote:
>>> Dear Angel (and everyone),
>>>
>>> For years I have wanted a way to find out (in javascript or in JSmol)
>>> the number of atoms (or molecular weight) of a PDB entry before
>>> attempting to load it into JSmol. But I have not known how to do this.
>>>
>>> If you know, please send me a sample of the code.
>>>
>>> When the size exceeds a threshold, I would load only alpha carbons.
>>>
>> Eric, as you might have expected, you could do it by using the PDBE API
>> that Angel used within his question.
>>
>> The following function needs as a parameter the PDB code (lower-case!)
>> and would return the combined molecular weight of all molecules.
>> It will only work for asymmetric units. (If you would build up a
>> biological unit within Jmol more information would be needed.)
>>
>> ------- Jmol function ------------------------------
>> function getPdbEntryWeight(pdbId) {
>>      var weight = 0;
>>
>>      if (pdbId != "") {
>>        var queryUrl = "http://www.ebi.ac.uk/pdbe/api/pdb/entry/molecules/";
>> + pdbId;
>>        var info = eval(load(queryUrl));
>>
>>        if (info.type == "hash") {
>>          for (var entity in info[pdbId]) {
>>            var currentWeight =  entity..weight;
>>            if (currentWeight != "") {
>>              weight = weight + currentWeight;
>>            }
>>          }
>>        }
>>      }
>>
>>      return weight;
>> }
>>
>> ----- Example code ---------------
>> weight = getPdbEntry("1deh");
>> print weight;
>>
>> ------Example output -------------
>> 40749.875
>> ----------------------------------
>>
> Sorry, I forgot the 'Weight' in the example function call':
>
>     weight = getPdbEntryWeight("1deh");
>
> Regards,
> Rolf
>


------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
_______________________________________________
Jmol-users mailing list
Jmol-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-users

Reply via email to