2.2. Utility Functions

These functions provide shorthand functional interfaces for actions such as getting a DXDataObject handler from an ID or link, or creating a link from a handler. In addition, there are functions for performing simple actions with an ID or link as input without creating a full object handler.

Parameters:
  • object_id (string or DXDataObject) – Object ID or the object handler itself
  • project_id (string) – A project ID, if creating a cross-project DXLink

Creates a DXLink (a dict formatted as a symbolic DNAnexus object reference) to the specified object. Returns object_id if it appears to be a DXLink already.

Parameters:x – A potential DNAnexus link

Returns whether x appears to be a DNAnexus link (is a dict with key "$dnanexus_link") with a referenced data object.

Parameters:link (dict) – A DNAnexus link
Returns:Object ID, Project ID (or None if no project specified in the link)
Return type:tuple

Returns the object and project IDs stored in the given DNAnexus link.

dxpy.bindings.dxdataobject_functions.get_handler(id_or_link, project=None)[source]
Parameters:
  • id_or_link (string or dict) – String containing an object ID or dict containing a DXLink
  • project (string) – String project ID to use as the context if the the object is a data object
Return type:

DXObject, DXApp, or DXGlobalWorkflow

Parses a string or DXLink dict. Creates and returns an object handler for it.

Example:

get_handler("file-1234")
dxpy.bindings.dxdataobject_functions.describe(id_or_link, **kwargs)[source]
Parameters:id_or_link – String containing an object ID or dict containing a DXLink, or a list of object IDs or dicts containing a DXLink.

Given an object ID, calls describe() on the object.

Example:

describe("file-1234")

Given a list of object IDs, calls system_describe_data_objects().

Example:

describe(["file-1234", "workflow-5678"])

Note: If id_or_link is a list and **kwargs contains a “fields” parameter, these fields will be returned in the response for each data object in addition to the fields included by default. Additionally, describe options can be provided for each data object class in the “classDescribeOptions” kwargs argument. See https://wiki.dnanexus.com/API-Specification-v1.0.0/System-Methods#API-method:-/system/describeDataObjects for input parameters used with the multiple object describe method.

dxpy.bindings.dxdataobject_functions.get_details(id_or_link, **kwargs)[source]
Parameters:id_or_link – String containing an object ID or dict containing a DXLink

Given an object ID, calls get_details() on the object.

Example:

get_details("file-1234")
dxpy.bindings.dxdataobject_functions.remove(id_or_link, **kwargs)[source]
Parameters:id_or_link – String containing an object ID or dict containing a DXLink

Given an object ID, calls remove() on the object.

Example:

remove("file-1234")

Previous topic

2.1. dxpy Object Handlers

Next topic

2.3. Projects and Containers

This Page