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

-- 

Rolf Huehne
Postdoc

Leibniz Institute on Aging - Fritz Lipmann Institute (FLI)
Beutenbergstrasse 11
07745 Jena, Germany

Phone:   +49 3641 65 6205
Fax:     +49 3641 65 6210
E-Mail:  rhue...@leibniz-fli.de
Website: http://www.leibniz-fli.de

           Scientific Director: Prof. Dr. K. Lenhard Rudolph
        Head of Administration: Dr. Daniele Barthel
Chairman of Board of Trustees: Burkhard Zinner

VAT No: DE 153 925 464
Register of Associations: No. 230296, Amtsgericht Jena
Tax Number: 162/141/08228


------------------------------------------------------------------------------
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