Viral AI Docs | Command Line Interface

Command Line Interface

Installation

Viral AI can be accessed programmatically through the DNAstack command line interface (CLI) for Windows, Mac, and Linux environments.

Run the following command in your terminal:

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

You can test the installation by running ./dnastack in the newly created ~/.dnastack directory.

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

1export PATH="$PATH:$HOME/.dnastack"

Run the following command in your terminal:

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

You can test the installation by running ./dnastack in the newly created ~/.dnastack directory.

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

1export PATH="$PATH:$HOME/.dnastack"

Run the following command in PowerShell:

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

You can test the installation by navigating to ~/.dnastack and running .\dnastack.exe.

Configuration

To point the CLI to Viral AI, execute the following:

1
dnastack config set collections.url https://viral.ai/api/collections/

Usage

List Collections
1
dnastack collections list
List Collection Tables
1
dnastack collections tables list [COLLECTION-NAME]
Arguments:
Argument Description
COLLECTION-NAME The name of the collection to query against
Example:
1
dnastack collections tables list ncbi-sra
Query a Collection Table
1
dnastack collections query [COLLECTION-NAME] [COLLECTION-QUERY]
Arguments:
Argument Description
COLLECTION-NAME The name of the collection to query against
COLLECTION-QUERY The SQL query to execute
Flags:
Option Required Description
-f [csv/json],
--format [csv/json]
no The format to display the query results in. Default: json
Example:
1
dnastack collections query ncbi-sra "SELECT * FROM publisher_data.ncbi_sra.variants LIMIT 20"
Format Your Queries Into CSV
1
dnastack collections query ncbi-sra "SELECT * FROM publisher_data.ncbi_sra.variants LIMIT 20" --format csv
Download From a DRS URL
1
dnastack files download [DRS-URL]   
Arguments:
Argument Description
DRS-URL A DRS url of the resource you would like to download
Flags:
Option Required Description
-o [path], --output-dir [path] no The location to download the DRS resource. Default: the current directory
-i [file], --input-file [file] no Specify a file to get DRS urls from. The file must contain one URL per line
-q, --quiet no Suppress all output from the command
Example:
1
dnastack files download drs://viral.ai/1b4468e3-be8a-4c6f-aad0-acd5c68da506 
Additional Resources

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