Nice. You can save yourself a little trouble with:

var title = jmolEvaluate('getProperty("fileHeader").split().find("TITLE")')

Also, realize that this goes back and retrieves the file again from its
source. If you know you want to use the file header this way, it's more
efficient to use

set pdbGetHeader TRUE

(uh, undocumented, I see...)

This setting instructs Jmol to preserve the file header in memory when the
file is loaded. It is used in Jmol Protein Explorer.

Since you are really wanting to display this in Jmol, you might consider
something like the following Jmol script, which requires no JavaScript:

function getHeader()
  var titleLines = getProperty("fileHeader").split().find("TITLE").split()
  for (var i = 1; i <= titleLines.size;i = i + 1)
      titleLines[i] = (titleLines[i])[11][0].trim()
  end for
  return titleLines.join("|")
end function

set echo bottom left
echo @{getheader()}


Something like that....


Bob

On Mon, Sep 22, 2008 at 3:50 PM, Thomas Stout <[EMAIL PROTECTED]>wrote:

>
> Here, then -- with my thanks for all the help -- is a working method to
> pull the "TITLE" lines from a PDB file and echo it to the bottom of the Jmol
> Applet window:
>
>                 var headerInfo = jmolGetPropertyAsString("fileHeader");
>                 var cutUp = headerInfo.split("\n");
>
>                 var headerstring="";
>
>                 for (l=0;l<cutUp.length;l++) {
>                 var regexp = new RegExp("TITLE.{5}(.*)\s*");
>                 var temp = cutUp[l];
>
>                 if (temp.search(regexp) == 0) {
>                 temp2 = RegExp.$1;
>                 temp2.replace(/^\s+|\s+$/g, "").replace(/\s+/g, " ");
>                 temp2 = temp2 + "|";
>                 headerstring += temp2;
>                                                 }
>                 }
>
>                 headerstring.replace(/TITLE/, "");
>                 jmolScript("set echo depth 0; set echo headerecho 2% 2%;
> font echo 12 sanserif bolditalic; color echo green");
>                 jmolScript('echo "' + headerstring + '"');
>
>
> Cheers,
> Tom
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's
> challenge
> Build the coolest Linux based applications with Moblin SDK & win great
> prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Jmol-users mailing list
> Jmol-users@lists.sourceforge.net
> 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
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Jmol-users mailing list
Jmol-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-users

Reply via email to