Types

In the real world, where people exchange files (on their hard drives, in USB sticks, as email attachments, etc.), a file suffix is often enough to distinguish what kind of data is being exchanged. However, DNAnexus operates on other, more complex, structures such record objects. To aid users and developers in establishing standards for data representation, DNAnexus provides a very simple type API. A type is a word (of length at least 1) consisting of characters in the ASCII range 47-57, 65-90, 95, 97-122 (that is, 0-9, A-Z, a-z, / and _), such as "UploadSentinel" or "history-record". In the DNAnexus platform, objects can be marked as being conformant to one or more types. This type system is advisory; types are semantically defined using free-form text, and object-type conformance is not checked by the system.

Marking objects as being conformant to certain types enables developers and users to produce and consume data in a convenient way. For example, the type "Book" could be defined as "a Record which contains the fields 'title' of type string, 'author' of type string, and 'year' of type int". Then, developers can produce or consume Records conformant to that spec.

The types associated with an object are returned by the "describe" method, and modified by the "addTypes" and "removeTypes" methods.

API method: /class-xxxx/addTypes

Specification

Marks the object as conformant to the specified type(s). Ensures that the specified types are added to the object -- if any of the types are already present, no action is taken for those types.

Inputs

  • types array of strings Types to be added

Outputs

  • id string ID of the manipulated object

Errors

  • InvalidInput (the input is not a hash, or the key types is missing, or its value is not an array, or the array contains at least one invalid (not in the specified ASCII range) type)
  • ResourceNotFound (the specified object in the URL does not exist)
  • PermissionDenied (UPLOAD access required for the project in which the object was created)
  • InvalidState (the object is not in the "open" state)

API method: /class-xxxx/removeTypes

Specification

Removes the specified types from the object. Ensures that the specified types are not part of the object -- if any of the types are already missing, no action is taken for those types.

Inputs

  • types array of strings Types to be removed

Outputs

  • id string ID of the manipulated object

Errors

  • InvalidInput (the input is not a hash, or the key types is missing, or its value is not an array, or the array contains at least one invalid (not in the specified ASCII range) type)
  • ResourceNotFound (the specified object in the URL does not exist)
  • PermissionDenied (UPLOAD access required for the project in which the object was created)
  • InvalidState (the object is not in the "open" state)

Last edited by Thanh-Ha Nguyen, 2016-06-24 18:55:10

 Feedback