Hi,

Yes, I see your point. However, I like the compactness (and resulting
performance) of the representation. I would be using this to handle larger
sets of molecules. The second example includes some more verbose
specifications. Personally, I don't mind working with indices but this
might be less intuitive when providing a public API for people to build on.

Corruption of data is not a direct concern to me when using this format so
I won't comment on this.

Tim

On Thu, Jun 6, 2013 at 11:11 PM, Patrick Fuller <patrickful...@gmail.com>wrote:

> Tim,
>
> I think Dimitri's point is that all the references are implicitly defined
> by list indices, rather than explicit keys. For example, something like
>
> {
>     "atoms": {
>         "C1": { "element": "C", "location": [ 0.230811, 0.380820, -0.610968 ] 
> },
>         "C2": { "element": "C", "location": [ -0.230811, -0.380820, 0.610968 
> ] }
>     },
>     "bonds": [
>         { "atoms": [ "C1", "C2" ], "order": 1 }
>     ]}
>
> will result in generally cleaner code. That is,
> molecule["atoms"]["C1"]["location"] is easier to understand than
> molecule["elements"]["coords"]["3d"][0]. In that regard, I completely
> agree with him.
>
> While i somewhat agree with Dimitri's point about the stability associated
> with lost bits (explicit keys will hold up better to a lost comma byte than
> list indices), I also think that it's up to the socket infrastructure to
> validate transmitted data.
>
>
> On Thu, Jun 6, 2013 at 4:03 PM, Tim Vandermeersch <
> tim.vandermeer...@gmail.com> wrote:
>
>>
>>
>> On Thu, Jun 6, 2013 at 10:50 PM, Dimitri Maziuk <dmaz...@bmrb.wisc.edu>wrote:
>>
>>> On 06/06/2013 03:13 PM, Tim Vandermeersch wrote:
>>> > Hi,
>>> >
>>> > The OpenChemsitry project also uses JSON (
>>> > http://wiki.openchemistry.org/Chemical_JSON).
>>>
>>> Not criticizing your effort, specifically, as this is common to most
>>> "life sciences" formats, but,
>>>
>>
>> I was not involved with this effort but thought it might be good to make
>> others aware of this. The OpenChemistry project was started by Kitware and
>> I know Marcus Hanwell is working on this (I included him in the recipients).
>>
>>
>>> I'm afraid to a programmer this has about 0 information content:
>>>
>>> elements": {
>>>       "number": [  1,   6,   1,   1,   6,   1,   1,   1 ]
>>>     },
>>>     "coords": {
>>>       "3d": [  1.185080, -0.003838,  0.987524,
>>>                0.751621, -0.022441, -0.020839,
>>>                1.166929,  0.833015, -0.569312,
>>>                1.115519, -0.932892, -0.514525,
>>>               -0.751587,  0.022496,  0.020891,
>>>               -1.166882, -0.833372,  0.568699,
>>>               -1.115691,  0.932608,  0.515082,
>>>               -1.184988,  0.004424, -0.987522 ]
>>>     }
>>>   },
>>>   "bonds": {
>>>     "connections": {
>>>       "index": [ 0, 1,
>>>                  1, 2,
>>>                  1, 3,
>>>                  1, 4,
>>>                  4, 5,
>>>                  4, 6,
>>>                  4, 7 ]
>>>     },
>>>     "order": [ 1, 1, 1, 1, 1, 1, 1 ]
>>>
>>>
>>> Where does it say which one's "C1" and which one's "H7"? All I can tell
>>> from this is all atoms are linked with the same type of bond ("1" stands
>>> for "aromatic" perhaps?) What do you draw if the "-0.932892" is missing
>>> from the json the client sent you?
>>>
>>
>> The molecule above contains al you need. The elements.number list
>> contains the chemical element number (i.e. 1 = H, 6 = C) for the atoms in
>> the order that will be adhered to in the rest of the JSON string (i.e. the
>> list indices are the atom indices). Ths bond.connections.index list
>> contains pairs that specify a start and end atom for a bond. The orders are
>> the orders of the bonds as they are listed in the conncections.index list.
>> 1 simply means a single bond. The described molecule is therefore ethane
>> with explicit hydrogens.
>>
>> I'm not sure what you mean by the "-0.932892" is missing, do you mean a
>> single value from the list is missing? If so, the code that produced the
>> JSON is wrong but this is not something the format tries to handle. Also
>> the 3d coordinates may well be left out. AFAIK, this format was meant as a
>> simple format to exchange molecules between different software modules
>> using a JSON to ensure no handwritten parser code is needed.
>>
>> Marcus, could you elaborate on this?
>>
>>
>>> If you want it machine-usable, you need at least the table of elements,
>>> the table of bond "numbers" (might as well use names), and atoms encoded
>>> as (element, index) pairs. Connections as (atom1, atom2, bond) tuples
>>> and 3d coordinates as (x, y, z) tuples.
>>>
>>> One of the particularly annoying things about pubchem is nowhere in
>>> their ASN.1, XML, or SDF you will find compound name that is shown on
>>> the webpage.
>>>
>>> (Apologies for the mini-rant, I've been working for biochemists for too
>>> long.)
>>>
>>
>> No problem, any feedback is welcome :)
>>
>> Tim
>>
>>
>>>  --
>>> Dimitri Maziuk
>>> Programmer/sysadmin
>>> BioMagResBank, UW-Madison -- http://www.bmrb.wisc.edu
>>>
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> How ServiceNow helps IT people transform IT departments:
>>> 1. A cloud service to automate IT design, transition and operations
>>> 2. Dashboards that offer high-level views of enterprise services
>>> 3. A single system of record for all IT processes
>>> http://p.sf.net/sfu/servicenow-d2d-j
>>> _______________________________________________
>>> OpenBabel-discuss mailing list
>>> OpenBabel-discuss@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>>>
>>>
>>
>>
>> ------------------------------------------------------------------------------
>> How ServiceNow helps IT people transform IT departments:
>> 1. A cloud service to automate IT design, transition and operations
>> 2. Dashboards that offer high-level views of enterprise services
>> 3. A single system of record for all IT processes
>> http://p.sf.net/sfu/servicenow-d2d-j
>> _______________________________________________
>> OpenBabel-discuss mailing list
>> OpenBabel-discuss@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>>
>>
>
------------------------------------------------------------------------------
How ServiceNow helps IT people transform IT departments:
1. A cloud service to automate IT design, transition and operations
2. Dashboards that offer high-level views of enterprise services
3. A single system of record for all IT processes
http://p.sf.net/sfu/servicenow-d2d-j
_______________________________________________
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss

Reply via email to