Eran Hodis wrote:

> Thank you Bob,
>
> How do I capture that response into a Jmol variable so that I can 
> manipulate it to obtain only the chain count?
>
There are a couple of ways of doing this from JavaScript:

  info = jmolEvaluate('script("show info")')

Then parse that. The idea there is to run the script as part of a Jmol 
math expression using the script() command. The parsing can be done in 
JavaScript or in Jmol script. For example:

  nChains = parseInt(jmolEvaluate('script("show 
info").split().find("Chains").split("... ")[2]'))

In order, that's:  (1) get the information, (2) split it into lines, (3) 
find the line with the word "Chains" in it, (4) split that line at the 
end of the dots, (5) take the 2nd element of that split.

Alternatively,

  info = jmolScriptWait("show info")

can also be used, but it returns all sorts of other data as well and 
requires more parsing.

Bob


> (By the way, show info is not part of the Jmol documentation on the 
> "show" function  http://chemapps.stolaf.edu/jmol/docs/?ver=11.6#show)
>
yes, must catch up there.....


> Best regards,
> Eran
>
> On Sun, Jun 22, 2008 at 8:34 PM, Bob Hanson <[EMAIL PROTECTED] 
> <mailto:[EMAIL PROTECTED]>> wrote:
>
>     the chaincount reported in getProperty reports all chains -- including
>     the "null" valued chain that involves water in older PDB files. Use
>
>     show info
>
>     for what you want.
>
>     $ show info
>     Molecule name ....... MOL_ID: 1; MOLECULE: HUMAN LYSOZYME; CHAIN:
>     A; EC:
>     3.2.1.17 <http://3.2.1.17>; ENGINEERED: YES
>     Secondary Structure . PDB Data Records
>     Brookhaven Code ..... 1TBY
>     Number of Chains .... 1
>     Number of Groups .... 130 (77)
>     Number of Atoms ..... 948 (154)
>     Number of Bonds ..... 1048
>     Number of Models ...... 1
>     Number of Helices ... 7
>     Number of Strands ... 7
>     Number of Turns ..... 7
>
>
>     -Bob
>
>     Eran Hodis wrote:
>
>     > Thanks Bob,
>     >
>     > But I'm getting what appears to be incorrect responses for the chain
>     > count.
>     >
>     > For example...
>     >
>     > 1tby and 2fbx should both have chainCount = 1, and indeed when you
>     > open the Jmol menu by right-clicking on the applet and go to the
>     first
>     > entry in the menu (the PDB code), you see "chains: 1".
>     >
>     > However, opening a console and typing "print
>     > getproperty("modelinfo","models",1,"chaincount")"  gives 2 in
>     both cases.
>     >
>     > 3ch7 is an example where the getproperty response matches what
>     we see
>     > in the Jmol menu.
>     >
>     > Am I missing something here?
>     >
>     > Best,
>     > Eran
>     >
>     >
>     > On Thu, Jun 19, 2008 at 11:15 PM, Bob Hanson <[EMAIL PROTECTED]
>     <mailto:[EMAIL PROTECTED]>
>     > <mailto:[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>>> wrote:
>     >
>     >     They both are the same -- they need a model index (starting
>     with 1):
>     >
>     >     print getproperty("modelinfo","models",1,"chaincount")
>     >
>     >     Eran Hodis wrote:
>     >
>     >     > It appears that
>     >     >
>     >     > x = getProperty("modelInfo","chainCount")
>     >     >
>     >     > sets x = ""
>     >     >
>     >     > and so does x = getProperty("modelInfo","polymerCount").
>     >     >
>     >     > x = getProperty("modelInfo","modelSetName") returns the
>     right value
>     >     > for x however.
>     >     >
>     >     >
>     >     >
>     >     > Jmol 11.5.41
>     >     >
>     >     >
>     >     >
>     >     > Best,
>     >     > Eran
>     >     >
>     >    
>     >------------------------------------------------------------------------
>     >     >
>     >    
>     >-------------------------------------------------------------------------
>     >     >Check out the new SourceForge.net Marketplace.
>     >     >It's the best place to buy or sell services for
>     >     >just about anything Open Source.
>     >     >http://sourceforge.net/services/buy/index.php
>     >     >
>     >    
>     >------------------------------------------------------------------------
>     >     >
>     >     >_______________________________________________
>     >     >Jmol-users mailing list
>     >     >[email protected]
>     <mailto:[email protected]>
>     >     <mailto:[email protected]
>     <mailto:[email protected]>>
>     >     >https://lists.sourceforge.net/lists/listinfo/jmol-users
>     >     >
>     >     >
>     >
>     >
>     >     --
>     >     Robert M. Hanson
>     >     Professor 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
>     >
>     >
>     >
>     >    
>     -------------------------------------------------------------------------
>     >     Check out the new SourceForge.net Marketplace.
>     >     It's the best place to buy or sell services for
>     >     just about anything Open Source.
>     >     http://sourceforge.net/services/buy/index.php
>     >     _______________________________________________
>     >     Jmol-users mailing list
>     >     [email protected]
>     <mailto:[email protected]>
>     >     <mailto:[email protected]
>     <mailto:[email protected]>>
>     >     https://lists.sourceforge.net/lists/listinfo/jmol-users
>     >
>     >
>     >------------------------------------------------------------------------
>     >
>     >-------------------------------------------------------------------------
>     >Check out the new SourceForge.net Marketplace.
>     >It's the best place to buy or sell services for
>     >just about anything Open Source.
>     >http://sourceforge.net/services/buy/index.php
>     >
>     >------------------------------------------------------------------------
>     >
>     >_______________________________________________
>     >Jmol-users mailing list
>     >[email protected]
>     <mailto:[email protected]>
>     >https://lists.sourceforge.net/lists/listinfo/jmol-users
>     >
>     >
>
>
>     --
>     Robert M. Hanson
>     Professor 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
>
>
>
>     -------------------------------------------------------------------------
>     Check out the new SourceForge.net Marketplace.
>     It's the best place to buy or sell services for
>     just about anything Open Source.
>     http://sourceforge.net/services/buy/index.php
>     _______________________________________________
>     Jmol-users mailing list
>     [email protected]
>     <mailto:[email protected]>
>     https://lists.sourceforge.net/lists/listinfo/jmol-users
>
>
>------------------------------------------------------------------------
>
>-------------------------------------------------------------------------
>Check out the new SourceForge.net Marketplace.
>It's the best place to buy or sell services for
>just about anything Open Source.
>http://sourceforge.net/services/buy/index.php
>
>------------------------------------------------------------------------
>
>_______________________________________________
>Jmol-users mailing list
>[email protected]
>https://lists.sourceforge.net/lists/listinfo/jmol-users
>  
>


-- 
Robert M. Hanson
Professor 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



-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Jmol-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-users

Reply via email to