Command Line Client/Useful Flags for Scripting

dx is meant both for interactive use and for easy scripting. Some output formatting, such as color and columns, can be controlled with the flags below. They change the output to be more machine-readable (while the default is optimized for visual output). They are not present for all commands – check the context help to see if they apply.

--brief

Formats the output in a single column, one data item per row.

  • The following line removes all data objects that are tagged with the tag "deleteme" in the current project.

    $ dx rm $(dx find data --tag deleteme --brief)
    
  • The ‑‑brief flag makes the output of dx find data consist of dx-compatible paths for dx rm. Specifically, it prints out the <project-id>:<class-id> string for each result, one per line.

    $ dx find data --tag saveme --brief
    project-B0j1kqGfK1p4QjyFxkf000Yv:record-B0jgv2ZfK1p14P0GxVf000JP
    

--delim/--delimiter

Changes the delimiter used to separate columns of dx output. For example, ‑‑delim="," will result in comma-separated output. Use this flag without a value (‑‑delim) for tab-separated output.

Examples

With no delimiter:

$ dx find apps
gatk_unifiedgenotyper (v0.0.65+git.42b8bb2)
coverage_track_generator (v0.0.5+retry)
gatk_recalibrate_and_realign (v0.0.191+git.b988940)
vcf_importer (v0.0.75+git.992224b)
gtf_importer (v0.1.2+git.c2c0d38)
gff_importer (v0.1.2+git.fcaa327)
deduplicate_reads (v0.0.38)
fastqc_reads_statistics (v0.0.3+git.6724068)
bwa (v1.0.2)

With the default tab delimiter:

$ dx find apps --delim
gatk_unifiedgenotyper     0.0.65+git.42b8bb2
coverage_track_generator        0.0.5+retry
gatk_recalibrate_and_realign 0.0.191+git.b988940
vcf_importer 0.0.75+git.992224b
gtf_importer    0.1.2+git.c2c0d38
gff_importer    0.1.2+git.fcaa327
deduplicate_reads       0.0.38  
fastqc_reads_statistics 0.0.3+git.6724068
bwa     1.0.2   

With the delimiter set to a space:

$ dx find apps --delim=" "
gatk_unifiedgenotyper 0.0.65+git.42b8bb2 
coverage_track_generator 0.0.5+retry 
gatk_recalibrate_and_realign 0.0.191+git.b988940
vcf_importer 0.0.75+git.992224b 
gtf_importer 0.1.2+git.c2c0d38 
gff_importer 0.1.2+git.fcaa327 
deduplicate_reads 0.0.38 
fastqc_reads_statistics 0.0.3+git.6724068 
bwa 1.0.2 

--color

Some dx commands print color to the terminal. This is enabled by using terminal control character sequences, and can confuse scripts that don't expect this. By default (‑‑color=auto), dx will suppress the color if its stdout is not a TTY. However, you can turn it back on using ‑‑color=on or ensure that it is off via ‑‑color=off.

-y/--yes

Some commands such as dx rmproject and dx run ask for interactive confirmation. The ‑y/‑‑yes flag will bypass this confirmation. NOTE: Use this feature with caution! It may cause accidental loss of data.

Overriding Environment Variables

Most commands also allow you to temporarily override the environment settings for the API server host, authentication token used, default project ID, etc. For online help, you can run dx ‑‑env‑help for more details.

Last edited by Katherine Lai (kjlai), 2013-01-25 08:04:52

 Feedback