On 10/01/2015 06:12 AM, Robert Hanson wrote:
> Then map.array("id") is perfect for you. It turns that map into an actual
> array (temporarily), and you can then use WHERE and WHEREIN on that next
> level of maps. After you do that, using array("id") again returns your
> top-level map. The result was identical to what you requested.
>
I couldn't test it yet (see below) but I fear the memory footprint might 
be quite high if data has to be copied for it.

The memory footprint of multi-level data constructs in Jmol generally 
seems to be quite high. If I load for example about 15 megabyte of 
annotation data for about 200,000 atoms, calculate coordinates, add 
bonds and then actually load the atoms about 900 megabyte of memory seem 
to be needed. Saved on disk with 'write var...' it takes about 300 
megabytes (and about 200 megabytes after removing whitespace).

In Perl my rule of thumb is a factor of 10-20 to load data into a 
multi-level data structure. The numbers above sound like a factor of 40 
in Jmol.

But maybe this is related also to the observation I mentioned today in 
the thread "Jmol reads a structure file from a pipe or system input":

"In the application there are shown two numbers about the memory used by 
Jmol at the bottom right. The amount of memory used increases about 
20-30 megabytes for each command I enter into the script console, 
seemingly independent of the command itself."

> I think what you are missing is that Jmol is treating an array or array of
> arrays totally differently from a map. The array is passed through, and
> WHERE or WHEREIN operate directly on the map itself, no matter how many
> levels deep it is in the array. So it makes no sense to refer to the array
> itself and its subarrays as the "first level." The first map that is found
> -- that is the level for WHERE; if the values in that map are also maps,
> those are what are tested for WHEREIN.
>
I don't know anything about the Jmol's internals, so what I get here is 
that it would be more complicated than I thought to implement my proposal.

> It's not more complicated than that.
>
>   snpInfo = {"rs1229984": [resno: 48,
>                            from: "R",
>                            to: "H"],
>              "rs1041969": [resno: 57,
>                            from: "N",
>                            to: "K"]
>              };
>
> print "=== Case 1 ====";
> print snpInfo.array("id").select("id,from,to WHERE
> to='H'").array("id").format("JSON");
>
> print "=== Case 2 ====";
> print snpInfo.array("id").select("(resno) WHERE to='H'").format("JSON");
>
> === Case 1 ====
> { "rs1229984": { "to": "H","from": "R" } }
> === Case 2 ====
> [ 48 ]
>
This example doesn't work for me in Jmol 14.3.16_2015.09.28:

------------------------------------------
$ print snpInfo.array("id").select("id,from,to WHERE 
to='H'").array("id").format("JSON");
script ERROR: invalid argument
----
          print snpInfo . array ( "id" ) . select ( "id,from,to WHERE 
to='H'" ) . array ( "id" ) . format ( "JSON" <<<<)
$  print snpInfo.array("id").select("(resno) WHERE to='H'").format("JSON");
script ERROR: invalid argument
----
          print snpInfo . array ( "id" ) . select ( "(resno) WHERE 
to='H'" ) . format ( "JSON" <<<<)
-------------------------------------------

Regards,
Rolf

-- 

Rolf Huehne
Postdoc

Leibniz Institute for Age Research - Fritz Lipmann Institute (FLI)
Beutenbergstrasse 11
07745 Jena, Germany

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

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

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


------------------------------------------------------------------------------
_______________________________________________
Jmol-users mailing list
Jmol-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-users

Reply via email to