# Usage Examples

DNAstack products can be accessed programmatically through the Command Line Interface (CLI) for Windows, Mac, and Linux environments.

For installation instructions, see the [Installation](/products/command-line-interface/installation.md) page.

## General

### Set up a service registry

You can easily set up your environment by using the `dnastack` use command. For example, we set up the CLI to work with the service endpoints available at viral.ai.

```
omics use viral.ai
```

### Download Files / Blobs

```
omics files download [DRS-URL] 
```

Arguments:\
`DRS-URL`: A DRS URL of the resource you would like to download

Example

```
omics files download drs://viral.ai/faux-blob-id-001 faux-blob-id-002
```

## Collections

### List Collections

```
omics collections list
```

### List Collection Items

You can list all items in a particular collection with `dnastack collections list-items -c SLUG_NAME` where `SLUG_NAME` is the slug name of the collection. Here is an example.

```
omics collections list-items -c ncbi-sra
```

where items can be tables or blobs/files.

### Query a Collection Table

```
omics collections query -c [SLUG-NAME] [COLLECTION-QUERY]
```

Arguments:\
`SLUG-NAME`: The name of the collection to query against\
`COLLECTION-QUERY`: The SQL query to execute

Example

```
omics collections query -c ncbi-sra "SELECT * FROM collections.ncbi_sra.variants LIMIT 10"
```

Alternatively, you can run the following query:

```
omics data-connect query --endpoint-id data-connect-ncbi-sra 
"SELECT * FROM collections.ncbi_sra.variants LIMIT 10"
```

### Additional Resources

Take a look at the [GA4GH Data Connect Documentation](https://ga4gh-discovery.github.io/data-connect/) for a detailed guide on using search commands.

## Workbench

See the [workbench reference](/products/command-line-interface/reference/workbench.md) for usage examples


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.omics.ai/products/command-line-interface/usage-examples.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
