Here's another idea: Check the "divided" directory at RCSB for the file
size:

x = "1crn"
print load("http://ftp.wwpdb.org/pub/pdb/data/structures/divided/pdb/
*"+x[2][3]+"*/").lines.find(x)[0].trim().split(" ")[0]

The result will be something like "1.5M" or "33K"



On Wed, Jan 13, 2016 at 5:00 PM, Eric Martz <ema...@microbio.umass.edu>
wrote:

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



-- 
Robert M. Hanson
Larson-Anderson Professor of Chemistry
Chair, Department of Chemistry
St. Olaf College
Northfield, MN
http://www.stolaf.edu/people/hansonr


If nature does not answer first what we want,
it is better to take what answer we get.

-- Josiah Willard Gibbs, Lecture XXX, Monday, February 5, 1900
------------------------------------------------------------------------------
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