Skip to content

Type guessing in MapDecoder? #16

@gtauriello

Description

@gtauriello

I was thinking of ways to help generic parsing of custom properties (e.g. imagine being able to visualize whatever anyone adds as custom atom or residue properties in an MMTF file in PyMOL ;-)). This is complementary #13 and related to possible extensions of the MMTF spec, where we know what per-atom/per-residue/... properties are (see rcsb/mmtf#32).

My idea is to extend the MapDecoder class with a guessType function which returns an enum for all possible types. Currently that would be something like:

enum DecodableType {
  NOT_SUPPORTED,
  NO_KEY,
  FLOAT,
  INT32,
  CHAR,
  STRING,
  FLOAT_VECTOR,
  INT8_VECTOR,
  INT16_VECTOR,
  INT32_VECTOR,
  STRING_VECTOR,
  CHAR_VECTOR
}

The first two are if key is not found or type is not supported. A user could then use that output and decide to call decode with an appropriately typed object. I think it should be possible to implement something like this with rather minimal changes.

What do you guys think?

Metadata

Metadata

Assignees

No one assigned

    Labels

    wait for usecaseWaiting for a real usecase scenario for the proposed enhancement

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions