This is an archive copy of the IUCr web site dating from 2008. For current content please visit https://www.iucr.org.
[IUCr Home Page] [CIF Home Page] [mmCIF Home Page]

Re: Sorting order.

Eldon Ulrich (elu@gir.nmrfam.wisc.edu)
Fri, 12 Jul 1996 09:49:04 -0500


I feel the structure of the mmCIF dictionary would be cleaner and clearer if
all 'ID' tags were defined as integers and current ID tags that have been given
definitions that are actually codes or abbreviations (amino acid one-letter or
three-letter codes, for example) were renamed _code or _abbr.

Eldon Ulrich



On Jul 12,  9:14am, Peter Keller wrote:
> Subject: Sorting order.
> Hi everyone,
>
> I'm starting to play around with sorting/searching, but I have hit the
> classical problem of sorting as strings vs. sorting as numbers. For
> example, compared as numbers, 2 < 10, but compared as strings,
> '10' < '2' .
>
> This is a problem where CIF items are defined in the dictionary as
> character types, but in practice, people tend to convert them from
> numbers. _atom_site.id is a case in point: its
> _item_type_list.primitive_code is 'char', so based purely on information
> in the dictionary, a sort would have to use character, rather than
> numerical sorting.
>
> I would like to suggest, that when numbers are output as the contents of
> such data items, they should be output right-justified in a fixed-width
> field, and either quoted ( '    2' < '   10' ), or padded with zeros
> ( 00002 < 00010 ), which solves the problem.
>
> Regards,
> Peter.
>
> ========================================================================
> Peter Keller.            \
> Dept. of Biology and      \       "...nothing works, but
>     Biochemistry,          \       everything survives...."
> University of Bath,         \
> Bath, BA2 7AY, UK.           \        --- Carlos Fuentes
> ------------------------------\-----------------------------------------
> Tel. (+44/0)1225 826826 x 4302 | Email: P.A.Keller@bath.ac.uk (Internet)
> Fax. (+44/0)1225 826449        |   P.A.Keller%bath.ac.uk@UKACRL (BITNET)
> ========================================================================
>-- End of excerpt from Peter Keller