COVID Cloud | Command Line Interface

Command Line Interface

Installation

COVID Cloud provides command line interfaces for Windows, Mac, and Linux environments.

Run the following command in your terminal:

1
2
3
mkdir ~/.covid-cloud; cd ~/.covid-cloud && mkdir ~/.covid-cloud/downloads &&
    curl -L https://github.com/DNAstack/public-covid-cloud-cli/releases/latest/download/covid-cloud-mac.zip > ~/.covid-cloud/covid-cloud.zip &&
    unzip covid-cloud.zip && chmod u+x covid-cloud && rm covid-cloud.zip

You can test the installation by running ./covid-cloud in the newly created ~/.covid-cloud directory.

To be able to run the COVID Cloud CLI from anywhere, you will need to update your PATH to include the ~/.covid-cloud directory. You can do so by adding the following line to your bash configuration, such as .bashrc or .zshrc.

1export PATH="$PATH:$HOME/.covid-cloud"

Run the following command in your terminal:

1
2
3
mkdir ~/.covid-cloud; cd ~/.covid-cloud &&
    curl -L https://github.com/DNAstack/public-covid-cloud-cli/releases/latest/download/covid-cloud-linux > ~/.covid-cloud/covid-cloud && 
    chmod u+x covid-cloud

You can test the installation by running ./covid-cloud in the newly created ~/.covid-cloud directory.

To be able to run the COVID Cloud CLI from anywhere, you will need to update your PATH to include the ~/.covid-cloud directory. You can do so by adding the following line to your bash configuration, such as .bashrc or .zshrc.

1export PATH="$PATH:$HOME/.covid-cloud"

Run the following command in PowerShell:

1
2
3
Invoke-WebRequest `
    https://github.com/DNAstack/public-covid-cloud-cli/releases/latest/download/covid-cloud-windows.exe `
    -OutFile ( New-Item -Path "~/.covid-cloud/covid-cloud.exe" -Force )

You can test the installation by navigating to ~/.covid-cloud and running .\covid-cloud.exe.

Configuration

1
2
#set up search url
./covid-cloud config search-url [YOUR-SEARCH-URL]

If you wish to connect the CLI on the public instance of COVID Cloud.

1
2
#set up search url
./covid-cloud config search-url https://search.international.covidcloud.ca/

Usage

Access Tables and Schemas
1
2
3
4
5
#get a json list of all tables
./covid-cloud search tables list

#get the schema for a single table   
./covid-cloud search tables get covid.cloud.sequences
Execute Queries
1
./covid-cloud search query "SELECT * FROM covid.cloud.sequences LIMIT 20"   
Download From a DRS URL
1
./covid-cloud files download [DRS-URL]   
Download From Queries
1
./covid-cloud search query "SELECT drs_url FROM covid.cloud.files LIMIT 10" -r | ./covid-cloud files download -q
Additional Resources

The CLI implements the GA4GH Search standard for browsing and querying using the ./covid-cloud search command.

Take a look at the GA4GH Search Documentation for a detailed guide on using search commands.