Viral AI Docs | Command Line InterfaceViral AI Docs | Command Line Interface

Command Line Interface

Prerequisite

  • Python 3.9 or newer
  • Optional: pip 21.3 or newer
    • This is only required for ARM-based CPU.

Installation

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

The library can be installed using pip.

1
pip3 install dnastack-client-library==3.0.56a1648737133

The library can be installed using pip.

1
pip3 install --user dnastack-client-library==3.0.56a1648737133

Run the following command in PowerShell using pip:

1
pip3 install dnastack-client-library==3.0.56a1648737133

You can test the installation by running python3 -m dnastack. To be able to run the DNAstack CLI from anywhere without python3 -m, you will need to update your PATH to include the Python Scripts directory.

If you have not set this, you must use python3 -m before every dnastack command below.

Configuration

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

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

Usage

List Collections
1
dnastack collections list
List Collection Tables
1
dnastack collections tables list [COLLECTION-NAME]
Arguments:
ArgumentDescription
COLLECTION-NAMEThe 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:
ArgumentDescription
COLLECTION-NAMEThe name of the collection to query against
COLLECTION-QUERYThe SQL query to execute
Flags:
OptionRequiredDescription
-f [csv/json],
--format [csv/json]
noThe 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:
ArgumentDescription
DRS-URLA DRS url of the resource you would like to download
Flags:
OptionRequiredDescription
-o [path], --output-dir [path]noThe location to download the DRS resource. Default: the current directory
-i [file], --input-file [file]noSpecify a file to get DRS urls from. The file must contain one URL per line
-q, --quietnoSuppress all output from the command
Example:
1
dnastack files download drs://viral.ai/BPv9-d574ecaf-8f63-4d05-88b2-05504100b0ed 
Additional Resources

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