Searching Data Objects

You can use the dx ls command to list the objects in your current project. You can determine the current project and folder you are in by using the command dx pwd. Using glob patterns, you can broaden your search for objects by specifying filenames with wildcard characters such as * and ?. An asterisk (*) represents zero or more characters in a string, and a question mark (?) represents exactly one character.

Searching Objects with Glob Patterns

Searching Objects in Your Current Folder

By listing objects in your current directory with the wildcard characters * and ?, you can search for objects with a filename using a glob pattern. The examples below use the folder "C. Elegans - Ce10/" in the public project "Reference Genome Files" (platform login required to access this link).

Printing the Current Working Directory

$ dx select "Reference Genome Files"
$ dx cd "C. Elegans - Ce10/"
$ dx pwd # Print current working directory
Reference Genome Files:/C. Elegans - Ce10

Listing Folders and/or Objects in a Folder

$ dx ls
ce10.bt2-index.tar.gz
ce10.bwa-index.tar.gz
ce10.cw2-index.tar.gz
ce10.fasta.fai
ce10.fasta.gz
ce10.hisat2-index.tar.gz
ce10.star-index.tar.gz
ce10.tmap-index.tar.gz

Listing Objects Named Using a Pattern

Searching Across Objects in the Current Project

To search the entire project with a filename pattern, use the command dx find data --name with the wildcard characters. Unless --path or --all-projects is specified, dx find data searches data under the current project. Below, the command dx find data is used in the public project "Reference Genome Files" (platform login required to access this link) using the --name option to specify the filename of objects that you're searching for.

Quoting Wildcards in Shell Commands

When using wildcard characters (* and ?) with dx commands, enclose the pattern in single ' or double " quotes. Without quotes, the shell expands the wildcards against files in your local filesystem before passing the pattern to the dx command, which produces unexpected results.

Quoting the pattern ensures the shell treats it as a literal string and passes it directly to the dx command, where DNAnexus interprets the wildcards to search Platform objects.

Bash also expands other special characters like ?, [, ], {, and }. For complete details about shell expansion and quoting, see the Bash manual section on expansions.

Escaping Special Characters

Escape special characters in filenames with a backslash (\) when you want to search for them literally. Characters that require escaping include wildcards (* and ?) when you want to find them as literal characters in filenames. You must also escape colons (:) and slashes (/), because these have special meaning in DNAnexus paths.

Shell behavior affects escaping rules. In many shells, you need to either double-escape (\\) or use single quotes to prevent the shell from interpreting the backslash.

The following examples show proper escaping techniques:

Searching Objects with Other Criteria

dx find data also allows you to search data using metadata fields, such as when the data was created, the data tags, or the project the data exists in.

Searching Objects Created Within a Certain Period of Time

You can use the flags --created-after and --created-before to search for data objects created within a specific time period.

Searching Objects by Their Metadata

You can search for objects based on their metadata. An object's metadata can be set by performing the command dx tag or dx set_properties to respectively tag or setup key-value pairs to describe your data object. You can also set metadata while uploading data to the platform. To search by object tags, use the option --tag. This option can be repeated if the search requires multiple tags.

To search by object properties, use the option --property. This option can be repeated if the search requires multiple properties.

Searching Objects in Another Project

You can search for an object living in a different project than your current working project by specifying a project and folder path with the flag --path. Below, the project ID (project-BQfgzV80bZ46kf6pBGy00J38) of the public project "Exome Analysis Demo" (platform login required to access this link) is specified as an example.

Searching Objects Across Projects with VIEW and Above Permissions

To search for data objects in all projects where you have VIEW and above permissions, use the --all-projects flag. Public projects are not shown in this search.

Scoping Within Projects

To describe data for small amounts of files (typically below 100), scope findDataObjects to only a project level.

The below is an example of code used to scope a project:

See the API method system/findDataObjects for more information about usage.

Last updated

Was this helpful?