Path Resolution
When using the command-line client, you may refer to objects either through their ID or by name.
In the DNAnexus platform, every data object has a unique ID starting with the class of the object (e.g. "record", "file", "project") followed by a hyphen ('-') and 24 alphanumberic characters, e.g. record-9zGPKyvvbJ3Q3P8J7bx00005
. A string matching this format will always be interpreted to be meant as the ID of such an object and will not be further resolved as a name.
The command-line client, however, also accepts names and paths as input in a particular syntax.
Path Syntax
There are three main types of paths that are recognized for referring to data objects: project paths, job-based object references (JBORs), and DNAnexus links.
Project Paths
To refer to a project by name, it must be suffixed with the colon character ":". Anything appearing after the ":" or without a ":" will be interpreted as a folder path to a named object. For example, to refer to a file called "hg19.fq.gz" in a folder called "human" in a project called "Genomes", the following path can be used in place of its object ID:
Note that the folder path appearing after the ":" is assumed to be relative to the root folder "/" of the project.
Exceptions to this are when commands take in arbitrary names (e.g. for dx describe
which takes in app names, user IDs, etc.). In this case, all possible interpretations will be attempted. However, it will always be assumed that it is not a project name unless it ends in ":".
Job-Based Object References (JBORs)
To refer to the output of a particular job, you can use the syntax <job id>:<output name>
.
Examples
If you have the job ID handy, you can use it directly.
Or if you know it's the last analysis you ran:
You can also automatically download a file once the job producing it is done:
If the output is an array, you can extract a single element by specifying its array index (numbered 0, 1, etc.) as follows:
DNAnexus Links
DNAnexus links are JSON hashes which are used for job input and output. They always contain one key, $dnanexus_link
, and have as a value either
a string representing a data object ID
another hash with two keys:
project
a string representing a project or other data container IDid
a string representing a data object ID
For example:
Special Characters
Because of the use of :
to denote project names and of /
to separate folder names, they must be escaped with a preceding backslash \\
when they appear in a data object's name. The characters *
and ?
are also reserved for the use in wildcard patterns and must also be escaped. Depending on your terminal and whether you put the entire name or path in quotes, you may have to additionally escape spaces in order to pass them in as part of the string. The use of backslashes in names is discouraged, and the best way to interact with objects with such names will probably be to use their IDs directly. See the following table for some examples of the necessary representation for accessing existing objects with special characters in their names (assuming a bash shell).
Character
Escaped version (no quotes)
Escaped version (with quotes)
`` (single space)
' '
:
\\\\:
'\\:'
/
\\\\/
'\/'
*
\\\\\\\\*
'\\\\\\*'
?
\\\\\\\\?
'\\\\\\?'
The following example illustrates how the special characters are escaped for use on the command line, with and without quotes.
For commands where the argument supplied involves naming or renaming something, the only escaping necessary is whatever is necessary for your shell or for setting it apart from a project or folder path.
Name Conflicts
It is possible to have multiple objects with the same name in the same folder. When an attempt is made to access or modify an object which shares the same name as another object, you will be prompted to select the desired data object.
Some commands (like mv
here) will allow you to enter *
so that all matches will be used. Other commands may automatically apply the command to all of them (e.g. ls
and describe
), and others will require that exactly one object be chosen (e.g. run
).
Last updated